Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
heat_transfer_input.cpp
1 // Copyright (c) 2019-2024, Lawrence Livermore National Security, LLC and
2 // other Serac Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
8 
9 namespace serac {
10 
11 void HeatTransferInputOptions::defineInputFileSchema(axom::inlet::Container& container)
12 {
13  // Polynomial interpolation order - currently up to 8th order is allowed
14  container.addInt("order", "Order degree of the finite elements.").defaultValue(1).range(1, 8);
15 
16  auto& material_container = container.addStructArray("materials", "Container for array of materials");
18 
19  auto& source = container.addStruct("source", "Scalar source term (RHS of the heat transfer PDE)");
21 
22  auto& equation_solver_container =
23  container.addStruct("equation_solver", "Linear and Nonlinear stiffness Solver Parameters.");
24  EquationSolver::defineInputFileSchema(equation_solver_container);
25 
26  auto& dynamics_container = container.addStruct("dynamics", "Parameters for mass matrix inversion");
27  dynamics_container.addString("timestepper", "Timestepper (ODE) method to use");
28  dynamics_container.addString("enforcement_method", "Time-varying constraint enforcement method to use");
29 
30  auto& bc_container = container.addStructDictionary("boundary_conds", "Container of boundary conditions");
32 
33  auto& init_temp = container.addStruct("initial_temperature", "Coefficient for initial condition");
35 }
36 
37 } // namespace serac
38 
40  const axom::inlet::Container& base)
41 {
43 
44  result.order = base["order"];
45 
46  // Solver parameters
47  auto equation_solver = base["equation_solver"];
48  result.lin_solver_options = equation_solver["linear"].get<serac::LinearSolverOptions>();
49  result.nonlin_solver_options = equation_solver["nonlinear"].get<serac::NonlinearSolverOptions>();
50 
51  if (base.contains("dynamics")) {
52  serac::TimesteppingOptions timestepping_options;
53  auto dynamics = base["dynamics"];
54 
55  // FIXME: Implement all supported methods as part of an ODE schema
56  const static std::map<std::string, serac::TimestepMethod> timestep_methods = {
57  {"AverageAcceleration", serac::TimestepMethod::AverageAcceleration},
58  {"BackwardEuler", serac::TimestepMethod::BackwardEuler},
59  {"ForwardEuler", serac::TimestepMethod::ForwardEuler}};
60  std::string timestep_method = dynamics["timestepper"];
61  SLIC_ERROR_ROOT_IF(timestep_methods.count(timestep_method) == 0,
62  "Unrecognized timestep method: " << timestep_method);
63  timestepping_options.timestepper = timestep_methods.at(timestep_method);
64 
65  // FIXME: Implement all supported methods as part of an ODE schema
66  const static std::map<std::string, serac::DirichletEnforcementMethod> enforcement_methods = {
68  std::string enforcement_method = dynamics["enforcement_method"];
69  SLIC_ERROR_ROOT_IF(enforcement_methods.count(enforcement_method) == 0,
70  "Unrecognized enforcement method: " << enforcement_method);
71  timestepping_options.enforcement_method = enforcement_methods.at(enforcement_method);
72 
73  result.timestepping_options = timestepping_options;
74  }
75 
76  if (base.contains("source")) {
77  result.source_coef = base["source"].get<serac::input::CoefficientInputOptions>();
78  }
79 
80  result.materials = base["materials"].get<std::vector<serac::var_thermal_material_t>>();
81 
82  result.boundary_conditions =
83  base["boundary_conds"].get<std::unordered_map<std::string, serac::input::BoundaryConditionInputOptions>>();
84 
85  if (base.contains("initial_temperature")) {
86  result.initial_temperature = base["initial_temperature"].get<serac::input::CoefficientInputOptions>();
87  }
88  return result;
89 }
static void defineInputFileSchema(axom::inlet::Container &container)
An object containing all input file options for the solver for a heat transfer PDE.
Accelerator functionality.
Definition: serac.cpp:38
serac::HeatTransferInputOptions operator()(const axom::inlet::Container &base)
Returns created object from Inlet container.
Stores all information held in the input file that is used to configure the solver.
NonlinearSolverOptions nonlin_solver_options
The linear solver options.
TimesteppingOptions timestepping_options
The timestepping options.
std::optional< input::CoefficientInputOptions > source_coef
Source function coefficient.
std::unordered_map< std::string, input::BoundaryConditionInputOptions > boundary_conditions
The boundary condition information.
LinearSolverOptions lin_solver_options
The linear solver options.
int order
The order of the discretized field.
std::vector< var_thermal_material_t > materials
The material options.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters specific to this class.
std::optional< input::CoefficientInputOptions > initial_temperature
The initial temperature field.
Parameters for an iterative linear solution scheme.
Nonlinear solution scheme parameters.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters specific to this class.
A timestep and boundary condition enforcement method for a dynamic solver.
TimestepMethod timestepper
The timestepping method to be applied.
DirichletEnforcementMethod enforcement_method
The essential boundary enforcement method to use.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters specific to this class.
Definition: input.cpp:105
The information required from the input file for an mfem::(Vector)(Function)Coefficient.
Definition: input.hpp:88
static void defineInputFileSchema(axom::inlet::Container &container)
Defines the input file schema on the provided inlet container.
Definition: input.cpp:190