Permalink
Browse files

Merge pull request #12486 from cpgr/fluidstate

Generic fluid state material and IC
  • Loading branch information...
andrsd committed Nov 26, 2018
2 parents 9022125 + 1515161 commit 92ef937eddc942d76eb951f1a9fa8507cf6d1088
Showing with 403 additions and 384 deletions.
  1. +2 −5 modules/porous_flow/doc/content/modules/porous_flow/brineco2.md
  2. +2 −5 modules/porous_flow/doc/content/modules/porous_flow/waterncg.md
  3. +3 −0 modules/porous_flow/doc/content/source/ics/PorousFlowFluidStateBrineCO2IC.md
  4. +11 −0 modules/porous_flow/doc/content/source/ics/PorousFlowFluidStateIC.md
  5. +3 −0 modules/porous_flow/doc/content/source/ics/PorousFlowFluidStateWaterNCGIC.md
  6. +13 −0 modules/porous_flow/doc/content/source/materials/PorousFlowFluidState.md
  7. +2 −4 modules/porous_flow/doc/content/source/materials/PorousFlowFluidStateBrineCO2.md
  8. +3 −0 modules/porous_flow/doc/content/source/materials/PorousFlowFluidStateWaterNCG.md
  9. +2 −0 modules/porous_flow/doc/hidden.yml
  10. +1 −1 modules/porous_flow/examples/co2_intercomparison/1Dradial/1Dradial.i
  11. +1 −1 modules/porous_flow/examples/co2_intercomparison/1Dradial/properties.i
  12. +2 −10 modules/porous_flow/include/ics/PorousFlowFluidStateBrineCO2IC.h
  13. +14 −7 modules/porous_flow/include/ics/{PorousFlowFluidStateICBase.h → PorousFlowFluidStateIC.h}
  14. +2 −8 modules/porous_flow/include/ics/PorousFlowFluidStateWaterNCGIC.h
  15. +21 −11 modules/porous_flow/include/materials/{PorousFlowFluidStateFlashBase.h → PorousFlowFluidState.h}
  16. +2 −18 modules/porous_flow/include/materials/PorousFlowFluidStateBrineCO2.h
  17. +2 −8 modules/porous_flow/include/materials/PorousFlowFluidStateWaterNCG.h
  18. +9 −36 modules/porous_flow/include/userobjects/PorousFlowBrineCO2.h
  19. +46 −1 modules/porous_flow/include/userobjects/PorousFlowFluidStateBase.h
  20. +6 −24 modules/porous_flow/include/userobjects/PorousFlowWaterNCG.h
  21. +5 −21 modules/porous_flow/src/ics/PorousFlowFluidStateBrineCO2IC.C
  22. +21 −4 modules/porous_flow/src/ics/{PorousFlowFluidStateICBase.C → PorousFlowFluidStateIC.C}
  23. +5 −18 modules/porous_flow/src/ics/PorousFlowFluidStateWaterNCGIC.C
  24. +123 −17 modules/porous_flow/src/materials/{PorousFlowFluidStateFlashBase.C → PorousFlowFluidState.C}
  25. +5 −117 modules/porous_flow/src/materials/PorousFlowFluidStateBrineCO2.C
  26. +5 −16 modules/porous_flow/src/materials/PorousFlowFluidStateWaterNCG.C
  27. +6 −6 modules/porous_flow/src/userobjects/PorousFlowBrineCO2.C
  28. +3 −1 modules/porous_flow/src/userobjects/PorousFlowFluidStateBase.C
  29. +8 −5 modules/porous_flow/src/userobjects/PorousFlowWaterNCG.C
  30. +1 −1 modules/porous_flow/test/tests/fluidstate/brineco2.i
  31. +1 −1 modules/porous_flow/test/tests/fluidstate/brineco2_2.i
  32. +1 −1 modules/porous_flow/test/tests/fluidstate/brineco2_hightemp.i
  33. +3 −3 modules/porous_flow/test/tests/fluidstate/brineco2_ic.i
  34. +33 −0 modules/porous_flow/test/tests/fluidstate/tests
  35. +1 −1 modules/porous_flow/test/tests/fluidstate/theis.i
  36. +2 −2 modules/porous_flow/test/tests/fluidstate/theis_brineco2.i
  37. +1 −1 modules/porous_flow/test/tests/fluidstate/theis_tabulated.i
  38. +2 −2 modules/porous_flow/test/tests/fluidstate/waterncg.i
  39. +3 −3 modules/porous_flow/test/tests/fluidstate/waterncg_ic.i
  40. +3 −3 modules/porous_flow/test/tests/jacobian/brineco2_gas.i
  41. +3 −3 modules/porous_flow/test/tests/jacobian/brineco2_liquid.i
  42. +3 −3 modules/porous_flow/test/tests/jacobian/brineco2_liquid_2.i
  43. +3 −3 modules/porous_flow/test/tests/jacobian/brineco2_twophase.i
  44. +3 −3 modules/porous_flow/test/tests/jacobian/brineco2_twophase_2.i
  45. +3 −3 modules/porous_flow/test/tests/jacobian/waterncg_gas.i
  46. +3 −3 modules/porous_flow/test/tests/jacobian/waterncg_liquid.i
  47. +3 −3 modules/porous_flow/test/tests/jacobian/waterncg_twophase.i
  48. +3 −1 unit/src/PorousFlowWaterNCGTest.C
@@ -138,10 +138,7 @@ thermophysical description of the model given pressure, temperature and salt mas
### Materials
The [`PorousFlowFluidStateBrineCO2`](/PorousFlowFluidStateBrineCO2.md)
Material provides all phase pressures, saturation, densities, viscosities etc, as well
as all mass fractions of all fluid components in all fluid phases in a single material
using the formulation provided in the [`PorousFlowBrineCO2`](/PorousFlowBrineCO2.md) UserObject.
The [`PorousFlowFluidState`](/PorousFlowFluidState.md) material provides all phase pressures, saturation, densities, viscosities etc, as well as all mass fractions of all fluid components in all fluid phases in a single material using the formulation provided in the [`PorousFlowBrineCO2`](/PorousFlowBrineCO2.md) UserObject.
!listing modules/porous_flow/test/tests/fluidstate/brineco2.i block=Materials/brineco2
@@ -150,7 +147,7 @@ using the formulation provided in the [`PorousFlowBrineCO2`](/PorousFlowBrineCO2
The nonlinear variable representing CO$_2$ is the total mass fraction of CO$_2$ summed over
all phases. In some cases, it may be preferred to provide an initial CO$_2$ saturation, rather
than total mass fraction. To allow an initial saturation to be specified, the
[`PorousFlowFluidStateBrineCO2IC`](/PorousFlowFluidStateBrineCO2IC.md) initial
[`PorousFlowFluidStateIC`](/PorousFlowFluidStateIC.md) initial
condition is provided. This initial condition calculates the total mass fraction of CO$_2$
summed over all phases for a given saturation.
@@ -114,10 +114,7 @@ Swapping NCG's is as simple as changing the `gas_fp` parameter in this UserObjec
### Materials
The [`PorousFlowFluidStateWaterNCG`](/PorousFlowFluidStateWaterNCG.md)
Material provides all phase pressures, saturation, densities, viscosities etc, as well
as all mass fractions of all fluid components in all fluid phases in a single material
using the formulation provided in the [`PorousFlowWaterNCG`](/PorousFlowWaterNCG.md) UserObject.
The [`PorousFlowFluidState`](/PorousFlowFluidState.md) material provides all phase pressures, saturation, densities, viscosities etc, as well as all mass fractions of all fluid components in all fluid phases in a single material using the formulation provided in the [`PorousFlowWaterNCG`](/PorousFlowWaterNCG.md) UserObject.
!listing modules/porous_flow/test/tests/fluidstate/theis.i block=Materials/waterncg
@@ -126,7 +123,7 @@ using the formulation provided in the [`PorousFlowWaterNCG`](/PorousFlowWaterNCG
The nonlinear variable representing NCG is the total mass fraction of NCG summed over
all phases. In some cases, it may be preferred to provide an initial NCG saturation, rather
than total mass fraction. To allow an initial saturation to be specified, the
[`PorousFlowFluidStateWaterNCGIC`](/PorousFlowFluidStateWaterNCGIC.md) initial
[`PorousFlowFluidStateIC`](/PorousFlowFluidStateIC.md) initial
condition is provided. This initial condition calculates the total mass fraction of NCG
summed over all phases for a given saturation.
@@ -2,6 +2,9 @@
!syntax description /ICs/PorousFlowFluidStateBrineCO2IC
!alert note
PorousFlowFluidStateBrineCO2IC is deprecated. Just use [PorousFlowFluidStateIC](/PorousFlowFluidStateIC.md)
!syntax parameters /ICs/PorousFlowFluidStateBrineCO2IC
!syntax inputs /ICs/PorousFlowFluidStateBrineCO2IC
@@ -0,0 +1,11 @@
# PorousFlowFluidStateIC
!syntax description /ICs/PorousFlowFluidStateIC
This initial condition provides a straightforward way to specify an initial gas saturation for models using the persistent variable fluid states that describe miscible multicomponent, multiphase flow.
!syntax parameters /ICs/PorousFlowFluidStateIC
!syntax inputs /ICs/PorousFlowFluidStateIC
!syntax children /ICs/PorousFlowFluidStateIC
@@ -2,6 +2,9 @@
!syntax description /ICs/PorousFlowFluidStateWaterNCGIC
!alert note
PorousFlowFluidStateWaterNCGIC is deprecated. Just use [PorousFlowFluidStateIC](/PorousFlowFluidStateIC.md)
!syntax parameters /ICs/PorousFlowFluidStateWaterNCGIC
!syntax inputs /ICs/PorousFlowFluidStateWaterNCGIC
@@ -0,0 +1,13 @@
# PorousFlowFluidState
!syntax description /Materials/PorousFlowFluidState
Material that provides all thermophysical properties of the system given a set
of nonlinear variables using the formulation provided by one of the fluid state
UserObjects.
!syntax parameters /Materials/PorousFlowFluidState
!syntax inputs /Materials/PorousFlowFluidState
!syntax children /Materials/PorousFlowFluidState
@@ -2,10 +2,8 @@
!syntax description /Materials/PorousFlowFluidStateBrineCO2
Material that provides all thermophysical properties of the system given a set
of nonlinear variables using the formulation provided by the [`PorousFlowBrineCO2`](/PorousFlowBrineCO2.md) UserObject.
For more details, see the documentation of the [brine and CO$_2$](brineco2.md) equation of state.
!alert note
PorousFlowFluidStateBrineCO2 is deprecated. Just use [PorousFlowFluidState](/PorousFlowFluidState.md)
!syntax parameters /Materials/PorousFlowFluidStateBrineCO2
@@ -2,6 +2,9 @@
!syntax description /Materials/PorousFlowFluidStateWaterNCG
!alert note
PorousFlowFluidStateBrineCO2 is deprecated. Just use [PorousFlowFluidState](/PorousFlowFluidState.md)
!syntax parameters /Materials/PorousFlowFluidStateWaterNCG
!syntax inputs /Materials/PorousFlowFluidStateWaterNCG
@@ -1,3 +1,4 @@
- /AuxVariables/InitialCondition/PorousFlowFluidStateIC
- /AuxVariables/InitialCondition/PorousFlowFluidStateBrineCO2IC
- /AuxVariables/InitialCondition/PorousFlowFluidStateWaterNCGIC
- /Functions/MovingPlanarFront
@@ -12,5 +13,6 @@
- /PorousFlowFullySaturated/PorousFlowFullySaturated
- /PorousFlowUnsaturated
- /PorousFlowUnsaturated/PorousFlowUnsaturated
- /Variables/InitialCondition/PorousFlowFluidStateIC
- /Variables/InitialCondition/PorousFlowFluidStateBrineCO2IC
- /Variables/InitialCondition/PorousFlowFluidStateWaterNCGIC
@@ -156,7 +156,7 @@
temperature = '45'
[]
[brineco2]
type = PorousFlowFluidStateBrineCO2
type = PorousFlowFluidState
gas_porepressure = 'pgas'
z = 'zi'
temperature_unit = Celsius
@@ -177,7 +177,7 @@
temperature = 45
[]
[brineco2]
type = PorousFlowFluidStateBrineCO2
type = PorousFlowFluidState
gas_porepressure = pgas
z = zi
temperature_unit = Celsius
@@ -10,7 +10,7 @@
#ifndef POROUSFLOWFLUIDSTATEBRINECO2IC_H
#define POROUSFLOWFLUIDSTATEBRINECO2IC_H
#include "PorousFlowFluidStateICBase.h"
#include "PorousFlowFluidStateIC.h"
class PorousFlowBrineCO2;
class PorousFlowFluidStateBrineCO2IC;
@@ -23,18 +23,10 @@ InputParameters validParams<PorousFlowFluidStateBrineCO2IC>();
* the total mass fraction of a component summed over all
* phases, z, for brine and CO2
*/
class PorousFlowFluidStateBrineCO2IC : public PorousFlowFluidStateICBase
class PorousFlowFluidStateBrineCO2IC : public PorousFlowFluidStateIC
{
public:
PorousFlowFluidStateBrineCO2IC(const InputParameters & parameters);
virtual Real value(const Point & p) override;
private:
/// NaCl mass fraction (kg/kg)
const VariableValue & _xnacl;
/// FluidState UserObject
const PorousFlowBrineCO2 & _fs_uo;
};
#endif // POROUSFLOWFLUIDSTATEBRINECO2IC_H
@@ -7,38 +7,45 @@
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#ifndef POROUSFLOWFLUIDSTATEICBASE_H
#define POROUSFLOWFLUIDSTATEICBASE_H
#ifndef POROUSFLOWFLUIDSTATEIC_H
#define POROUSFLOWFLUIDSTATEIC_H
#include "InitialCondition.h"
class PorousFlowDictator;
class PorousFlowFluidStateICBase;
class PorousFlowFluidStateIC;
class PorousFlowFluidStateBase;
template <>
InputParameters validParams<PorousFlowFluidStateICBase>();
InputParameters validParams<PorousFlowFluidStateIC>();
/**
* PorousFlowFluidStateIC calculates an initial value for
* the total mass fraction of a component summed over all
* phases, z.
*/
class PorousFlowFluidStateICBase : public InitialCondition
class PorousFlowFluidStateIC : public InitialCondition
{
public:
PorousFlowFluidStateICBase(const InputParameters & parameters);
PorousFlowFluidStateIC(const InputParameters & parameters);
virtual Real value(const Point & p) override;
protected:
/// Gas porepressure (Pa)
const VariableValue & _gas_porepressure;
/// Fluid temperature (C or K)
const VariableValue & _temperature;
/// NaCl mass fraction (kg/kg)
const VariableValue & _Xnacl;
/// Gas saturation (-)
const VariableValue & _saturation;
/// Conversion from degrees Celsius to degrees Kelvin
const Real _T_c2k;
/// The PorousFlowDictator UserObject
const PorousFlowDictator & _dictator;
/// FluidState UserObject
const PorousFlowFluidStateBase & _fs;
};
#endif // POROUSFLOWFLUIDSTATEICBASE_H
#endif // POROUSFLOWFLUIDSTATEIC_H
@@ -10,7 +10,7 @@
#ifndef POROUSFLOWFLUIDSTATEWATERNCGIC_H
#define POROUSFLOWFLUIDSTATEWATERNCGIC_H
#include "PorousFlowFluidStateICBase.h"
#include "PorousFlowFluidStateIC.h"
class PorousFlowWaterNCG;
class PorousFlowFluidStateWaterNCGIC;
@@ -23,16 +23,10 @@ InputParameters validParams<PorousFlowFluidStateWaterNCGIC>();
* the total mass fraction of a component summed over all
* phases, z, for water and non-condensable gas
*/
class PorousFlowFluidStateWaterNCGIC : public PorousFlowFluidStateICBase
class PorousFlowFluidStateWaterNCGIC : public PorousFlowFluidStateIC
{
public:
PorousFlowFluidStateWaterNCGIC(const InputParameters & parameters);
virtual Real value(const Point & p) override;
private:
/// FluidState UserObject
const PorousFlowWaterNCG & _fs_uo;
};
#endif // POROUSFLOWFLUIDSTATEWATERNCGIC_H
@@ -7,20 +7,20 @@
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#ifndef POROUSFLOWFLUIDSTATEFLASHBASE_H
#define POROUSFLOWFLUIDSTATEFLASHBASE_H
#ifndef POROUSFLOWFLUIDSTATE_H
#define POROUSFLOWFLUIDSTATE_H
#include "PorousFlowVariableBase.h"
#include "PorousFlowFluidStateBase.h"
class PorousFlowFluidStateFlashBase;
class PorousFlowFluidState;
class PorousFlowCapillaryPressure;
template <>
InputParameters validParams<PorousFlowFluidStateFlashBase>();
InputParameters validParams<PorousFlowFluidState>();
/**
* Base class for fluid states using a persistent set of primary variables for
* Fluid state class using a persistent set of primary variables for
* the mutliphase, multicomponent case.
*
* Primary variables are: gas pressure, total mass fraction
@@ -48,10 +48,10 @@ InputParameters validParams<PorousFlowFluidStateFlashBase>();
* to determine vapor fraction (gas saturation), and subsequently the composition
* of each phase.
*/
class PorousFlowFluidStateFlashBase : public PorousFlowVariableBase
class PorousFlowFluidState : public PorousFlowVariableBase
{
public:
PorousFlowFluidStateFlashBase(const InputParameters & parameters);
PorousFlowFluidState(const InputParameters & parameters);
protected:
virtual void initQpStatefulProperties() override;
@@ -64,7 +64,7 @@ class PorousFlowFluidStateFlashBase : public PorousFlowVariableBase
* Calculates all required thermophysical properties and derivatives for each phase
* and fluid component. Must override in all derived classes.
*/
virtual void thermophysicalProperties() = 0;
virtual void thermophysicalProperties();
/// Porepressure
const VariableValue & _gas_porepressure;
@@ -84,8 +84,16 @@ class PorousFlowFluidStateFlashBase : public PorousFlowVariableBase
std::vector<unsigned int> _Zvar;
/// Number of coupled total mass fractions. Should be _num_phases - 1
const unsigned int _num_Z_vars;
/// Salt mass fraction (kg/kg)
const VariableValue & _Xnacl;
/// Gradient of salt mass fraction (only defined at the qps)
const VariableGradient & _grad_Xnacl_qp;
/// Salt mass fraction variable number
const unsigned int _Xnacl_varnum;
/// Salt mass fraction PorousFlow variable number
const unsigned int _Xvar;
/// FluidState UserObject
const PorousFlowFluidStateBase & _fs_base;
const PorousFlowFluidStateBase & _fs;
/// Phase number of the aqueous phase
const unsigned int _aqueous_phase_number;
/// Phase number of the gas phase
@@ -94,6 +102,8 @@ class PorousFlowFluidStateFlashBase : public PorousFlowVariableBase
const unsigned int _aqueous_fluid_component;
/// Fluid component number of the gas phase
const unsigned int _gas_fluid_component;
/// Salt component index
const unsigned int _salt_component;
/// Temperature
const MaterialProperty<Real> & _temperature;
/// Gradient of temperature (only defined at the qps)
@@ -129,7 +139,7 @@ class PorousFlowFluidStateFlashBase : public PorousFlowVariableBase
/// FluidStateProperties data structure
std::vector<FluidStateProperties> _fsp;
/// Capillary pressure UserObject
const PorousFlowCapillaryPressure & _pc_uo;
const PorousFlowCapillaryPressure & _pc;
};
#endif // POROUSFLOWFLUIDSTATEFLASHBASE_H
#endif // POROUSFLOWFLUIDSTATE_H
@@ -10,9 +10,8 @@
#ifndef POROUSFLOWFLUIDSTATEBRINECO2_H
#define POROUSFLOWFLUIDSTATEBRINECO2_H
#include "PorousFlowFluidStateFlashBase.h"
#include "PorousFlowFluidState.h"
class PorousFlowBrineCO2;
class PorousFlowFluidStateBrineCO2;
template <>
@@ -28,27 +27,12 @@ InputParameters validParams<PorousFlowFluidStateBrineCO2>();
* Partitioning in chloride brine at 12-100C and up to 600 bar, Geochimica et
* Cosmochimica Acta, 69, 3309-3320 (2005)
*/
class PorousFlowFluidStateBrineCO2 : public PorousFlowFluidStateFlashBase
class PorousFlowFluidStateBrineCO2 : public PorousFlowFluidState
{
public:
PorousFlowFluidStateBrineCO2(const InputParameters & parameters);
protected:
virtual void computeQpProperties() override;
virtual void thermophysicalProperties() override;
/// Salt mass fraction (kg/kg)
const VariableValue & _Xnacl;
/// Gradient of salt mass fraction (only defined at the qps)
const VariableGradient & _grad_Xnacl_qp;
/// Salt mass fraction variable number
const unsigned int _Xnacl_varnum;
/// Salt mass fraction PorousFlow variable number
const unsigned int _Xvar;
/// FluidState UserObject
const PorousFlowBrineCO2 & _fs_uo;
/// Salt component index
const unsigned int _salt_component;
};
#endif // POROUSFLOWFLUIDSTATEBRINECO2_H
Oops, something went wrong.

0 comments on commit 92ef937

Please sign in to comment.