00001 #include "sorpisorootgrun.h"
00002
00003 sorpisorootgrun::sorpisorootgrun (void)
00004 {
00005
00006 whyg=0.0;
00007
00008 rhhyg=0.0;
00009
00010 wsat=0.0;
00011
00012 }
00013
00014 sorpisorootgrun::~sorpisorootgrun (void)
00015 {
00016 }
00017
00018
00019
00020
00021
00022
00023
00024
00025 void sorpisorootgrun::read (XFILE *in)
00026 {
00027
00028
00029
00030 xfscanf(in,"%le %le %le",&whyg,&rhhyg,&wsat);
00031 }
00032
00033
00034
00035
00036
00037
00038
00039
00040 void sorpisorootgrun::print (FILE *out)
00041 {
00042 fprintf(out, "%le %le %le",whyg,rhhyg,wsat);
00043
00044 }
00045
00046
00047
00048
00049
00050
00051
00052
00053 double sorpisorootgrun::sorption_isotherm (double rh)
00054 {
00055 double moist;
00056
00057 if (rh < rhhyg){
00058 moist = (1.0-sqrt(1.0-rh)) * whyg/(1.0-sqrt(1.0-rhhyg));
00059 }else{
00060 if (rh > 1.0){
00061 moist = wsat;
00062 }else{
00063 moist = whyg + (rh - rhhyg)/(1.0-rhhyg) * (wsat - whyg);
00064 }
00065 }
00066
00067 return moist;
00068 }
00069
00070
00071
00072
00073
00074
00075
00076
00077 double sorpisorootgrun::inverse_sorption_isotherm (double w)
00078 {
00079 double phi,whygs;
00080
00081 if (w < whyg){
00082
00083 whygs = whyg/(1.0-sqrt(1.0-rhhyg));
00084 phi = 1.0 - (1.0-w/whygs)*(1.0-w/whygs);
00085 }else{
00086 if (w > wsat){
00087 phi = 1.0;
00088 }else{
00089 phi = rhhyg + (1.0-rhhyg)*(w-whyg)/(wsat-whyg);
00090 }
00091 }
00092
00093 return phi;
00094 }
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 double sorpisorootgrun::derivative_sorption_isotherm (double rh)
00108 {
00109 double dersi,whygs;
00110
00111 if (rh > 1.0)
00112 rh = 1.0;
00113 if (rh < 0.0)
00114 rh = 0.0;
00115
00116 if (rh < rhhyg){
00117
00118 whygs = whyg/(1.0-sqrt(1.0-rhhyg));
00119
00120 dersi = whygs/2.0/(sqrt (1-rh));
00121 }else{
00122 dersi = (wsat - whyg)/(1.0 - rhhyg);
00123 }
00124
00125 return dersi;
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 double sorpisorootgrun::derivative_inverse_sorption_isotherm (double w)
00137 {
00138 double dersi,whygs;
00139
00140 if (w > wsat){
00141 w = wsat;}
00142 if (w < 0.0){
00143 w = 0.0;
00144 }
00145
00146 if (w < whyg){
00147
00148 whygs = whyg/(1.0-sqrt(1.0-rhhyg));
00149 dersi = 2.0*(whygs-w)/whygs/whygs;
00150 }else{
00151 dersi = (1.0 - rhhyg)/(wsat - whyg);
00152 }
00153
00154 return dersi;
00155 }