Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SourceFluxStatistics #2954

Merged
merged 110 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
d73ac6d
added region mass stats
MelReyCG Dec 21, 2023
909a1c5
added region temperature stats
MelReyCG Dec 21, 2023
8bee3cf
Logging debug info - to be removed laster
MelReyCG Jan 12, 2024
256caeb
better debug output
MelReyCG Jan 12, 2024
0ec69b5
annotations
MelReyCG Jan 15, 2024
67d8a7e
cleaning
MelReyCG Jan 16, 2024
27bec78
Output flux stats in log
MelReyCG Jan 16, 2024
f89e2d8
completed previous commit
MelReyCG Jan 19, 2024
e0592ed
Add the logLevel viewkey & description
MelReyCG Jan 19, 2024
078e6ed
Add a way to expend the description of a wrapper
MelReyCG Jan 19, 2024
5b8f213
Intermediate progress to properly store the SourceFlux stats
MelReyCG Jan 19, 2024
953ec3a
adding the SourceFluxStatistics Task which will allow to aggregate st…
MelReyCG Jan 19, 2024
1a9fe0c
simplify description to avoid regenerating a lot of .rst (to be added…
MelReyCG Jan 19, 2024
867a20c
Merge remote-tracking branch 'origin/develop' into feature/rey/source…
MelReyCG Jan 19, 2024
814fd34
missed a few details
MelReyCG Jan 19, 2024
818fcc2
forgotten generated files...
MelReyCG Jan 19, 2024
a5d762b
SourceFlluxStatistics now compiles
MelReyCG Jan 19, 2024
28a7730
generated docs
MelReyCG Jan 19, 2024
4e71130
SourceFluxStatistics now runs:
MelReyCG Jan 25, 2024
cc55358
few edits
MelReyCG Jan 25, 2024
69c6918
uncrustify
MelReyCG Jan 26, 2024
a164ece
architecture adaptations to expose values to unit tests
MelReyCG Feb 1, 2024
badfc4e
added singlephase test
MelReyCG Feb 1, 2024
23e41fc
removed debug infos
MelReyCG Feb 1, 2024
d59318a
unit test: code layout, removed debug info
MelReyCG Feb 1, 2024
db72798
unit test: code layout, removed debug info, xmlInput improvements
MelReyCG Feb 2, 2024
232106b
Merge branch 'feature/rey/sourceflux-stats' of https://github.com/GEO…
MelReyCG Feb 2, 2024
8477262
Added multiphase xml input
MelReyCG Feb 2, 2024
317560a
few comments
MelReyCG Feb 2, 2024
af7be1e
code style
MelReyCG Feb 6, 2024
796f020
unit test: Added checks on every timesteps stats
MelReyCG Feb 6, 2024
c6ccc63
unit test: separated the input parameters and expected value set
MelReyCG Feb 6, 2024
b806da7
unit test: cleaning comments
MelReyCG Feb 6, 2024
aa4b250
unit test: compositional multiphase sim now runs
MelReyCG Feb 7, 2024
c2fa0f8
allowed multiple component stats for SourceFluxStatistics
MelReyCG Feb 7, 2024
dc3398c
changed singlephase parameters so that they are not multiple among th…
MelReyCG Feb 8, 2024
c2c74f0
forgot to replace some hard coded values
MelReyCG Feb 8, 2024
0a0fb7b
Whole multiphase sim stat check
MelReyCG Feb 8, 2024
e2ac446
crash investigating...
MelReyCG Feb 8, 2024
4c3fa0b
fixed crashed :)
MelReyCG Feb 8, 2024
41b0fc8
Revert unwanted pushed files
MelReyCG Feb 8, 2024
f163aed
Finished the multiphase test
MelReyCG Feb 9, 2024
1781ac9
Unexpected result debugging
MelReyCG Feb 9, 2024
620a53b
forgotten decls
MelReyCG Feb 9, 2024
45f7452
code cleaning
MelReyCG Feb 9, 2024
703b73a
fixing gpu captures + adding support for ReactiveCompositionalMultiph…
MelReyCG Feb 9, 2024
cdebcff
fixed sum operations (=> reduceSum)
MelReyCG Feb 12, 2024
ffcf39b
uncrustify
MelReyCG Feb 12, 2024
7a96ee2
test pvt tables optimisation (13.4s -> 3.0s)
MelReyCG Feb 12, 2024
2446436
exposed SinglePhaseStatistics::RegionStatistics
MelReyCG Feb 13, 2024
a0d085a
compared mass difference from SinglePhaseStatistics and SourceFluxSta…
MelReyCG Feb 13, 2024
e427189
Merge branch 'develop' into feature/rey/sourceflux-stats
MelReyCG Feb 14, 2024
e1e79cf
fixed typo
MelReyCG Feb 14, 2024
3da5569
Merge branch 'feature/rey/sourceflux-stats' of https://github.com/GEO…
MelReyCG Feb 14, 2024
e9f7f4a
Added guard to test sub-timesteps
MelReyCG Feb 15, 2024
6af8726
Added CSV export & more docs
MelReyCG Feb 16, 2024
3d19803
Removing the MultifluidBase::useMass wrapper as it is set by the solv…
MelReyCG Feb 21, 2024
a2d618a
fixed catalog name of TimeStepChecker
MelReyCG Feb 21, 2024
7ee9b4d
Fixed solver "amount of fluid" units (kg or mol), and added documenta…
MelReyCG Feb 22, 2024
7378ec2
better timestep cut checking + refactored a bit
MelReyCG Feb 22, 2024
322a3f8
Merge remote-tracking branch 'origin/develop' into feature/rey/source…
MelReyCG Feb 22, 2024
0161b19
generated docs
MelReyCG Feb 22, 2024
d6a47d8
uncrustify
MelReyCG Feb 22, 2024
c528da8
typo
MelReyCG Feb 22, 2024
5907f9c
reverting undesired paste
MelReyCG Feb 22, 2024
720c493
wrappers like this one is required to be able to "deliverClone()"
MelReyCG Feb 22, 2024
afab7c7
generated documentations
MelReyCG Feb 22, 2024
1e33b3d
docs
MelReyCG Feb 22, 2024
f911df3
wrong doxygen keyword
MelReyCG Feb 22, 2024
8dfe5db
doxygen test
MelReyCG Feb 22, 2024
2662637
test2
MelReyCG Feb 22, 2024
7fcf887
fixed doxygen
MelReyCG Feb 22, 2024
ffaf9d4
ajusting test value to facilitate convergence
MelReyCG Feb 23, 2024
e9ee4ea
code reordering + docs
MelReyCG Feb 23, 2024
a9d17d4
debugging sub-sub-timestep behaviour
MelReyCG Feb 23, 2024
2003fd2
finally fixed numerical precision issue
MelReyCG Feb 23, 2024
45084b5
removing double decl
MelReyCG Feb 23, 2024
000978a
removing unrelated code change
MelReyCG Feb 23, 2024
923b0d8
ajusting test value to facilitate convergence
MelReyCG Feb 23, 2024
02d35fc
test
MelReyCG Feb 23, 2024
f53a8f5
allow non converged solution is tests as trilinos struggles with the …
MelReyCG Feb 27, 2024
d5b4a14
Solver setting test
MelReyCG Feb 28, 2024
fad3edf
Solver setting test 2 (Mass test is passed with trilinos)
MelReyCG Feb 28, 2024
68eb991
Solver setting test
MelReyCG Feb 28, 2024
9b0628f
reverted to previous settings
MelReyCG Feb 29, 2024
adab7a0
forgotten ILUK attribute
MelReyCG Feb 29, 2024
32cdd5e
trying to test sub-timesteps only with hypre
MelReyCG Mar 5, 2024
42a57d8
trilinos & hyper work in stastifying time
MelReyCG Mar 5, 2024
7f2a913
removed unused headers
MelReyCG Mar 5, 2024
7f51542
Merge remote-tracking branch 'origin/develop' into feature/rey/source…
MelReyCG Mar 5, 2024
dc5b827
solver precision
MelReyCG Mar 5, 2024
7f9097c
avoiding exact 0 / 1 values in test
MelReyCG Mar 8, 2024
de20aba
removed parameter as they are to defualt values
MelReyCG Mar 8, 2024
9f78b8d
renaming testFluidStatistics to testFlowStatistics
MelReyCG Mar 8, 2024
25bc30f
removing the 4th log level
MelReyCG Apr 3, 2024
f56b2f6
missing inlines
MelReyCG Apr 3, 2024
37b3c97
xsd / rst changes
MelReyCG Apr 3, 2024
3165aef
moving the TimeStepChecker in its own file (& created a testingUtilit…
MelReyCG Apr 3, 2024
9905ae1
Merge remote-tracking branch 'origin/develop' into feature/rey/source…
MelReyCG Apr 3, 2024
3883d39
moving some definition to cpp
MelReyCG Apr 3, 2024
8f72e9f
uncrustify :s
MelReyCG Apr 3, 2024
43fe9f4
few adjustments
MelReyCG Jun 4, 2024
34fc78d
Merge commit '79856a0e653a508b4fe4dcd8c582fcdc2838b756' into feature/…
MelReyCG Jun 4, 2024
cf15bb3
added an header due to incomplete DomainPartition type
MelReyCG Jun 4, 2024
b051ed1
by default, SourceFluxStat targets al SourceFlux + adapted test
MelReyCG Jun 4, 2024
cf0271a
generated files
MelReyCG Jun 4, 2024
b0c7fe6
Added star character * in group name reference regex.
MelReyCG Jun 5, 2024
db2efea
Merge branch 'develop' into feature/rey/sourceflux-stats
paveltomin Jun 7, 2024
ce24a37
Merge branch 'develop' into feature/rey/sourceflux-stats
paveltomin Jun 13, 2024
fc11f5b
Merge branch 'develop' into feature/rey/sourceflux-stats
paveltomin Jun 14, 2024
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
16 changes: 8 additions & 8 deletions src/coreComponents/codingUtilities/UnitTestUtilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ T expected( T expectedSerial,
constexpr real64 DEFAULT_ABS_TOL = 1E-12;
constexpr real64 DEFAULT_REL_TOL = std::numeric_limits< real64 >::epsilon();

::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, const char *,
real64 const v1, real64 const v2, real64 const relTol, real64 const absTol )
inline ::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *, const char *, const char *,
real64 const v1, real64 const v2, real64 const relTol, real64 const absTol )
{
real64 const delta = std::abs( v1 - v2 );
real64 const value = std::max( std::abs( v1 ), std::abs( v2 ) );
Expand All @@ -99,23 +99,23 @@ ::testing::AssertionResult checkRelativeErrorFormat( const char *, const char *,
return ::testing::AssertionSuccess();
}

::testing::AssertionResult checkRelativeErrorFormat( char const * a, char const * b, char const * c,
real64 const v1, real64 const v2, real64 const relTol )
inline ::testing::AssertionResult checkRelativeErrorFormat( char const * a, char const * b, char const * c,
real64 const v1, real64 const v2, real64 const relTol )
{ return checkRelativeErrorFormat( a, b, c, "DEFAULT_ABS_TOL", v1, v2, relTol, DEFAULT_ABS_TOL ); }

void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol )
inline void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol )
{ EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol ); }

void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol )
inline void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol )
{ EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol ); }

void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, string const & name )
inline void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, string const & name )
{
SCOPED_TRACE( name );
EXPECT_PRED_FORMAT3( checkRelativeErrorFormat, v1, v2, relTol );
}

void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol, string const & name )
inline void checkRelativeError( real64 const v1, real64 const v2, real64 const relTol, real64 const absTol, string const & name )
{
SCOPED_TRACE( name );
EXPECT_PRED_FORMAT4( checkRelativeErrorFormat, v1, v2, relTol, absTol );
Expand Down
4 changes: 2 additions & 2 deletions src/coreComponents/common/DataTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ rtTypes::RegexMapType rtTypes::createBasicTypesRegexMap()

string_view const groupNameDesc = "Input value must be a string that cannot be empty and contains only upper/lower letters, digits, and the characters . - _";
string_view const groupNameRegex = "[a-zA-Z0-9.\\-_]+";
string_view const groupNameRefDesc = "Input value must be a string that can contain only upper/lower letters, digits, and the characters . - _ /";
string_view const groupNameRefRegex = "[a-zA-Z0-9.\\-_/]*";
string_view const groupNameRefDesc = "Input value must be a string that can contain only upper/lower letters, digits, and the characters . - _ / *";
string_view const groupNameRefRegex = "[a-zA-Z0-9.\\-_/*]*";


// Build master list of regexes
Expand Down
32 changes: 32 additions & 0 deletions src/coreComponents/common/Units.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@

/// Solubility in g/L
Solubility,

/// Mass in kg
Mass,

/// Mole in mol
Mole,

/// Mass rate in kg/s
MassRate,

/// Mole rate in mol/s
MoleRate,
};


Expand All @@ -104,6 +116,10 @@
case Enthalpy: return "enthalpy [J/kg]";
case Density: return "density [kg/m3]";
case Solubility: return "solubility [g/L]";
case Mass: return "mass [kg]";
case Mole: return "mole [mol]";
case MassRate: return "mass rate [kg/s]";
case MoleRate: return "mole rate [mol/s]";

Check warning on line 122 in src/coreComponents/common/Units.hpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/Units.hpp#L119-L122

Added lines #L119 - L122 were not covered by tests
}
}

Expand All @@ -122,6 +138,14 @@
case TemperatureInC: return "C";
case Distance: return "m";
case Time: return "s";
case Viscosity: return "Pa*s";
case Enthalpy: return "J/kg";
case Density: return "kg/m3";
case Solubility: return "g/L";

Check warning on line 144 in src/coreComponents/common/Units.hpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/Units.hpp#L141-L144

Added lines #L141 - L144 were not covered by tests
case Mass: return "kg";
case Mole: return "mol";
case MassRate: return "kg/s";
case MoleRate: return "mol/s";

Check warning on line 148 in src/coreComponents/common/Units.hpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/Units.hpp#L147-L148

Added lines #L147 - L148 were not covered by tests
Comment on lines +141 to +148
Copy link
Collaborator

Choose a reason for hiding this comment

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

Units are not really strongly enforced in GEOS. One could use any set of units as long as they are consistent. For example a user can decide to specify pressures in MPa an adjust all other properties. I would say that we either properly introduce a unit parser or these units can easily be false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

About this header, it is in S.I. by default (following the GEOS convention). Some units can be in other systems as you can see for the temperatures (°C rather than °K), and if someone want to add more, I think it should come with conversion functions.
I strongly advise to add comments on all non-S.I. variables / method, it would be less error-prone and would help when implementing a parsing unit system or when adding new outputs.

About adding unit parsing system, it is on my roadmap. Feel free to add suggestions on my EPIC.

}
}

Expand All @@ -143,6 +167,14 @@
case TemperatureInC: return GEOS_FMT( "temperature of {} [K]", convertCToK( value ) );
case Distance: return GEOS_FMT( "distance of {} [s]", value );
case Time: return GEOS_FMT( "time of {} [s]", value );
case Viscosity: return GEOS_FMT( "viscosity of {} [Pa*s]", value );
case Enthalpy: return GEOS_FMT( "enthalpy of {} [J/kg]", value );
case Density: return GEOS_FMT( "density of {} [kg/m3]", value );
case Solubility: return GEOS_FMT( "solubility of {} [g/L]", value );
case Mass: return GEOS_FMT( "mass of {} [kg]", value );
case Mole: return GEOS_FMT( "mole of {} [mol]", value );
case MassRate: return GEOS_FMT( "mass rate of {} [kg/s]", value );
case MoleRate: return GEOS_FMT( "mole rate of {} [mol/s]", value );

Check warning on line 177 in src/coreComponents/common/Units.hpp

View check run for this annotation

Codecov / codecov/patch

src/coreComponents/common/Units.hpp#L170-L177

Added lines #L170 - L177 were not covered by tests
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/coreComponents/dataRepository/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,8 @@ void Group::postRestartInitializationRecursive()

void Group::enableLogLevelInput()
{
string const logLevelString = "logLevel";

registerWrapper( logLevelString, &m_logLevel ).
// TODO : Improve the Log Level description to clearly assign a usecase per log level (incoming PR).
registerWrapper( viewKeyStruct::logLevelString(), &m_logLevel ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Log level" );
Expand Down
9 changes: 9 additions & 0 deletions src/coreComponents/dataRepository/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,15 @@ class Group
*/
void setInputFlags( InputFlags flags ) { m_input_flags = flags; }

/**
* @brief Structure to hold scoped key names
*/
struct viewKeyStruct
{
/// @return String for the logLevel wrapper
static constexpr char const * logLevelString() { return "logLevel"; }
};

///@}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/coreComponents/dataRepository/Wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,15 @@ class Wrapper final : public WrapperBase
return *this;
}

/**
* @copydoc WrapperBase::appendDescription(string const &)
*/
Wrapper< T > & appendDescription( string const & description )
{
WrapperBase::appendDescription( description );
return *this;
}

/**
* @copydoc WrapperBase::setRegisteringObjects(string const &)
*/
Expand Down
11 changes: 11 additions & 0 deletions src/coreComponents/dataRepository/WrapperBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,17 @@ class WrapperBase
return *this;
}

/**
* @brief Add up more text to the existing description string of the wrapper.
* @param description the description to add to the end of the previous one.
* @return a pointer to this wrapper
*/
WrapperBase & appendDescription( string const & description )
{
m_description += description;
return *this;
}

/**
* @brief Get the description string of the wrapper.
* @return this wrapper's description string
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/fieldSpecification/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set( fieldSpecification_headers
TractionBoundaryCondition.hpp
AquiferBoundaryCondition.hpp
PerfectlyMatchedLayer.hpp
SourceFluxStatistics.hpp
)

#
Expand All @@ -24,6 +25,7 @@ set( fieldSpecification_sources
TractionBoundaryCondition.cpp
AquiferBoundaryCondition.cpp
PerfectlyMatchedLayer.cpp
SourceFluxStatistics.cpp
)

set( dependencyList ${parallelDeps} functions linearAlgebra )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "SourceFluxBoundaryCondition.hpp"
#include "physicsSolvers/fluidFlow/CompositionalMultiphaseBase.hpp"

namespace geos
{
Expand All @@ -29,6 +30,18 @@ SourceFluxBoundaryCondition::SourceFluxBoundaryCondition( string const & name, G
getWrapper< string >( FieldSpecificationBase::viewKeyStruct::fieldNameString() ).
setInputFlag( InputFlags::FALSE );
setFieldName( catalogName() );

getWrapper< string >( FieldSpecificationBase::viewKeyStruct::functionNameString() ).
setDescription( GEOS_FMT( "Name of a function that specifies the variation of the production rate variations of this {}."
"Multiplied by {}. If no function is provided, a constant value of 1 is used."
"The producted fluid rate unit is in kg by default, or in mole if the flow solver has a {} of 0.",
catalogName(),
FieldSpecificationBase::viewKeyStruct::scaleString(),
CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString() ) );

getWrapper< real64 >( FieldSpecificationBase::viewKeyStruct::scaleString() ).
setDescription( GEOS_FMT( "Multiplier of the {0} value. If no {0} is provided, this value is used directly.",
FieldSpecificationBase::viewKeyStruct::functionNameString() ) );
}

REGISTER_CATALOG_ENTRY( FieldSpecificationBase, SourceFluxBoundaryCondition, string const &, Group * const )
Expand Down
Loading