Hi, if I understand the comment with the TODO correctly, the constraint solver will then not solve the correct phase composition in your case.
If your fugacity depends on the mass fraction the system to solve for the phase composition is non-linear and then you need to e.g. use a Newton solver to find the phase composition. So in addition to changing the FluidSystem you may also need to adapt the constraint solver to be able to solve the non-linear system. The mp multi-component constraint solver solves a small equation system with equations encoding some chemical equilibrium and mass constraint assumptions. It should not be too difficult to replace the small linear solver with a small Newton solver if you use numeric differences to compute the Jacobian. Timo > On 23. Oct 2020, at 16:28, MOHAMMADREZA KARAMI <[email protected]> wrote: > > sorry, my previous email is not complete. > It's my complete email > > Hi, > I want to model evaporation of brine in porous media. > after checking fugacityCoefficient of brineair.hh file,I found that we use > H2O fugacity for liquid phase. > for this reason, evaporation rate for brine and water is equal.but It is not > correct. > I found TODO for changing fugacity of water to brine,but I don't understand > why we can not add bellow code for solving this problem: > > change vapor pressure of brine component to: > static Scalar vaporPressure(Scalar temperature, Scalar salinityy) > { > Scalar ps = H2O::vaporPressure(temperature); //Saturation vapor > pressure for pure water > Scalar pi = 0; > using std::log; > if (ThisType::salinity() < 0.26) // here we have hard coded the > solubility limit for NaCl > pi = (R * temperature * log(1- salinityy)); // simplified version > of Eq 2.29 in Vishal Jambhekar's Promo > else > pi = (R * temperature * log(0.74)); > using std::exp; > ps *= 0.9;// Kelvin's law for reduction in saturation vapor pressure > due to osmotic potential > return ps; > } > > then,change fugacitycoefficent of brineair.hh to : > template <class FluidState> > static Scalar fugacityCoefficient(const FluidState& fluidState, int > phaseIdx, int compIdx) > { > assert(0 <= phaseIdx && phaseIdx < numPhases); > assert(0 <= compIdx && compIdx < numComponents); > > Scalar T = fluidState.temperature(phaseIdx); > Scalar salinityy = fluidState.massFraction(phaseIdx,NaClIdx); > Scalar p = fluidState.pressure(phaseIdx); > > if (phaseIdx == gasPhaseIdx) > return 1.0; > > else if (phaseIdx == liquidPhaseIdx) > { > // TODO: Should we use the vapor pressure of the mixture (brine) > here? > // The presence of NaCl lowers the vapor pressure, thus, we > would > // expect the fugacity coefficient to be lower as well. > However, > // with the fugacity coefficient being dependent on the > salinity, > // the equation system for the phase equilibria becomes > non-linear > // and our constraint solvers assume linear system of > equations. > if (compIdx == H2OIdx) > return Brinee::vaporPressure(T,salinityy)/p; > > else if (compIdx == AirIdx) > return BinaryCoeff::H2O_Air::henry(T)/p; > > // we assume nacl always stays in the liquid phase > else > return 0.0; > } > > DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << > phaseIdx); > } > > Brinee is brine component from brine.hh file > -- > This email was Anti Virus checked by Security Gateway. > _______________________________________________ > DuMux mailing list > [email protected] <mailto:[email protected]> > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux > <https://listserv.uni-stuttgart.de/mailman/listinfo/dumux>
_______________________________________________ DuMux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
