Corrected simlation name default if not specified on command line;

Default log level changed to info and flush only enabled when debug or trace are enabled;
This commit is contained in:
josh bowden 2023-09-25 21:03:34 +02:00
parent c7c4bffa7c
commit 11a81211bd
3 changed files with 12 additions and 10 deletions

View File

@ -427,7 +427,7 @@ struct DamarisSharedMemeorySizeBytes<TypeTag, TTag::EclBaseProblem> {
};
template<class TypeTag>
struct DamarisLogLevel<TypeTag, TTag::EclBaseProblem> {
static constexpr auto value = "trace";
static constexpr auto value = "info";
};
#endif

View File

@ -120,7 +120,7 @@ DamarisKeywords(MPI_Comm comm, std::string OutputDir)
std::string disableParaviewXMLfin("--") ;
// Test if input Python file exists and set the name of the script for <variable ... script="" > )XML elements
std::string publishToPython_str("") ;
std::string publishToPython_str("#") ;
if (pythonFilename != ""){
if (FileExists(pythonFilename, comm, rank)) {
publishToPython_str="PythonScript" ; // the name of the PyScript XML element
@ -169,14 +169,14 @@ DamarisKeywords(MPI_Comm comm, std::string OutputDir)
// and when one sim finishes it removes its shmem file.
// simName_str = damaris::Environment::GetMagicNumber(comm) ;
if (simName_str == "") {
// We will add a random value as GetMagicNumber(comm) requires latest Damaris
// We will add a random value as GetMagicNumber(comm) requires Damaris v1.9.3
// Seed with a real random value, if available
std::random_device r;
// Choose a random number between 0 and MAX_INT
std::default_random_engine e1(r());
std::uniform_int_distribution<int> uniform_dist(0, std::numeric_limits<int>::max());
int rand_int = uniform_dist(e1);
simName_str = std::to_string(rand_int) ;
simName_str = "opm-flow-" + std::to_string(rand_int) ;
} else {
simName_str = "opm-flow-" + simName_str ;
}
@ -210,9 +210,10 @@ DamarisKeywords(MPI_Comm comm, std::string OutputDir)
}
std::string logLevel_str(damarisLogLevel) ;
// _MAKE_AVAILABLE_IN_PYTHON_
// _PYTHON_SCRIPT_
std::string logFlush_str("false") ;
if ((logLevel_str == "debug") || (logLevel_str == "trace") ) {
logFlush_str = "true" ;
}
std::map<std::string, std::string> damaris_keywords = {
{"_SHMEM_BUFFER_BYTES_REGEX_", shmemSizeBytes_str},
@ -228,6 +229,7 @@ DamarisKeywords(MPI_Comm comm, std::string OutputDir)
{"_MAKE_AVAILABLE_IN_PYTHON_",publishToPython_str}, /* must match <pyscript name="PythonScript" */
{"_SIM_NAME_",simName_str},
{"_LOG_LEVEL_",logLevel_str},
{"_LOG_FLUSH_",logFlush_str},
{"_DISABLEPYTHONSTART_",disablePythonXMLstart},
{"_DISABLEPYTHONFIN_",disablePythonXMLfin},
{"_DISABLEPARAVIEWSTART_",disableParaviewXMLstart},

View File

@ -52,10 +52,10 @@ std::string initDamarisXmlFile()
<layout name="zonal_layout_usmesh_integer" type="int" dimensions="n_elements_local" global="n_elements_total" comment="For the field data e.g. Pressure" />
<variable name="GLOBAL_CELL_INDEX" layout="zonal_layout_usmesh_integer" type="scalar" visualizable="false" time-varying="false" centering="zonal" />
<layout name="zonal_layout_usmesh" type="double" dimensions="n_elements_local" global="n_elements_total" comment="For the field data e.g. Pressure" />
<variable name="PRESSURE" layout="zonal_layout_usmesh" type="scalar" visualizable="true" mesh="us_mesh" unit="_PRESSURE_UNIT_" centering="zonal" select-file="GLOBAL_CELL_INDEX" store="_MYSTORE_OR_EMPTY_REGEX_" script="PythonScript" />
<variable name="PRESSURE" layout="zonal_layout_usmesh" type="scalar" visualizable="true" mesh="us_mesh" unit="_PRESSURE_UNIT_" centering="zonal" select-file="GLOBAL_CELL_INDEX" store="_MYSTORE_OR_EMPTY_REGEX_" script="_MAKE_AVAILABLE_IN_PYTHON_" />
_MORE_VARIABLES_REGEX_
<variable name="MPI_RANK" layout="zonal_layout_usmesh_integer" type="scalar" visualizable="true" mesh="us_mesh" unit="rank" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" time-varying="false" select-file="GLOBAL_CELL_INDEX" script="PythonScript" comment="The MPI rank of each cell"/>
<variable name="MPI_RANK" layout="zonal_layout_usmesh_integer" type="scalar" visualizable="true" mesh="us_mesh" unit="rank" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" time-varying="false" select-file="GLOBAL_CELL_INDEX" script="_MAKE_AVAILABLE_IN_PYTHON_" comment="The MPI rank of each cell"/>
<variable name="KRNSW_GO" layout="zonal_layout_usmesh" type="scalar" visualizable="true" mesh="#" unit="" centering="zonal" time-varying="true" select-file="GLOBAL_CELL_INDEX" store="#" script="#" />
<variable name="KRNSW_OW" layout="zonal_layout_usmesh" type="scalar" visualizable="true" mesh="#" unit="" centering="zonal" time-varying="true" select-file="GLOBAL_CELL_INDEX" store="#" script="#" />
@ -161,7 +161,7 @@ std::string initDamarisXmlFile()
<actions>
</actions>
<log FileName="_PATH_REGEX_/damaris_log/_SIM_NAME_" RotationSize="5" LogFormat="[%TimeStamp%]: %Message%" Flush="false" LogLevel="_LOG_LEVEL_" />
<log FileName="_PATH_REGEX_/damaris_log/_SIM_NAME_" RotationSize="5" LogFormat="[%TimeStamp%]: %Message%" Flush="_LOG_FLUSH_" LogLevel="_LOG_LEVEL_" />
</simulation>)V0G0N";