/[ascend]/branches/fprops-incomp/models/johnpye/fprops/fluids/chloridesalt.c
ViewVC logotype

Contents of /branches/fprops-incomp/models/johnpye/fprops/fluids/chloridesalt.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3471 - (show annotations) (download) (as text)
Tue Feb 18 11:03:57 2020 UTC (3 months, 1 week ago) by jpye
File MIME type: text/x-csrc
File size: 5843 byte(s)
removed TC for sodium from chloridesalt file.

1 /* ASCEND modelling environment
2 Copyright (C) 2020 John Pye
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *//* @file
17 Property data for high-temperature chloride salt (data from NREL),
18 with test cases. This file was created by John Pye 4 Feb 2020.
19 */
20 #define CLSALT_SOURCE \
21 "Pers. comm. from Devon Kesseli, NREL, 21 June 2019. SaltParams-6-21-19.csv"
22 #define CLSALT_SOURCEURL ""
23
24 #include "../incomp.h"
25 #ifndef CUNIT_TEST
26
27 #define CLSALT_M NAN /* UNKNOWN kg/kmol */
28
29 static const IncompressibleData incomp_data_chloridesalt = {
30 .M = CLSALT_M
31 ,.cp0={
32 1000. /* cp0star */
33 , 1. /* Tstar */
34 , 2 /* power terms */
35 , (const Cp0PowTerm[]){
36 {1.5388204685, 0}
37 ,{-0.00052799, 1}
38 }
39 , 0 /* exponential terms */
40 }
41 ,.rho={
42 .Tstar = 1.
43 ,.rhostar = 1.
44 ,.type = FPROPS_DENS_T
45 ,.np = 2
46 ,.pt = (const DensityTerm[]){
47 { 1992.99890, 0. }
48 ,{ -0.406000, 1. }
49 }
50 }
51 ,.ref={FPROPS_REF_TPHS,.data={.tphs={400+273.15,101.325e3,18989.2875,0}}}
52 };
53
54 static const ThermalConductivityData thcond_data_chloridesalt = {
55 .source = CLSALT_SOURCE " " CLSALT_SOURCEURL
56 ,.type = FPROPS_THCOND_POLY
57 ,.data = {.poly=(ThCondPoly){
58 .np = 2
59 ,.pt = (const ThCondPolyTerm[]){
60 {5.355150e-1, 0}
61 ,{-1e-4, 1}
62 }
63 ,.Tstar = 1
64 ,.kstar = 1
65 }}
66 };
67
68 static const ViscosityData visc_data_chloridesalt = {
69 .source = CLSALT_SOURCE " " CLSALT_SOURCEURL
70 ,.type = FPROPS_VISC_EPT
71 ,.data = {.ept=(ViscDataEpt){
72 .mu_star = 1
73 ,.np = 3
74 ,.pt = (const ViscPowTerm[]){
75 {-8.09998306264701, 0}
76 ,{2.13731951E+03, -1}
77 ,{3.39389663E-02, -2}
78 }
79 ,.b = 2.36796774274476E-05
80 ,.is_ln = 1
81 }}
82 };
83
84 const EosData eos_chloridesalt = {
85 "chloridesalt"
86 ,CLSALT_SOURCE
87 ,CLSALT_SOURCEURL
88 ,100
89 ,FPROPS_INCOMP
90 ,.data = {.incomp = &incomp_data_chloridesalt}
91 ,.thcond = &thcond_data_chloridesalt
92 ,.visc = &visc_data_chloridesalt
93 };
94
95 #else
96
97 //#define TEST_VERBOSE
98
99 # include "../test.h"
100 # include "../refstate.h"
101 # include "../fprops.h"
102 # include "../incomp.h"
103 # include "../rundata.h"
104 # include "../thcond.h"
105 # include "../solve_ph.h"
106
107 extern const EosData eos_chloridesalt;
108
109 /* Some test data from Fink & Liebowitz */
110
111 typedef struct TestDataTrho_struct{
112 double T, rho, cp, lam, h, mu;
113 } TestDataTrho;
114
115 /*
116 Data points for T, rho, k, h are from Fink & Liebowitz.
117 Values of 's' were calculated with models/johnpye/liquidsodium.a4c.
118 */
119
120 static const TestDataTrho td[] = {
121 /* T, rho, cp, lam, h, mu */
122 /* (K), (kg/m3), J/kg/K (W/m/K), J/kg, Pa.s */
123 {400.+273.15, 1719.7, 1.183404e3, 0.4682, 18989.2875, 7.264709E-03 }
124 ,{500.+273.15, 1679.1, 1.130605e3, 0.4582, 134689.7375, 4.818011E-03 }
125 ,{600.+273.15, 1638.5, 1.077806e3, 0.4482, 245110.2875, 3.510504E-03 }
126 ,{700.+273.15, 1597.9, 1.025007e3, 0.4382, 350250.9375, 2.729793E-03 }
127 ,{780.+273.15, 1565.42, 0.9827678e3, 0.4302, 430561.9295, 2.310332E-03 }
128 };
129
130 static const unsigned ntd = sizeof(td)/sizeof(TestDataTrho);
131
132 void test_fluid_chloridesalt(void){
133 double maxerr = 0;
134 FpropsError err;
135
136 PureFluid *P = fprops_prepare(&eos_chloridesalt,NULL);
137
138 ASSERT(NULL != P->thcond);
139
140 double p = 1e5;
141 #define TEST_PROP(PROP,TOL) \
142 for(int i=0; i<ntd; ++i){ \
143 double T = td[i].T; \
144 FluidState2 S = fprops_set_Tp(T,p,P,&err); \
145 double PROP = fprops_##PROP(S,&err);\
146 ASSERT_TOL_VAL(PROP,td[i].PROP,TOL);\
147 }
148
149 TEST_PROP(rho,0.05);
150 TEST_PROP(cp,0.0000005e3);
151 TEST_PROP(h,0.003);
152 TEST_PROP(lam,0.00005);
153 TEST_PROP(mu,0.005e-3);
154
155 #if 0
156 for(int i=0; i<ntd; ++i){
157 double p = 1;
158 double T = td[i].T;
159 FluidState2 S = fprops_set_Tp(T,p,P,&err);
160
161 double rho = incomp_rho(S.vals,S.fluid->data,&err);
162 ASSERT_TOL_VAL(rho,td[i].rho,0.5);
163 }
164
165 for(int i=0; i<ntd; ++i){
166 double p = 1;
167 double T = td[i].T;
168 FluidState2 S = fprops_set_Tp(T,p,P,&err);
169 //TEST_MSG("T = %f",T);
170 double h = incomp_h(S.vals,S.fluid->data,&err);
171 ASSERT_TOL_VAL(h,td[i].h,0.5e3);
172 }
173
174 for(int i=0; i<ntd; ++i){
175 double p = 1;
176 double T = td[i].T;
177 FluidState2 S = fprops_set_Tp(T,p,P,&err);
178 //TEST_MSG("T = %f",T);
179 double lam = thcond1_lam_poly(S.vals.Tp.T,&(S.fluid->thcond->data.poly),&err);
180 ASSERT_TOL_VAL(lam,td[i].lam,0.008);
181 }
182
183
184
185 /**
186 // check the high-level interface through 'fprops_T' etc.
187 FluidState2 S = fprops_set_Tp(400.,1e5,P,&err);
188 ASSERT_PROP(T,S,&err,400.,1e-20);
189 ASSERT_PROP(p,S,&err,1e5,1e-20);
190 ASSERT_PROP(h,S,&err,247e3,0.5e3);
191 ASSERT_PROP(rho,S,&err,919.,0.5);
192 ASSERT_PROP(lam,S,&err,87.22,0.005);
193 ASSERT_PROP(v,S,&err,1/919.,0.03e-2);
194 */
195 // check viscosity
196 for(int i=0; i<ntd; ++i){
197 double p = 1;
198 double T = td[i].T;
199 FluidState2 S = fprops_set_Tp(T,p,P,&err);
200 //TEST_MSG("T = %f",T);
201 double mu = fprops_mu(S,&err);
202 ASSERT_TOL_VAL(mu,td[i].mu,0.005e-4);
203 }
204 #endif
205
206 // check solve_ph...
207 p = 1e5; // works equally with 5e5,10e5... shouldn't have any effect.
208 for(int i=0; i<ntd; ++i){
209 double T = td[i].T;
210 FluidState2 S = fprops_set_Tp(T,p,P,&err);
211 double h = fprops_h(S,&err);
212 if(err)TEST_MSG("failed to evaluate 'h': %s",fprops_error(err));
213 FluidState2 S1 = fprops_solve_ph(p,h,P,&err);
214 if(err)TEST_MSG("failed to solve (p,h): %s",fprops_error(err));
215 double T1 = fprops_T(S1,&err);
216 ASSERT_TOL_VAL(T1,T,1e-12);
217 }
218
219 }
220
221 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22