00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "moistheat.h"
00015 #include "globalt.h"
00016 #include "math.h"
00017 #include "globmatt.h"
00018
00019 dampermeability moistheatmat::damper;
00020
00021 moistheatmat::moistheatmat()
00022 {
00023 long i;
00024
00025
00026 rho_m = 0.0;
00027
00028 rho_w = 1000.0;
00029
00030 M = 0.01801528;
00031
00032 R = 8.314472;
00033
00034
00035 daminfl = off;
00036 }
00037
00038 moistheatmat::~moistheatmat()
00039 {
00040 }
00041
00042
00043
00044
00045
00046
00047
00048
00049 void moistheatmat::read (XFILE *in)
00050 {
00051
00052 rho.read (in);
00053
00054
00055 dpp.read (in);
00056
00057
00058 transpar.read (in);
00059
00060
00061 sorpiso.read (in);
00062
00063
00064 sm.read (in);
00065
00066
00067 c.read (in);
00068
00069
00070 lambda.read (in);
00071
00072
00073 teptr.read(in);
00074
00075 xfscanf (in,"%m", &answertype_kwdset, &daminfl);
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 void moistheatmat::print (FILE *out)
00087 {
00088
00089 rho.print (out);
00090
00091
00092 dpp.print (out);
00093
00094
00095 transpar.print (out);
00096
00097
00098 sorpiso.print (out);
00099
00100
00101 sm.print (out);
00102
00103
00104 c.print (out);
00105
00106
00107 lambda.print (out);
00108
00109
00110 teptr.print(out);
00111
00112 fprintf(out, "%d\n", daminfl);
00113 }
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 void moistheatmat::matcond (matrix &d,long ri,long ci,long ipp)
00126 {
00127 long n;
00128 n = d.n;
00129
00130 switch (n){
00131 case 1:{
00132 matcond1d (d,ri,ci,ipp);
00133 break;
00134 }
00135 case 2:{
00136 matcond2d (d,ri,ci,ipp);
00137 break;
00138 }
00139 case 3:{
00140 matcond3d (d,ri,ci,ipp);
00141 break;
00142 }
00143 default:{
00144 print_err("unknown number of components of conductivity tensor is required",__FILE__,__LINE__,__func__);
00145 }
00146 }
00147
00148 if (daminfl == on){
00149 if (ri==0 && ci==0){
00150
00151 damper.matcond (d,ipp);
00152 Tm->ip[ipp].eqother[3] = d[0][0];
00153 }
00154 if (ri==1 && ci==0){
00155
00156 damper.matcond (d,ipp);
00157 Tm->ip[ipp].eqother[4] = d[0][0];
00158 }
00159
00160 }
00161 }
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 void moistheatmat::matcond1d (matrix &d,long ri,long ci,long ipp)
00175 {
00176 double k;
00177 k = 0.0;
00178
00179 if((ri == 0) && (ci == 0))
00180 k = kmm(ipp);
00181 if((ri == 0) && (ci == 1))
00182 k = kmt(ipp);
00183 if((ri == 1) && (ci == 0))
00184 k = khm(ipp);
00185 if((ri == 1) && (ci == 1))
00186 k = kht(ipp);
00187
00188 d[0][0] = k;
00189 }
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201 void moistheatmat::matcond2d (matrix &d,long ri,long ci,long ipp)
00202 {
00203 double k;
00204 k = 0.0;
00205
00206
00207 if((ri == 0) && (ci == 0))
00208 k = kmm(ipp);
00209 if((ri == 0) && (ci == 1))
00210 k = kmt(ipp);
00211 if((ri == 1) && (ci == 0))
00212 k = khm(ipp);
00213 if((ri == 1) && (ci == 1))
00214 k = kht(ipp);
00215
00216 fillm(0.0,d);
00217
00218
00219
00220
00221 d[0][0] = k; d[0][1] = 0.0;
00222 d[1][0] = 0.0; d[1][1] = k;
00223 }
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236 void moistheatmat::matcond3d (matrix &d,long ri,long ci,long ipp)
00237 {
00238 double k;
00239 k = 0.0;
00240
00241
00242 if((ri == 0) && (ci == 0))
00243 k = kmm(ipp);
00244 if((ri == 0) && (ci == 1))
00245 k = kmt(ipp);
00246 if((ri == 1) && (ci == 0))
00247 k = khm(ipp);
00248 if((ri == 1) && (ci == 1))
00249 k = kht(ipp);
00250
00251 fillm(0.0,d);
00252
00253 d[0][0]=k; d[0][1]=0.0; d[0][2]=0.0;
00254 d[1][0]=0.0; d[1][1]=k; d[1][2]=0.0;
00255 d[2][0]=0.0; d[2][1]=0.0; d[2][2]=k;
00256 }
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269 void moistheatmat::matcap (double &c,long ri,long ci,long ipp)
00270 {
00271 c=0.0;
00272
00273 if((ri == 0) && (ci == 0))
00274 c = cmm(ipp);
00275 if((ri == 0) && (ci == 1))
00276 c = cmt(ipp);
00277 if((ri == 1) && (ci == 0))
00278 c = chm(ipp);
00279 if((ri == 1) && (ci == 1)){
00280 c = cht(ipp);
00281 }
00282 }
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292 void moistheatmat::values_correction (vector &nv)
00293 {
00294 double rh, tk, pv, pvs;
00295
00296
00297 pv=nv[0];
00298
00299 tk=nv[1];
00300
00301 if(pv >= 3.16995416e+03)
00302
00303 pv = 3.1699e+03;
00304 if(pv <= 3.17014677e-06)
00305 pv = 3.18e-06;
00306
00307 nv[0]=pv;
00308 nv[1]=tk;
00309
00310 }
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 double moistheatmat::kmm (long ipp)
00321 {
00322 double kk, transp, pv;
00323
00324
00325 pv = Tm->ip[ipp].av[0];
00326
00327 transp = transpar.getval (pv);
00328
00329 kk = transp;
00330
00331 return (kk);
00332 }
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344 double moistheatmat::kmt(long ipp)
00345 {
00346 double kk;
00347
00348 kk = 0.0;
00349 return (kk);
00350 }
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361 double moistheatmat::kht(long ipp)
00362 {
00363 double moist, lamb, kk;
00364
00365 moist = Tm->ip[ipp].eqother[0];
00366
00367 lamb = lambda.getval (moist);
00368
00369
00370 kk = lamb;
00371
00372 return (kk);
00373 }
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384 double moistheatmat::khm (long ipp)
00385 {
00386 double kk,tk,lv,dp,pv;
00387
00388
00389 tk = Tm->ip[ipp].av[1];
00390
00391
00392 pv = Tm->ip[ipp].av[0];
00393
00394
00395 dp = dpp.getval (pv);
00396
00397
00398 lv = latent_heat_of_evaporation_of_water (tk);
00399
00400 kk = lv*dp;
00401
00402 return (kk);
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414 double moistheatmat::cmm(long ipp)
00415 {
00416 double cc,tk;
00417 double pv, t;
00418
00419 pv = Tm->ip[ipp].av[0];
00420
00421
00422
00423
00424
00425 cc = Tm->ip[ipp].eqother[1]*rho_w;
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435 return (cc);
00436 }
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447 double moistheatmat::cmt(long ipp)
00448 {
00449 double cc;
00450
00451 cc = 0.0;
00452 return (cc);
00453 }
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464 double moistheatmat::chm(long ipp)
00465 {
00466 double cc;
00467
00468 cc = 0.0;
00469
00470 return (cc);
00471 }
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482 double moistheatmat::cht(long ipp)
00483 {
00484 double cc;
00485
00486 cc = derivative_of_the_enthalpy_density(ipp);
00487
00488 return (cc);
00489 }
00490
00491
00492
00493
00494
00495
00496
00497 double moistheatmat::latent_heat_of_evaporation_of_water(double tk)
00498 {
00499 return (2.5008e6)*pow((273.15/tk),(0.167+tk*3.67e-4));
00500 }
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514 double moistheatmat::saturated_water_vapor_pressure(double tk)
00515 {
00516 return (exp(23.5771 - 4042.9/(tk - 37.58)));
00517 }
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529 double moistheatmat::derivative_of_the_enthalpy_density (long ipp)
00530 {
00531 double cap, moist,rho_m;
00532
00533
00534 moist = Tm->ip[ipp].eqother[0];
00535
00536
00537 cap = c.getval (moist);
00538
00539 rho_m = rho.getval (0.0);
00540
00541 return (rho_m * cap);
00542 }
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 double moistheatmat::transmission_nodval (double nodval,long ri,long ci,long nid,long bc)
00563 {
00564
00565 long k;
00566 double pv,new_nodval,h,t;
00567 new_nodval = 0.0;
00568
00569
00570 pv = nodalval (0,nid,0);
00571
00572 t = nodalval (0,nid,1);
00573
00574 if((ri == 0) && (ci == 0))
00575 new_nodval = get_transmission_nodval_hh (nodval,pv,t,bc);
00576 if((ri == 0) && (ci == 1))
00577 new_nodval = 0.0;
00578
00579 if((ri == 1) && (ci == 0))
00580 new_nodval = get_transmission_nodval_th (nodval,bc);
00581 if((ri == 1) && (ci == 1))
00582 new_nodval = get_transmission_nodval_tt (nodval,bc);
00583
00584 return (new_nodval);
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596 double moistheatmat::get_transmission_nodval_hh (double bv,double rh,double t,long bc)
00597 {
00598 double nodval,pgws,moist;
00599
00600 switch (bc){
00601 case 5:{
00602 nodval = bv;
00603 break;
00604 }
00605 case 30:{
00606
00607
00608
00609
00610 nodval = bv;
00611 break;
00612 }
00613 case 31:{
00614
00615 nodval = bv;
00616 break;
00617 }
00618 case 32:{
00619
00620
00621 pgws = saturated_water_vapor_pressure(t);
00622 nodval = pgws*rh;
00623 bv = pgws*bv;
00624
00625 nodval = bv - nodval;
00626
00627 break;
00628 }
00629 case 33:{
00630
00631
00632
00633 rho_m = rho.getval (0.0);
00634
00635 moist = bv/100.0*rho_m/rho_w;
00636
00637
00638 nodval = sorpiso.inverse_isotherm_value (moist);
00639 break;
00640 }
00641 default:{
00642 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00643 exit(0);
00644 }
00645 }
00646 return nodval;
00647 }
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658 double moistheatmat::get_transmission_nodval_th (double bv,long bc)
00659 {
00660 double nodval,pgws,moist;
00661
00662 switch (bc){
00663 case 5:{
00664 nodval = bv;
00665 break;
00666 }
00667 default:{
00668 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00669 exit(0);
00670 }
00671 }
00672 return nodval;
00673 }
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683 double moistheatmat::get_transmission_nodval_tt (double bv,long bc)
00684 {
00685 double nodval;
00686
00687 switch (bc){
00688 case 5:{
00689 nodval = bv;
00690 break;
00691 }
00692 case 30:{
00693 nodval = bv;
00694 break;
00695 }
00696 default:{
00697 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00698 exit(0);
00699 }
00700 }
00701
00702 return (nodval);
00703 }
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717 double moistheatmat::transmission_transcoeff (double trc,long ri,long ci,long nid,long bc)
00718 {
00719
00720 double new_trc;
00721
00722 new_trc = 0.0;
00723
00724
00725
00726
00727
00728
00729 if((ri == 0) && (ci == 0))
00730 new_trc = get_transmission_transcoeff_hh (trc,bc);
00731 if((ri == 0) && (ci == 1))
00732 new_trc = 0.0;
00733
00734 if((ri == 1) && (ci == 0))
00735 new_trc = get_transmission_transcoeff_th (trc,bc);
00736 if((ri == 1) && (ci == 1))
00737 new_trc = get_transmission_transcoeff_tt (trc,bc);
00738
00739 return (new_trc);
00740 }
00741
00742
00743
00744
00745
00746
00747
00748
00749 double moistheatmat::get_transmission_transcoeff_hh (double t,long bc)
00750 {
00751 double trc,pgws;
00752
00753 switch (bc){
00754 case 5:{
00755 trc = t;
00756 break;
00757 }
00758 case 30:{
00759
00760
00761
00762 trc = t;
00763 break;
00764 }
00765 case 31:{
00766
00767 pgws = saturated_water_vapor_pressure (t);
00768 trc = pgws;
00769 trc = 1.0;
00770 break;
00771 }
00772 case 32:{
00773
00774 trc = 0.0;
00775 break;
00776 }
00777 case 33:{
00778
00779 trc = 1.0;
00780 break;
00781 }
00782 default:{
00783 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00784 exit(0);
00785 }
00786 }
00787
00788 return trc;
00789 }
00790
00791
00792
00793
00794
00795
00796
00797
00798 double moistheatmat::get_transmission_transcoeff_th (double t,long bc)
00799 {
00800 double trc;
00801
00802 switch (bc){
00803 case 5:{
00804 trc = t;
00805 break;
00806 }
00807 default:{
00808 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00809 exit(0);
00810 }
00811 }
00812
00813 return trc;
00814 }
00815
00816
00817
00818
00819
00820
00821
00822
00823 double moistheatmat::get_transmission_transcoeff_tt (double trcp,long bc)
00824 {
00825 double trc;
00826
00827 switch (bc){
00828 case 5:{
00829 trc = trcp;
00830 }
00831 case 30:{
00832
00833 trc = trcp;
00834 break;
00835 }
00836 default:{
00837 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00838 exit(0);
00839 }
00840 }
00841
00842 return trc;
00843 }
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858 double moistheatmat::transmission_flux (double nodval,long ri,long ci,long nid,long bc)
00859 {
00860 long k;
00861 double flux,pv,t;
00862
00863 flux = 0.0;
00864
00865
00866 pv = nodalval (0,nid,0);
00867
00868 t = nodalval (0,nid,1);
00869
00870 if((ri == 0) && (ci == 0))
00871 flux = get_transmission_flux_hh (nodval,pv,t,bc);
00872 if((ri == 0) && (ci == 1))
00873 flux = 0.0;
00874
00875 if((ri == 1) && (ci == 0))
00876 flux = 0.0;
00877 if((ri == 1) && (ci == 1))
00878 flux = get_transmission_flux_tt (nodval,t,bc);
00879
00880 return flux;
00881 }
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892 double moistheatmat::get_transmission_flux_hh (double bv,double pv,double t,long bc)
00893 {
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946 }
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959 double moistheatmat::get_transmission_flux_tt (double bv,double t,long bc)
00960 {
00961 double flux;
00962
00963 switch (bc){
00964 case 30:{
00965
00966 flux = (bv - t);
00967 break;
00968 }
00969 default:{
00970 print_err("no acceptable boundary condition is prescribed",__FILE__,__LINE__,__func__);
00971 exit(0);
00972 }
00973 }
00974 return(flux);
00975 }
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987 double moistheatmat::get_othervalue(long compother,double rh,double t, long ipp)
00988 {
00989 double other,w;
00990
00991 switch (compother){
00992 case 0:{
00993 other = rh/saturated_water_vapor_pressure (teptr.getval(0));
00994 break;
00995 }
00996 case 1:{
00997 other = t-273.15;
00998 break;
00999 }
01000 case 2:{
01001
01002 w = sorpiso.isotherm_value (rh);
01003 other = w;
01004 break;
01005 }
01006 case 3:{
01007 other = rh * saturated_water_vapor_pressure (t);
01008 break;
01009 }
01010 case 4:{
01011
01012 rho_m = rho.getval (0.0);
01013 other = w*rho_w/rho_m;
01014 break;
01015 }
01016 case 5:{
01017 t = 298.15;
01018 other = rh/saturated_water_vapor_pressure (t);
01019 break;
01020 }
01021 case 6:{
01022 other = rh*saturated_water_vapor_pressure (t)*M/(R*t);
01023 break;
01024 }
01025 case 7:{
01026 other = rh*R*t/(saturated_water_vapor_pressure (t)*M);
01027 break;
01028 }
01029 case 8:{
01030 other = 0.0;
01031 break;
01032 }
01033 case 9:{
01034 other = 0.0;
01035 break;
01036 }
01037 case 10:{
01038 other = 0.0;
01039 break;
01040 }
01041 default:{
01042 print_err("unknown type of component is required",__FILE__,__LINE__,__func__);
01043 }
01044 }
01045 return (other);
01046
01047 }
01048
01049
01050
01051
01052
01053
01054 void moistheatmat::print_othervalue_name(FILE *out,long compother)
01055 {
01056 switch (compother){
01057 case 0:{
01058 fprintf (out,"Relative humidity () ");
01059 break;
01060 }
01061 case 1:{
01062 fprintf (out,"Temperature (K) ");
01063 break;
01064 }
01065 case 2:{
01066 fprintf (out,"Moisture content w (m3/m3) ");
01067 break;
01068 }
01069 case 3:{
01070 fprintf (out,"Water vapour pressure (Pa) ");
01071 break;
01072 }
01073 case 4:{
01074 fprintf (out,"Moisture content u (kg/kg) ");
01075 break;
01076 }
01077 default:{
01078 print_err("unknown type of component is required",__FILE__,__LINE__,__func__);
01079 }
01080 }
01081 }
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094
01095
01096
01097
01098
01099 void moistheatmat::aux_values (long ipp,double *inv,double *inp,double *ine,double *out)
01100 {
01101 double rh,tk,w,dwdf, kapaA, smc, tep;
01102
01103 double pv;
01104
01105 pv = inv[0];
01106
01107 tk = inv[1];
01108
01109
01110 smc = sm.getval (0.0);
01111
01112 w = sorpiso.isotherm_value (pv);
01113
01114 dwdf = sorpiso.derivative_isotherm_value (pv);
01115
01116 tep = teptr.getval(0.0);
01117
01118
01119 if (w>smc)
01120 w = smc;
01121 if (w<0.0)
01122 w = 0.0;
01123
01124
01125 out[0] = w;
01126
01127 out[1] = dwdf;
01128
01129 out[2] = smc;
01130
01131 out[3] = tep;
01132
01133
01134 }
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144 void moistheatmat::save_values (long ipp,double *out)
01145 {
01146 Tm->ip[ipp].eqother[0]=out[0];
01147 Tm->ip[ipp].eqother[1]=out[1];
01148 Tm->ip[ipp].eqother[2]=out[2];
01149
01150 }
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161 void moistheatmat::give_values (long ipp,double *av,double *pv,double *eq)
01162 {
01163 av[0] = Tm->ip[ipp].av[0];
01164 av[1] = Tm->ip[ipp].av[1];
01165
01166 pv[0] = Tm->ip[ipp].pv[0];
01167 pv[1] = Tm->ip[ipp].pv[1];
01168
01169 eq[0] = Tm->ip[ipp].eqother[0];
01170 eq[1] = Tm->ip[ipp].eqother[1];
01171 eq[2] = Tm->ip[ipp].eqother[2];
01172
01173 }
01174
01175
01176
01177
01178
01179
01180
01181
01182 void moistheatmat::initvalues (long ipp,long ido)
01183 {
01184 }
01185
01186
01187
01188
01189
01190
01191
01192
01193
01194
01195
01196 void moistheatmat::give_dof_names(namevart *dofname, long ntm)
01197 {
01198 if (ntm < 1)
01199 {
01200 print_err("the model defines %ld unknowns but number of transported media is %ld",
01201 __FILE__, __LINE__, __func__, 1, ntm);
01202 abort();
01203 }
01204 dofname[0] = trf_press_water_vapor;
01205 dofname[1] = trf_temperature;
01206 }
01207
01208
01209
01210
01211
01212
01213
01214
01215
01216
01217
01218
01219 double moistheatmat::give_temperature (long ipp)
01220 {
01221 return Tm->ip[ipp].av[1];
01222 }
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235 double moistheatmat::give_inittemperature (long ipp)
01236 {
01237 print_err("Not yet implemented", __FILE__, __LINE__, __func__);
01238 abort();
01239 }
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252 double moistheatmat::give_rel_hum (long ipp)
01253 {
01254 double pv, pvs, relhum, t;
01255 pv = Tm->ip[ipp].av[0];
01256 t = teptr.getval(0.0);
01257 pvs = saturated_water_vapor_pressure (t);
01258 relhum = pv/pvs;
01259
01260 return relhum;
01261 }
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272 double moistheatmat::give_press_water_vapor (long ipp)
01273 {
01274 return Tm->ip[ipp].av[0];
01275 }
01276
01277
01278
01279
01280
01281
01282
01283
01284
01285
01286
01287
01288 double moistheatmat::give_vol_moist (long ipp)
01289 {
01290 return Tm->ip[ipp].eqother[0];
01291 }
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303
01304
01305
01306 void moistheatmat::give_reqntq(long *antq)
01307 {
01308 if (daminfl == on){
01309
01310 antq[scal_iso_damage-1] = 1;
01311
01312 antq[proc_zone_length-1] = 1;
01313
01314 antq[crack_width-1] = 1;
01315 }
01316 }