svMultiPhysics
Loading...
Searching...
No Matches
ActiveStressUniformUnsteady.h
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#ifndef ACTIVE_STRESS_UNIFORM_UNSTEADY_H
5#define ACTIVE_STRESS_UNIFORM_UNSTEADY_H
6
7#include "ActiveStress.h"
8
9#include "FourierInterpolation.h"
10
11/**
12 * @brief Uniform and time dependent active stress model.
13 *
14 * Defines an active tension that is constant in space but time dependent, i.e.
15 * @f[
16 * \Tact(t, \calcium, \fiberstretch, \fiberstretchrate, \astressstate) =
17 * g(t)\;,
18 * @f]
19 * where @f$g(t)@f$ is a user-defined function of time.
20 */
22public:
23 /// Model label.
24 static inline const std::string label = "UniformUnsteady";
25
26 /// Model parameters class.
27 class Parameters : public ActiveStressModelParameters {
28 public:
29 Parameters() : ActiveStressModelParameters(label) {
30 constexpr bool required = true;
31
32 add_parameter("Ramp", false, required);
33 add_parameter("Temporal_values_file_path", std::string(""), required);
34 }
35 };
36
37 /**
38 * @brief Constructor.
39 */
41 : ActiveStress(/* n_states = */ 0,
42 /* needs_fiber_stretch = */ false,
43 /* needs_fiber_stretch_rate = */ false) {}
44
45 /**
46 * @brief Construct an instance of model parameters.
47 */
48 virtual std::unique_ptr<ActiveStressModelParameters>
49 get_parameters() const override {
50 return std::make_unique<Parameters>();
51 }
52
53 /**
54 * @brief Initialization.
55 *
56 * Calls the parent class initialization method, and reads the Fourier
57 * coefficient from file.
58 *
59 * @param[in] tnNo Total number of mesh nodes for the current rank.
60 */
61 virtual void init(const unsigned int tnNo) override;
62
63protected:
64 /**
65 * @brief Read model parameters from a parameter object.
66 */
68 const ActiveStressModelParameters &params) override;
69
70 /**
71 * @brief Distribute model parameters to all parallel processes.
72 */
73 virtual void distribute_model_specific_parameters(const CmMod &cm_mod,
74 const cmType &cm) override;
75
76 /**
77 * @brief Initialize the state vector for a single node.
78 *
79 * This model has no states, so this function does nothing.
80 */
81 virtual void init_local(Vector<double> &state) const override {}
82
83 /**
84 * @brief Advance in time for a single node.
85 *
86 * This model has no states, so this function does nothing.
87 */
88 virtual void advance_time_step_local(const double t, const double dt,
89 const double calcium,
90 const double fiber_stretch,
91 const double fiber_stretch_rate,
92 Vector<double> &state) const override {}
93
94 /**
95 * @brief Compute the active tension for a single node.
96 */
97 virtual double
99 const double fiber_stretch) const override;
100
101 /**
102 * @brief Compute the partial derivative of the active tension with respect
103 * to the fiber stretch, at fixed state, for a single node.
104 *
105 * The active tension does not depend on the fiber stretch, so this is zero.
106 */
108 const Vector<double> &state,
109 const double fiber_stretch) const override {
110 return 0.0;
111 }
112
113 /// Toggle between ramp or Fourier transform.
114 bool ramp;
115
116 /// Name of the file containing the temporal values.
118
119 /// Fourier interpolation of the time dependent data.
121};
122
123#endif
ActiveStress(const unsigned int n_states_, const bool needs_fiber_stretch, const bool needs_fiber_stretch_rate)
Constructor.
Definition ActiveStress.h:270
Parameters for a generic active stress model.
Definition Parameters.h:1450
ActiveStressModelParameters(const std::string &xml_element_name_)
Constructor.
Definition Parameters.cpp:1860
void add_parameter(const std::string &label, double default_value, bool required)
Add a new parameter to this object.
Definition Parameters.h:1496
virtual void init(const unsigned int tnNo) override
Initialization.
Definition ActiveStressUniformUnsteady.cpp:9
virtual void init_local(Vector< double > &state) const override
Initialize the state vector for a single node.
Definition ActiveStressUniformUnsteady.h:81
virtual double compute_active_tension_local(const Vector< double > &state, const double fiber_stretch) const override
Compute the active tension for a single node.
Definition ActiveStressUniformUnsteady.cpp:28
virtual double compute_active_tension_derivative_local(const Vector< double > &state, const double fiber_stretch) const override
Compute the partial derivative of the active tension with respect to the fiber stretch,...
Definition ActiveStressUniformUnsteady.h:107
std::string temporal_values_file_path
Name of the file containing the temporal values.
Definition ActiveStressUniformUnsteady.h:117
virtual void advance_time_step_local(const double t, const double dt, const double calcium, const double fiber_stretch, const double fiber_stretch_rate, Vector< double > &state) const override
Advance in time for a single node.
Definition ActiveStressUniformUnsteady.h:88
virtual std::unique_ptr< ActiveStressModelParameters > get_parameters() const override
Construct an instance of model parameters.
Definition ActiveStressUniformUnsteady.h:49
bool ramp
Toggle between ramp or Fourier transform.
Definition ActiveStressUniformUnsteady.h:114
virtual void read_model_specific_parameters(const ActiveStressModelParameters &params) override
Read model parameters from a parameter object.
Definition ActiveStressUniformUnsteady.cpp:16
FourierInterpolation fourier_interpolation
Fourier interpolation of the time dependent data.
Definition ActiveStressUniformUnsteady.h:120
virtual void distribute_model_specific_parameters(const CmMod &cm_mod, const cmType &cm) override
Distribute model parameters to all parallel processes.
Definition ActiveStressUniformUnsteady.cpp:22
ActiveStressUniformUnsteady()
Constructor.
Definition ActiveStressUniformUnsteady.h:40
static const std::string label
Model label.
Definition ActiveStressUniformUnsteady.h:24
The CmMod class duplicates the data structures in the Fortran CMMOD module defined in COMU....
Definition CmMod.h:37
Fourier interpolation of time dependent data.
Definition FourierInterpolation.h:113
The Vector template class is used for storing int and double data.
Definition Vector.h:26
The cmType class stores data and defines methods used for mpi communication.
Definition CmMod.h:57