Hi Christian,

your FluidState object fs is default initialized, which means that all quantities like pressure, temperature, etc. are (probably) zero by default.

It depends where exactly you want to use Scalar fcN2 = FluidSystem::density(fs.liquidPhaseIdx);

If it is within your neumann() or source() function, you may use

const auto& fs = volVars.fluidState();

which automatically gives you the correct fluid state.

If you want to use it for example in your initialAtPos() function, you need to correctly initialize the fluid state yourself.

This means you need to assign values to fs before you can use it in the FluidSystem. Have a look at here https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/porousmediumflow/2p2c/volumevariables.hh#L183

You may not need to set all variables. It depends on the FluidSystem::density function which ones are actually needed.

Hope this helps.

Best wishes
Kilian


On 09.08.21 13:14, Christian Truitt Lüddeke wrote:

Hello everyone,

I have a problem with the initialization of my model. To be more specific, I have difficulties with the initialization of my variables for the fugacity coefficients and the density of the components. I have a grid with the following dimensions: 200 * 200 *10 (Cells 40 40 5).  I am using a 2p2c model and my fluidsystem is the standard h2on2. I am using the compositional fluid state. In my problem file to assign the variable “fcN2” to a density I have used the following code:

FluidState fs;

Scalar fcN2 = (FluidSystem::density(fs,liquidPhaseIdx));

But when I run this file, the terminal says that the density is zero. And when I change to the gasPhaseIdx, then the output is “-nan”.

I have a similar problem with the fugacity coefficients. When I try to initialize those, I use the following code in my problem file: Scalar xH2O = (FluidSystem::fugacityCoefficient(fs,liquidPhaseIdx,H2OIdx));

Making this file is no problem. However, when I try to run it then it aborts very quickly. Additionally, the fugacity coefficient for N2Idx cannot be computed.

I appreciate your help and hints to solve this problem. Thank you very much in advance.

Kind regards


_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Kilian Weishaupt
Institut für Wasser- und Umweltsystemmodellierung (IWS)
Lehrstuhl für Hydromechanik und Hydrosystemmodellierung
Universität Stuttgart, Pfaffenwaldring 61, 70569 Stuttgart
Email: [email protected]
Telefon: 0049 711 685-60461 ** fax: 0049-711-685-60430
http://www.hydrosys.uni-stuttgart.de
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to