Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
heat_transfer_input.cpp
1 // Copyright (c) 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 #include <map>
10 
12 
13 namespace serac {
14 
15 void HeatTransferInputOptions::defineInputFileSchema(axom::inlet::Container& container)
16 {
17  // Polynomial interpolation order - currently up to 8th order is allowed
18  container.addInt("order", "Order degree of the finite elements.").defaultValue(1).range(1, 8);
19 
20  auto& material_container = container.addStructArray("materials", "Container for array of materials");
22 
23  auto& source = container.addStruct("source", "Scalar source term (RHS of the heat transfer PDE)");
25 
26  auto& equation_solver_container =
27  container.addStruct("equation_solver", "Linear and Nonlinear stiffness Solver Parameters.");
28  EquationSolver::defineInputFileSchema(equation_solver_container);
29 
30  auto& dynamics_container = container.addStruct("dynamics", "Parameters for mass matrix inversion");
31  dynamics_container.addString("timestepper", "Timestepper (ODE) method to use");
32  dynamics_container.addString("enforcement_method", "Time-varying constraint enforcement method to use");
33 
34  auto& bc_container = container.addStructDictionary("boundary_conds", "Container of boundary conditions");
36 
37  auto& init_temp = container.addStruct("initial_temperature", "Coefficient for initial condition");
39 }
40 
41 } // namespace serac
42 
44  const axom::inlet::Container& base)
45 {
47 
48  result.order = base["order"];
49 
50  // Solver parameters
51  auto equation_solver = base["equation_solver"];
52  result.lin_solver_options = equation_solver["linear"].get<serac::LinearSolverOptions>();
53  result.nonlin_solver_options = equation_solver["nonlinear"].get<serac::NonlinearSolverOptions>();
54 
55  if (base.contains("dynamics")) {
56  serac::TimesteppingOptions timestepping_options;
57  auto dynamics = base["dynamics"];
58 
59  // FIXME: Implement all supported methods as part of an ODE schema
60  const static std::map<std::string, serac::TimestepMethod> timestep_methods = {
61  {"AverageAcceleration", serac::TimestepMethod::AverageAcceleration},
62  {"BackwardEuler", serac::TimestepMethod::BackwardEuler},
63  {"ForwardEuler", serac::TimestepMethod::ForwardEuler}};
64  std::string timestep_method = dynamics["timestepper"];
65  SLIC_ERROR_ROOT_IF(timestep_methods.count(timestep_method) == 0,
66  "Unrecognized timestep method: " << timestep_method);
67  timestepping_options.timestepper = timestep_methods.at(timestep_method);
68 
69  // FIXME: Implement all supported methods as part of an ODE schema
70  const static std::map<std::string, serac::DirichletEnforcementMethod> enforcement_methods = {
72  std::string enforcement_method = dynamics["enforcement_method"];
73  SLIC_ERROR_ROOT_IF(enforcement_methods.count(enforcement_method) == 0,
74  "Unrecognized enforcement method: " << enforcement_method);
75  timestepping_options.enforcement_method = enforcement_methods.at(enforcement_method);
76 
77  result.timestepping_options = timestepping_options;
78  }
79 
80  if (base.contains("source")) {
81  result.source_coef = base["source"].get<serac::input::CoefficientInputOptions>();
82  }
83 
84  result.materials = base["materials"].get<std::vector<serac::var_thermal_material_t>>();
85 
86  result.boundary_conditions =
87  base["boundary_conds"].get<std::unordered_map<std::string, serac::input::BoundaryConditionInputOptions>>();
88 
89  if (base.contains("initial_temperature")) {
90  result.initial_temperature = base["initial_temperature"].get<serac::input::CoefficientInputOptions>();
91  }
92  return result;
93 }
static void defineInputFileSchema(axom::inlet::Container &container)
This file contains the declaration of an equation solver wrapper.
An object containing all input file options for the solver for a heat transfer PDE.
Accelerator functionality.
Definition: serac.cpp:36
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:107
The information required from the input file for an mfem::(Vector)(Function)Coefficient.
Definition: input.hpp:92
static void defineInputFileSchema(axom::inlet::Container &container)
Defines the input file schema on the provided inlet container.
Definition: input.cpp:192