From 52dca0a04e38917a8bd149a9a90a97e13c303ebc Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Mon, 3 Feb 2025 15:18:57 +0100 Subject: [PATCH 1/8] Preparing folder for table outputs (CSVs) - uniformizing behaviour of TableFunction regarding other outputing components (OutputBase...) --- src/coreComponents/functions/FunctionBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/coreComponents/functions/FunctionBase.cpp b/src/coreComponents/functions/FunctionBase.cpp index 07a831fb05f..694ac585505 100644 --- a/src/coreComponents/functions/FunctionBase.cpp +++ b/src/coreComponents/functions/FunctionBase.cpp @@ -18,6 +18,7 @@ */ #include "FunctionBase.hpp" +#include "common/MpiWrapper.hpp" namespace geos { @@ -81,6 +82,12 @@ void FunctionBase::setOutputDirectory( string const & dir ) { string & outputDirectory = const_cast< string & >( getOutputDirectory() ); outputDirectory = dir; + + if( MpiWrapper::commRank( MPI_COMM_GEOS ) == 0 ) + { + makeDirsForPath( dir ); + } + MpiWrapper::barrier( MPI_COMM_GEOS ); } From 55fb7db1c20290253a6796fb30a255a7d2940c6c Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Wed, 5 Feb 2025 17:52:18 +0100 Subject: [PATCH 2/8] =?UTF-8?q?=E2=9C=A8=20Added=20ability=20to=20output?= =?UTF-8?q?=20any=20TableFunction=20in=20log=20/=20CSV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/coreComponents/functions/CMakeLists.txt | 1 + .../functions/LogLevelsInfo.hpp | 50 +++++++++++++++++++ .../functions/TableFunction.cpp | 19 +++++++ .../functions/TableFunction.hpp | 10 +++- 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/coreComponents/functions/LogLevelsInfo.hpp diff --git a/src/coreComponents/functions/CMakeLists.txt b/src/coreComponents/functions/CMakeLists.txt index 8fb39ce419d..b3869114d73 100644 --- a/src/coreComponents/functions/CMakeLists.txt +++ b/src/coreComponents/functions/CMakeLists.txt @@ -23,6 +23,7 @@ Contains classes for storing and computing arbitrary N-dimensional functions. set( functions_headers FunctionBase.hpp FunctionManager.hpp + LogLevelsInfo.hpp TableFunction.hpp ) diff --git a/src/coreComponents/functions/LogLevelsInfo.hpp b/src/coreComponents/functions/LogLevelsInfo.hpp new file mode 100644 index 00000000000..021f81dd77d --- /dev/null +++ b/src/coreComponents/functions/LogLevelsInfo.hpp @@ -0,0 +1,50 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file LogLevelsInfo.hpp + * This file contains common log level informations for physics solvers + */ + +#ifndef GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP +#define GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP + +#include "common/DataTypes.hpp" + +namespace geos +{ + +namespace logInfo +{ + +/// @cond DO_NOT_DOCUMENT + +struct TableDataOutput +{ + static constexpr int getMinLogLevel() { return 1; } + static constexpr std::string_view getDescription() + { + return "Output the loaded/computed table data in the log if succinct enough," + " otherwise output it in a CSV file."; + } +}; + +/// @endcond + +} + +} + +#endif // GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index 3fc62833d41..834c9ded069 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -18,8 +18,10 @@ */ #include "TableFunction.hpp" +#include "LogLevelsInfo.hpp" #include "codingUtilities/Parsing.hpp" #include "common/DataTypes.hpp" +#include "common/MpiWrapper.hpp" #include @@ -57,6 +59,14 @@ TableFunction::TableFunction( const string & name, setInputFlag( InputFlags::OPTIONAL ). setDescription( "Interpolation method. Valid options:\n* " + EnumStrings< InterpolationType >::concat( "\n* " ) ). setApplyDefaultValue( m_interpolationMethod ); + + registerWrapper( viewKeyStruct::writeCSVFlagString(), &m_writeCSV ). + setApplyDefaultValue( 0 ). + setInputFlag( InputFlags::OPTIONAL ). + setRestartFlags( RestartFlags::NO_WRITE ). + setDescription( "When set to 1, write the table into a CSV file" ); + + addLogLevel< logInfo::TableDataOutput >(); } void TableFunction::readFile( string const & filename, array1d< real64 > & target ) @@ -283,6 +293,15 @@ void TableFunction::outputPVTTableData( OutputOptions const pvtOutputOpts ) cons } } +void TableFunction::initializePostSubGroups() +{ + // Output user defined tables (not generated PVT tables) + outputTableData( OutputOptions{ + m_writeCSV, // writeCSV + isLogLevelEnabled< logInfo::TableDataOutput >() // writeInLog + } ); +} + template<> string TableCSVFormatter::toString< TableFunction >( TableFunction const & tableFunction ) const { diff --git a/src/coreComponents/functions/TableFunction.hpp b/src/coreComponents/functions/TableFunction.hpp index b7be867d123..906211b7b86 100644 --- a/src/coreComponents/functions/TableFunction.hpp +++ b/src/coreComponents/functions/TableFunction.hpp @@ -51,9 +51,9 @@ class TableFunction : public FunctionBase /// Struct containing output options struct OutputOptions { - /// Output PVT in CSV file + /// Request table output in CSV file bool writeCSV; - /// Output PVT in log + /// Request table output in log bool writeInLog; }; @@ -218,6 +218,8 @@ class TableFunction : public FunctionBase */ void reInitializeFunction(); + void initializePostSubGroups() override; + /** * @brief Method to evaluate a function on a target object * @param group a pointer to the object holding the function arguments @@ -361,6 +363,8 @@ class TableFunction : public FunctionBase static constexpr char const * coordinateFilesString() { return "coordinateFiles"; } /// @return Key for name of file containing table values static constexpr char const * voxelFileString() { return "voxelFile"; } + /// @return Key for name of file containing table values + static constexpr char const * writeCSVFlagString() { return "writeCSV"; } }; private: @@ -401,6 +405,8 @@ class TableFunction : public FunctionBase /// Kernel wrapper object used in evaluate() interface KernelWrapper m_kernelWrapper; + /// Output table in a CSV file + integer m_writeCSV; }; /// @cond DO_NOT_DOCUMENT template< typename IN_ARRAY > From 8d68c374d70e0a452056bb08d68d16af31c0e613 Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Wed, 5 Feb 2025 17:54:43 +0100 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=90=9B=20Properly=20ensure=20we=20onl?= =?UTF-8?q?y=20output=20from=20rank=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fluid/multifluid/CO2Brine/CO2BrineFluid.cpp | 6 +++--- .../fluid/multifluid/reactive/ReactiveBrineFluid.cpp | 2 +- src/coreComponents/functions/TableFunction.cpp | 12 ++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp index ee6b5482a92..ed47fd04117 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp @@ -333,7 +333,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() bool const isClone = this->isClone(); TableFunction::OutputOptions const pvtOutputOpts = { !isClone && m_writeCSV,// writeCSV - !isClone && (getLogLevel() > 0 && logger::internal::rank==0), // writeInLog + !isClone && getLogLevel() > 0, // writeInLog }; m_phase1 = std::make_unique< PHASE1 >( getName() + "_phaseModel1", @@ -369,7 +369,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() { TableFunction::OutputOptions const flashOutputOpts = { !isClone && m_writeCSV,// writeCSV - !isClone && (getLogLevel() > 0 && logger::internal::rank==0), // writeInLog + !isClone && getLogLevel() > 0, // writeInLog }; m_flash = std::make_unique< FLASH >( getName() + '_' + FLASH::catalogName(), strs, @@ -415,7 +415,7 @@ void CO2BrineFluid< PHASE1, PHASE2, FLASH >::createPVTModels() TableFunction::OutputOptions const flashOutputOpts = { !isClone && m_writeCSV,// writeCSV - !isClone && (getLogLevel() >= 0 && logger::internal::rank==0), // writeInLog + !isClone && getLogLevel() > 0, // writeInLog }; m_flash = std::make_unique< FLASH >( getName() + '_' + FLASH::catalogName(), diff --git a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp index 7451008cd6c..1050f7b7c1c 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp @@ -203,7 +203,7 @@ void ReactiveBrineFluid< PHASE > ::createPVTModels() bool const isClone = this->isClone(); TableFunction::OutputOptions const pvtOutputOpts = { !isClone && m_writeCSV,// writeCSV - !isClone && (getLogLevel() >= 0 && logger::internal::rank==0), // writeInLog + !isClone && getLogLevel() >= 0, // writeInLog }; // then, we are ready to instantiate the phase models diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index 834c9ded069..f25be6db505 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -276,18 +276,22 @@ void collectValues( std::ostringstream & formatterStream, void TableFunction::outputPVTTableData( OutputOptions const pvtOutputOpts ) const { + // we only output from rank 0 + if( MpiWrapper::commRank() != 0 ) + return; + if( pvtOutputOpts.writeInLog && this->numDimensions() <= 2 ) { TableTextFormatter textFormatter; - GEOS_LOG_RANK_0( textFormatter.toString( *this )); + GEOS_LOG( textFormatter.toString( *this )); } if( pvtOutputOpts.writeCSV || ( pvtOutputOpts.writeInLog && this->numDimensions() >= 3 ) ) { string const filename = this->getName(); std::ofstream logStream( joinPath( FunctionBase::getOutputDirectory(), filename + ".csv" ) ); - GEOS_LOG_RANK_0( GEOS_FMT( "CSV Generated to {}/{}.csv \n", - FunctionBase::getOutputDirectory(), - filename )); + GEOS_LOG( GEOS_FMT( "CSV Generated to {}/{}.csv \n", + FunctionBase::getOutputDirectory(), + filename )); TableCSVFormatter csvFormatter; logStream << csvFormatter.toString( *this ); } From 3b6e6f05ec5722e21663f0395ef35b4342ecb71f Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Wed, 5 Feb 2025 17:55:22 +0100 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=93=9D=20clearer=20writeCSV=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp | 2 +- .../fluid/multifluid/reactive/ReactiveBrineFluid.cpp | 2 +- src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp | 2 +- .../physicsSolvers/fluidFlow/wells/WellSolverBase.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp index ed47fd04117..a9d5b5e1a8f 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/CO2BrineFluid.cpp @@ -106,7 +106,7 @@ CO2BrineFluid( string const & name, Group * const parent ): this->registerWrapper( viewKeyStruct::writeCSVFlagString(), &m_writeCSV ). setInputFlag( InputFlags::OPTIONAL ). setRestartFlags( RestartFlags::NO_WRITE ). - setDescription( "Write PVT tables into a CSV file" ). + setDescription( "When set to 1, write PVT tables into a CSV file" ). setDefaultValue( 0 ); // if this is a thermal model, we need to make sure that the arrays will be properly displayed and saved to restart diff --git a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp index 1050f7b7c1c..4fe4dfd2271 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/reactive/ReactiveBrineFluid.cpp @@ -74,7 +74,7 @@ ReactiveBrineFluid( string const & name, Group * const parent ): setApplyDefaultValue( 0 ). setInputFlag( InputFlags::OPTIONAL ). setRestartFlags( RestartFlags::NO_WRITE ). - setDescription( "Write PVT tables into a CSV file" ); + setDescription( "When set to 1, write PVT tables into a CSV file" ); // if this is a thermal model, we need to make sure that the arrays will be properly displayed and saved to restart if( isThermal() ) diff --git a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp index c2516decb26..8ee9c4052ea 100644 --- a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp +++ b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp @@ -60,7 +60,7 @@ class FieldStatisticsBase : public TaskBase this->registerWrapper( viewKeyStruct::writeCSVFlagString(), &m_writeCSV ). setApplyDefaultValue( 0 ). setInputFlag( dataRepository::InputFlags::OPTIONAL ). - setDescription( "Write statistics into a CSV file" ); + setDescription( "When set to 1, write the statistics into a CSV file" ); } /** diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index 1b7ed01bb4e..a70d97191ee 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -59,7 +59,7 @@ WellSolverBase::WellSolverBase( string const & name, this->registerWrapper( viewKeyStruct::writeCSVFlagString(), &m_writeCSV ). setApplyDefaultValue( 0 ). setInputFlag( dataRepository::InputFlags::OPTIONAL ). - setDescription( "Write rates into a CSV file" ); + setDescription( "When set to 1, write the rates into a CSV file" ); addLogLevel< logInfo::WellControl >(); addLogLevel< logInfo::Crossflow >(); From be7c981f2d4bc0fe814c0e0f91c2b062f1a68933 Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Wed, 5 Feb 2025 17:56:57 +0100 Subject: [PATCH 5/8] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor=20a=20bit=20t?= =?UTF-8?q?able=20header=20&=20code=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../functions/TableFunction.cpp | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index f25be6db505..7f3b6518435 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -341,6 +341,7 @@ string TableCSVFormatter::toString< TableFunction >( TableFunction const & table template<> string TableTextFormatter::toString< TableFunction >( TableFunction const & tableFunction ) const { + static constexpr integer maxRows = 500; ArrayOfArraysView< real64 const > coordinates = tableFunction.getCoordinates(); units::Unit const valueUnit = tableFunction.getValueUnit(); arrayView1d< real64 const > const values = tableFunction.getValues(); @@ -348,9 +349,7 @@ string TableTextFormatter::toString< TableFunction >( TableFunction const & tabl std::string_view filename = tableFunction.getName(); string logOutput; - GEOS_LOG_RANK_0( GEOS_FMT( "Values in the table are represented by : {}", units::getDescription( valueUnit ))); - - if( numDimensions == 1 ) + if( numDimensions == 1 && coordinates[0].size() < maxRows ) { TableData tableData; arraySlice1d< real64 const > const coords = coordinates[0]; @@ -365,31 +364,28 @@ string TableTextFormatter::toString< TableFunction >( TableFunction const & tabl TableTextFormatter const logTable( tableLayout ); logOutput = logTable.toString( tableData ); } - else if( numDimensions == 2 ) + else if( numDimensions == 2 && ( coordinates[0].size() * coordinates[1].size() ) < maxRows ) { - integer const nX = coordinates[0].size(); - integer const nY = coordinates[1].size(); - if( nX * nY <= 500 ) - { - TableData2D tableData2D; - TableData2D::TableDataHolder tableConverted; - tableConverted = tableData2D.convertTable2D( values, - valueUnit, - coordinates, - units::getDescription( tableFunction.getDimUnit( 0 ) ), - units::getDescription( tableFunction.getDimUnit( 1 ) )); - - TableLayout const tableLayout( filename, tableConverted.headerNames ); - TableTextFormatter const table2DLog( tableLayout ); - logOutput = table2DLog.toString( tableConverted.tableData ); - } - else - { - string const log = GEOS_FMT( "The {} PVT table exceeding 500 rows.\nTo visualize the tables, go to the generated csv", filename ); - TableLayout const tableLayoutInfos( filename, {log} ); - TableTextFormatter const tableLog( tableLayoutInfos ); - logOutput = tableLog.toString(); - } + TableData2D tableData2D; + TableData2D::TableDataHolder tableConverted; + tableConverted = tableData2D.convertTable2D( values, + valueUnit, + coordinates, + units::getDescription( tableFunction.getDimUnit( 0 ) ), + units::getDescription( tableFunction.getDimUnit( 1 ) )); + + TableLayout const tableLayout( filename, tableConverted.headerNames ); + TableTextFormatter const table2DLog( tableLayout ); + logOutput = table2DLog.toString( tableConverted.tableData ); + } + else + { + string const tooLongOutputMsg = GEOS_FMT( "The {} table is too heavy for log output.\n" + "To visualize the table, please refer to the generated csv.", + filename, maxRows ); + TableLayout const tableLayoutInfos( filename, {tooLongOutputMsg} ); + TableTextFormatter const tableLog( tableLayoutInfos ); + logOutput = tableLog.toString(); } return logOutput; } From 6814ec8862b2d5ffb31b32915c52029c9b95bb3a Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Thu, 6 Feb 2025 10:18:21 +0100 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=8E=A8=20=F0=9F=90=9B=20bug=20&=20nam?= =?UTF-8?q?e=20fix=20(removing=20any=20pvt=20concept=20from=20TableFunctio?= =?UTF-8?q?n)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multifluid/CO2Brine/functions/BrineEnthalpy.cpp | 4 ++-- .../multifluid/CO2Brine/functions/CO2Enthalpy.cpp | 4 ++-- .../multifluid/CO2Brine/functions/CO2Solubility.cpp | 4 ++-- .../CO2Brine/functions/EzrokhiBrineDensity.cpp | 4 ++-- .../CO2Brine/functions/EzrokhiBrineViscosity.cpp | 2 +- .../CO2Brine/functions/FenghourCO2Viscosity.cpp | 2 +- .../CO2Brine/functions/PhillipsBrineDensity.cpp | 2 +- .../CO2Brine/functions/PhillipsBrineViscosity.cpp | 2 +- .../CO2Brine/functions/SpanWagnerCO2Density.cpp | 2 +- .../multifluid/CO2Brine/functions/WaterDensity.cpp | 2 +- src/coreComponents/functions/TableFunction.cpp | 10 +++++----- src/coreComponents/functions/TableFunction.hpp | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/BrineEnthalpy.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/BrineEnthalpy.cpp index 27eb1053d38..41008529fe3 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/BrineEnthalpy.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/BrineEnthalpy.cpp @@ -206,8 +206,8 @@ BrineEnthalpy::BrineEnthalpy( string const & name, m_CO2EnthalpyTable = makeCO2EnthalpyTable( inputParams, m_functionName, FunctionManager::getInstance() ); m_brineEnthalpyTable = makeBrineEnthalpyTable( inputParams, m_functionName, FunctionManager::getInstance() ); - m_CO2EnthalpyTable->outputPVTTableData( pvtOutputOpts ); - m_brineEnthalpyTable->outputPVTTableData( pvtOutputOpts ); + m_CO2EnthalpyTable->outputTableData( pvtOutputOpts ); + m_brineEnthalpyTable->outputTableData( pvtOutputOpts ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Enthalpy.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Enthalpy.cpp index 90de88580bf..40ffcd5cd8b 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Enthalpy.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Enthalpy.cpp @@ -267,8 +267,8 @@ CO2Enthalpy::CO2Enthalpy( string const & name, m_CO2EnthalpyTable = makeCO2EnthalpyTable( inputParams, m_functionName, FunctionManager::getInstance() ); - m_CO2EnthalpyTable->outputPVTTableData( pvtOutputOpts ); - m_CO2EnthalpyTable->outputPVTTableData( pvtOutputOpts ); + m_CO2EnthalpyTable->outputTableData( pvtOutputOpts ); + m_CO2EnthalpyTable->outputTableData( pvtOutputOpts ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp index f3946b7bc0d..65c1b219484 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/CO2Solubility.cpp @@ -257,8 +257,8 @@ CO2Solubility::CO2Solubility( string const & name, std::tie( m_CO2SolubilityTable, m_WaterVapourisationTable ) = makeSolubilityTables( m_modelName, inputParams, solubilityModel ); - m_CO2SolubilityTable->outputPVTTableData( pvtOutputOpts ); - m_WaterVapourisationTable->outputPVTTableData( pvtOutputOpts ); + m_CO2SolubilityTable->outputTableData( pvtOutputOpts ); + m_WaterVapourisationTable->outputTableData( pvtOutputOpts ); } diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.cpp index d35b2c040f5..6f2b3caf5b8 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineDensity.cpp @@ -53,8 +53,8 @@ EzrokhiBrineDensity::EzrokhiBrineDensity( string const & name, m_waterSatDensityTable = PureWaterProperties::makeSaturationDensityTable( m_functionName, FunctionManager::getInstance() ); m_waterSatPressureTable = PureWaterProperties::makeSaturationPressureTable( m_functionName, FunctionManager::getInstance() ); - m_waterSatPressureTable->outputPVTTableData( pvtOutputOpts ); - m_waterSatDensityTable->outputPVTTableData( pvtOutputOpts ); + m_waterSatPressureTable->outputTableData( pvtOutputOpts ); + m_waterSatDensityTable->outputTableData( pvtOutputOpts ); } void EzrokhiBrineDensity::makeCoefficients( string_array const & inputPara ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.cpp index 65976e0d0d9..605ede35515 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/EzrokhiBrineViscosity.cpp @@ -52,7 +52,7 @@ EzrokhiBrineViscosity::EzrokhiBrineViscosity( string const & name, makeCoefficients( inputPara ); m_waterViscosityTable = PureWaterProperties::makeSaturationViscosityTable( m_functionName, FunctionManager::getInstance() ); - m_waterViscosityTable->outputPVTTableData( pvtOutputOpts ); + m_waterViscosityTable->outputTableData( pvtOutputOpts ); } void EzrokhiBrineViscosity::makeCoefficients( string_array const & inputPara ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.cpp index 9664a1b3ec4..da161b99874 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/FenghourCO2Viscosity.cpp @@ -149,7 +149,7 @@ FenghourCO2Viscosity::FenghourCO2Viscosity( string const & name, { m_CO2ViscosityTable = makeViscosityTable( inputParams, m_functionName, FunctionManager::getInstance() ); - m_CO2ViscosityTable->outputPVTTableData( pvtOutputOpts ); + m_CO2ViscosityTable->outputTableData( pvtOutputOpts ); } void FenghourCO2Viscosity::checkTablesParameters( real64 const pressure, diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.cpp index de646696998..02b7f42dd0a 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineDensity.cpp @@ -190,7 +190,7 @@ PhillipsBrineDensity::PhillipsBrineDensity( string const & name, m_brineDensityTable = makeDensityTable( inputParams, m_functionName, FunctionManager::getInstance() ); - m_brineDensityTable->outputPVTTableData( pvtOutputOpts ); + m_brineDensityTable->outputTableData( pvtOutputOpts ); } PhillipsBrineDensity::KernelWrapper diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.cpp index a38a58cc664..6ab93100f47 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/PhillipsBrineViscosity.cpp @@ -45,7 +45,7 @@ PhillipsBrineViscosity::PhillipsBrineViscosity( string const & name, m_waterViscosityTable = PureWaterProperties::makeSaturationViscosityTable( m_functionName, FunctionManager::getInstance() ); makeCoefficients( inputPara ); - m_waterViscosityTable->outputPVTTableData( pvtOutputOpts ); + m_waterViscosityTable->outputTableData( pvtOutputOpts ); } void PhillipsBrineViscosity::makeCoefficients( string_array const & inputPara ) diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.cpp index d2922a6a174..554118fe552 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/SpanWagnerCO2Density.cpp @@ -289,7 +289,7 @@ SpanWagnerCO2Density::SpanWagnerCO2Density( string const & name, m_CO2DensityTable = makeDensityTable( inputParams, m_functionName, FunctionManager::getInstance() ); - m_CO2DensityTable->outputPVTTableData( pvtOutputOpts ); + m_CO2DensityTable->outputTableData( pvtOutputOpts ); } void SpanWagnerCO2Density::checkTablesParameters( real64 const pressure, diff --git a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/WaterDensity.cpp b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/WaterDensity.cpp index bcfccaf9754..5d8827423db 100644 --- a/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/WaterDensity.cpp +++ b/src/coreComponents/constitutive/fluid/multifluid/CO2Brine/functions/WaterDensity.cpp @@ -45,7 +45,7 @@ WaterDensity::WaterDensity( string const & name, GEOS_UNUSED_VAR( inputParams ); m_waterDensityTable = PureWaterProperties::makeSaturationDensityTable( m_functionName, FunctionManager::getInstance() ); - m_waterDensityTable->outputPVTTableData( pvtOutputOpts ); + m_waterDensityTable->outputTableData( pvtOutputOpts ); } void WaterDensity::checkTablesParameters( real64 const pressure, diff --git a/src/coreComponents/functions/TableFunction.cpp b/src/coreComponents/functions/TableFunction.cpp index 7f3b6518435..647670a17de 100644 --- a/src/coreComponents/functions/TableFunction.cpp +++ b/src/coreComponents/functions/TableFunction.cpp @@ -274,18 +274,18 @@ void collectValues( std::ostringstream & formatterStream, } } -void TableFunction::outputPVTTableData( OutputOptions const pvtOutputOpts ) const +void TableFunction::outputTableData( OutputOptions const outputOpts ) const { // we only output from rank 0 if( MpiWrapper::commRank() != 0 ) return; - if( pvtOutputOpts.writeInLog && this->numDimensions() <= 2 ) + if( outputOpts.writeInLog && this->numDimensions() <= 2 ) { TableTextFormatter textFormatter; GEOS_LOG( textFormatter.toString( *this )); } - if( pvtOutputOpts.writeCSV || ( pvtOutputOpts.writeInLog && this->numDimensions() >= 3 ) ) + if( outputOpts.writeCSV || ( outputOpts.writeInLog && this->numDimensions() >= 3 ) ) { string const filename = this->getName(); std::ofstream logStream( joinPath( FunctionBase::getOutputDirectory(), filename + ".csv" ) ); @@ -301,8 +301,8 @@ void TableFunction::initializePostSubGroups() { // Output user defined tables (not generated PVT tables) outputTableData( OutputOptions{ - m_writeCSV, // writeCSV - isLogLevelEnabled< logInfo::TableDataOutput >() // writeInLog + m_writeCSV != 0, // writeCSV + isLogLevelActive< logInfo::TableDataOutput >( getLogLevel() ) // writeInLog } ); } diff --git a/src/coreComponents/functions/TableFunction.hpp b/src/coreComponents/functions/TableFunction.hpp index 906211b7b86..964d8902baf 100644 --- a/src/coreComponents/functions/TableFunction.hpp +++ b/src/coreComponents/functions/TableFunction.hpp @@ -342,7 +342,7 @@ class TableFunction : public FunctionBase * @brief Print the table(s) in the log and/or CSV files when requested by the user. * @param pvtOutputOpts Struct containing output options */ - void outputPVTTableData( OutputOptions const pvtOutputOpts ) const; + void outputTableData( OutputOptions const outputOpts ) const; /** * @brief Create an instance of the kernel wrapper From 34ed7670ee862336fccdbe50fd18b53059f146a2 Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Thu, 6 Feb 2025 10:19:39 +0100 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=93=9D=20Clarifying=20a=20bit=20getLo?= =?UTF-8?q?gLevel()=20documentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/coreComponents/dataRepository/Group.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreComponents/dataRepository/Group.hpp b/src/coreComponents/dataRepository/Group.hpp index 627e0fd4e6f..12e2d2890ac 100644 --- a/src/coreComponents/dataRepository/Group.hpp +++ b/src/coreComponents/dataRepository/Group.hpp @@ -1503,8 +1503,13 @@ class Group */ void setLogLevel( integer const logLevel ) { m_logLevel = logLevel; } - /// @return The verbosity level + /** + * @return The verbosity level of the Group instance. + * @warning For logging activation, *Please use `isLogLevelActive< logInfo::yourInfo >( getLogLevel() )`* + * to be sure to document to the user what the Group is able to output. + */ integer getLogLevel() const { return m_logLevel; } + ///@} /** From 28965f50bfeb4ce22555247924757a0414357e65 Mon Sep 17 00:00:00 2001 From: MelReyCG Date: Thu, 6 Feb 2025 12:00:48 +0100 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=93=A6=20our=20favorite=20generated?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/coreComponents/schema/schema.xsd | 140 +++++++++++++++++---- src/coreComponents/schema/schema.xsd.other | 29 +++-- 2 files changed, 138 insertions(+), 31 deletions(-) diff --git a/src/coreComponents/schema/schema.xsd b/src/coreComponents/schema/schema.xsd index 87f70867a1e..70a43826bc9 100644 --- a/src/coreComponents/schema/schema.xsd +++ b/src/coreComponents/schema/schema.xsd @@ -395,6 +395,10 @@ + + + + @@ -521,6 +525,10 @@ + + + + @@ -1434,10 +1442,17 @@ stress - traction is applied to the faces as specified by the inner product of i * upper * lower--> + + + + @@ -1849,6 +1864,8 @@ stress - traction is applied to the faces as specified by the inner product of i + + @@ -2302,6 +2319,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m + @@ -2625,6 +2643,8 @@ Level 0 outputs no specific information for this solver. Higher levels require m + + @@ -2671,7 +2691,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + @@ -2692,8 +2712,6 @@ Level 0 outputs no specific information for this solver. Higher levels require m - - @@ -2708,7 +2726,12 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + + + + + + @@ -2765,8 +2788,6 @@ Level 0 outputs no specific information for this solver. Higher levels require m - - @@ -2781,8 +2802,6 @@ Level 0 outputs no specific information for this solver. Higher levels require m - - @@ -2922,7 +2941,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + @@ -3506,6 +3525,51 @@ Level 0 outputs no specific information for this solver. Higher levels require m + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4323,7 +4387,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + @@ -4343,6 +4407,10 @@ Level 0 outputs no specific information for this solver. Higher levels require m + + + + + + + + + + + + + + + + @@ -4797,6 +4877,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m + @@ -4852,7 +4933,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + @@ -4860,6 +4941,19 @@ Level 0 outputs no specific information for this solver. Higher levels require m + + + + + + + + + + @@ -5030,7 +5124,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m 1 - Print statistics--> - + @@ -5058,7 +5152,7 @@ Level 0 outputs no specific information for this solver. Higher levels require m - + @@ -5071,13 +5165,13 @@ Level 0 outputs no specific information for this solver. Higher levels require m + - Print statistics for each source flux in each regions--> - + @@ -5326,7 +5420,7 @@ The expected format is "{ waterMax, oilMax }", in that order--> - + @@ -5348,7 +5442,7 @@ The expected format is "{ waterMax, oilMax }", in that order--> - + @@ -5370,7 +5464,7 @@ The expected format is "{ waterMax, oilMax }", in that order--> - + @@ -5392,7 +5486,7 @@ The expected format is "{ waterMax, oilMax }", in that order--> - + @@ -6470,7 +6564,7 @@ If you want to do a three-phase simulation, please use instead wettingIntermedia - + @@ -6486,7 +6580,7 @@ If you want to do a three-phase simulation, please use instead wettingIntermedia - + diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index bdfbfbec836..7f81ad2a092 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -537,6 +537,7 @@ + @@ -929,7 +930,7 @@ - + @@ -940,7 +941,7 @@ - + @@ -990,11 +991,7 @@ - - - - @@ -1005,7 +1002,7 @@ - + @@ -1018,10 +1015,24 @@ - + + + + + + + + + + + + + + + @@ -1445,6 +1456,7 @@ + @@ -1475,6 +1487,7 @@ +