Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
hardening_input.cpp
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith 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 smith {
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  // LinearHardening
22  container.addDouble("Hi", "Isotropic hardening modulus");
23 
24  // PowerLawHardening
25  container.addDouble("n", "Hardening index in reciprocal form");
26  container.addDouble("eps0", "Reference value of accumulated plastic strain");
27 
28  // VoceHardening
29  container.addDouble("sigma_sat", "Saturation value of flow strength");
30  container.addDouble("strain_constant", "Constant dictating how fast the exponential decays");
31 
32  // Verify
33  container.registerVerifier([](const axom::inlet::Container& c) -> bool {
34  axom::inlet::InletType double_type = axom::inlet::InletType::Double;
35  bool sigma_y_present = c.contains("sigma_y") && (c["sigma_y"].type() == double_type);
36  bool Hi_present = c.contains("Hi") && (c["Hi"].type() == double_type);
37  bool n_present = c.contains("n") && (c["n"].type() == double_type);
38  bool eps0_present = c.contains("eps0") && (c["eps0"].type() == double_type);
39  bool sigma_sat_present = c.contains("sigma_sat") && (c["sigma_sat"].type() == double_type);
40  bool strain_constant_present = c.contains("strain_constant") && (c["strain_constant"].type() == double_type);
41  bool eta_present = c.contains("eta") && (c["eta"].type() == double_type);
42 
43  std::string law = c["law"];
44  if (law == "LinearHardening") {
45  return sigma_y_present && Hi_present && eta_present && !n_present && !eps0_present && !sigma_sat_present &&
46  !strain_constant_present;
47  } else if (law == "PowerLawHardening") {
48  return sigma_y_present && !Hi_present && n_present && eps0_present && eta_present && !sigma_sat_present &&
49  !strain_constant_present;
50  } else if (law == "VoceHardening") {
51  return sigma_y_present && !Hi_present && eta_present && !n_present && !eps0_present && sigma_sat_present &&
52  strain_constant_present;
53  }
54 
55  return false;
56  });
57 }
58 
59 } // namespace smith
60 
62 {
64  std::string law = base["law"];
65  if (law == "LinearHardening") {
66  result = smith::solid_mechanics::LinearHardening{.sigma_y = base["sigma_y"], .Hi = base["Hi"], .eta = base["eta"]};
67  } else if (law == "PowerLawHardening") {
69  .sigma_y = base["sigma_y"], .n = base["n"], .eps0 = base["eps0"], .eta = base["eta"]};
70  } else if (law == "VoceHardening") {
71  result = smith::solid_mechanics::VoceHardening{.sigma_y = base["sigma_y"],
72  .sigma_sat = base["sigma_sat"],
73  .strain_constant = base["strain_constant"],
74  .eta = base["eta"]};
75  }
76  return result;
77 }
This file contains functions for reading a material from input files.
Accelerator functionality.
Definition: smith.cpp:36
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.
smith::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.
Linear isotropic hardening law.
Power-law isotropic hardening law.
Voce's isotropic hardening law.