Skip to content

Commit ddd7cb9

Browse files
CusiniMyue-2018Francois Hamon
authored
Add energy balance equation to Compositional solver. (#1225)
* Initial commit * thermalKernels * Assembly up to accumulation is done. * Added all views. Modified input for FluxKernels. * done kernels and solver. * FluidModels: added enthalpy and internalEnergy * Enthalpy and Internal energy functions * dummy functions and derivatives for enthalpy and internalEnergy. * fixed comp errors for const. model. * Fixed some errors. * missing only intEnergy for solid material. * down to 1 linking error. * Finally builds. * bug fix. * xml file * added CO2 and brine enthalpy functions * Post merge fixes. Mainly fixing the strings. * removed old files not compiled * additional fix * added thermal accumulation and volume balance in the new style * Merge branch 'develop' into feature/addEnergyBalance * implemented thermal flux kernel in the new style * some cleanup in the kernels * added conduction term * implemented temperature BC * removed unused variable * various fixes * first working version * added integrated test; made ready for review * passing unit test for thermal compositional * start addressing Matteo's comments * passing all integrated tests * removed enum string in CO2-brine fluid * addressed Sergey's comments Co-authored-by: Yue Hao <hao1@llnl.gov> Co-authored-by: Francois Hamon <francois.hamon@totalenergies.com>
1 parent c478839 commit ddd7cb9

82 files changed

Lines changed: 3381 additions & 1001 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
<?xml version="1.0" ?>
2+
3+
<Problem>
4+
<Solvers>
5+
<CompositionalMultiphaseFVM
6+
name="compflow"
7+
logLevel="1"
8+
discretization="fluidTPFA"
9+
temperature="368.15"
10+
useMass="1"
11+
isThermal="1"
12+
initialDt="1e3"
13+
maxCompFractionChange="0.5"
14+
targetRegions="{ region }">
15+
<NonlinearSolverParameters
16+
newtonTol="1.0e-6"
17+
newtonMaxIter="100"
18+
lineSearchAction="None"
19+
maxTimeStepCuts="5"/>
20+
<LinearSolverParameters
21+
directParallel="0"/>
22+
</CompositionalMultiphaseFVM>
23+
</Solvers>
24+
25+
<Mesh>
26+
<InternalMesh
27+
name="mesh1"
28+
elementTypes="{ C3D8 }"
29+
xCoords="{ 0, 100 }"
30+
yCoords="{ 0, 100 }"
31+
zCoords="{ 0, 1 }"
32+
nx="{ 10 }"
33+
ny="{ 10 }"
34+
nz="{ 1 }"
35+
cellBlockNames="{ cb }"/>
36+
</Mesh>
37+
38+
<Geometry>
39+
<Box
40+
name="sink"
41+
xMin="{ 89.99, 89.99, -0.01 }"
42+
xMax="{ 101.01, 101.01, 1.01 }"/>
43+
44+
<Box
45+
name="source"
46+
xMin="{ -0.01, -0.01, -0.01 }"
47+
xMax="{ 10.01, 10.01, 1.01 }"/>
48+
</Geometry>
49+
50+
<Events
51+
maxTime="1.5e5">
52+
<PeriodicEvent
53+
name="outputs"
54+
timeFrequency="2.5e4"
55+
target="/Outputs/vtkOutput"/>
56+
57+
<PeriodicEvent
58+
name="solverApplications"
59+
maxEventDt="2.5e4"
60+
target="/Solvers/compflow"/>
61+
62+
<PeriodicEvent
63+
name="restarts"
64+
timeFrequency="7.5e4"
65+
target="/Outputs/sidreRestart"/>
66+
</Events>
67+
68+
<NumericalMethods>
69+
<FiniteVolume>
70+
<TwoPointFluxApproximation
71+
name="fluidTPFA"/>
72+
</FiniteVolume>
73+
</NumericalMethods>
74+
75+
<ElementRegions>
76+
<CellElementRegion
77+
name="region"
78+
cellBlocks="{ cb }"
79+
materialList="{ fluid, rock, relperm, thermalCond }"/>
80+
</ElementRegions>
81+
82+
<Constitutive>
83+
84+
<CompressibleSolidConstantPermeability
85+
name="rock"
86+
solidModelName="nullSolid"
87+
porosityModelName="rockPorosity"
88+
permeabilityModelName="rockPerm"
89+
solidInternalEnergyModelName="rockInternalEnergy"/>
90+
<NullModel
91+
name="nullSolid"/>
92+
<PressurePorosity
93+
name="rockPorosity"
94+
defaultReferencePorosity="0.2"
95+
referencePressure="0.0"
96+
compressibility="1.0e-9"/>
97+
<SolidInternalEnergy
98+
name="rockInternalEnergy"
99+
volumetricHeatCapacity="1.95e6"
100+
referenceTemperature="368.15"
101+
referenceInternalEnergy="0"/>
102+
<ConstantPermeability
103+
name="rockPerm"
104+
permeabilityComponents="{ 1.0e-13, 1.0e-13, 1.0e-13 }"/>
105+
106+
<CO2BrinePhillipsThermalFluid
107+
name="fluid"
108+
phaseNames="{ gas, water }"
109+
componentNames="{ co2, water }"
110+
componentMolarWeight="{ 44e-3, 18e-3 }"
111+
phasePVTParaFiles="{ pvtgas.txt, pvtliquid.txt }"
112+
flashModelParaFile="co2flash.txt"/>
113+
114+
<BrooksCoreyRelativePermeability
115+
name="relperm"
116+
phaseNames="{ gas, water }"
117+
phaseMinVolumeFraction="{ 0.0, 0.0 }"
118+
phaseRelPermExponent="{ 1.5, 1.5 }"
119+
phaseRelPermMaxValue="{ 0.9, 0.9 }"/>
120+
121+
<ConstantThermalConductivity
122+
name="thermalCond"
123+
phaseNames="{ gas, water }"
124+
thermalConductivityComponents="{ 0.6, 0.6, 0.6 }"/>
125+
126+
</Constitutive>
127+
128+
<FieldSpecifications>
129+
130+
<FieldSpecification
131+
name="initialPressure"
132+
initialCondition="1"
133+
setNames="{ all }"
134+
objectPath="ElementRegions/region/cb"
135+
fieldName="pressure"
136+
scale="9e6"/>
137+
<FieldSpecification
138+
name="initialTemperature"
139+
initialCondition="1"
140+
setNames="{ all }"
141+
objectPath="ElementRegions/region/cb"
142+
fieldName="temperature"
143+
scale="368.15"/>
144+
<FieldSpecification
145+
name="initialComposition_co2"
146+
initialCondition="1"
147+
setNames="{ all }"
148+
objectPath="ElementRegions/region/cb"
149+
fieldName="globalCompFraction"
150+
component="0"
151+
scale="0.005"/>
152+
<FieldSpecification
153+
name="initialComposition_water"
154+
initialCondition="1"
155+
setNames="{ all }"
156+
objectPath="ElementRegions/region/cb"
157+
fieldName="globalCompFraction"
158+
component="1"
159+
scale="0.995"/>
160+
161+
<FieldSpecification
162+
name="sinkPressure"
163+
setNames="{ sink }"
164+
objectPath="ElementRegions/region/cb"
165+
fieldName="pressure"
166+
scale="7e6"/>
167+
<FieldSpecification
168+
name="sinkTemperature"
169+
setNames="{ sink }"
170+
objectPath="ElementRegions/region/cb"
171+
fieldName="temperature"
172+
scale="368.15"/>
173+
<FieldSpecification
174+
name="sinkTermComposition_co2"
175+
setNames="{ sink }"
176+
objectPath="ElementRegions/region/cb"
177+
fieldName="globalCompFraction"
178+
component="0"
179+
scale="0.005"/>
180+
<FieldSpecification
181+
name="sinkTermComposition_water"
182+
setNames="{ sink }"
183+
objectPath="ElementRegions/region/cb"
184+
fieldName="globalCompFraction"
185+
component="1"
186+
scale="0.995"/>
187+
188+
<FieldSpecification
189+
name="sourcePressure"
190+
setNames="{ source }"
191+
objectPath="ElementRegions/region/cb"
192+
fieldName="pressure"
193+
scale="1.45e7"/>
194+
<FieldSpecification
195+
name="sourceTemperature"
196+
setNames="{ source }"
197+
objectPath="ElementRegions/region/cb"
198+
fieldName="temperature"
199+
scale="300.15"/>
200+
<FieldSpecification
201+
name="sourceTermComposition_co2"
202+
setNames="{ source }"
203+
objectPath="ElementRegions/region/cb"
204+
fieldName="globalCompFraction"
205+
component="0"
206+
scale="0.995"/>
207+
<FieldSpecification
208+
name="sourceTermComposition_water"
209+
setNames="{ source }"
210+
objectPath="ElementRegions/region/cb"
211+
fieldName="globalCompFraction"
212+
component="1"
213+
scale="0.005"/>
214+
</FieldSpecifications>
215+
216+
<Outputs>
217+
<VTK
218+
name="vtkOutput"/>
219+
220+
<Restart
221+
name="sidreRestart"/>
222+
</Outputs>
223+
</Problem>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FlashModel CO2Solubility 1e6 7.5e7 5e5 299.15 369.15 10 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DensityFun SpanWagnerCO2Density 1e6 7.5e7 5e5 299.15 369.15 10
2+
ViscosityFun FenghourCO2Viscosity 1e6 7.5e7 5e5 299.15 369.15 10
3+
EnthalpyFun CO2Enthalpy 1e6 7.5e7 5e5 299.15 369.15 10
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DensityFun PhillipsBrineDensity 1e6 7.5e7 5e5 299.15 369.15 10 0
2+
ViscosityFun PhillipsBrineViscosity 0
3+
EnthalpyFun BrineEnthalpy 1e6 7.5e7 5e5 299.15 369.15 10 0

integratedTests

src/coreComponents/constitutive/fluid/CO2BrineFluid.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
185185
{
186186
string_array const strs = stringutilities::tokenize( str, " " );
187187

188-
if( strs[0] == toString( SubModelInputNames::DENSITY ) )
188+
if( strs[0] == "DensityFun" )
189189
{
190190
if( strs[1] == PHASE1::Density::catalogName() )
191191
{
@@ -196,7 +196,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
196196
phase2InputParams[PHASE2::InputParamOrder::DENSITY] = strs;
197197
}
198198
}
199-
else if( strs[0] == toString( SubModelInputNames::VISCOSITY ) )
199+
else if( strs[0] == "ViscosityFun" )
200200
{
201201
if( strs[1] == PHASE1::Viscosity::catalogName() )
202202
{
@@ -207,7 +207,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
207207
phase2InputParams[PHASE2::InputParamOrder::VISCOSITY] = strs;
208208
}
209209
}
210-
else if( strs[0] == toString( SubModelInputNames::ENTHALPY ) )
210+
else if( strs[0] == "EnthalpyFun" )
211211
{
212212
if( strs[1] == PHASE1::Enthalpy::catalogName() )
213213
{

src/coreComponents/constitutive/fluid/CO2BrineFluid.hpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -569,25 +569,6 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::KernelWrapper::
569569
m_totalDensity( k, q ) );
570570
}
571571

572-
/// Declare strings associated with enumeration values
573-
/// Needed for now, because we don't use the catalogNames for input (yet)
574-
ENUM_STRINGS( CO2BrinePhillipsFluid::SubModelInputNames,
575-
"DensityFun",
576-
"ViscosityFun",
577-
"EnthalpyFun" );
578-
ENUM_STRINGS( CO2BrinePhillipsThermalFluid::SubModelInputNames,
579-
"DensityFun",
580-
"ViscosityFun",
581-
"EnthalpyFun" );
582-
ENUM_STRINGS( CO2BrineEzrokhiFluid::SubModelInputNames,
583-
"DensityFun",
584-
"ViscosityFun",
585-
"EnthalpyFun" );
586-
ENUM_STRINGS( CO2BrineEzrokhiThermalFluid::SubModelInputNames,
587-
"DensityFun",
588-
"ViscosityFun",
589-
"EnthalpyFun" );
590-
591572

592573
} // namespace constitutive
593574

src/coreComponents/constitutive/fluid/MultiFluidExtrinsicData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ EXTRINSIC_MESH_DATA_TRAIT( dPhaseInternalEnergy,
156156
0,
157157
NOPLOT,
158158
NO_WRITE,
159-
"Derivative of phase internal energy with respect to pressure, temperature, and global component fraction" );
159+
"Derivative of phase internal energy with respect to pressure, temperature, and global component fractions" );
160160

161161
EXTRINSIC_MESH_DATA_TRAIT( phaseCompFraction,
162162
"phaseCompFraction",

src/coreComponents/constitutive/fluid/multiFluidSelector.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ void constitutiveUpdatePassThru( MultiFluidBase const & fluid,
4444
CompositionalMultiphaseFluid,
4545
#endif
4646
CO2BrinePhillipsFluid,
47-
CO2BrineEzrokhiFluid >::execute( fluid, std::forward< LAMBDA >( lambda ) );
47+
CO2BrineEzrokhiFluid,
48+
CO2BrinePhillipsThermalFluid /*, // if I uncomment the two models at the same time, the compiler segfaults on
49+
Lassen!
50+
CO2BrineEzrokhiThermalFluid*/>::execute( fluid, std::forward< LAMBDA >( lambda ) );
4851
}
4952

5053
template< typename LAMBDA >
@@ -57,7 +60,10 @@ void constitutiveUpdatePassThru( MultiFluidBase & fluid,
5760
CompositionalMultiphaseFluid,
5861
#endif
5962
CO2BrinePhillipsFluid,
60-
CO2BrineEzrokhiFluid >::execute( fluid, std::forward< LAMBDA >( lambda ) );
63+
CO2BrineEzrokhiFluid,
64+
CO2BrinePhillipsThermalFluid /*, // if I uncomment the two models at the same time, the compiler segfaults on
65+
Lassen!
66+
CO2BrineEzrokhiThermalFluid*/>::execute( fluid, std::forward< LAMBDA >( lambda ) );
6167
}
6268

6369
} // namespace constitutive

src/coreComponents/constitutive/solid/SolidInternalEnergy.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,34 @@ SolidInternalEnergy::SolidInternalEnergy( string const & name, Group * const par
3030
ConstitutiveBase( name, parent ),
3131
m_internalEnergy(),
3232
m_dInternalEnergy_dTemperature(),
33-
m_specificHeatCapacity(),
33+
m_volumetricHeatCapacity(),
3434
m_referenceTemperature(),
3535
m_referenceInternalEnergy()
3636
{
3737
registerWrapper( viewKeyStruct::internalEnergyString(), &m_internalEnergy ).
3838
setPlotLevel( PlotLevel::LEVEL_0 ).
3939
setApplyDefaultValue( 0.0 ).
40-
setDescription( "Internal energy of the solid" );
40+
setDescription( "Internal energy of the solid per unit volume [J/m^3]" );
4141

4242
registerWrapper( viewKeyStruct::oldInternalEnergyString(), &m_oldInternalEnergy ).
4343
setApplyDefaultValue( 0.0 ).
44-
setDescription( "Internal energy of the solid at the previous time-step" );
44+
setDescription( "Internal energy of the solid per unit volume at the previous time-step [J/m^3]" );
4545

4646
registerWrapper( viewKeyStruct::dInternalEnergy_dTemperatureString(), &m_dInternalEnergy_dTemperature ).
4747
setApplyDefaultValue( 0.0 ).
48-
setDescription( "Derivative of the solid internal energy w.r.t. temperature" );
48+
setDescription( "Derivative of the solid internal energy w.r.t. temperature [J/(m^3.K)]" );
4949

50-
registerWrapper( viewKeyStruct::specificHeatCapacityString(), &m_specificHeatCapacity ).
51-
setApplyDefaultValue( 0.0 ).
52-
setDescription( "Solid specific heat capacity" );
50+
registerWrapper( viewKeyStruct::volumetricHeatCapacityString(), &m_volumetricHeatCapacity ).
51+
setInputFlag( InputFlags::REQUIRED ).
52+
setDescription( "Solid volumetric heat capacity [J/(kg.K)]" );
5353

5454
registerWrapper( viewKeyStruct::referenceTemperatureString(), &m_referenceTemperature ).
55-
setApplyDefaultValue( 0.0 ).
56-
setDescription( "Reference temperature" );
55+
setInputFlag( InputFlags::REQUIRED ).
56+
setDescription( "Reference temperature [K]" );
5757

5858
registerWrapper( viewKeyStruct::referenceInternalEnergyString(), &m_referenceInternalEnergy ).
59-
setApplyDefaultValue( 0.0 ).
60-
setDescription( "Internal energy at the reference temperature" );
59+
setInputFlag( InputFlags::REQUIRED ).
60+
setDescription( "Internal energy at the reference temperature [J/kg]" );
6161
}
6262

6363
void SolidInternalEnergy::allocateConstitutiveData( Group & parent,
@@ -81,6 +81,8 @@ void SolidInternalEnergy::saveConvergedState() const
8181
} );
8282
}
8383

84-
}
84+
REGISTER_CATALOG_ENTRY( ConstitutiveBase, SolidInternalEnergy, string const &, Group * const )
8585

86-
}
86+
} /* namespace constitutive */
87+
88+
} /* namespace geosx */

0 commit comments

Comments
 (0)