Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions inputFiles/singlePhaseFlow/thermalSinglePhaseFlow.ats
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ decks = [
restart_step=0,
check_step=1,
restartcheck_params=RestartcheckParameters(**restartcheck_params)),
TestDeck(
name="thermalViscosity_1d",
description='Thermal problem with temperature dependent viscosity',
partitions=((1, 1, 1)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
partitions=((1, 1, 1)),
partitions=((1, 1, 1),),

restart_step=1,
check_step=1,
restartcheck_params=RestartcheckParameters(**restartcheck_params)),
]

generate_geos_tests(decks)
183 changes: 183 additions & 0 deletions inputFiles/singlePhaseFlow/thermalViscosity_1d.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?xml version="1.0" ?>

<Problem>
<Solvers>
<SinglePhaseFVM
name="singleFlow"
logLevel="1"
discretization="tpfaFlow"
temperature="0"
isThermal="1"
targetRegions="{ region }">
<NonlinearSolverParameters
newtonTol="1.0e-6"
newtonMaxIter="100"/>
<LinearSolverParameters
directParallel="0"/>
</SinglePhaseFVM>
</Solvers>

<NumericalMethods>
<FiniteVolume>
<TwoPointFluxApproximation
name="tpfaFlow"/>
</FiniteVolume>
</NumericalMethods>

<Mesh>
<InternalMesh
name="mesh"
elementTypes="{ C3D8 }"
xCoords="{ 0, 20 }"
yCoords="{ 0, 1 }"
zCoords="{ 0, 1 }"
nx="{ 20 }"
ny="{ 1 }"
nz="{ 1 }"
cellBlockNames="{ region }">
</InternalMesh>
</Mesh>

<ElementRegions>
<CellElementRegion
name="region"
cellBlocks="{ region }"
materialList="{ rock, fluid, thermalCond }"/>
</ElementRegions>

<Constitutive>

<CompressibleSolidConstantPermeability
name="rock"
solidModelName="nullSolid"
porosityModelName="rockPorosity"
permeabilityModelName="rockPerm"
solidInternalEnergyModelName="rockInternalEnergy" />

<NullModel
name="nullSolid"/>

<PressurePorosity
name="rockPorosity"
defaultReferencePorosity="0.1"
referencePressure="0.0"
compressibility="3.0e-11"/>

<!-- SPHINX_SolidInternalEnergy_linear -->
<SolidInternalEnergy
name="rockInternalEnergy"
referenceVolumetricHeatCapacity="1.0e6"
referenceTemperature="0"
referenceInternalEnergy="0"/>
<!-- SPHINX_SolidInternalEnergy_linearEnd -->

<ConstantPermeability
name="rockPerm"
permeabilityComponents="{ 1.0e-18, 1.0e-18, 1.0e-18 }"/>

<!-- SPHINX_ThermalCompressibleSinglePhaseFluid -->
<ThermalCompressibleSinglePhaseFluid
name="fluid"
defaultDensity="1000"
defaultViscosity="0.001"
referencePressure="0.0"
referenceTemperature="293.15"
compressibility="5e-10"
thermalExpansionCoeff="3e-4"
viscosibility="0.0"
viscosityExpansivity="6.21e-4"
specificHeatCapacity="1"
referenceInternalEnergy="0.99"/>
<!-- SPHINX_ThermalCompressibleSinglePhaseFluidEnd -->

<!-- SPHINX_SinglePhaseThermalConductivity_linear -->
<SinglePhaseThermalConductivity
name="thermalCond"
defaultThermalConductivityComponents="{ 1.66, 1.66, 1.66 }"
thermalConductivityGradientComponents="{ 0, 0, 0 }"
referenceTemperature="293.15" />
<!-- SPHINX_SinglePhaseThermalConductivity_linearEnd -->
</Constitutive>

<FieldSpecifications>

<!-- SPHINX_FieldSpecificationImposedPressure -->
<FieldSpecification
name="initialPressure"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="pressure"
scale="0e6"/>

<FieldSpecification
name="sinkPressure"
setNames="{ xpos }"
objectPath="faceManager"
fieldName="pressure"
scale="1e6"/>

<FieldSpecification
name="sourcePressure"
setNames="{ xneg }"
objectPath="faceManager"
fieldName="pressure"
scale="-1e6"/>
<!-- SPHINX_FieldSpecificationImposedPressureEnd -->

<!-- SPHINX_FieldSpecificationImposedTemperature -->
<FieldSpecification
name="initialTemperature"
initialCondition="1"
setNames="{ all }"
objectPath="ElementRegions/region"
fieldName="temperature"
scale="373.15"/>

<FieldSpecification
name="sinkTemperature"
setNames="{ xpos }"
objectPath="faceManager"
fieldName="temperature"
scale="373.15"/>

<FieldSpecification
name="sourceTemperature"
setNames="{ xneg }"
objectPath="faceManager"
fieldName="temperature"
scale="293.15"/>
<!-- SPHINX_FieldSpecificationImposedTemperatureEnd -->

</FieldSpecifications>

<Outputs>
<VTK
name="vtkOutput"/>

<Restart
name="restartOutput"/>
</Outputs>

<Events
maxTime="8640000">

<PeriodicEvent
name="outputs"
cycleFrequency="5"
target="/Outputs/vtkOutput"/>

<PeriodicEvent
name="solverApplications"
beginTime="0"
maxEventDt="864000"
target="/Solvers/singleFlow"/>

<PeriodicEvent
name="restarts"
cycleFrequency="5"
target="/Outputs/restartOutput"/>

</Events>

</Problem>
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,46 @@ Overview

This model represents a compressible single-phase fluid with constant compressibility
and pressure-dependent viscosity.
For thermal simulations, the model density and viscosity have a temperature dependency
expressed as a constant thermal expansion coefficient.
Comment on lines +12 to +13
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For thermal simulations, the model density and viscosity have a temperature dependency
expressed as a constant thermal expansion coefficient.
For thermal simulations, fluid density and viscosity are temperature-dependent, governed by a constant thermal expansion coefficient.

These assumptions are valid for slightly compressible fluids, such as water, and some
types of oil with negligible amounts of dissolved gas.

Specifically, fluid density is computed as

.. math::
\rho(p) = \rho_0 ( e^{c_\rho(p - p_0)} + e^{\beta_f (T - T_0)} )
\rho(p) = \rho_0 e^{c_\rho(p - p_0)}

where :math:`c_\rho` is compressibility, :math:`p_0` is reference pressure, :math:`\rho_0` is
density at reference pressure, :math:`\beta_f` is the fluid thermal expansion coefficient, :math:`T_0` is reference temperature.
for isothermal cases and,

.. math::
\rho(p,T) = \rho_0 e^{c_\rho(p - p_0)} e^{-\beta_\rho (T - T_0)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\rho(p,T) = \rho_0 e^{c_\rho(p - p_0)} e^{-\beta_\rho (T - T_0)}
\rho(p,T) = \rho_0 e^{c_\rho(p - p_0)} e^{ - \beta_\rho (T - T_0)}


for thermal cases.

where :math:`c_\rho` is compressibility, :math:`p_0` is reference pressure, :math:`\rho_0` is the
density at the reference pressure, :math:`\beta_\rho` is the fluid thermal expansion coefficient,
:math:`T_0` is reference temperature.

Similarly,

.. math::
\mu(p) = \mu_0 e^{c_\mu(p - p_0)}

where :math:`c_\mu` is viscosibility (viscosity compressibility), :math:`\mu_0` is reference viscosity.
for isothermal cases and,

Either exponent may be approximated by linear (default) or quadratic terms of Taylor series expansion.
Currently there is no temperature dependence in the model, although it may be added in future.
.. math::
\mu(p,T) = \mu_0 e^{c_\mu(p - p_0)} e^{-\beta_\mu (T - T_0)}

for thermal cases.

where :math:`c_\mu` is viscosibility (viscosity compressibility), :math:`\mu_0` is reference viscosity,
:math:`\beta_\rho` is the fluid viscosity thermal coefficient.

Parameters
=========================

The model is represented by ``<CompressibleSinglePhaseFluid>`` node in the input.
For the isothermal case, the model is represented by ``<CompressibleSinglePhaseFluid>`` node in the input.

The following attributes are supported:

Expand All @@ -51,4 +66,29 @@ Example
compressibility="1e-19"
referenceViscosity="0.001"
viscosibility="0.0"/>
</Constitutive>
</Constitutive>

For the thermal case, the model is represented by ``<ThermalCompressibleSinglePhaseFluid>`` node in the input.

The following attributes are supported:

.. include:: /docs/sphinx/datastructure/ThermalCompressibleSinglePhaseFluid.rst

Example
=========================

.. code-block:: xml

<Constitutive>
<ThermalCompressibleSinglePhaseFluid name="fluid"
defaultDensity="1000"
defaultViscosity="0.001"
referencePressure="0.0"
referenceTemperature="0"
compressibility="5e-10"
thermalExpansionCoeff="3e-4"
viscosibility="0.0"
viscosityExpansivity="6.21e-4"
specificHeatCapacity="1"
referenceInternalEnergy="0.99" />
</Constitutive>
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ namespace constitutive
ThermalCompressibleSinglePhaseFluid::ThermalCompressibleSinglePhaseFluid( string const & name, Group * const parent ):
CompressibleSinglePhaseFluid( name, parent )
{
m_numDOF=2;
m_numDOF = 2;

registerWrapper( viewKeyStruct::thermalExpansionCoeffString(), &m_thermalExpansionCoeff ).
setApplyDefaultValue( 0.0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Fluid thermal expansion coefficient. Unit: 1/K" );

registerWrapper( viewKeyStruct::viscosityExpansivityString(), &m_viscosityExpansivity ).
setApplyDefaultValue( 0.0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Fluid viscosity thermal expansion coefficient at the reference temperature. Unit: 1/K" );

registerWrapper( viewKeyStruct::specificHeatCapacityString(), &m_specificHeatCapacity ).
setApplyDefaultValue( 0.0 ).
setInputFlag( InputFlags::OPTIONAL ).
Expand Down Expand Up @@ -80,6 +86,7 @@ void ThermalCompressibleSinglePhaseFluid::postInputInitialization()
};

checkNonnegative( m_thermalExpansionCoeff, viewKeyStruct::thermalExpansionCoeffString() );
checkNonnegative( m_viscosityExpansivity, viewKeyStruct::viscosityExpansivityString() );
checkNonnegative( m_specificHeatCapacity, viewKeyStruct::specificHeatCapacityString() );
checkNonnegative( m_referenceInternalEnergy, viewKeyStruct::referenceInternalEnergyString() );

Expand All @@ -98,7 +105,7 @@ ThermalCompressibleSinglePhaseFluid::KernelWrapper
ThermalCompressibleSinglePhaseFluid::createKernelWrapper()
{
return KernelWrapper( KernelWrapper::DensRelationType( m_referencePressure, m_referenceTemperature, m_referenceDensity, m_compressibility, -m_thermalExpansionCoeff ),
KernelWrapper::ViscRelationType( m_referencePressure, m_referenceViscosity, m_viscosibility ),
KernelWrapper::ViscRelationType( m_referencePressure, m_referenceTemperature, m_referenceViscosity, m_viscosibility, -m_viscosityExpansivity ),
KernelWrapper::IntEnergyRelationType( m_referenceTemperature, m_referenceInternalEnergy, m_specificHeatCapacity/m_referenceInternalEnergy ),
m_density.value,
m_density.derivs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ThermalCompressibleSinglePhaseUpdate : public SingleFluidBaseUpdate
public:

using DensRelationType = ExponentialRelation< real64, DENS_EAT, 3 >;
using ViscRelationType = ExponentialRelation< real64, VISC_EAT >;
using ViscRelationType = ExponentialRelation< real64, VISC_EAT, 3 >;
using IntEnergyRelationType = ExponentialRelation< real64, INTENERGY_EAT >;
using DerivOffset = constitutive::singlefluid::DerivativeOffsetC< 1 >;

Expand Down Expand Up @@ -114,19 +114,17 @@ class ThermalCompressibleSinglePhaseUpdate : public SingleFluidBaseUpdate
real64 & dEnthalpy_dPressure,
real64 & dEnthalpy_dTemperature ) const override
{
m_viscRelation.compute( pressure, viscosity, dViscosity_dPressure );
dViscosity_dTemperature = 0.0;

m_densRelation.compute( pressure, temperature, density, dDensity_dPressure, dDensity_dTemperature );

m_viscRelation.compute( pressure, temperature, viscosity, dViscosity_dPressure, dViscosity_dTemperature );

/// Compute the internal energy (only sensitive to temperature)
m_intEnergyRelation.compute( temperature, internalEnergy, dInternalEnergy_dTemperature );
dInternalEnergy_dPressure = 0.0;

enthalpy = internalEnergy - m_refIntEnergy;
dEnthalpy_dPressure = 0.0;
dEnthalpy_dTemperature = dInternalEnergy_dTemperature;

}

GEOS_HOST_DEVICE
Expand Down Expand Up @@ -240,6 +238,7 @@ class ThermalCompressibleSinglePhaseFluid : public CompressibleSinglePhaseFluid
struct viewKeyStruct : public CompressibleSinglePhaseFluid::viewKeyStruct
{
static constexpr char const * thermalExpansionCoeffString() { return "thermalExpansionCoeff"; }
static constexpr char const * viscosityExpansivityString() { return "viscosityExpansivity"; }
static constexpr char const * specificHeatCapacityString() { return "specificHeatCapacity"; }
static constexpr char const * referenceTemperatureString() { return "referenceTemperature"; }
static constexpr char const * referenceInternalEnergyString() { return "referenceInternalEnergy"; }
Expand All @@ -255,6 +254,9 @@ class ThermalCompressibleSinglePhaseFluid : public CompressibleSinglePhaseFluid
/// scalar fluid thermal expansion coefficient
real64 m_thermalExpansionCoeff;

/// scalar fluid viscosity thermal expansion coefficient
real64 m_viscosityExpansivity;

/// scalar fluid volumetric heat capacity coefficient
real64 m_specificHeatCapacity;

Expand Down
4 changes: 4 additions & 0 deletions src/coreComponents/schema/schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -8616,6 +8616,8 @@ If you want to do a three-phase simulation, please use instead wettingIntermedia
<xsd:attribute name="thermalExpansionCoeff" type="real64" default="0" />
<!--viscosibility => Fluid viscosity exponential coefficient-->
<xsd:attribute name="viscosibility" type="real64" default="0" />
<!--viscosityExpansivity => Fluid viscosity thermal expansion coefficient at the reference temperature. Unit: 1/K-->
<xsd:attribute name="viscosityExpansivity" type="real64" default="0" />
<!--viscosityModelType => Type of viscosity model. Valid options:
* exponential
* linear
Expand Down Expand Up @@ -8774,6 +8776,8 @@ To neglect hysteresis on this phase, just use the same table name for the draina
<xsd:attribute name="thermalExpansionCoeff" type="real64" default="0" />
<!--viscosibility => Fluid viscosity exponential coefficient-->
<xsd:attribute name="viscosibility" type="real64" default="0" />
<!--viscosityExpansivity => Fluid viscosity thermal expansion coefficient at the reference temperature. Unit: 1/K-->
<xsd:attribute name="viscosityExpansivity" type="real64" default="0" />
<!--viscosityModelType => Type of viscosity model. Valid options:
* exponential
* linear
Expand Down
Loading