41 template <
typename MaterialType,
typename StateType,
typename... parameter_types>
42 auto uniaxial_stress_test(
double t_max,
size_t num_steps,
const MaterialType material,
const StateType initial_state,
43 std::function<
double(
double)> epsilon_xx,
const parameter_types... parameter_functions)
46 const double dt = t_max / double(num_steps - 1);
48 auto state = initial_state;
50 auto sigma_yy_and_zz = [&](
auto x) {
51 auto epsilon_yy = x[0];
52 auto epsilon_zz = x[1];
53 using T = decltype(epsilon_yy);
55 du_dx[0][0] = epsilon_xx(t);
56 du_dx[1][1] = epsilon_yy;
57 du_dx[2][2] = epsilon_zz;
58 auto state_copy = state;
59 auto stress = material(state_copy, du_dx, parameter_functions(t)...);
60 return tensor{{stress[1][1], stress[2][2]}};
63 std::vector<tuple<double, tensor<double, 3, 3>,
tensor<double, 3, 3>, StateType> > output_history;
64 output_history.reserve(num_steps);
67 for (
size_t i = 0; i < num_steps; i++) {
69 auto epsilon_yy_and_zz =
find_root(sigma_yy_and_zz, initial_guess);
70 dudx[0][0] = epsilon_xx(t);
71 dudx[1][1] = epsilon_yy_and_zz[0];
72 dudx[2][2] = epsilon_yy_and_zz[1];
74 auto stress = material(state, dudx, parameter_functions(t)...);
75 output_history.push_back(
tuple{t, dudx, stress, state});
80 return output_history;
91 template <
typename MaterialType,
typename StateType,
typename... parameter_types>
93 const StateType initial_state, std::function<
double(
double)> epsilon_xx,
94 const parameter_types... parameter_functions)
96 const double dt = t_max / double(num_steps - 1);
97 auto mat_with_dt = [&material, dt](
auto& state,
auto du_dx, parameter_types... parameters) {
98 return material(state, dt, du_dx, parameters...);
100 return uniaxial_stress_test(t_max, num_steps, mat_with_dt, initial_state, epsilon_xx, parameter_functions...);
122 template <
typename MaterialType,
typename StateType,
typename... functions>
124 const StateType initial_state,
const functions... f)
127 const double dt = t_max / double(num_steps - 1);
128 auto state = initial_state;
130 using output_type = decltype(
std::tuple{t, state, f(0.0)..., decltype(material(state, dt, f(0.0)...)){}});
131 std::vector<output_type> history;
132 history.reserve(num_steps);
134 for (
size_t i = 0; i < num_steps; i++) {
135 auto material_output = material(state, dt, f(t)...);
136 history.push_back(
std::tuple{t, state, f(t)..., material_output});
Accelerator functionality.
auto uniaxial_stress_test(double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, std::function< double(double)> epsilon_xx, const parameter_types... parameter_functions)
Drive the material model thorugh a uniaxial tension experiment.
auto find_root(const function &f, tensor< double, n > x0)
Finds a root of a vector-valued nonlinear function.
auto uniaxial_stress_test_rate_dependent(double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, std::function< double(double)> epsilon_xx, const parameter_types... parameter_functions)
Drive a rate-dependent material model thorugh a uniaxial tension experiment.
tuple(T...) -> tuple< T... >
Class template argument deduction rule for tuples.
auto single_quadrature_point_test(double t_max, size_t num_steps, const MaterialType material, const StateType initial_state, const functions... f)
This function takes a material model (and associate state variables), subjects it to a time history o...
Arbitrary-rank tensor class.
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
Implementation of the tensor class used by Functional.
Implements a std::tuple-like object that works in CUDA kernels.