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
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,10 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh,

{
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localNegativeValues( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localWrongSum( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 );
Comment on lines +905 to +906
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localSupFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localInfFrac( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooLowFracCount( 0 );
RAJA::ReduceSum< parallelDeviceReduce, localIndex > localTooHighFracCount( 0 );

RAJA::ReduceMin< parallelDeviceReduce, localIndex > localMinFrac( LvArray::NumericLimits< localIndex >::max );
RAJA::ReduceMax< parallelDeviceReduce, localIndex > localMaxFrac( LvArray::NumericLimits< localIndex >::min );
forAll< parallelDevicePolicy<> >( subRegion.size(), [=] GEOS_HOST_DEVICE ( localIndex const ei )
{
real64 sumCompFrac = 0.0;
Expand All @@ -912,19 +915,31 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh,
if( compFrac[ei][ic] < 0.0 )
localNegativeValues += 1;
}
localMinFrac.min( sumCompFrac );
localMaxFrac.max( sumCompFrac );
if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 )
localWrongSum += 1;
localSupFrac += 1;
if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 )
localInfFrac += 1;
Comment on lines 920 to +923
Copy link
Contributor

Choose a reason for hiding this comment

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

You must adapt the computation here:

Suggested change
if( LvArray::math::abs( sumCompFrac - 1.0 ) > 1e-6 )
localWrongSum += 1;
localSupFrac += 1;
if( LvArray::math::abs( sumCompFrac - 1.0 ) < 1e-6 )
localInfFrac += 1;
if( sumCompFrac > 1.0 + 1e-6 )
localSupFrac += 1;
if( sumCompFrac < 1.0 - 1e-6 )
localInfFrac += 1;
  • use a configurable tolerance? What do you think @paveltomin ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

fixed tolerance is probably ok

} );

localMinFrac = MpiWrapper::min( localMinFrac.get() );
localMaxFrac = MpiWrapper::max( localMaxFrac.get() );

localIndex const negativeValues = MpiWrapper::sum( localNegativeValues.get() );
GEOS_ERROR_IF( negativeValues > 0,
GEOS_FMT( "{}: negative global component fraction values found in subregion '{}' for {} elements",
getName(), subRegion.getName(), negativeValues ) );

localIndex const wrongSum = MpiWrapper::sum( localWrongSum.get() );
GEOS_ERROR_IF( wrongSum > 0,
GEOS_FMT( "{}: component fractions do not sum to 1.0 in subregion '{}' for {} elements",
getName(), subRegion.getName(), wrongSum ) );
localIndex const totalSupFrac = MpiWrapper::sum( localSupFrac.get() );
localIndex const totalInfFrac = MpiWrapper::sum( localInfFrac.get() );
localIndex const totalWrongCompFrac = totalSupFrac + totalInfFrac;
localIndex const infFrac = MpiWrapper::min( localMinFrac.get() );
localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() );
Comment on lines +937 to +938
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
localIndex const infFrac = MpiWrapper::min( localMinFrac.get() );
localIndex const supFrac = MpiWrapper::sum( localMaxFrac.get() );
localIndex const minFrac = MpiWrapper::min( localMinFrac.get() );
localIndex const maxFrac = MpiWrapper::sum( localMaxFrac.get() );

GEOS_ERROR_IF( totalWrongCompFrac > 0,
GEOS_FMT( "Component fractions go from {} to {} ( over {} elements ) in subregion '{}', but should always sum to 1.0",
infFrac, supFrac, totalWrongCompFrac, subRegion.getName() ),
getDataContext());
Comment on lines +939 to +942
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
GEOS_ERROR_IF( totalWrongCompFrac > 0,
GEOS_FMT( "Component fractions go from {} to {} ( over {} elements ) in subregion '{}', but should always sum to 1.0",
infFrac, supFrac, totalWrongCompFrac, subRegion.getName() ),
getDataContext());
GEOS_ERROR_IF( totalWrongCompFrac > 0,
GEOS_FMT( "{} component fractions do not sum to 1.0 in subregion '{}'!\n"
"{} are too low ; {} are too high ; component fractions sum range is from {} to {}.\n"
"Consider adding field specification to initialize the '{}' field.",
totalWrongCompFrac, subRegion.getName(),
tooLowFracCount, tooHighFracCount, minFrac, maxFrac,
/* globalCompFrac viewkey here */ ),
getDataContext());

}

// Assume global component fractions have been prescribed.
Expand Down
154 changes: 154 additions & 0 deletions src/coreComponents/schema/schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@
<xsd:selector xpath="SinglePhasePoromechanicsConformingFractures" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="SolversSinglePhasePoromechanicsConformingFracturesALMUniqueName">
<xsd:selector xpath="SinglePhasePoromechanicsConformingFracturesALM" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="SolversSinglePhasePoromechanicsConformingFracturesReservoirUniqueName">
<xsd:selector xpath="SinglePhasePoromechanicsConformingFracturesReservoir" />
<xsd:field xpath="@name" />
Expand Down Expand Up @@ -491,6 +495,10 @@
<xsd:selector xpath="SinglePhaseReservoirPoromechanicsConformingFractures" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="SolversSinglePhaseReservoirPoromechanicsConformingFracturesALMUniqueName">
<xsd:selector xpath="SinglePhaseReservoirPoromechanicsConformingFracturesALM" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="SolversSinglePhaseWellUniqueName">
<xsd:selector xpath="SinglePhaseWell" />
<xsd:field xpath="@name" />
Expand Down Expand Up @@ -569,6 +577,10 @@
<xsd:selector xpath="RelpermDriver" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="TasksSinglePhasePoromechanicsConformingFracturesALMInitializationUniqueName">
<xsd:selector xpath="SinglePhasePoromechanicsConformingFracturesALMInitialization" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="TasksSinglePhasePoromechanicsConformingFracturesInitializationUniqueName">
<xsd:selector xpath="SinglePhasePoromechanicsConformingFracturesInitialization" />
<xsd:field xpath="@name" />
Expand All @@ -581,6 +593,10 @@
<xsd:selector xpath="SinglePhasePoromechanicsInitialization" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="TasksSinglePhaseReservoirPoromechanicsConformingFracturesALMInitializationUniqueName">
<xsd:selector xpath="SinglePhaseReservoirPoromechanicsConformingFracturesALMInitialization" />
<xsd:field xpath="@name" />
</xsd:unique>
<xsd:unique name="TasksSinglePhaseReservoirPoromechanicsConformingFracturesInitializationUniqueName">
<xsd:selector xpath="SinglePhaseReservoirPoromechanicsConformingFracturesInitialization" />
<xsd:field xpath="@name" />
Expand Down Expand Up @@ -2740,13 +2756,15 @@ Information output from lower logLevels is added with the desired log level
<xsd:element name="SinglePhaseHybridFVM" type="SinglePhaseHybridFVMType" />
<xsd:element name="SinglePhasePoromechanics" type="SinglePhasePoromechanicsType" />
<xsd:element name="SinglePhasePoromechanicsConformingFractures" type="SinglePhasePoromechanicsConformingFracturesType" />
<xsd:element name="SinglePhasePoromechanicsConformingFracturesALM" type="SinglePhasePoromechanicsConformingFracturesALMType" />
<xsd:element name="SinglePhasePoromechanicsConformingFracturesReservoir" type="SinglePhasePoromechanicsConformingFracturesReservoirType" />
<xsd:element name="SinglePhasePoromechanicsEmbeddedFractures" type="SinglePhasePoromechanicsEmbeddedFracturesType" />
<xsd:element name="SinglePhasePoromechanicsReservoir" type="SinglePhasePoromechanicsReservoirType" />
<xsd:element name="SinglePhaseProppantFVM" type="SinglePhaseProppantFVMType" />
<xsd:element name="SinglePhaseReservoir" type="SinglePhaseReservoirType" />
<xsd:element name="SinglePhaseReservoirPoromechanics" type="SinglePhaseReservoirPoromechanicsType" />
<xsd:element name="SinglePhaseReservoirPoromechanicsConformingFractures" type="SinglePhaseReservoirPoromechanicsConformingFracturesType" />
<xsd:element name="SinglePhaseReservoirPoromechanicsConformingFracturesALM" type="SinglePhaseReservoirPoromechanicsConformingFracturesALMType" />
<xsd:element name="SinglePhaseWell" type="SinglePhaseWellType">
<xsd:unique name="SolversSinglePhaseWellWellControlsUniqueName">
<xsd:selector xpath="WellControls" />
Expand Down Expand Up @@ -5028,6 +5046,60 @@ Local- Add jump stabilization on interior of macro elements-->
<xsd:attribute name="writeLinearSystem" type="integer" default="0" />
<!--writeStatistics => When set to `iteration`, output iterations information to a csv
When set to `convergence`, output convergence information to a csv
When set to `all` output both convergence & iteration information to a csv.-->
<xsd:attribute name="writeStatistics" type="geos_PhysicsSolverBase_StatsOutputType" default="none" />
<!--name => A name is required for any non-unique nodes-->
<xsd:attribute name="name" type="groupName" use="required" />
</xsd:complexType>
<xsd:complexType name="SinglePhasePoromechanicsConformingFracturesALMType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="LinearSolverParameters" type="LinearSolverParametersType" maxOccurs="1" />
<xsd:element name="NonlinearSolverParameters" type="NonlinearSolverParametersType" maxOccurs="1" />
</xsd:choice>
<!--allowNonConvergedLinearSolverSolution => Cut time step if linear solution fail without going until max nonlinear iterations.-->
<xsd:attribute name="allowNonConvergedLinearSolverSolution" type="integer" default="1" />
<!--cflFactor => Factor to apply to the `CFL condition <http://en.wikipedia.org/wiki/Courant-Friedrichs-Lewy_condition>`_ when calculating the maximum allowable time step. Values should be in the interval (0,1] -->
<xsd:attribute name="cflFactor" type="real64" default="0.5" />
<!--damageFlag => The flag to indicate whether a damage solid model is used-->
<xsd:attribute name="damageFlag" type="integer" default="0" />
<!--flowSolverName => Name of the flow solver used by the coupled solver-->
<xsd:attribute name="flowSolverName" type="groupNameRef" use="required" />
<!--initialDt => Initial time-step value required by the solver to the event manager.-->
<xsd:attribute name="initialDt" type="real64" default="1e+99" />
<!--isThermal => Flag indicating whether the problem is thermal or not. Set isThermal="1" to enable the thermal coupling-->
<xsd:attribute name="isThermal" type="integer" default="0" />
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
1
- Convergence information
- Linear solver information
- Output residual norm
- Solution information (scaling, maximum changes, quality check)
- Time step information
- Solver timers information
- Coupling information
2
- The summary of declared fields and coupling-->
<xsd:attribute name="logLevel" type="integer" default="0" />
<!--solidSolverName => Name of the solid solver used by the coupled solver-->
<xsd:attribute name="solidSolverName" type="groupNameRef" use="required" />
<!--stabilizationMultiplier => Constant multiplier of stabilization strength-->
<xsd:attribute name="stabilizationMultiplier" type="real64" default="1" />
<!--stabilizationRegionNames => Regions where stabilization is applied.-->
<xsd:attribute name="stabilizationRegionNames" type="groupNameRef_array" default="{}" />
<!--stabilizationType => StabilizationType. Options are:
None- Add no stabilization to mass equation
Global- Add jump stabilization to all faces
Local- Add jump stabilization on interior of macro elements-->
<xsd:attribute name="stabilizationType" type="geos_stabilization_StabilizationType" default="None" />
<!--targetRegions => Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager.-->
<xsd:attribute name="targetRegions" type="groupNameRef_array" use="required" />
<!--usePhysicsScaling => Enable physics-based scaling of the linear system. Default: true.-->
<xsd:attribute name="usePhysicsScaling" type="integer" default="1" />
<!--writeLinearSystem => Write matrix, rhs, solution to screen ( = 1) or file ( = 2).-->
<xsd:attribute name="writeLinearSystem" type="integer" default="0" />
<!--writeStatistics => When set to `iteration`, output iterations information to a csv
When set to `convergence`, output convergence information to a csv
When set to `all` output both convergence & iteration information to a csv.-->
<xsd:attribute name="writeStatistics" type="geos_PhysicsSolverBase_StatsOutputType" default="none" />
<!--name => A name is required for any non-unique nodes-->
Expand Down Expand Up @@ -5368,6 +5440,60 @@ Local- Add jump stabilization on interior of macro elements-->
<xsd:attribute name="writeLinearSystem" type="integer" default="0" />
<!--writeStatistics => When set to `iteration`, output iterations information to a csv
When set to `convergence`, output convergence information to a csv
When set to `all` output both convergence & iteration information to a csv.-->
<xsd:attribute name="writeStatistics" type="geos_PhysicsSolverBase_StatsOutputType" default="none" />
<!--name => A name is required for any non-unique nodes-->
<xsd:attribute name="name" type="groupName" use="required" />
</xsd:complexType>
<xsd:complexType name="SinglePhaseReservoirPoromechanicsConformingFracturesALMType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="LinearSolverParameters" type="LinearSolverParametersType" maxOccurs="1" />
<xsd:element name="NonlinearSolverParameters" type="NonlinearSolverParametersType" maxOccurs="1" />
</xsd:choice>
<!--allowNonConvergedLinearSolverSolution => Cut time step if linear solution fail without going until max nonlinear iterations.-->
<xsd:attribute name="allowNonConvergedLinearSolverSolution" type="integer" default="1" />
<!--cflFactor => Factor to apply to the `CFL condition <http://en.wikipedia.org/wiki/Courant-Friedrichs-Lewy_condition>`_ when calculating the maximum allowable time step. Values should be in the interval (0,1] -->
<xsd:attribute name="cflFactor" type="real64" default="0.5" />
<!--damageFlag => The flag to indicate whether a damage solid model is used-->
<xsd:attribute name="damageFlag" type="integer" default="0" />
<!--initialDt => Initial time-step value required by the solver to the event manager.-->
<xsd:attribute name="initialDt" type="real64" default="1e+99" />
<!--isThermal => Flag indicating whether the problem is thermal or not. Set isThermal="1" to enable the thermal coupling-->
<xsd:attribute name="isThermal" type="integer" default="0" />
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
1
- Convergence information
- Linear solver information
- Output residual norm
- Solution information (scaling, maximum changes, quality check)
- Time step information
- Solver timers information
- Coupling information
2
- The summary of declared fields and coupling-->
<xsd:attribute name="logLevel" type="integer" default="0" />
<!--reservoirAndWellsSolverName => Name of the reservoirAndWells solver used by the coupled solver-->
<xsd:attribute name="reservoirAndWellsSolverName" type="groupNameRef" use="required" />
<!--solidSolverName => Name of the solid solver used by the coupled solver-->
<xsd:attribute name="solidSolverName" type="groupNameRef" use="required" />
<!--stabilizationMultiplier => Constant multiplier of stabilization strength-->
<xsd:attribute name="stabilizationMultiplier" type="real64" default="1" />
<!--stabilizationRegionNames => Regions where stabilization is applied.-->
<xsd:attribute name="stabilizationRegionNames" type="groupNameRef_array" default="{}" />
<!--stabilizationType => StabilizationType. Options are:
None- Add no stabilization to mass equation
Global- Add jump stabilization to all faces
Local- Add jump stabilization on interior of macro elements-->
<xsd:attribute name="stabilizationType" type="geos_stabilization_StabilizationType" default="None" />
<!--targetRegions => Allowable regions that the solver may be applied to. Note that this does not indicate that the solver will be applied to these regions, only that allocation will occur such that the solver may be applied to these regions. The decision about what regions this solver will beapplied to rests in the EventManager.-->
<xsd:attribute name="targetRegions" type="groupNameRef_array" use="required" />
<!--usePhysicsScaling => Enable physics-based scaling of the linear system. Default: true.-->
<xsd:attribute name="usePhysicsScaling" type="integer" default="1" />
<!--writeLinearSystem => Write matrix, rhs, solution to screen ( = 1) or file ( = 2).-->
<xsd:attribute name="writeLinearSystem" type="integer" default="0" />
<!--writeStatistics => When set to `iteration`, output iterations information to a csv
When set to `convergence`, output convergence information to a csv
When set to `all` output both convergence & iteration information to a csv.-->
<xsd:attribute name="writeStatistics" type="geos_PhysicsSolverBase_StatsOutputType" default="none" />
<!--name => A name is required for any non-unique nodes-->
Expand Down Expand Up @@ -5912,9 +6038,11 @@ When set to `all` output both convergence & iteration information to a csv.-->
<xsd:element name="PackCollection" type="PackCollectionType" />
<xsd:element name="ReactiveFluidDriver" type="ReactiveFluidDriverType" />
<xsd:element name="RelpermDriver" type="RelpermDriverType" />
<xsd:element name="SinglePhasePoromechanicsConformingFracturesALMInitialization" type="SinglePhasePoromechanicsConformingFracturesALMInitializationType" />
<xsd:element name="SinglePhasePoromechanicsConformingFracturesInitialization" type="SinglePhasePoromechanicsConformingFracturesInitializationType" />
<xsd:element name="SinglePhasePoromechanicsEmbeddedFracturesInitialization" type="SinglePhasePoromechanicsEmbeddedFracturesInitializationType" />
<xsd:element name="SinglePhasePoromechanicsInitialization" type="SinglePhasePoromechanicsInitializationType" />
<xsd:element name="SinglePhaseReservoirPoromechanicsConformingFracturesALMInitialization" type="SinglePhaseReservoirPoromechanicsConformingFracturesALMInitializationType" />
<xsd:element name="SinglePhaseReservoirPoromechanicsConformingFracturesInitialization" type="SinglePhaseReservoirPoromechanicsConformingFracturesInitializationType" />
<xsd:element name="SinglePhaseReservoirPoromechanicsInitialization" type="SinglePhaseReservoirPoromechanicsInitializationType" />
<xsd:element name="SinglePhaseStatistics" type="SinglePhaseStatisticsType" />
Expand Down Expand Up @@ -6108,6 +6236,19 @@ Information output from lower logLevels is added with the desired log level
<!--name => A name is required for any non-unique nodes-->
<xsd:attribute name="name" type="groupName" use="required" />
</xsd:complexType>
<xsd:complexType name="SinglePhasePoromechanicsConformingFracturesALMInitializationType">
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
1
- Information on solver initialization-->
<xsd:attribute name="logLevel" type="integer" default="0" />
<!--poromechanicsSolverName => Name of the poromechanics solver-->
<xsd:attribute name="poromechanicsSolverName" type="groupNameRef" use="required" />
<!--solidMechanicsStatisticsName => Name of the solid mechanics statistics-->
<xsd:attribute name="solidMechanicsStatisticsName" type="groupNameRef" default="" />
<!--name => A name is required for any non-unique nodes-->
<xsd:attribute name="name" type="groupName" use="required" />
</xsd:complexType>
<xsd:complexType name="SinglePhasePoromechanicsConformingFracturesInitializationType">
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
Expand Down Expand Up @@ -6137,6 +6278,19 @@ Information output from lower logLevels is added with the desired log level
<xsd:complexType name="SinglePhasePoromechanicsInitializationType">
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
1
- Information on solver initialization-->
<xsd:attribute name="logLevel" type="integer" default="0" />
<!--poromechanicsSolverName => Name of the poromechanics solver-->
<xsd:attribute name="poromechanicsSolverName" type="groupNameRef" use="required" />
<!--solidMechanicsStatisticsName => Name of the solid mechanics statistics-->
<xsd:attribute name="solidMechanicsStatisticsName" type="groupNameRef" default="" />
<!--name => A name is required for any non-unique nodes-->
<xsd:attribute name="name" type="groupName" use="required" />
</xsd:complexType>
<xsd:complexType name="SinglePhaseReservoirPoromechanicsConformingFracturesALMInitializationType">
<!--logLevel => Sets the level of information to write in the standard output (the console typically).
Information output from lower logLevels is added with the desired log level
1
- Information on solver initialization-->
<xsd:attribute name="logLevel" type="integer" default="0" />
Expand Down
Loading
Loading