Gems3k
3.1
GEMS3K standalone solver for geochemical equilibria
|
00001 //------------------------------------------------------------------- 00002 // $Id: ms_multi.h 756 2012-11-05 13:59:16Z kosakowski $ 00003 // 00007 // 00010 // 00011 // Copyright (c) 1995-2012 S.Dmytriyeva, D.Kulik, T.Wagner 00012 // <GEMS Development Team, mailto:gems2.support@psi.ch> 00013 // 00014 // This file is part of the GEMS3K code for thermodynamic modelling 00015 // by Gibbs energy minimization <http://gems.web.psi.ch/GEMS3K/> 00016 // 00017 // GEMS3K is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU Lesser General Public License as 00019 // published by the Free Software Foundation, either version 3 of 00020 // the License, or (at your option) any later version. 00021 00022 // GEMS3K is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU Lesser General Public License for more details. 00026 00027 // You should have received a copy of the GNU General Public License 00028 // along with GEMS3K code. If not, see <http://www.gnu.org/licenses/>. 00029 //------------------------------------------------------------------- 00030 // 00031 #ifndef _ms_multi_h_ 00032 #define _ms_multi_h_ 00033 00034 #ifndef IPMGEMPLUGIN 00035 00036 #include "m_param.h" 00037 #include "v_ipnc.h" 00038 00039 // Internal subroutine for ET_translate() to process Phase scripts 00040 typedef int (tget_ndx)( int nI, int nO, int Xplace ); 00041 00042 #else 00043 00044 #include <ctime> 00045 #include "m_const.h" 00046 #include "datach.h" 00047 00048 #endif 00049 00050 #include "s_solmod.h" 00051 // #include "s_sorpmod.h" 00052 00053 typedef struct 00054 { // MULTI is base structure to Project (local values) 00055 char 00056 stkey[EQ_RKLEN+1], 00057 // NV_[MAXNV], nulch, nulch1, ///< Variant Nr for fixed b,P,T,V; index in a megasystem 00058 PunE, 00059 PunV, 00060 PunP, 00061 PunT; 00062 long int 00063 N, 00064 NR, 00065 L, 00066 Ls, 00067 LO, 00068 PG, 00069 PSOL, 00070 Lads, 00071 FI, 00072 FIs, 00073 FIa, 00074 FI1, 00075 FI1s, 00076 FI1a, 00077 IT, 00078 E, 00079 PD, 00080 PV, 00081 PLIM, 00082 Ec, 00083 K2, 00084 PZ, 00085 00086 pNP, 00087 pESU, 00088 pIPN, 00089 pBAL, 00090 tMin, 00091 pTPD, 00092 pULR, 00093 ITaia, 00094 FIat, 00095 MK, 00096 W1, 00097 is, 00098 js, 00099 next, 00100 sitNcat, 00101 sitNan 00102 ; 00103 double 00104 TC, 00105 TCc, 00106 T, 00107 Tc, 00108 P, 00109 Pc, 00110 VX_, 00111 VXc, 00112 GX_, 00113 GXc, 00114 AX_, 00115 AXc, 00116 UX_, 00117 UXc, 00118 HX_, 00119 HXc, 00120 SX_, 00121 SXc, 00122 CpX_, 00123 CpXc, 00124 CvX_, 00125 CvXc, 00126 TMols, 00127 SMols, 00128 MBX, 00129 FX, 00130 IC, 00131 pH, 00132 pe, 00133 Eh, 00134 DHBM, 00135 DSM, 00136 GWAT, 00137 YMET, 00138 PCI, 00139 DXM, 00140 lnP, 00141 RT, 00142 FRT, 00143 Yw, 00144 ln5551, 00145 aqsTail, 00146 lowPosNum, 00147 logXw, 00148 logYFk, 00149 YFk, 00150 FitVar[5]; 00151 00152 00153 00154 double 00155 denW[5], 00156 denWg[5], 00157 epsW[5], 00158 epsWg[5]; 00159 00160 long int 00161 *L1, 00162 *LsMod, 00163 00164 *LsMdc, 00165 *IPx, 00166 00167 *mui, 00168 *muk, 00169 *muj; 00170 long int (*SATX)[4]; 00171 // link indexes to surface type [XL_ST]; sorbent em [XL_EM]; surf.site [XL-SI] and EDL plane [XL_SP] 00172 double 00173 *PMc, 00174 *DMc, 00175 *MoiSN, 00176 *SitFr, 00177 *A, 00178 *Awt, 00179 00180 // Reconsider usage 00181 *Wb, 00182 *Wabs, 00183 *Rion, 00184 *HYM, 00185 *ENT, 00186 00187 // Convert H0, A0, U0, S0, Cp0 to double 00188 *H0, 00189 *A0, 00190 *U0, 00191 *S0, 00192 *Cp0, 00193 *Cv0, 00194 00195 *VL, 00196 *Xcond, 00197 *Xeps, 00198 *Aalp, 00199 *Sigw, 00200 *Sigg 00201 ; 00202 00203 00204 // Data for surface comlexation and sorption models (new variant [Kulik,2006]) 00205 double (*Xr0h0)[2]; 00206 double (*Nfsp)[MST]; 00207 double (*MASDT)[MST]; 00208 double (*XcapF)[MST]; 00209 double (*XcapA)[MST]; 00210 double (*XcapB)[MST]; 00211 double (*XcapD)[MST]; 00212 double (*XdlA)[MST]; 00213 double (*XdlB)[MST]; 00214 double (*XdlD)[MST]; 00215 double (*XlamA)[MST]; 00216 double (*Xetaf)[MST]; 00217 double (*MASDJ)[DFCN]; 00218 // Contents defined in the enum below this structure 00219 // Other data 00220 00221 double 00222 *XFs, 00223 *Falps, 00224 *Fug, 00225 *Fug_l, 00226 *Ppg_l, 00227 00228 *DUL, 00229 *DLL, 00230 *fDQF, 00231 *PUL, 00232 *PLL, 00233 *YOF, 00234 *Vol, 00235 *MM, 00236 *Pparc, 00237 *Y_m, 00238 *Y_la, 00239 *Y_w, 00240 *Gamma, 00241 *lnGmf, 00242 *lnGmM, 00243 *EZ, 00244 *FVOL, 00245 *FWGT, 00246 // 00247 *G, 00248 *G0, 00249 *lnGam, 00250 *lnGmo; 00251 double (*lnSAC)[4]; 00252 double *B, 00253 *U, 00254 *U_r, 00255 *C, 00256 *IC_m, 00257 *IC_lm, 00258 *IC_wm, 00259 *BF, 00260 *BFC, 00261 *XF, 00262 *YF, 00263 *XFA, 00264 *YFA, 00265 *Falp; 00266 00267 double (*VPh)[MIXPHPROPS], 00268 (*GPh)[MIXPHPROPS], 00269 (*HPh)[MIXPHPROPS], 00270 (*SPh)[MIXPHPROPS], 00271 (*CPh)[MIXPHPROPS], 00272 (*APh)[MIXPHPROPS], 00273 (*UPh)[MIXPHPROPS]; 00274 00275 // EDL models (data for electrostatic activity coefficients) 00276 double (*XetaA)[MST]; 00277 double (*XetaB)[MST]; 00278 double (*XetaD)[MST]; 00279 double (*XpsiA)[MST]; 00280 double (*XpsiB)[MST]; 00281 double (*XpsiD)[MST]; 00282 double (*XFTS)[MST]; 00283 // 00284 double *X, 00285 *Y, 00286 *XY, 00287 *Qp, 00288 *Qd, 00289 *MU, 00290 *EMU, 00291 *NMU, 00292 *W, 00293 *Fx, 00294 *Wx, 00295 *F, 00296 *F0; 00297 double (*D)[MST]; 00298 // Name lists 00299 char (*sMod)[6]; 00300 char (*dcMod)[6]; 00301 char (*SB)[MAXICNAME+MAXSYMB]; 00302 char (*SB1)[MAXICNAME]; 00303 char (*SM)[MAXDCNAME]; 00304 char (*SF)[MAXPHNAME+MAXSYMB]; 00305 char (*SM2)[MAXDCNAME]; 00306 char (*SM3)[MAXDCNAME]; 00307 char *DCC3; 00308 char (*SF2)[MAXPHNAME+MAXSYMB]; 00309 char (*SFs)[MAXPHNAME+MAXSYMB]; 00310 char *pbuf, 00311 // Class codes 00312 *RLC, 00313 *RSC, 00314 *RFLC, 00315 *RFSC, 00316 *ICC, 00317 *DCC, 00318 *PHC; 00319 char (*SCM)[MST]; 00320 char *SATT, 00321 *DCCW; 00322 00323 // SolutionData *asd; ///< Array of data structures to pass info to TSolMod [FIs] 00324 00325 long int ITF, 00326 ITG; 00327 clock_t t_start, t_end; 00328 double t_elap_sec; 00329 #ifdef IPMGEMPLUGIN 00330 double *Guns; 00331 double *Vuns; 00332 double *tpp_G; 00333 double *tpp_S; 00334 double *tpp_Vm; 00335 #endif 00336 00337 // additional arrays for internal calculation in ipm_main 00338 double *XU; 00339 double (*Uc)[2]; 00340 double *Uefd; 00341 char errorCode[100]; 00342 char errorBuf[1024]; 00343 double logCDvalues[5]; 00344 double *GamFs; 00345 00346 double // Iterators for MTP interpolation (do not load/unload for IPM) 00347 Pai[4], 00348 Tai[4], 00349 Fdev1[2], 00350 Fdev2[2]; 00351 00352 // Experimental: modified cutoff and insertion values (DK 28.04.2010) 00353 double 00354 // cutoffs (rescaled to system size) 00355 XwMinM, 00356 ScMinM, 00357 DcMinM, 00358 PhMinM, 00359 00360 DFYwM, 00361 DFYaqM, 00362 DFYidM, 00363 DFYrM, 00364 DFYhM, 00365 DFYcM, 00366 DFYsM, 00367 SizeFactor; 00368 } 00369 MULTI; 00370 00378 enum IndexationSATX { 00379 XL_ST = 0, XL_EM = 1, XL_SI = 2, XL_SP = 3 00380 }; 00381 00382 struct SPP_SETTING; 00383 class TProfil; 00384 class TNode; 00385 00386 // Data of MULTI 00387 class TMulti 00388 #ifndef IPMGEMPLUGIN 00389 : public TSubModule 00390 #endif 00391 { 00392 MULTI pm; 00393 MULTI *pmp; 00394 SPP_SETTING *paTProfil; 00395 00396 // Internal arrays for the performance optimization (since version 2.0.0) 00397 long int sizeN; /*, sizeL, sizeAN;*/ 00398 double *AA; 00399 double *BB; 00400 long int *arrL; 00401 long int *arrAN; 00402 00403 void Alloc_A_B( long int newN ); 00404 void Free_A_B(); 00405 void Build_compressed_xAN(); 00406 void Free_compressed_xAN(); 00407 void Free_internal(); 00408 00409 #ifndef IPMGEMPLUGIN 00410 // These pointers and methods are only used in GEMS-PSI 00411 //SYSTEM *syp; 00412 //MTPARM *tpp; 00413 //RMULTS *mup; 00414 00415 void MultiSystemInit(); 00416 void SystemToLookup(); 00417 00418 void multi_sys_dc(); 00419 void multi_sys_ph(); 00420 void ph_sur_param( int k, int kk ); 00421 void ph_surtype_assign( int k, int kk, int jb, int je, 00422 int car_l[], int car_c, int Cjs ); 00423 void sm_text_analyze( int nph, int Type, int JB, int JE, int jb, int je ); 00424 void SolModLoad(); 00425 bool CompressPhaseIpxt( int kPH ); 00426 gstring PressSolMod( int nP ); 00427 char *ExtractEG( char *Etext, int jp, int *EGlen, int Nes ); 00428 int find_icnum( char *name, int LNmode ); 00429 int find_dcnum( char *name, int jb, int je, int LNmode, char *stmt ); 00430 int find_phnum( char *name, int LNmode ); 00431 int find_acnum( char *name, int LNmode ); 00432 const char* GetHtml(); 00433 00434 #else 00435 00436 bool load; // internal value 00437 00438 #endif 00439 00440 protected: 00441 00442 long int sizeFIs; 00443 TSolMod* (*phSolMod); 00444 00445 void Alloc_TSolMod( long int newFIs ); 00446 void Free_TSolMod(); 00447 00448 00449 // Added for implementation of divergence detection in dual solution 06.05.2011 DK 00450 long int nNu; 00451 long int cnr; 00452 long int nCNud; 00453 double *U_mean; 00454 double *U_M2; 00455 double *U_CVo; 00456 double *U_CV; 00457 long int *ICNud; 00458 void Alloc_uDD( long int newN ); 00459 void Free_uDD(); 00460 void Reset_uDD(long int cr, bool trace = false ); 00461 void Increment_uDD( long int r, bool trace = false ); 00462 long int Check_uDD( long int mode, double DivTol, bool trace = false ); 00463 00464 #ifdef IPMGEMPLUGIN 00465 00466 char PAalp_; 00467 char PSigm_; 00468 00469 #endif 00470 00471 // Internal functions for SCMs 00472 void getLsModsum( long int& LsModSum, long int& LsIPxSum ); 00473 void getLsMdcsum( long int& LsMdcSum,long int& LsMsnSum,long int& LsSitSum ); 00474 00475 void setErrorMessage( long int num, const char *code, const char * msg); 00476 void addErrorMessage( const char * msg); 00477 00478 // ipm_chemical.cpp 00479 void XmaxSAT_IPM2(); 00480 // void XmaxSAT_IPM2_reset(); 00481 double DC_DualChemicalPotential( double U[], double AL[], long int N, long int j ); 00482 void Set_DC_limits( long int Mode ); 00483 void TotalPhasesAmounts( double X[], double XF[], double XFA[] ); 00484 double DC_PrimalChemicalPotentialUpdate( long int j, long int k ); 00485 double DC_PrimalChemicalPotential( double G, double logY, double logYF, 00486 double asTail, double logYw, char DCCW ); 00487 void PrimalChemicalPotentials( double F[], double Y[], 00488 double YF[], double YFA[] ); 00489 double KarpovCriterionDC( double *dNuG, double logYF, double asTail, 00490 double logYw, double Wx, char DCCW ); 00491 void KarpovsPhaseStabilityCriteria(); 00492 void StabilityIndexes( ); // added 01.05.2010 DK 00493 double DC_GibbsEnergyContribution( double G, double x, double logXF, 00494 double logXw, char DCCW ); 00495 double GX( double LM ); 00496 00497 void ConvertDCC(); 00498 long int getXvolume(); 00499 00500 // ipm_chemical2.cpp 00501 void GasParcP(); 00502 void phase_bcs( long int N, long int M, long int jb, double *A, double X[], double BF[] ); 00503 void phase_bfc( long int k, long int jj ); 00504 double bfc_mass( void ); 00505 void CalculateConcentrationsInPhase( double X[], double XF[], double XFA[], 00506 double Factor, double MMC, double Dsur, long int jb, long int je, long int k ); 00507 void CalculateConcentrations( double X[], double XF[], double XFA[]); 00508 long int GouyChapman( long int jb, long int je, long int k ); 00509 00510 // Surface activity coefficient terms 00511 long int SurfaceActivityCoeff( long int jb, long int je, long int jpb, long int jdb, long int k ); 00512 // void SurfaceActivityTerm( long int jb, long int je, long int k ); // Obsolete / deleted 00513 00514 // ipm_chemical3.cpp 00515 void IS_EtaCalc(); 00516 void pm_GC_ods_link( long int k, long int jb, long int jpb, long int jdb, long int ipb ); 00517 double SmoothingFactor( ); 00518 void SetSmoothingFactor( long int mode ); // new smoothing function (3 variants) 00519 // Main call for calculation of activity coefficients on IPM iterations 00520 long int CalculateActivityCoefficients( long int LinkMode ); 00521 // Built-in activity coefficient models 00522 // Generic solution model calls 00523 void SolModCreate( long int jb, long int jmb, long int jsb, long int jpb, long int jdb, 00524 long int k, long int ipb, char ModCode, char MixCode ); 00525 void SolModParPT( long int k, char ModCode ); 00526 void SolModActCoeff( long int k, char ModCode ); 00527 void SolModExcessProp( long int k, char ModCode ); 00528 void SolModIdealProp ( long int jb, long int k, char ModCode ); 00529 void SolModStandProp ( long int jb, long int k, char ModCode ); 00530 void SolModDarkenProp ( long int jb, long int k, char ModCode ); 00531 00532 // Specific phase property calculation functions // obsolete (29.11.10 TW) 00533 // void IdealGas( long int jb, long int k, double *Zid ); 00534 // void IdealOneSite( long int jb, long int k, double *Zid ); 00535 // void IdealMultiSite( long int jb, long int k, double *Zid ); 00536 00537 // ipm_main.cpp - numerical part of GEM IPM-2 00538 void GEM_IPM( long int rLoop ); 00539 long int MassBalanceRefinement( long int WhereCalledFrom ); 00540 long int InteriorPointsMethod( long int &status, long int rLoop ); 00541 void AutoInitialApproximation( ); 00542 00543 // ipm_main.cpp - miscellaneous fuctions of GEM IPM-2 00544 void MassBalanceResiduals( long int N, long int L, double *A, double *Y, 00545 double *B, double *C ); 00546 // long int CheckMassBalanceResiduals(double *Y ); 00547 double OptimizeStepSize( double LM ); 00548 void DC_ZeroOff( long int jStart, long int jEnd, long int k=-1L ); 00549 void DC_RaiseZeroedOff( long int jStart, long int jEnd, long int k=-1L ); 00550 double RaiseDC_Value( const long int j ); 00551 // void LagrangeMultiplier(); 00552 long int MetastabilityLagrangeMultiplier(); 00553 void WeightMultipliers( bool square ); 00554 long int MakeAndSolveSystemOfLinearEquations( long int N, bool initAppr ); 00555 double DikinsCriterion( long int N, bool initAppr ); 00556 double StepSizeEstimate( bool initAppr ); 00557 void Restore_Y_YF_Vectors(); 00558 00559 double RescaleToSize( bool standard_size ); // replaced calcSfactor() 30.08.2009 DK 00560 long int SpeciationCleanup( double AmountThreshold, double ChemPotDiffCutoff ); // added 25.03.10 DK 00561 long int PhaseSelectionSpeciationCleanup( long int &k_miss, long int &k_unst, long int rLoop ); 00562 long int PhaseSelect( long int &k_miss, long int &k_unst, long int rLoop ); 00563 bool GEM_IPM_InitialApproximation(); 00564 00565 // IPM_SIMPLEX.CPP Simplex method modified with two-sided constraints (Karpov ea 1997) 00566 void SolveSimplex(long int M, long int N, long int T, double GZ, double EPS, 00567 double *UND, double *UP, double *B, double *U, 00568 double *AA, long int *STR, long int *NMB ); 00569 void SPOS( double *P, long int STR[],long int NMB[],long int J,long int M,double AA[]); 00570 void START( long int T,long int *ITER,long int M,long int N,long int NMB[], 00571 double GZ,double EPS,long int STR[],long int *BASE, 00572 double B[],double UND[],double UP[],double AA[],double *A, 00573 double *Q ); 00574 void NEW(long int *OPT,long int N,long int M,double EPS,double *LEVEL,long int *J0, 00575 long int *Z,long int STR[], long int NMB[], double UP[], 00576 double AA[], double *A); 00577 void WORK(double GZ,double EPS,long int *I0, long int *J0,long int *Z,long int *ITER, 00578 long int M, long int STR[],long int NMB[],double AA[], 00579 long int BASE[],long int *UNO,double UP[],double *A,double Q[]); 00580 void FIN(double EPS,long int M,long int N,long int STR[],long int NMB[], 00581 long int BASE[],double UND[],double UP[],double U[], 00582 double AA[],double *A,double Q[],long int *ITER); 00583 void GibbsEnergyMinimization(); 00584 double SystemTotalMolesIC( ); 00585 void ScaleSystemToInternal( double ScFact ); 00586 void RescaleSystemFromInternal( double ScFact ); 00587 void MultiConstInit(); // from MultiRemake 00588 void GEM_IPM_Init(); 00589 00590 public: 00591 TNode *node; 00592 00593 void set_def( long int i=0); 00594 00595 #ifndef IPMGEMPLUGIN 00596 00597 static TMulti* sm; 00598 00599 // This is used only in GEM-Selektor 00600 TIArray<IPNCalc> qEp; 00601 TIArray<IPNCalc> qEd; 00602 00603 TMulti( int nrt ); 00604 ~TMulti() 00605 { 00606 // Free_TSolMod(); // Added 06.05.2011 DK - possible bugfix 00607 Free_internal(); 00608 Free_uDD(); 00609 }; 00610 00611 void ods_link( int i=0); 00612 void dyn_set( int i=0); 00613 void dyn_kill( int i=0); 00614 void dyn_new( int i=0); 00615 // void set_def( int i=0); 00616 // void sit_dyn_new(); 00617 00618 // ms_muleq.cpp 00619 void packData(); 00620 void packData( TCIntArray PHon, TCIntArray DCon ); 00621 void setSizes(); 00622 void loadData( bool newRec ); 00623 void unpackData(); 00624 00625 void MultiKeyInit( const char*key ); 00626 void EqstatExpand( const char *key, bool calcActivityModels = true ); 00627 void ET_translate( int nOet, int nOpex, int JB, int JE, int jb, int je, 00628 tget_ndx *get_ndx = 0 ); 00629 void getNamesList( int nO, TCStringArray& lst ); 00630 00631 class UserCancelException {}; 00632 00634 double pb_GX( double *Gxx ); 00635 00636 #else 00637 00638 TMulti( TNode* na_ ) 00639 { 00640 pmp = ± 00641 node = na_; // parent 00642 sizeN = 0; 00643 AA = 0; 00644 BB = 0; 00645 arrL = 0; 00646 arrAN = 0; 00647 00648 U_mean = 0; 00649 U_M2 = 0; 00650 U_CVo = 0; 00651 U_CV = 0; 00652 ICNud = 0; 00653 00654 sizeFIs = 0; 00655 phSolMod = 0; 00656 00657 pmp->Guns = 0; 00658 pmp->Vuns = 0; 00659 pmp->tpp_G = 0; 00660 pmp->tpp_S = 0; 00661 pmp->tpp_Vm = 0; 00662 00663 load = false; 00664 } 00665 00666 ~TMulti() 00667 { multi_free(); } 00668 00669 void multi_realloc( char PAalp, char PSigm ); 00670 void multi_free(); 00671 00672 void CheckMtparam(); // Test load thermodynamic data before 00673 00674 #endif 00675 00676 MULTI* GetPM() 00677 { return ± } 00678 00679 void setPa( TProfil *prof); 00680 long int testMulti( ); 00681 00682 const char* GetName() const 00683 { return "Multi"; } 00684 00685 //connection to mass transport 00686 void to_file( GemDataStream& ff ); 00687 void to_text_file( const char *path, bool append=false ); 00688 void from_file( GemDataStream& ff ); 00689 void to_text_file_gemipm( const char *path, bool addMui, 00690 bool with_comments = true, bool brief_mode = false ); 00691 void from_text_file_gemipm( const char *path, DATACH *dCH ); 00692 00693 // EXTERNAL FUNCTIONS 00694 // MultiCalc 00695 void Alloc_internal(); 00696 double CalculateEquilibriumState( long int typeMin, long int& NumIterFIA, long int& NumIterIPM ); 00697 void InitalizeGEM_IPM_Data(); 00698 void DC_LoadThermodynamicData( TNode* aNa = 0 ); 00699 00700 long int CheckMassBalanceResiduals(double *Y ); 00701 double ConvertGj_toUniformStandardState( double g0, long int j, long int k ); 00702 double PhaseSpecificGamma( long int j, long int jb, long int je, long int k, long int DirFlag = 0L ); // Added 26.06.08 00703 00704 double HelmholtzEnergy( double x ); 00705 double InternalEnergy( double TC, double P ); 00706 00707 }; 00708 00709 // ???? syp->PGmax 00710 typedef enum { // Symbols of thermodynamic potential to minimize 00711 G_TP = 'G', // Gibbs energy minimization G(T,P) 00712 A_TV = 'A', // Helmholts energy minimization A(T,V) 00713 U_SV = 'U', // isochoric-isentropicor internal energy at isochoric conditions U(S,V) 00714 H_PS = 'H', // isobaric-isentropic or enthalpy H(P,S) 00715 _S_PH = '1', // negative entropy at isobaric conditions and fixed enthalpy -S(P,H) 00716 _S_UV = '2' // negative entropy at isochoric conditions and fixed internal energy -S(P,H) 00717 00718 } THERM_POTENTIALS; 00719 00720 typedef enum { // Symbols of thermodynamic potential to minimize 00721 G_TP_ = 0, // Gibbs energy minimization G(T,P) 00722 A_TV_ = 1, // Helmholts energy minimization A(T,V) 00723 U_SV_ = 2, // isochoric-isentropicor internal energy at isochoric conditions U(S,V) 00724 H_PS_ = 3, // isobaric-isentropic or enthalpy H(P,S) 00725 _S_PH_ = 4, // negative entropy at isobaric conditions and fixed enthalpy -S(P,H) 00726 _S_UV_ = 5 // negative entropy at isochoric conditions and fixed internal energy -S(P,H) 00727 00728 } NUM_POTENTIALS; 00729 00730 // kg44: this is not correctly implemented!! 00731 //double A_P( double x, double x2=0.); 00732 //double U_TP( double TC, double P); 00733 00734 00735 typedef enum { // Field index into outField structure 00736 f_pa_PE = 0, f_PV, f_PSOL, f_PAalp, f_PSigm, 00737 f_Lads, f_FIa, f_FIat 00738 } MULTI_STATIC_FIELDS; 00739 00740 typedef enum { // Field index into outField structure 00741 f_sMod = 0, f_LsMod, f_LsMdc, f_B, f_DCCW, 00742 f_Pparc, f_fDQF, f_lnGmf, f_RLC, f_RSC, 00743 f_DLL, f_DUL, f_Aalp, f_Sigw, f_Sigg, 00744 f_YOF, f_Nfsp, f_MASDT, f_C1, f_C2, 00745 f_C3, f_pCh, f_SATX, f_MASDJ, f_SCM, 00746 f_SACT, f_DCads, 00747 // static 00748 f_pa_DB, f_pa_DHB, f_pa_EPS, f_pa_DK, f_pa_DF, 00749 f_pa_DP, f_pa_IIM, f_pa_PD, f_pa_PRD, f_pa_AG, 00750 f_pa_DGC, f_pa_PSM, f_pa_GAR, f_pa_GAH, f_pa_DS, 00751 f_pa_XwMin, f_pa_ScMin, f_pa_DcMin, f_pa_PhMin, f_pa_ICmin, 00752 f_pa_PC, f_pa_DFM, f_pa_DFYw, f_pa_DFYaq, f_pa_DFYid, 00753 f_pa_DFYr, f_pa_DFYh, f_pa_DFYc, f_pa_DFYs, f_pa_DW, 00754 f_pa_DT, f_pa_GAS, f_pa_DG, f_pa_DNS, f_pa_IEPS, 00755 f_pKin, f_pa_DKIN, f_mui, f_muk, f_muj, 00756 f_pa_PLLG, f_tMin, f_dcMod 00757 } MULTI_DYNAMIC_FIELDS; 00758 00759 00760 00761 #endif //_ms_multi_h 00762