13namespace timeintegration
17 PetscFunctionBeginUser;
23 info += (std::string(80,
'=') +
"\n");
24 info += (
"Time Integration [" +
name +
"]\n");
25 info += (std::string(80,
'=') +
"\n");
27 info += (
"\tScheme: " +
scheme +
"\n\n");
29 (
"\tCoefficient of implicit term: " + std::to_string(
implicitCoeff) +
31 info +=
"\tCoefficients of Explicit terms: [";
32 for (
auto it :
explicitCoeffs) info += (std::to_string(it) +
", ");
35 ierr = PetscPrintf(PETSC_COMM_WORLD,
"%s", info.c_str()); CHKERRQ(ierr);
37 PetscFunctionReturn(0);
41 const YAML::Node &node,
44 PetscFunctionBeginUser;
48 if (!node[
"parameters"].IsDefined())
50 SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE,
51 "Could not find the key \"parameters\" in the YAML node "
52 "passed to the function \"createTimeIntegration\"!");
55 if (!node[
"parameters"][name].IsDefined())
57 SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE,
58 "Could not find the key \"%s\" under sub-node \"parameters\" "
59 "in the YAML node passed to the function "
60 "\"createTimeIntegration\"!",
64 scheme = node[
"parameters"][name].as<std::string>();
67 if (scheme ==
"EULER_EXPLICIT")
68 integration = std::make_shared<Euler_Explicit>(name);
69 else if (scheme ==
"EULER_IMPLICIT")
70 integration = std::make_shared<Euler_Implicit>(name);
71 else if (scheme ==
"ADAMS_BASHFORTH_2")
72 integration = std::make_shared<Adams_Bashforth_2>(name);
73 else if (scheme ==
"CRANK_NICOLSON")
74 integration = std::make_shared<Crank_Nicolson>(name);
77 SETERRQ1(PETSC_COMM_WORLD, PETSC_ERR_ARG_OUTOFRANGE,
78 "The time integration scheme \"%s\" does not exist.\n",
82 PetscFunctionReturn(0);
const type::RealVec1D explicitCoeffs
Coefficients of explicit terms.
PetscErrorCode printInfo() const
Print information to standard output.
const std::string scheme
Name of the scheme.
const PetscReal implicitCoeff
Coefficient of implicit term.
const std::string name
Name of current instance.
PetscErrorCode createTimeIntegration(const std::string &name, const YAML::Node &node, type::TimeIntegration &integration)
factory function for type::TimeIntegration.
std::shared_ptr< timeintegration::TimeIntegrationBase > TimeIntegration
Definition of type::TimeIntegration.
A toolbox for building flow solvers.
Definition of TimeIntegration related classes.