mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Move XML template to separate file, fix formatting, and use path.
This commit is contained in:
parent
fd1d1d15a4
commit
76bacff3cf
@ -111,6 +111,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
if (DAMARIS_FOUND)
|
||||
list (APPEND MAIN_SOURCE_FILES opm/simulators/utils/DamarisOutputModule.cpp)
|
||||
list (APPEND MAIN_SOURCE_FILES opm/simulators/utils/DamarisKeywords.cpp)
|
||||
list (APPEND MAIN_SOURCE_FILES opm/simulators/utils/initDamarisXMLFile.cpp)
|
||||
endif()
|
||||
if(CUDA_FOUND)
|
||||
list (APPEND MAIN_SOURCE_FILES opm/simulators/linalg/bda/cuda/cusparseSolverBackend.cu)
|
||||
|
@ -25,64 +25,19 @@
|
||||
#include <opm/simulators/utils/DamarisOutputModule.hpp>
|
||||
#include <opm/simulators/utils/DamarisKeywords.hpp>
|
||||
#include <opm/simulators/utils/ParallelCommunication.hpp>
|
||||
/*
|
||||
Below is the XML file for Damaris that is supported by Damaris.
|
||||
|
||||
The entries in the map below will be filled by corresponding Damaris
|
||||
Keywords.
|
||||
*/
|
||||
|
||||
namespace Opm::DamarisOutput
|
||||
{
|
||||
|
||||
std::string initDamarisXmlFile()
|
||||
{
|
||||
std::string init_damaris = R"V0G0N(<?xml version="1.0"?>
|
||||
<simulation name="opm-flow" language="c"
|
||||
xmlns="http://damaris.gforge.inria.fr/damaris/model">
|
||||
<architecture>
|
||||
<domains count="1"/>
|
||||
<dedicated cores="_DC_REGEX_" nodes="_DN_REGEX_"/>
|
||||
<buffer name="buffer" size="_SHMEM_BUFFER_BYTES_REGEX_" />
|
||||
<placement />
|
||||
<queue name="queue" size="300" />
|
||||
</architecture>
|
||||
<data>
|
||||
|
||||
<parameter name="n_elements_total" type="int" value="1" />
|
||||
<parameter name="n_elements_local" type="int" value="1" />
|
||||
<parameter name="n" type="int" value="1" />
|
||||
|
||||
<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="false" unit="Pa" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" />
|
||||
_MORE_VARIABLES_REGEX_
|
||||
</data>
|
||||
|
||||
<storage>
|
||||
<store name="MyStore" type="HDF5">
|
||||
<option key="FileMode">_File_Mode</option>
|
||||
<option key="XDMFMode">NoIteration</option>
|
||||
<option key="FilesPath">./</option>
|
||||
</store>
|
||||
</storage>
|
||||
|
||||
|
||||
<actions>
|
||||
</actions>
|
||||
std::string initDamarisXmlFile(); // Defined in initDamarisXMLFile.cpp, to avoid messing up this file.
|
||||
|
||||
<log FileName="_PATH_REGEX_/damaris_log/exa_dbg" RotationSize="5" LogFormat="[%TimeStamp%]: %Message%" Flush="True" LogLevel="debug" />
|
||||
|
||||
</simulation>)V0G0N";
|
||||
|
||||
return init_damaris;
|
||||
}
|
||||
|
||||
void initializeDamaris(MPI_Comm comm, int mpiRank, std::string OutputDir, bool enableAsyncDamarisOutput)
|
||||
void initializeDamaris(MPI_Comm comm, int mpiRank, std::string OutputDir, bool enableAsyncDamarisOutput)
|
||||
{
|
||||
// Prepare the XML file
|
||||
std::string damaris_config_xml = initDamarisXmlFile();
|
||||
damaris::model::ModifyModel myMod = damaris::model::ModifyModel(damaris_config_xml);
|
||||
// The map will make it precise the output directory and FileMode (either FilePerCore or Collective storage)
|
||||
damaris::model::ModifyModel myMod = damaris::model::ModifyModel(damaris_config_xml);
|
||||
// The map will make it precise the output directory and FileMode (either FilePerCore or Collective storage)
|
||||
// The map file find all occurences of the string in position 1 and repalce it/them with string in position 2
|
||||
std::map<std::string,std::string> find_replace_map = DamarisKeywords(OutputDir, enableAsyncDamarisOutput);
|
||||
myMod.RepalceWithRegEx(find_replace_map);
|
||||
@ -115,7 +70,7 @@ void initializeDamaris(MPI_Comm comm, int mpiRank, std::string OutputDir, bool e
|
||||
|
||||
}
|
||||
|
||||
void setupDamarisWritingPars(Parallel::Communication comm, const int n_elements_local_grid)
|
||||
void setupDamarisWritingPars(Parallel::Communication comm, const int n_elements_local_grid)
|
||||
{
|
||||
int damaris_err = DAMARIS_OK;
|
||||
|
||||
@ -139,7 +94,7 @@ void setupDamarisWritingPars(Parallel::Communication comm, const int n_elements_
|
||||
}
|
||||
|
||||
// find the global/total size
|
||||
unsigned long long n_elements_global_max = elements_rank_offsets[nranks-1] ;
|
||||
unsigned long long n_elements_global_max = elements_rank_offsets[nranks-1] ;
|
||||
n_elements_global_max += elements_rank_sizes[nranks-1] ; // add the last ranks size to the already accumulated offset values
|
||||
|
||||
if (rank == 0 ) {
|
||||
|
71
opm/simulators/utils/DamarisXMLTemplateString.cpp
Normal file
71
opm/simulators/utils/DamarisXMLTemplateString.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright 2022 KerData Research Team, Inria Rennes, Bretagne–Atlantique Research Center
|
||||
Copyright 2022 SINTEF Digital, Mathematics and Cybernetics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Opm::DamarisOutput
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
Below is the XML file for Damaris that is supported by Damaris.
|
||||
|
||||
The entries in the map below will be filled by corresponding Damaris
|
||||
Keywords.
|
||||
*/
|
||||
std::string initDamarisXmlFile()
|
||||
{
|
||||
std::string init_damaris = R"V0G0N(<?xml version="1.0"?>
|
||||
<simulation name="opm-flow" language="c" xmlns="http://damaris.gforge.inria.fr/damaris/model">
|
||||
<architecture>
|
||||
<domains count="1"/>
|
||||
<dedicated cores="_DC_REGEX_" nodes="_DN_REGEX_"/>
|
||||
<buffer name="buffer" size="_SHMEM_BUFFER_BYTES_REGEX_" />
|
||||
<placement />
|
||||
<queue name="queue" size="300" />
|
||||
</architecture>
|
||||
|
||||
<data>
|
||||
<parameter name="n_elements_total" type="int" value="1" />
|
||||
<parameter name="n_elements_local" type="int" value="1" />
|
||||
<parameter name="n" type="int" value="1" />
|
||||
|
||||
<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="false" unit="Pa" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" />
|
||||
_MORE_VARIABLES_REGEX_
|
||||
</data>
|
||||
|
||||
<storage>
|
||||
<store name="MyStore" type="HDF5">
|
||||
<option key="FileMode">_File_Mode</option>
|
||||
<option key="XDMFMode">NoIteration</option>
|
||||
<option key="FilesPath">./</option>
|
||||
</store>
|
||||
</storage>
|
||||
|
||||
<actions>
|
||||
</actions>
|
||||
|
||||
<log FileName="_PATH_REGEX_/damaris_log/exa_dbg" RotationSize="5" LogFormat="[%TimeStamp%]: %Message%" Flush="True" LogLevel="debug" />
|
||||
|
||||
</simulation>)V0G0N";
|
||||
|
||||
return init_damaris;
|
||||
}
|
||||
|
||||
} // namespace Opm::DamarisOutput
|
73
opm/simulators/utils/initDamarisXmlFile.cpp
Normal file
73
opm/simulators/utils/initDamarisXmlFile.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright 2022 KerData Research Team, Inria Rennes, Bretagne–Atlantique Research Center
|
||||
Copyright 2022 SINTEF Digital, Mathematics and Cybernetics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Opm::DamarisOutput
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
Below is the XML file for Damaris that is supported by Damaris.
|
||||
|
||||
The entries in the map below will be filled by corresponding Damaris
|
||||
Keywords.
|
||||
*/
|
||||
std::string initDamarisXmlFile()
|
||||
{
|
||||
std::string init_damaris = R"V0G0N(<?xml version="1.0"?>
|
||||
<simulation name="opm-flow" language="c" xmlns="http://damaris.gforge.inria.fr/damaris/model">
|
||||
<architecture>
|
||||
<domains count="1"/>
|
||||
<dedicated cores="_DC_REGEX_" nodes="_DN_REGEX_"/>
|
||||
<buffer name="buffer" size="_SHMEM_BUFFER_BYTES_REGEX_" />
|
||||
<placement />
|
||||
<queue name="queue" size="300" />
|
||||
</architecture>
|
||||
|
||||
<data>
|
||||
<parameter name="n_elements_total" type="int" value="1" />
|
||||
<parameter name="n_elements_local" type="int" value="1" />
|
||||
<parameter name="n" type="int" value="1" />
|
||||
|
||||
<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="false" unit="Pa" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" />
|
||||
_MORE_VARIABLES_REGEX_
|
||||
</data>
|
||||
|
||||
<storage>
|
||||
<store name="MyStore" type="HDF5">
|
||||
<option key="FileMode">_File_Mode</option>
|
||||
<option key="XDMFMode">NoIteration</option>
|
||||
<option key="FilesPath">_PATH_REGEX_/</option>
|
||||
</store>
|
||||
</storage>
|
||||
|
||||
<actions>
|
||||
</actions>
|
||||
|
||||
<log FileName="_PATH_REGEX_/damaris_log/exa_dbg" RotationSize="5" LogFormat="[%TimeStamp%]: %Message%" Flush="True" LogLevel="debug" />
|
||||
|
||||
</simulation>)V0G0N";
|
||||
|
||||
return init_damaris;
|
||||
}
|
||||
|
||||
} // namespace Opm::DamarisOutput
|
Loading…
Reference in New Issue
Block a user