summaryrefslogtreecommitdiff
path: root/Utilib/src/b23.c
diff options
context:
space:
mode:
authorstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
committerstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
commit7dfcc480ba1e19bd3232349fc733caef94034292 (patch)
tree03ee104eb8846d5cc1a981d267687a729185d3f3 /Utilib/src/b23.c
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Utilib/src/b23.c')
-rw-r--r--Utilib/src/b23.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/Utilib/src/b23.c b/Utilib/src/b23.c
new file mode 100644
index 0000000..7b4b56f
--- /dev/null
+++ b/Utilib/src/b23.c
@@ -0,0 +1,40 @@
+/*
+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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#define FREESTEAM_BUILDING_LIB
+#include "b23.h"
+
+#include <math.h>
+
+const double B23_N[6] = { 0, 0.34805185628969E+03, -0.11671859879975E+01
+ , 0.10192970039326E-02, 0.57254459862746E+03, 0.13918839778870E+02
+};
+
+const double B23_PSTAR = 1e6;
+
+double freesteam_b23_p_T(double T){
+#define theta T
+ return (B23_N[1] + B23_N[2] * theta + B23_N[3] * SQ(theta)) * B23_PSTAR;
+#undef theta
+}
+
+double freesteam_b23_T_p(double p){
+ double pi = p / B23_PSTAR;
+ return B23_N[4] + sqrt((pi - B23_N[5])/B23_N[3]) /* * 1{K} */;
+}