Skip to content

refactor: cleanup logInfo #3755

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

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
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 @@ -7,15 +7,13 @@
objectPath="ElementRegions"
fieldName="temperature"
scale="313.15"
setNames="{ top }"
logLevel="0" />
setNames="{ top }" />
<FieldSpecification
name="bottomTemperature"
objectPath="ElementRegions"
fieldName="temperature"
scale="343.15"
setNames="{ bottom }"
logLevel="0" />
setNames="{ bottom }" />
</FieldSpecifications>

</Problem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@
component="0"
functionName="totalRateTable1"
scale="1"
setNames="{ thermalSource1 }"
logLevel="0" />
setNames="{ thermalSource1 }" />

<FieldSpecification
beginTime="7.8840000001e8"
Expand All @@ -233,8 +232,7 @@
component="0"
functionName="totalRateTable2"
scale="1"
setNames="{ thermalSource2 }"
logLevel="0" />
setNames="{ thermalSource2 }" />
</FieldSpecifications>
<!-- SPHINX_SOURCES_END -->

Expand Down
2 changes: 0 additions & 2 deletions inputFiles/compositionalMultiphaseFlow/co2_flux_3d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@

<Aquifer
name="aquiferBC1"
logLevel="1"
aquiferPorosity="1e-1"
aquiferPermeability="1e-13"
aquiferInitialPressure="8e6"
Expand All @@ -248,7 +247,6 @@

<Aquifer
name="aquiferBC2"
logLevel="1"
aquiferPorosity="1e-1"
aquiferPermeability="1e-13"
aquiferInitialPressure="8e6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
objectPath="ElementRegions/region"
fieldName="pressure"
initialCondition="1"
logLevel="2"
scale="1.1e6" />
<FieldSpecification
name="initial_temperature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
<!-- Injection pressure: ~100 bar -->
<FieldSpecification
name="sourceTermPressure"
logLevel="1"
objectPath="faceManager"
fieldName="pressure"
scale="1e7"
Expand Down Expand Up @@ -241,7 +240,6 @@
<!-- Production pressure: ~50 bar, -->
<FieldSpecification
name="sinkTermPressure"
logLevel="1"
objectPath="faceManager"
fieldName="pressure"
scale="5e6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
objectPath="ElementRegions/region"
fieldName="pressure"
initialCondition="1"
logLevel="2"
scale="1.1e6" />
<FieldSpecification
name="initial_temperature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@
fieldName="projectedShearTraction"
scale="1.0"
functionName="shearStress_function"
setNames="{ all }"
logLevel="0"/>
setNames="{ all }"/>
</FieldSpecifications>

<Functions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@

<FieldSpecification
name="sourceTerm"
logLevel="1"
objectPath="faceManager"
fieldName="pressure"
scale="5e7"
Expand Down
1 change: 0 additions & 1 deletion inputFiles/singlePhaseFlow/staircase_3d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@

<FieldSpecification
name="sourceTerm"
logLevel="1"
objectPath="faceManager"
fieldName="pressure"
scale="5e6"
Expand Down
1 change: 0 additions & 1 deletion inputFiles/thermalMultiphaseFlow/co2_thermal_2d.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@

<FieldSpecification
name="sourcePressure"
logLevel="1"
setNames="{ source1, source2 }"
objectPath="faceManager"
fieldName="pressure"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@
objectPath="faceManager"
fieldName="pressure"
scale="2e6"
setNames="{ zpos }"
logLevel="0"/>
setNames="{ zpos }"/>

<FieldSpecification
name="topTemperature"
objectPath="faceManager"
fieldName="temperature"
scale="296.0153"
setNames="{ zpos }"
logLevel="0"/>
setNames="{ zpos }"/>

<FieldSpecification
name="botTemperature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@
objectPath="faceManager"
fieldName="pressure"
scale="2e6"
setNames="{ zpos }"
logLevel="0"/>
setNames="{ zpos }"/>

<FieldSpecification
name="topTemperature"
objectPath="faceManager"
fieldName="temperature"
scale="296.0153"
setNames="{ zpos }"
logLevel="0"/>
setNames="{ zpos }"/>

<FieldSpecification
name="botTemperature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ CO2BrineFluid( string const & name, Group * const parent ):
setPlotLevel( PlotLevel::LEVEL_0 ).
setRestartFlags( RestartFlags::WRITE_AND_READ );
}
addLogLevel< logInfo::PVT >();

addLogLevel< logInfo::TableLogOutput >();
}

template< typename PHASE1, typename PHASE2, typename FLASH >
Expand Down Expand Up @@ -214,6 +215,8 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::postInputInitialization()
{
MultiFluidBase::postInputInitialization();

m_writeInLog = isLogLevelActive< logInfo::TableLogOutput >( this->getLogLevel() );

GEOS_THROW_IF_NE_MSG( numFluidPhases(), 2,
GEOS_FMT( "{}: invalid number of phases", getFullName() ),
InputError );
Expand Down Expand Up @@ -337,22 +340,21 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()

// then, we are ready to instantiate the phase models
bool const isClone = this->isClone();
TableFunction::OutputOptions const pvtOutputOpts = {
!isClone && m_writeCSV,// writeCSV
!isClone && isLogLevelActive< logInfo::PVT >( this->getLogLevel()), // writeInLog
TableFunction::OutputOptions const outputOpts = {
!isClone && m_writeCSV, // writeCSV
!isClone && m_writeInLog // writeInLog
};


m_phase1 = std::make_unique< PHASE1 >( getName() + "_phaseModel1",
phase1InputParams,
m_componentNames,
m_componentMolarWeight,
pvtOutputOpts );
outputOpts );
m_phase2 = std::make_unique< PHASE2 >( getName() + "_phaseModel2",
phase2InputParams,
m_componentNames,
m_componentMolarWeight,
pvtOutputOpts );
outputOpts );


// 2) Create the flash model
Expand All @@ -374,16 +376,12 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
{
if( strs[1] == FLASH::catalogName() )
{
TableFunction::OutputOptions const flashOutputOpts = {
!isClone && m_writeCSV,// writeCSV
!isClone && isLogLevelActive< logInfo::PVT >( this->getLogLevel()), // writeInLog
};
m_flash = std::make_unique< FLASH >( getName() + '_' + FLASH::catalogName(),
strs,
m_phaseNames,
m_componentNames,
m_componentMolarWeight,
flashOutputOpts );
outputOpts );
}
}
else
Expand Down Expand Up @@ -420,17 +418,12 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels()
strs[2] = m_solubilityTables[0];
}

TableFunction::OutputOptions const flashOutputOpts = {
!isClone && m_writeCSV,// writeCSV
!isClone && isLogLevelActive< logInfo::PVT >( this->getLogLevel() ), // writeInLog
};

m_flash = std::make_unique< FLASH >( getName() + '_' + FLASH::catalogName(),
strs,
m_phaseNames,
m_componentNames,
m_componentMolarWeight,
flashOutputOpts );
outputOpts );
}

GEOS_THROW_IF( m_flash == nullptr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ class CO2BrineFluid : public MultiFluidBase
/// Output csv file containing informations about PVT
integer m_writeCSV;

/// Write PVT tables in log
bool m_writeInLog;
Copy link
Contributor

Choose a reason for hiding this comment

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

why not keeping local?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for symmetry with m_writeCSV but can revert if you prefer


///
integer m_checkPhasePresence;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ namespace logInfo
*/
///@{

struct PVT
struct TableLogOutput
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Output PVT table"; }
static constexpr std::string_view getDescription() { return "Output PVT table to log"; }
};

/// @cond DO_NOT_DOCUMENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ReactiveBrineFluid( string const & name, Group * const parent ):
setRestartFlags( RestartFlags::WRITE_AND_READ );
}

addLogLevel< logInfo::PVT >();
addLogLevel< logInfo::TableLogOutput >();
}

template< typename PHASE >
Expand Down Expand Up @@ -127,6 +127,8 @@ void ReactiveBrineFluid< PHASE > ::postInputInitialization()
{
ReactiveMultiFluid::postInputInitialization();

m_writeInLog = isLogLevelActive< logInfo::TableLogOutput >( this->getLogLevel() );

GEOS_THROW_IF_NE_MSG( numFluidPhases(), 1,
GEOS_FMT( "{}: invalid number of phases", getFullName() ),
InputError );
Expand Down Expand Up @@ -205,8 +207,8 @@ void ReactiveBrineFluid< PHASE > ::createPVTModels()

bool const isClone = this->isClone();
TableFunction::OutputOptions const pvtOutputOpts = {
!isClone && m_writeCSV,// writeCSV
!isClone && isLogLevelActive< logInfo::PVT >( this->getLogLevel() ), // writeInLog
!isClone && m_writeCSV, // writeCSV
!isClone && m_writeInLog // writeInLog
};

// then, we are ready to instantiate the phase models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ class ReactiveBrineFluid : public ReactiveMultiFluid
/// Output csv file containing informations about PVT
integer m_writeCSV;

/// Write PVT tables in log
bool m_writeInLog;

/// Brine constitutive models
std::unique_ptr< PHASE > m_phase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ namespace logInfo

/// @cond DO_NOT_DOCUMENT

struct Initialisation
struct LogOutput
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Informations on initialisation"; }
};

struct Results
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Output results"; }
static constexpr std::string_view getDescription() { return "Enable log output"; }
};

/// @endcond
Expand Down
Loading
Loading