00001
00002
00003
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <math.h>
00011 #include "constrel.h"
00012 #include "baroghelBc.h"
00013 #include "globalt.h"
00014
00015 baroghelmatc::baroghelmatc()
00016 {
00017 mw = 18.01528;
00018 ma = 28.9645;
00019 gasr = 8314.41;
00020
00021 t0 = 273.15;
00022 p0 = 101325.0;
00023 tcr = 647.3;
00024
00025
00026 scr = 1.0;
00027 ag = 1.0;
00028
00029
00030 av = 1.0;
00031 fs = 1.0;
00032
00033
00034 betas = 3.0*10.2e-6;
00035
00036
00037 alpha = 0.5;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 w1 = 163.0;
00072
00073 c1 = 450.0;
00074
00075 hydren = 0.5e+6;
00076
00077 finv = 0.65;
00078
00079 fste = 0.36;
00080
00081 ddbw0 = 1.0e-20;
00082 }
00083
00084 baroghelmatc::~baroghelmatc()
00085 {}
00086
00087
00088
00089
00090
00091
00092
00093
00094 double baroghelmatc::baroghel_sw(double pc,double t)
00095 {
00096 double sw,k,n,m,help,a,b;
00097
00098 a = ab;
00099 b = bb;
00100
00101 m = 1.0/(1.0-1.0/b);
00102 n = -1.0/b;
00103 k = 1.0/a;
00104
00105
00106
00107 help = exp(m*log(k*pc));
00108
00109
00110
00111 sw = exp(n*log(1.0+help));
00112
00113 return(sw);
00114 }
00115
00116
00117
00118
00119
00120
00121
00122
00123 double baroghelmatc::baroghel_dsw_dpc(double pc,double t)
00124 {
00125 double dsw_dpc;
00126 double sw1,k,n,m,help,help2,a,b;
00127
00128 a = ab;
00129 b = bb;
00130
00131 m = 1.0/(1.0-1.0/b);
00132 n = -1.0/b;
00133 k = 1.0/a;
00134 help = pow((k*pc),m);
00135 sw1 = n*(pow((1.0 + help),(n-1.0)));
00136 help2 = m*(pow((k*pc),(m-1.0)))*k;
00137 dsw_dpc = sw1*help2;
00138
00139 return(dsw_dpc);
00140 }
00141
00142
00143
00144
00145
00146
00147
00148
00149 double baroghelmatc::baroghel_dsw_dt(double pc,double t)
00150 {
00151 double dsw_dt;
00152
00153 dsw_dt = 0.0;
00154
00155 return(dsw_dt);
00156 }
00157
00158
00159
00160
00161
00162
00163 double baroghelmatc::baroghel_ssp()
00164 {
00165 return(0.55);
00166 }
00167
00168
00169
00170
00171
00172
00173
00174 double baroghelmatc::baroghel_krg(double s)
00175 {
00176 double krg;
00177
00178 if (s < scr)
00179 krg = 1.0 - pow((s/scr),ag);
00180 else
00181 krg = 0.0;
00182
00183 return(krg);
00184 }
00185
00186
00187
00188
00189
00190
00191
00192
00193 double baroghelmatc::baroghel_krw(double pc, double t)
00194 {
00195 double krw,s;
00196
00197 s = baroghel_sw(pc,t);
00198 krw = pow(s,10.0);
00199
00200 return(krw);
00201 }
00202
00203
00204
00205
00206
00207
00208 double baroghelmatc::baroghel_phi()
00209 {
00210 double phi;
00211
00212 phi = phib;
00213
00214 return(phi);
00215 }
00216
00217
00218
00219
00220
00221
00222 double baroghelmatc::baroghel_kintr()
00223 {
00224 double kintr;
00225
00226 kintr = c;
00227
00228 return(kintr);
00229 }
00230
00231
00232
00233
00234
00235
00236 double baroghelmatc::baroghel_cps()
00237 {
00238 double cps;
00239
00240 cps = cpb;
00241
00242 return(cps);
00243 }
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 double baroghelmatc::baroghel_rhocp(double pc,double pg,double t)
00254 {
00255 double s,pgw,phi,rhocp,rhow,cps,cpw,rhocpg,cpgw,rhos;
00256 state_eq tt;
00257
00258 s = baroghel_sw(pc,t);
00259 phi = baroghel_phi();
00260 pgw = tt.get_pgw(pc,t);
00261 rhow = tt.get_rhow(t);
00262 cps = baroghel_cps();
00263 cpw = tt.get_cpw();
00264 rhocpg = tt.get_rhocpg(pc,pg,t);
00265 cpgw = tt.get_cpgw();
00266 rhos = baroghel_rhos();
00267
00268 rhocp = (1.0-phi)*rhos*cps + phi*(s*rhow*cpw + (1.0-s)*rhocpg);
00269
00270 return(rhocp);
00271 }
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 double baroghelmatc::baroghel_cp(double pc,double pg,double t,long ipp)
00283 {
00284 double s,pgw,phi,cp,rho,rhow,rhog,rhogw,cps,cpw,cpga,cpgw,rhos;
00285 state_eq tt;
00286
00287 s = baroghel_sw(pc,t);
00288 phi = baroghel_phi();
00289 pgw = tt.get_pgw(pc,t);
00290 rho = tt.get_rho(pc,pg,t,ipp);
00291 rhow = tt.get_rhow(t);
00292 rhog = tt.get_rhog(pc,pg,t);
00293 rhogw = tt.get_rhogw(pc,t);
00294 cps = baroghel_cps();
00295 cpw = tt.get_cpw();
00296 cpga = tt.get_cpga();
00297 cpgw = tt.get_cpgw();
00298 rhos = baroghel_rhos();
00299
00300 cp = (1.0-phi)*rhos*cps + phi*(s*rhow*cpw + (1.0-s)*(rhog*cpga + rhogw*(cpgw-cpga)));
00301 cp = cp/rho;
00302
00303 return(cp);
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313 double baroghelmatc::baroghel_tau(double pc,double t)
00314 {
00315 double phi,s,tau;
00316
00317 s = baroghel_sw(pc,t);
00318 phi = baroghel_phi();
00319
00320 tau = pow(phi,(1.0/3.0))*pow((1.0-s),(7.0/3.0));
00321
00322 return(tau);
00323 }
00324
00325
00326
00327
00328
00329
00330
00331
00332 double baroghelmatc::baroghel_dd(double pc,double t)
00333 {
00334 double tau,dd;
00335
00336 tau = baroghel_tau(pc,t);
00337
00338 dd = tau*mw*ma/gasr;
00339
00340
00341
00342 return(dd);
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353 double baroghelmatc::baroghel_deff(double pc,double pg,double t)
00354 {
00355 double dd,deff,phi,s,cdiff;
00356 state_eq tt;
00357
00358 dd = baroghel_dd(pc,t);
00359 phi = baroghel_phi();
00360 s = baroghel_sw(pc,t);
00361 cdiff = tt.get_cdiff(pc,pg,t);
00362
00363 deff = dd*phi*(1.0 - s)*fs*cdiff;
00364
00365 return(deff);
00366 }
00367
00368
00369
00370
00371
00372
00373
00374
00375 double baroghelmatc::baroghel_lambdaeff(double pc,double pg,double t)
00376 {
00377 double lambdaeff,lambdad,lambdad0,alam,s,phi,rhow,rhos;
00378 state_eq tt;
00379
00380 s = baroghel_sw(pc,t);
00381 phi = baroghel_phi();
00382 lambdad0 = lambdab;
00383 alam = 0.000;
00384 rhow = tt.get_rhow(t);
00385 rhos = baroghel_rhos();
00386
00387 lambdad = lambdad0*(1.0 + alam*(t-t0));
00388
00389 lambdaeff = lambdad*(1.0 + 4.0*phi*rhow*s/(1.0-phi)/rhos);
00390
00391 return(lambdaeff);
00392 }
00393
00394
00395
00396
00397
00398
00399 double baroghelmatc::baroghel_rhos()
00400 {
00401 double rhos;
00402
00403 rhos = rhosb;
00404
00405 return(rhos);
00406 }
00407
00408
00409
00410
00411
00412
00413 double baroghelmatc::baroghel_betas()
00414 {
00415 return(betas);
00416 }
00417
00418
00419
00420
00421
00422
00423 double baroghelmatc::baroghel_alpha()
00424 {
00425 return(alpha);
00426 }
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438 double baroghelmatc::baroghel_hydw(double pc,double pg,double t)
00439 {
00440 double fhy,hydw;
00441
00442 if((t-t0)< 105.0){
00443 fhy = 0.0;
00444 }
00445 else{
00446 fhy = (1.0+sin(3.1416/2.0*(1.0-2.0*exp(-0.004*((t-t0)-105.0)))))/2.0;
00447 }
00448
00449 hydw = fste*finv*c1*fhy;
00450
00451 return(hydw);
00452 }
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462 double baroghelmatc::baroghel_dehydw_dt(double pc,double pg,double t)
00463 {
00464 double dfhyt,dehydw_dt;
00465
00466 if((t-t0)< 105.0){
00467 dfhyt = 0.0;
00468 }
00469 else{
00470 dfhyt = (3.1416*0.004/2.0)*cos(3.1416/2.0*(1.0-2.0*exp(-0.004*((t-t0)-105.0))))*exp(-0.004*((t-t0)-105.0));
00471 }
00472
00473 dehydw_dt = fste*finv*c1*dfhyt;
00474
00475 return(dehydw_dt);
00476 }
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487 double baroghelmatc::baroghel_hydren(double pc,double pg,double t)
00488 {
00489 return(hydren);
00490 }
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500 double baroghelmatc::baroghel_fste(double pc,double pg,double t)
00501 {
00502 return(fste);
00503 }
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513 double baroghelmatc::baroghel_ddbw(double pc,double pg,double t)
00514 {
00515 double ddbw;
00516
00517 ddbw = ddbw0*exp(-t/(273.15+23));
00518 if (t > tcr)
00519 ddbw = ddbw0*exp(-tcr/(273.15+23));
00520
00521 return(ddbw);
00522 }
00523
00524
00525
00526
00527
00528
00529 double baroghelmatc::baroghel_emod()
00530 {
00531 return(emod);
00532 }
00533
00534
00535
00536
00537
00538
00539 double baroghelmatc::baroghel_nu()
00540 {
00541 return(nu);
00542 }
00543
00544
00545
00546
00547
00548
00549
00550 void baroghelmatc::read(XFILE *in)
00551 {
00552 xfscanf (in,"%lf %lf %lf %lf %lf %lf %lf %lf %lf", &ab, &bb, &c, &lambdab, &cpb, &rhosb, &phib, &emod, &nu);
00553 }