25#ifndef SOLVER_PARAMETERS_H
26#define SOLVER_PARAMETERS_H
73template<
typename T,
typename LATTICES>
78 using NAME =
typename LATTICES::keys_t::template get<0>;
79 using descriptor =
typename LATTICES::template value<NAME>;
80 std::shared_ptr<UnitConverter<T,descriptor>
const>
converter;
95template<
typename T,
typename... STAT_LATTICES>
109 std::array <T,numberOfStationaryLattices>
epsilon {1e-3};
121 std::array <ConvergenceType,numberOfStationaryLattices> type,
122 std::array <T,numberOfStationaryLattices> interval_,
123 std::array <T,numberOfStationaryLattices> epsilon_)
136template<
typename T,
typename LatticeLog= names::NavierStokes>
157 std::string outputDir_,
160 bool printLogConverter_,
197 }
else if (out ==
"intervals"){
199 }
else if (out ==
"final"){
219template<
typename PARAMETERS>
237template<
typename PARAMETERS,
typename TAG>
246template<
typename PARAMETERS,
typename TAG>
250template<
typename PARAMETERS>
254template<
typename T,
typename LatticeLog,
typename TAG>
262 xml.
readOrWarn<std::string>(
"Application",
"Name",
"", this->
params->name,
true,
true,
true);
263 xml.
readOrWarn<std::string>(
"Application",
"OlbDir",
"", this->
params->olbDir,
true,
true,
true);
264 xml.
readOrWarn<std::string>(
"Output",
"OutputDir",
"", this->
params->outputDir,
true,
true,
true);
267 xml.
readOrWarn<
bool>(
"Output",
"Log",
"VerboseLog", this->
params->verbose,
true,
false,
true);
268 xml.
readOrWarn<
bool>(
"Output",
"PrintLogConverter",
"", this->
params->printLogConverter,
true,
false,
false);
270 xml.
readOrWarn<
int>(
"Output",
"Timer",
"PrintMode", this->
params->timerPrintMode,
true,
false,
false);
276template<
typename T,
typename TAG>
283 std::string tag {TAG().name};
284 xml.
readOrWarn<std::string>(
"Output", tag,
"Output", this->
params->output,
true,
false,
true);
285 if (this->
params->output !=
"off") {
286 xml.
readOrWarn<std::string>(
"Output", tag,
"Filename", this->
params->filename,
true,
false,
false);
289 if(this->
params->output ==
"off"){
291 }
else if (this->
params->output ==
"intervals"){
293 }
else if (this->
params->output ==
"final"){
299template<
typename T,
typename TAG>
308 xml.
readOrWarn<BT>(
"Application",
"PhysParameters",
"StartUpTime", this->
params->startUpTime,
false,
false,
false);
309 xml.
readOrWarn<BT>(
"Application",
"PhysParameters",
"PhysMaxTime", this->
params->maxTime,
false,
true,
true);
310 xml.
readOrWarn<
int>(
"Application",
"Mesh",
"noCuboidsPerProcess", this->
params->noC,
true,
false,
true);
311 xml.
readOrWarn<
bool>(
"Application",
"PressureFilter",
"", this->
params->pressureFilter,
true,
false,
false);
313 this->
params->physBoundaryValueUpdateTime = this->
params->maxTime / BT(100);
314 xml.
readOrWarn<BT>(
"Application",
"PhysParameters",
"BoundaryValueUpdateTime", this->
params->physBoundaryValueUpdateTime,
true,
false,
true);
315 this->
params->physTimeStabilityCheck = this->
params->maxTime / BT(100);
316 xml.
readOrWarn<BT>(
"Application",
"PhysParameters",
"TimeStabilityCheck", this->
params->physTimeStabilityCheck,
true,
false,
true);
320template<
typename T,
typename TAG>
327 std::string type =
"MaxLatticeVelocity";
328 xml.
readOrWarn<std::string>(
"Application",
"ConvergenceCheck",
"Type", type,
true,
false,
true);
332 this->
params->physInterval[0] = help;
334 this->
params->epsilon[0] = help;
338template<
typename T,
typename LATTICES,
typename TAG>
346 this->
params->xml = &xml_;
348 using NAME =
typename LATTICES::keys_t::template get<0>;
349 using descriptor =
typename LATTICES::template value<NAME>;
350 this->
params->converter = std::shared_ptr<UnitConverter<T,descriptor>>(createUnitConverter<T,descriptor>(xml_));
359template <
typename PARAMETERS,
typename TAG>
362 auto result = std::make_shared<PARAMETERS>();
364 result->initialize();
368template <
class parameters_map>
373 using parameter_type = typename std::remove_reference_t<decltype(element)>::element_type;
374 using tag = typename parameters_map::keys_t::template get<index()>;
375 element = createParameters<parameter_type,tag>(xml);
class for marking output with some text
bool readOrWarn(std::string name_parameter_1, std::string name_parameter_2, std::string name_parameter_3, ParameterType &var, bool defaultAvailable=true, bool exitIfMissing=false, bool showWarning=true) const
This wrapper function reads the given parameter from the "type_parameter" and "name_parameter_1" or "...
void setOutputDir(std::string outputDir)
void setOlbDir(std::string olbDir_)
Reader(std::shared_ptr< PARAMETERS > params_, TAG tag) -> Reader< PARAMETERS, TAG >
Directories & directories()
Top level namespace for all of OpenLB.
std::shared_ptr< PARAMETERS > createParameters(XMLreader const &xml)
typename util::BaseTypeHelper< T >::type BaseType
auto createParametersTuple(XMLreader const &xml)
Structs to keep parameters which characterize the output.
virtual void initialize() override
OutputGeneral(std::string name_, std::string olbDir_, std::string outputDir_, bool verbose_, bool printLogConverter_, BT logT_, int timerPrintMode_)
OutputPlot(std::string out, std::string name, BT savetime)
virtual void initialize()
ReaderBase(std::shared_ptr< PARAMETERS > params_)
std::shared_ptr< PARAMETERS > params
void read(XMLreader const &xml)
void read(XMLreader const &xml)
void read(XMLreader const &xml)
void read(XMLreader const &xml)
void read(XMLreader const &xml_)
Base struct for reading parameters from files.
Reader(std::shared_ptr< PARAMETERS > params_)
virtual void read(XMLreader const &xml)
Struct to keep results of the simulation in order to provide communication with other parts of the pr...
Base struct to keep the parameters that are necessary for the simulation.
BT physTimeStabilityCheck
BT physBoundaryValueUpdateTime
virtual void initialize()
All parameters that are necessary for checking whether the simulation became stationary.
std::array< T, numberOfStationaryLattices > epsilon
static constexpr unsigned numberOfStationaryLattices
Stationarity(std::array< ConvergenceType, numberOfStationaryLattices > type, std::array< T, numberOfStationaryLattices > interval_, std::array< T, numberOfStationaryLattices > epsilon_)
std::conditional_t<(numberOfArguments==0), meta::list< names::NavierStokes >, meta::list< STAT_LATTICES... > > stat_lattices
std::array< ConvergenceType, numberOfStationaryLattices > convergenceType
Stationarity(ConvergenceType type, T interval_, T epsilon_)
static constexpr unsigned numberOfArguments
std::array< T, numberOfStationaryLattices > physInterval
All the simulation parameters are read directly from an xml file.
typename LATTICES::template value< NAME > descriptor
typename LATTICES::keys_t::template get< 0 > NAME
std::shared_ptr< UnitConverter< T, descriptor > const > converter
Mapping between KEYs and instances of type VALUEs.
Input/Output in XML format – header file.