Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
hardening_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 
7 #include <string>
8 
11 
12 namespace serac {
13 
14 void HardeningInputOptions::defineInputFileSchema(axom::inlet::Container& container)
15 {
16  // Shared between both hardening laws
17  container.addString("law", "Name of the hardening law (e.g. PowerLawHardening)").required(true);
18  container.addDouble("sigma_y", "Yield strength");
19  container.addDouble("eta", "Plastic viscosity");
20 
21  // PowerLawHardening
22  container.addDouble("n", "Hardening index in reciprocal form");
23  container.addDouble("eps0", "Reference value of accumulated plastic strain");
24 
25  // VoceHardening
26  container.addDouble("sigma_sat", "Saturation value of flow strength");
27  container.addDouble("strain_constant", "Constant dictating how fast the exponential decays");
28 
29  // Verify
30  container.registerVerifier([](const axom::inlet::Container& c) -> bool {
31  axom::inlet::InletType double_type = axom::inlet::InletType::Double;
32  bool sigma_y_present = c.contains("sigma_y") && (c["sigma_y"].type() == double_type);
33  bool n_present = c.contains("n") && (c["n"].type() == double_type);
34  bool eps0_present = c.contains("eps0") && (c["eps0"].type() == double_type);
35  bool sigma_sat_present = c.contains("sigma_sat") && (c["sigma_sat"].type() == double_type);
36  bool strain_constant_present = c.contains("strain_constant") && (c["strain_constant"].type() == double_type);
37  bool eta_present = c.contains("eta") && (c["eta"].type() == double_type);
38 
39  std::string law = c["law"];
40  if (law == "PowerLawHardening") {
41  return sigma_y_present && n_present && eps0_present && eta_present && !sigma_sat_present && !sigma_sat_present;
42  } else if (law == "VoceHardening") {
43  return sigma_y_present && eta_present && !n_present && !eps0_present && sigma_sat_present &&
44  strain_constant_present;
45  }
46 
47  return false;
48  });
49 }
50 
51 } // namespace serac
52 
54 {
56  std::string law = base["law"];
57  if (law == "PowerLawHardening") {
59  .sigma_y = base["sigma_y"], .n = base["n"], .eps0 = base["eps0"], .eta = base["eta"]};
60  } else if (law == "VoceHardening") {
61  result = serac::solid_mechanics::VoceHardening{.sigma_y = base["sigma_y"],
62  .sigma_sat = base["sigma_sat"],
63  .strain_constant = base["strain_constant"],
64  .eta = base["eta"]};
65  }
66  return result;
67 }
This file contains functions for reading a material from input files.
Accelerator functionality.
Definition: serac.cpp:36
constexpr SERAC_HOST_DEVICE auto type(const tuple< T... > &values)
a function intended to be used for extracting the ith type from a tuple.
Definition: tuple.hpp:379
std::variant< solid_mechanics::LinearHardening, solid_mechanics::PowerLawHardening, solid_mechanics::VoceHardening > var_hardening_t
Holds all possible isotropic hardening laws that can be utilized in our input file.
The material and load types for the solid functional physics module.
serac::var_hardening_t operator()(const axom::inlet::Container &base)
Returns created object from Inlet container.
static void defineInputFileSchema(axom::inlet::Container &container)
Input file parameters specific to this class.
Power-law isotropic hardening law.
Voce's isotropic hardening law.