svZeroDSolver
Loading...
Searching...
No Matches
SphereMaterial.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the
2// University of California, and others. SPDX-License-Identifier: BSD-3-Clause
3
4/**
5 * @file SphereMaterial.h
6 * @brief Material models for the ChamberSphere block
7 */
8
9#ifndef SVZERODSOLVER_MODEL_SPHEREMATERIAL_HPP_
10#define SVZERODSOLVER_MODEL_SPHEREMATERIAL_HPP_
11
12#include <map>
13#include <memory>
14#include <string>
15#include <vector>
16
17#include "Parameter.h"
18
19/**
20 * @brief Return type for SphereMaterial::compute
21 *
22 * Bundles the nonlinear residual contribution and its derivatives that
23 * appear in the spherical-stress equation of ChamberSphere.
24 */
26 double C_val; ///< Residual contribution to C vector
27 double dC_dy_radius; ///< Derivative w.r.t. radius
28};
29
30/**
31 * @brief Base class for spherical chamber wall materials
32 *
33 * Subclasses implement the material-specific elastic stress term in the
34 * spherical stress equation:
35 * \f[
36 * -S + \tau + S_\text{sl}(r, r_0) = 0
37 * \f]
38 */
40 public:
41 /**
42 * @brief Properties of the input parameters for this material
43 * [(name, InputParameter), ...]
44 */
45 const std::vector<std::pair<std::string, InputParameter>> input_param_properties;
46
47 /**
48 * @brief Construct a SphereMaterial
49 *
50 * @param props Parameter name/spec pairs for this material type
51 */
53 const std::vector<std::pair<std::string, InputParameter>>& props);
54
55 virtual ~SphereMaterial() = default;
56
57 /**
58 * @brief Compute material stress contributions at the current state
59 *
60 * @param radius Radius perturbation \f$r\f$
61 * @param radius0 Reference radius \f$r_0\f$
62 * @return SphericalStressResult
63 */
64 virtual SphericalStressResult compute(double radius,
65 double radius0) const = 0;
66
67 /**
68 * @brief Factory: create a material from a type string
69 *
70 * @param type_str One of: "mooney_rivlin", "exponential"
71 * @return Unique pointer to the created material
72 */
73 static std::unique_ptr<SphereMaterial> create(const std::string& type_str);
74
75 /**
76 * @brief Set a scalar parameter value by name
77 *
78 * @param name Parameter name
79 * @param value Parameter value
80 */
81 void set_param(const std::string& name, double value);
82
83 protected:
84 /**
85 * @brief Map of parameter names to their values
86 */
87 std::map<std::string, double> params_;
88};
89
90/**
91 * @brief Mooney–Rivlin material (reduces to neo-Hookean for W2=0)
92 *
93 * Implements:
94 * \f[
95 * f = 4(1 - C^{-3})(W_1 + C W_2)
96 * \f]
97 *
98 * Parameters: `W1`, `W2`
99 */
100class MooneyRivlinMaterial : public SphereMaterial {
101 public:
102 MooneyRivlinMaterial()
103 : SphereMaterial({{"W1", InputParameter()},
104 {"W2", InputParameter()}}) {}
105
106 SphericalStressResult compute(double radius,
107 double radius0) const override;
108};
109
110/**
111 * @brief Exponential material
112 *
113 * Implements the exponential strain-energy density:
114 * \f[
115 * W_1(r) = C_0 \exp(C_1 [I_{1,\text{iso}}]^2),\quad
116 * W_4(r) = C_2 \exp(C_3 [I_{4,\text{iso}}]^2)
117 * \f]
118 *
119 * Parameters: `C0`, `C1`, `C2`, `C3`
120 */
121class ExponentialMaterial : public SphereMaterial {
122 public:
123 ExponentialMaterial()
124 : SphereMaterial({{"C0", InputParameter()},
125 {"C1", InputParameter()},
126 {"C2", InputParameter()},
127 {"C3", InputParameter()}}) {}
128
129 SphericalStressResult compute(double radius,
130 double radius0) const override;
131};
132
133#endif // SVZERODSOLVER_MODEL_SPHEREMATERIAL_HPP_
model::Parameter source file
SphericalStressResult compute(double radius, double radius0) const override
Compute material stress contributions at the current state.
Definition SphereMaterial.cpp:58
SphericalStressResult compute(double radius, double radius0) const override
Compute material stress contributions at the current state.
Definition SphereMaterial.cpp:36
void set_param(const std::string &name, double value)
Set a scalar parameter value by name.
Definition SphereMaterial.cpp:19
virtual SphericalStressResult compute(double radius, double radius0) const =0
Compute material stress contributions at the current state.
const std::vector< std::pair< std::string, InputParameter > > input_param_properties
Properties of the input parameters for this material [(name, InputParameter), ...].
Definition SphereMaterial.h:45
SphereMaterial(const std::vector< std::pair< std::string, InputParameter > > &props)
Construct a SphereMaterial.
Definition SphereMaterial.cpp:9
static std::unique_ptr< SphereMaterial > create(const std::string &type_str)
Factory: create a material from a type string.
Definition SphereMaterial.cpp:23
std::map< std::string, double > params_
Map of parameter names to their values.
Definition SphereMaterial.h:87
Handles the properties of input parameters.
Definition Parameter.h:100
Return type for SphereMaterial::compute.
Definition SphereMaterial.h:25
double C_val
Residual contribution to C vector.
Definition SphereMaterial.h:26
double dC_dy_radius
Derivative w.r.t. radius.
Definition SphereMaterial.h:27