-
Notifications
You must be signed in to change notification settings - Fork 0
/
b23.c
40 lines (30 loc) · 1.27 KB
/
b23.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
freesteam - IAPWS-IF97 steam tables library
Copyright (C) 2004-2005 John Pye
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
#define FREESTEAM_BUILDING_LIB
#include "b23.h"
#include <math.h>
const MyDouble B23_N[6] = { 0, 0.34805185628969E+03, -0.11671859879975E+01
, 0.10192970039326E-02, 0.57254459862746E+03, 0.13918839778870E+02
};
const MyDouble B23_PSTAR = 1e6;
MyDouble freesteam_b23_p_T(MyDouble T){
#define theta T
return (B23_N[1] + B23_N[2] * theta + B23_N[3] * SQ(theta)) * B23_PSTAR;
#undef theta
}
MyDouble freesteam_b23_T_p(MyDouble p){
MyDouble pi = p / B23_PSTAR;
return B23_N[4] + sqrt((pi - B23_N[5])/B23_N[3]) /* * 1{K} */;
}