svMultiPhysics
Loading...
Searching...
No Matches
Parameters.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef PARAMETERS_H
5#define PARAMETERS_H
6
7#include <any>
8#include <functional>
9#include <iostream>
10#include <map>
11#include <memory>
12#include <regex>
13#include <set>
14#include <sstream>
15#include <string>
16#include <tuple>
17#include <variant>
18#include <vector>
19
20#include "Vector.h"
21
22#include "Core/Exception.h"
23#include "tinyxml2.h"
24
25template<typename T>
26
27/// @brief The Parameter class template is used to store a named
28/// paramater and its scalar value as a basic type: bool, double,
29/// int and string.
30///
31/// The classes defined here are used to process svFSIplus simulation parameters read in
32/// from an Extensible Markup Language (XML) format file. XML is a simple text-based format
33/// for representing structured information.
34///
35/// An XML document is formed as an element tree. The XML tree starts at a root element and
36/// branches from the root to sub-elements. All elements can have sub-elements:
37///
38/// \code{.cpp}
39/// <svMultiPhysicsFile>
40/// <element>
41/// <subelement>.....</subelement>
42/// </element>
43/// </svMultiPhysicsFile>
44/// \endcode
45///
46/// The elements in the svFSIplus simulation file are represented by sections of
47/// related parameters. Sub-elements are refered to as sub-sections.
48///
49///-----------------
50/// Parameters class
51///-----------------
52/// The Parameters class is the top level class. It contains objects used to store
53/// parameters for the sections making up an XML simulation parameters file
54///
55/// 1) General (GeneralSimulationParameters)
56/// 2) Mesh (MeshParameters)
57/// 3) Equation (EquationParameters)
58/// 4) Projection (ProjectionParameters)
59/// 5) RIS Projection (RIS ProjectionParameters)
60///
61/// Each object contains methods to parse the XML file for the parameters defined for it.
62/// These section objects may also contain objects representing the sub-sections defined
63/// for each section.
64///
65///-----------------
66/// Section objects
67///-----------------
68/// Each section object contains objects representing parameters. A parameter's name and value
69/// is stored using either a Parameter and VectorParamater template objects. A parameter
70/// value is stored as a basic type: bool, double, int and string.
71///
72/// Parameter objects in a section class are named using the same XML element name with the 1st
73/// character lower case.
74///
75/// Example: GeneralSimulationParameters class
76///
77/// \code{.cpp}
78/// Parameter<bool> verbose; // <Verbose>
79/// Parameter<double> spectral_radius_of_infinite_time_step; // <Spectral_radius_of_infinite_time_step>
80/// Parameter<double> time_step_size; // <Time_step_size>
81/// \endcode
82///
83/// The name and default value for each parameter is defined in a section object's constructor.
84///
85/// Parameter values are set using the set_values() method which contains calls to tinyxml2
86/// to parse parameter values from an XML file.
87///
88/// Each section object inherits from the ParameterLists class. This class provides methods to
89/// store parameters in a map and process iterated over them for setting values and other operations.
90class Parameter
91{
92 public:
93 Parameter() {};
94
95 Parameter(const std::string& name, T value, bool required, std::vector<T> range = {}) :
96 value_(value), name_(name), required_(required)
97 {
98 value_ = value;
99 range_ = range;
100 };
101
102 std::string name() const { return name_; };
103 T value() const { return value_; };
104 T operator()() const { return value_; };
105 bool defined() const { return value_set_; };
106
107 /// @brief Get the value of a parameter as a string.
108 std::string svalue()
109 {
110 std::ostringstream str_stream;
111 str_stream << value_;
112 return str_stream.str();
113 }
114
115 friend std::ostream& operator << (std::ostream& out, const Parameter<T>& param)
116 {
117 out << param.value();
118 return out;
119 }
120
121 /// @brief Set the parameter name and value, and if it is required.
122 void set(const std::string& name, bool required, T value) {
123 name_ = name;
124 required_ = required;
125 value_ = value;
126 }
127
128 /// @brief Set the parameter value from a string.
129 void set(const std::string& str_value)
130 {
131 if constexpr (std::is_same_v<T, std::string>) {
132 value_ = str_value.substr(0, str_value.find_last_not_of(" \t\r\n") + 1);
133 value_.erase(0, value_.find_first_not_of(" \t\r\n"));
134 value_set_ = true;
135 return;
136 }
137 if (str_value == "") {
138 value_ = T{0};
139 }
140
141 auto str = str_value;
142 std::string::iterator end_pos = std::remove(str.begin(), str.end(), ' ');
143 str.erase(end_pos, str.end());
144
145 std::istringstream str_stream(str);
146 if (!(str_stream >> value_)) {
147 std::istringstream str_stream(str);
148 if (!(str_stream >> std::boolalpha >> value_)) {
149 svmp::raise<svmp::ParseException>("Incorrect value '" + str + "' for '" + name_ + "'.");
150 }
151 }
152
153 value_set_ = true;
154 }
155
156 bool check_required_set()
157 {
158 if (!required_) {
159 return true;
160 }
161 return value_set_;
162 }
163
164 T value_ = T{0};
165 std::string name_ = "";
166 bool required_ = false;
167 bool value_set_ = false;
168 std::vector<T> range_;
169};
170
171/// @brief The VectorParameter class template is used to store a named
172/// paramater and its vector of values as a basic type: bool, double,
173/// int and string.
174template<typename T>
175class VectorParameter
176{
177 public:
178 VectorParameter() {};
179
180 VectorParameter(const std::string& name, const std::vector<T>& value, bool required, std::vector<T> range = {}) :
181 value_(value), name_(name), required_(required)
182 {
183 value_ = value;
184 range_ = range;
185 };
186
187 std::string name() const { return name_; };
188 std::vector<T> value() const { return value_; };
189 bool defined() const { return value_set_; };
190 int size() const { return value_.size(); };
191
192 std::vector<T> operator()() const { return value_; };
193 const double& operator[](const int i) const { return value_[i]; };
194
195 /// @brief Get the string representation of the parameter value.
196 std::string svalue()
197 {
198 std::string str;
199
200 if constexpr (std::is_same<T, std::string>::value) {
201 for (auto v : value_) {
202 str += " " + v + " ";
203 }
204 } else {
205 for (auto v : value_) {
206 str += " " + std::to_string(v);
207 }
208 }
209
210 return str;
211 }
212
213 friend std::ostream& operator << (std::ostream& out, const VectorParameter<T>& param)
214 {
215 for (int i = 0; i < param.size(); i++) {
216 out << param.value_[i];
217 }
218 return out;
219 }
220
221 /// @brief Set the parameter name and value, and if it is required.
222 void set(const std::string& name, bool required, const std::vector<T>& value)
223 {
224 name_ = name;
225 required_ = required;
226 value_ = value;
227 }
228
229 /// @brief Set the parameter value from a string.
230 void set(const std::string& str_value)
231 {
232 if (str_value == "") {
233 return;
234 }
235
236 std::string error_msg = "Improper vector format '" + str_value + "' found in '" + name_ + "'." + " Vector format is: (x,y,z)";
237 std::regex sep("\\(|\\)|\\,");
238 auto str = std::regex_replace(str_value, sep, " ");
239
240 // If this is the first time this method is called, we clear any previous
241 // content of the vector of values. This means that, when the XML tag
242 // associated to this parameter is encoutered for the first time, the
243 // values given when declaring the parameter (see other overload of the
244 // set function) will be discarded. However, if the same XML tag is
245 // encountered again, the new values are appended, without discarding the
246 // previously encoutered ones.
247 if (!value_set_) {
248 value_.clear();
249 }
250
251 if constexpr (std::is_same<T, std::string>::value) {
252 std::stringstream ssin(str);
253 std::string value;
254 while (ssin >> value) {
255 value_.push_back(value);
256 }
257 } else {
258 T value;
259 std::istringstream ssin(str);
260 while (ssin >> value) {
261 value_.push_back(value);
262 }
263 }
264
265 value_set_ = true;
266 }
267
268 bool check_required_set()
269 {
270 if (!required_) {
271 return true;
272 }
273 return value_set_;
274 }
275
276 std::vector<T> value_;
277 std::string name_;
278 bool required_ = false;
279 bool value_set_ = false;
280 std::vector<T> range_;
281};
282
283/// @brief struct to define a row of CANN model parameter table
284struct CANNRow {
285 Parameter<int> invariant_index;
286 VectorParameter<int> activation_functions; // Fixed size (3 values)
287 VectorParameter<double> weights; // Fixed size (3 values)
288};
289
290/// @brief Defines parameter name and value, and stores them in
291/// maps for settng values from XML.
292class ParameterLists
293{
294 public:
295
296 ParameterLists() { }
297
298 void set_xml_element_name(const std::string& name)
299 {
300 xml_element_name = name;
301 }
302
303 /// @brief Set the name, default value and the parameter required flag.
304 void set_parameter(const std::string& name, const bool value, bool required, Parameter<bool>& param)
305 {
306 param.set(name, required, value);
307 params_map[name] = &param;
308 }
309
310 void set_parameter(const std::string& name, const double value, bool required, Parameter<double>& param)
311 {
312 param.set(name, required, value);
313 params_map[name] = &param;
314 }
315
316 void set_parameter(const std::string& name, std::initializer_list<double> value, bool required, VectorParameter<double>& param)
317 {
318 param.set(name, required, value);
319 params_map[name] = &param;
320 }
321
322 void set_parameter(const std::string& name, std::initializer_list<int> value, bool required, VectorParameter<int>& param)
323 {
324 param.set(name, required, value);
325 params_map[name] = &param;
326 }
327
328 void set_parameter(const std::string& name, std::initializer_list<std::string> value, bool required,
329 VectorParameter<std::string>& param)
330 {
331 param.set(name, required, value);
332 params_map[name] = &param;
333 }
334
335 void set_parameter(const std::string& name, const int value, bool required, Parameter<int>& param, std::vector<int> range = {})
336 {
337 param.set(name, required, value);
338 params_map[name] = &param;
339 }
340
341 void set_parameter(const std::string& name, const std::string& value, bool required, Parameter<std::string>& param)
342 {
343 param.set(name, required, value);
344 params_map[name] = &param;
345 }
346
347 /// @brief set_parameter function to handle CANNRow
348 void set_parameter_value_CANN(const std::string& name, const std::string& value)
349 {
350 if (params_map.count(name) == 0) {
351 svmp::raise<svmp::ParseException>("Unknown " + xml_element_name + " XML element '" + name + "'.");
352 }
353
354 auto& param_variant = params_map[name];
355
356 // Check for Activation_functions
357 if (name == "Activation_functions") {
358 if (auto* vec_param = std::get_if<VectorParameter<int>*>(&param_variant)) {
359 (*vec_param)->value_.clear(); // Clear the vector before setting
360 (*vec_param)->set(value); // Set the new value
361 } else {
362 svmp::raise<svmp::ParseException>("Activation_functions is not a VectorParameter<int>.");
363 }
364 }
365 // Check for Weights
366 else if (name == "Weights") {
367 if (auto* vec_param = std::get_if<VectorParameter<double>*>(&param_variant)) {
368 (*vec_param)->value_.clear(); // Clear the vector before setting
369 (*vec_param)->set(value); // Set the new value
370 } else {
371 svmp::raise<svmp::ParseException>("Weights is not a VectorParameter<double>.");
372 }
373 }
374 // Default: everything else
375 else {
376 std::visit([&](auto&& p) -> void {
377 p->set(value);
378 }, param_variant);
379 }
380 }
381
382
383
384 /// @brief Set the value of a paramter from a string.
385 void set_parameter_value(const std::string& name, const std::string& value)
386 {
387 if (params_map.count(name) == 0) {
388 svmp::raise<svmp::ParseException>("Unknown " + xml_element_name + " XML element '" + name + "'.");
389 }
390
391 std::visit([value](auto&& p) { p->set(value); }, params_map[name]);
392 }
393
394 /// @brief Check if any required parameters have not been set.
396 {
397 bool unset_found = false;
398
399 for (auto& [ key, param ] : params_map) {
400 if (std::visit([](auto&& p) {
401 return !p->check_required_set();
402 }, param)) {
403 svmp::raise<svmp::ParseException>(xml_element_name + " XML element '" + key + "' has not been set.");
404 }
405 }
406 }
407
408 /// @brief Get the defined parameters as a map of strings.
409 std::map<std::string, std::string> get_parameter_list() const {
410 std::map<std::string,std::string> params;
411
412 for (auto& [ key, param ] : params_map) {
413 std::visit([&params](auto&& p) {
414 params[p->name()] = p->svalue();
415 }, param);
416 }
417
418 return params;
419 }
420
421 /// @brief Print the parameters.
423 {
424 for (auto& [ key, param ] : params_map) {
425 std::cout << key << ": ";
426 std::visit([](auto& p) {
427 std::cout << p->name_ << std::endl;
428 std::cout << p->svalue() << std::endl;
429 }, param);
430 }
431 }
432
433 /// @brief Map used for storing parameters by name / Parameter template union.
434 std::map<std::string, std::variant<Parameter<bool>*, Parameter<double>*, Parameter<int>*,
437
438 std::string xml_element_name = "";
439};
440
441//----------------------
442// IncludeParameterFile
443//----------------------
444// The IncludeParameterFile class is used to read and set the
445// root element of external XML file.
446//
447class IncludeParametersFile
448{
449 public:
450 IncludeParametersFile(const char* file_name);
451 tinyxml2::XMLDocument document;
452 tinyxml2::XMLElement* root_element = nullptr;
453 static std::string NAME;
454};
455
456//////////////////////////////////////////////////////////
457// ConstitutiveModelParameters //
458//////////////////////////////////////////////////////////
459
460// The following classes are used to store parameters for
461// various constitutive models.
462
463class LeeSacksParameters : public ParameterLists
464{
465 public:
466 LeeSacksParameters();
467 bool defined() const { return value_set; };
468 void set_values(tinyxml2::XMLElement* con_model_params);
469 void print_parameters();
475 bool value_set = false;
476};
477
478class GuccioneParameters : public ParameterLists
479{
480 public:
481 GuccioneParameters();
482 bool defined() const { return value_set; };
483 void set_values(tinyxml2::XMLElement* con_model_params);
484 void print_parameters();
489 bool value_set = false;
490};
491
492//---------------------
493// HolzapfelParameters
494//---------------------
495class HolzapfelParameters : public ParameterLists
496{
497 public:
498 HolzapfelParameters();
499 bool defined() const { return value_set; };
500 void set_values(tinyxml2::XMLElement* con_model_params);
501 void print_parameters();
502
512
513 bool value_set = false;
514};
515
516class HolzapfelGasserOgdenParameters : public ParameterLists
517{
518 public:
519 HolzapfelGasserOgdenParameters();
520 bool defined() const { return value_set; };
521 void set_values(tinyxml2::XMLElement* con_model_params);
522 void print_parameters();
527 Parameter<double> kappa;
528 bool value_set = false;
529};
530
531class MooneyRivlinParameters : public ParameterLists
532{
533 public:
534 MooneyRivlinParameters();
535 bool defined() const { return value_set; };
536 void set_values(tinyxml2::XMLElement* con_model_params);
537 void print_parameters();
540 bool value_set = false;
541};
542
543class NeoHookeanParameters : public ParameterLists
544{
545 public:
547 void set_values(tinyxml2::XMLElement* modl_params);
548 void print_parameters();
549 bool value_set = false;
550};
551
552class StVenantKirchhoffParameters : public ParameterLists
553{
554 public:
556 void set_values(tinyxml2::XMLElement* modl_params);
557 void print_parameters();
558 bool value_set = false;
559};
560
561/// @brief The CANNRowParameters class is used to store the parameters for
562/// each row of the CANN table for the xml element "Add_row"
563class CANNRowParameters : public ParameterLists
564{
565 public:
566 CANNRowParameters();
567
568 void print_parameters();
569 void set_values(tinyxml2::XMLElement* xml_elem);
570
571 static const std::string xml_element_name_;
572
573 Parameter<std::string> row_name; // to identify each row
574 CANNRow row;
575
576};
577
578/// @brief The CANNParameters class stores the parameters table rows
579/// for xml element "Constitutive_model type=CANN". Each row is handled
580/// with xml element "Add_row"
581///
582/// \code {.xml}
583/// <Constitutive_model type="CANN">
584/// <Add_row row_name="1">
585/// <Invariant_num> 1 </Invariant_num>
586/// <Activation_functions> (1,1,1) </Activation_functions>
587/// <Weights> (1.0,1.0,1.0) </Weights>
588/// </Add_row>
589/// </Constitutive_model>
590/// \endcode
591class CANNParameters : public ParameterLists
592{
593 public:
596 bool defined() const { return value_set; };
597 void set_values(tinyxml2::XMLElement* con_model_params);
598 void print_parameters();
599
600 std::vector<CANNRowParameters*> rows; // Store multiple rows
601
602 bool value_set = false;
603};
604
605/// @brief The ConstitutiveModelParameters class store parameters
606/// for various constitutive models.
607class ConstitutiveModelParameters : public ParameterLists
608{
609 public:
610 ConstitutiveModelParameters();
611 void print_parameters();
613 bool defined() const { return value_set; };
614 void set_values(tinyxml2::XMLElement* modl_params);
615 static const std::string xml_element_name_;
616
617 // Model types supported.
618 static const std::string GUCCIONE_MODEL;
619 static const std::string HGO_MODEL;
620 static const std::string HOLZAPFEL_OGDEN_MODEL;
621 static const std::string HOLZAPFEL_OGDEN_MA_MODEL;
622 static const std::string LEE_SACKS;
623 static const std::string NEOHOOKEAN_MODEL;
624 static const std::string STVENANT_KIRCHHOFF_MODEL;
625 static const std::string CANN_MODEL;
626 static const std::map<std::string, std::string> constitutive_model_types;
627
628 // Constitutive model type.
630
631 GuccioneParameters guccione;
632 HolzapfelParameters holzapfel;
633 HolzapfelGasserOgdenParameters holzapfel_gasser_ogden;
634 LeeSacksParameters lee_sacks;
635 MooneyRivlinParameters mooney_rivlin;
636 NeoHookeanParameters neo_hookean;
637 StVenantKirchhoffParameters stvenant_kirchhoff;
638 CANNParameters cann;
639
640 bool value_set = false;
641};
642
643/// @brief Coupling to GenBC.
644class CoupleGenBCParameters : public ParameterLists
645{
646 public:
647 CoupleGenBCParameters();
648
649 static const std::string xml_element_name_;
650
651 bool defined() const { return value_set; };
652 void set_values(tinyxml2::XMLElement* xml_elem);
653
654 // attributes.
656
657 // String parameters.
658 Parameter<std::string> zerod_code_file_path;
659
660 bool value_set = false;
661};
662
663//----------------------------------
664// svZeroDSolverInterfaceParameters
665//----------------------------------
666/// @brief Parameters for coupling to the svZeroDSolver (0D lumped-parameter solver).
667///
668/// XML element: \code {.xml}
669/// <svZeroDSolver_interface>
670/// <Coupling_type> implicit </Coupling_type>
671/// <Configuration_file> svzerod_3Dcoupling.json </Configuration_file>
672/// <Shared_library> /path/to/libsvzero_interface </Shared_library>
673/// <Finite_difference_absolute_perturbation> 1.0e-7 </Finite_difference_absolute_perturbation>
674/// <Finite_difference_relative_perturbation> 1.0e-5 </Finite_difference_relative_perturbation>
675/// </svZeroDSolver_interface>
676/// \endcode
677//
678class svZeroDSolverInterfaceParameters : public ParameterLists
679{
680 public:
681 svZeroDSolverInterfaceParameters();
682
683 static const std::string xml_element_name_;
684
685 bool defined() const { return value_set; };
686 void set_values(tinyxml2::XMLElement* xml_elem);
687
688 Parameter<std::string> configuration_file;
689 Parameter<std::string> coupling_type;
690
691 Parameter<double> initial_flows;
692 Parameter<double> initial_pressures;
693
694 Parameter<double> finite_difference_absolute_perturbation;
695 Parameter<double> finite_difference_relative_perturbation;
696
697 Parameter<std::string> shared_library;
698
699 bool value_set = false;
700};
701
702//----------------------------------
703// svOneDSolverInterfaceParameters
704//----------------------------------
705/// @brief Parameters for coupling to the svOneDSolver (1D blood-flow solver).
706///
707/// XML element: \code {.xml}
708/// <svOneDSolver_interface>
709/// <Coupling_type> Implicit </Coupling_type>
710/// <Shared_library> /path/to/libsvoned_interface </Shared_library>
711/// </svOneDSolver_interface>
712/// \endcode
713///
714/// Notes
715/// -----
716/// Coupling_type: "Explicit" | "Implicit" | "Semi-implicit"
717/// Controls how the 3D Newton iteration couples to the 1D solver
718/// (same semantics as the 0D coupling_type).
719/// Shared_library: Path to the 1D interface shared library. The
720/// extension (.so or .dylib) may be omitted; it will be appended
721/// automatically based on the platform.
722///
723/// Each coupled face specifies its own input file via
724/// <Coupling_interface> <svOneDSolver_input_file> ... </svOneDSolver_input_file>
725/// </Coupling_interface> inside the corresponding <Add_BC> element.
726//
727class svOneDSolverInterfaceParameters : public ParameterLists
728{
729 public:
730 svOneDSolverInterfaceParameters();
731
732 static const std::string xml_element_name_;
733
734 bool defined() const { return value_set; };
735 void set_values(tinyxml2::XMLElement* xml_elem);
736
737 Parameter<std::string> coupling_type;
738 Parameter<std::string> shared_library;
739
740 bool value_set = false;
741};
742
743/// @brief Body force over a mesh using the "Add_BF" command.
744///
745/// \code {.xml}
746/// <Add_BF mesh="msh" >
747/// <Type> volumetric </Type>
748/// <Time_dependence> general </Time_dependence>
749/// <Temporal_and_spatial_values_file_path> bforce.dat </Temporal_and_spatial_values_file_path>
750/// </Add_BF>
751/// \endcode
752class BodyForceParameters : public ParameterLists
753{
754 public:
755 BodyForceParameters();
756 void print_parameters();
757 void set_values(tinyxml2::XMLElement* xml_elem);
758 static const std::string xml_element_name_;
759
760 // Attributes.
761 Parameter<std::string> mesh_name;
762
763 // Boolean parameters.
764 Parameter<bool> ramp_function;
765
766 // Double parameters.
767 Parameter<double> value;
768
769 // String parameters.
770 Parameter<std::string> fourier_coefficients_file_path;
771 Parameter<std::string> spatial_values_file_path;
772 Parameter<std::string> temporal_and_spatial_values_file_path;
773 Parameter<std::string> temporal_values_file_path;
774 Parameter<std::string> time_dependence;
776};
777
778/// @brief RCR values for Neumann BC type.
779///
780/// \code {.xml}
781/// <RCR_values>
782/// <Proximal_resistance> 121.0 </Proximal_resistance>
783/// <Capacitance> 1.5e-5 </Capacitance>
784/// <Distal_resistance> 1212.0 </Distal_resistance>
785/// </RCR_values>
786/// \endcode
787class BoundaryConditionRCRParameters : public ParameterLists
788{
789 public:
791
792 static const std::string xml_element_name_;
793
794 void set_values(tinyxml2::XMLElement* xml_elem);
795 void print_parameters();
796
797 Parameter<double> capacitance;
798 Parameter<double> distal_pressure;
799 Parameter<double> distal_resistance;
800 Parameter<double> initial_pressure;
801 Parameter<double> proximal_resistance;
802
803 bool value_set = false;
804};
805
806/// @brief svZeroDSolver coupling options under Add_BC (with Time_dependence Coupled).
807///
808/// \code {.xml}
809// <Coupling_interface>
810// <svOneDSolver_input_file> OneDfilename.in </svOneDSolver_input_file>
811// <Ramp_steps> 100 </Ramp_steps>
812// <Ramp_ref_pressure> 0.0 </Ramp_ref_pressure>
813// <Relax_factor> 0.3 </Relax_factor>
814// </Coupling_interface>
815/// \endcode
816class CouplingInterfaceParameters : public ParameterLists
817{
818 public:
819 CouplingInterfaceParameters();
820
821 static const std::string xml_element_name_;
822
823 void set_values(tinyxml2::XMLElement* xml_elem);
824 void print_parameters();
825
826 Parameter<std::string> svzerod_solver_block;
827 Parameter<std::string> chamber_cap_surface;
828
829 // Path to the svOneDSolver .in input file for this face (1D coupling).
830 Parameter<std::string> svoned_input_file;
831
832 // Ramp for 1D coupling initialization (both DIR and NEU coupling).
833 // Over the first Coupling_ramp_steps committed time steps the value passed
834 // to the 1D solver is linearly ramped:
835 // DIR: pressure P ramped from Coupling_ramp_ref_pressure to actual 3D P.
836 // NEU: output pressure P is ramped before being applied to the 3D domain.
837 // Set Coupling_ramp_steps = 0 (default) to disable.
838 Parameter<int> coupling_ramp_steps;
839 Parameter<double> coupling_ramp_ref_pressure;
840
841 // Under-relaxation factor for the value passed to the 1D solver (both DIR and NEU coupling).
842 // DIR: P_sent = omega * P_target + (1 - omega) * P_prev_sent
843 // NEU: Q_sent = omega * Q_target + (1 - omega) * Q_prev_sent
844 // Range: (0, 1]. Default 1.0 = no relaxation.
845 Parameter<double> coupling_relax_factor;
846
847 bool value_set = false;
848};
849
850/// @brief The BoundaryConditionParameters stores paramaters for various
851/// type of boundary conditions under the Add_BC XML element.
852class BoundaryConditionParameters : public ParameterLists
853{
854 public:
855 BoundaryConditionParameters();
856 void print_parameters();
857 void set_values(tinyxml2::XMLElement* bc_params);
858 static const std::string xml_element_name_;
859
860 // RCR parameters sub-element.
862
863 // svZeroDSolver coupling subsection (with Time_dependence Coupled).
864 CouplingInterfaceParameters coupling_interface;
865
866 // Add_BC name= attribute.
868
869 // Add_BC XML elements.
870 //
871 Parameter<bool> apply_along_normal_direction;
872 Parameter<std::string> bct_file_path;
873
874 Parameter<double> damping;
875 Parameter<double> distal_pressure;
876 VectorParameter<int> effective_direction;
877 Parameter<bool> follower_pressure_load;
878 Parameter<std::string> fourier_coefficients_file_path;
879
880 Parameter<bool> impose_flux;
881 Parameter<bool> impose_on_state_variable_integral;
882 Parameter<std::string> initial_displacements_file_path;
883
884 Parameter<double> penalty_parameter;
885 Parameter<double> penalty_parameter_normal;
886 Parameter<double> penalty_parameter_tangential;
887 Parameter<std::string> prestress_file_path;
889 Parameter<bool> ramp_function;
890
891 Parameter<std::string> cst_shell_bc_type;
892 Parameter<std::string> spatial_profile_file_path;
893 Parameter<std::string> spatial_values_file_path;
894 Parameter<double> stiffness;
895
896 Parameter<std::string> temporal_and_spatial_values_file_path;
897 Parameter<std::string> temporal_values_file_path;
898 Parameter<std::string> time_dependence;
899 Parameter<std::string> traction_values_file_path;
900 Parameter<double> traction_multiplier;
902
903 Parameter<bool> undeforming_neu_face;
904 Parameter<double> value;
905 Parameter<bool> weakly_applied;
906 Parameter<bool> zero_out_perimeter;
907
908 Parameter<double> resistance;
909};
910
911/// @brief The OutputParameters class stores parameters for the
912/// Output XML element under Add_equation.
913///
914/// \code {.xml}
915/// <Output type="Volume_integral" >
916/// <Temperature> true </Temperature>
917/// </Output>
918/// \endcode
919class OutputParameters : public ParameterLists
920{
921 public:
922 OutputParameters();
923
924 static const std::string xml_element_name_;
925
926 void print_parameters();
927 void set_values(tinyxml2::XMLElement* xml_elem);
928 bool get_output_value(const std::string& name);
929 std::string get_alias_value(const std::string& name);
930
932
933 // List of output names.
934 std::vector<Parameter<bool>> output_list;
935
936 // List of alias output names.
937 std::vector<Parameter<std::string>> alias_list;
938};
939
940/// @brief The PrecomputedSolutionParameters class stores parameters for the
941/// 'Precomputed_solution' XML element used to read in the data from a precomputed solution
942/// for the simulation state
943/// \code {.xml}
944/// <Precomputed_solution>
945/// <Project_from_face> lumen_wall </Project_from_face>
946/// </Precomputed_solution>
947/// \endcode
948
949class PrecomputedSolutionParameters: public ParameterLists
950{
951 public:
952 PrecomputedSolutionParameters();
953
954 void set_values(tinyxml2::XMLElement* xml_elem);
955
956 static const std::string xml_element_name_;
957
958 Parameter<std::string> field_name;
959 Parameter<std::string> file_path;
960 Parameter<double> time_step;
961 Parameter<bool> use_precomputed_solution;
962};
963
964/// @brief The ProjectionParameters class stores parameters for the
965/// 'Add_projection' XML element used for fluid-structure interaction
966/// simulations.
967/// \code {.xml}
968/// <Add_projection name="wall_inner" >
969/// <Project_from_face> lumen_wall </Project_from_face>
970/// </Add_projection>
971/// \endcode
972class ProjectionParameters : public ParameterLists
973{
974 public:
975 ProjectionParameters();
976
977 void set_values(tinyxml2::XMLElement* xml_elem);
978
979 static const std::string xml_element_name_;
980
982
983 Parameter<std::string> project_from_face;
984 Parameter<double> projection_tolerance;
985};
986
987/// @brief The VariableWallPropsParameters class stores parameters for
988/// variable wall properties for the CMM equation.
989class VariableWallPropsParameters : public ParameterLists
990{
991 public:
992 VariableWallPropsParameters();
993 static const std::string xml_element_name_;
994 bool defined() const { return value_set; };
995 void set_values(tinyxml2::XMLElement* xml_elemnt);
996
997 Parameter<std::string> mesh_name;
998 Parameter<std::string> wall_properties_file_path;
999 bool value_set = false;
1000};
1001
1002
1003//////////////////////////////////////////////////////////
1004// FluidViscosity //
1005//////////////////////////////////////////////////////////
1006
1007// The following classes are used to store parameters for
1008// various fluid viscosity models.
1009
1010class FluidViscosityNewtonianParameters : public ParameterLists
1011{
1012 public:
1013 FluidViscosityNewtonianParameters();
1014 void print_parameters();
1015 void set_values(tinyxml2::XMLElement* equation_params);
1016 Parameter<double> constant_value;
1017};
1018
1019class FluidViscosityCarreauYasudaParameters : public ParameterLists
1020{
1021 public:
1022 FluidViscosityCarreauYasudaParameters();
1023 void print_parameters();
1024 void set_values(tinyxml2::XMLElement* xml_elem);
1025
1026 Parameter<double> limiting_high_shear_rate_viscosity;
1027 Parameter<double> limiting_low_shear_rate_viscosity;
1028 Parameter<double> power_law_index;
1029 Parameter<double> shear_rate_tensor_multipler;
1030 Parameter<double> shear_rate_tensor_exponent;
1031};
1032
1033class FluidViscosityCassonsParameters : public ParameterLists
1034{
1035 public:
1036 FluidViscosityCassonsParameters();
1037 void print_parameters();
1038 void set_values(tinyxml2::XMLElement* xml_elem);
1039 Parameter<double> asymptotic_viscosity;
1040 Parameter<double> yield_stress;
1041 Parameter<double> low_shear_rate_threshold;
1042};
1043
1044class FluidViscosityParameters : public ParameterLists
1045{
1046 public:
1047 FluidViscosityParameters();
1048
1049 static const std::string xml_element_name_;
1050
1051 static const std::string CONSTANT_MODEL;
1052 static const std::string CARREAU_YASUDA_MODEL;
1053 static const std::string CASSONS_MODEL;
1054 static const std::set<std::string> model_names;
1055
1056 void print_parameters();
1057 void set_values(tinyxml2::XMLElement* xml_elem);
1058
1060
1061 FluidViscosityNewtonianParameters newtonian_model;
1062 FluidViscosityCarreauYasudaParameters carreau_yasuda_model;
1063 FluidViscosityCassonsParameters cassons_model;
1064};
1065
1066//////////////////////////////////////////////////////////
1067// SolidViscosity //
1068//////////////////////////////////////////////////////////
1069
1070// The following classes are used to store parameters for
1071// various solid viscosity models.
1072
1073class SolidViscosityNewtonianParameters : public ParameterLists
1074{
1075 public:
1076 SolidViscosityNewtonianParameters();
1077 void print_parameters();
1078 void set_values(tinyxml2::XMLElement* equation_params);
1079 Parameter<double> constant_value;
1080};
1081
1082class SolidViscosityPotentialParameters : public ParameterLists
1083{
1084 public:
1085 SolidViscosityPotentialParameters();
1086 void print_parameters();
1087 void set_values(tinyxml2::XMLElement* equation_params);
1088 Parameter<double> constant_value;
1089};
1090
1091class SolidViscosityParameters : public ParameterLists
1092{
1093 public:
1094 SolidViscosityParameters();
1095
1096 static const std::string xml_element_name_;
1097
1098 static const std::string NEWTONIAN_MODEL;
1099 static const std::string POTENTIAL_MODEL;
1100 static const std::set<std::string> model_names;
1101
1102 void print_parameters();
1103 void set_values(tinyxml2::XMLElement* xml_elem);
1104
1106
1107 SolidViscosityNewtonianParameters newtonian_model;
1108 SolidViscosityPotentialParameters potential_model;
1109};
1110
1111
1112/// @brief The LinearAlgebraParameters class stores parameters for
1113/// the 'Linear_algebra' XML element.
1114class LinearAlgebraParameters : public ParameterLists
1115{
1116 public:
1117 static const std::string xml_element_name_;
1118 LinearAlgebraParameters();
1120 void print_parameters();
1121 void set_values(tinyxml2::XMLElement* fsi_file);
1122 bool defined() const { return values_set_; };
1123
1124 bool values_set_ = false;
1126
1127 Parameter<std::string> assembly;
1128 Parameter<std::string> configuration_file;
1129 Parameter<std::string> preconditioner;
1130};
1131
1132/// @brief The LinearSolverParameters class stores parameters for
1133/// the 'LS' XML element.
1134class LinearSolverParameters : public ParameterLists
1135{
1136 public:
1137 LinearSolverParameters();
1138
1139 void print_parameters();
1140 void set_values(tinyxml2::XMLElement* fsi_file);
1141
1142 static const std::string xml_element_name_;
1143
1145
1146 Parameter<double> absolute_tolerance;
1147 Parameter<int> krylov_space_dimension;
1148
1149 Parameter<int> max_iterations;
1150 Parameter<int> ns_cg_max_iterations;
1151 Parameter<double> ns_cg_tolerance;
1152 Parameter<int> ns_gm_max_iterations;
1153 Parameter<double> ns_gm_tolerance;
1154
1155 //Parameter<std::string> preconditioner;
1156
1157 Parameter<double> tolerance;
1158
1159 LinearAlgebraParameters linear_algebra;
1160};
1161
1162/// @brief Stores <Box> parameters for CEP stimulus spatial bounds.
1163class StimulusBoxParameters : public ParameterLists
1164{
1165 public:
1166 StimulusBoxParameters();
1167
1168 /// @brief XML element name for CEP stimulus box spatial bounds.
1169 static const std::string xml_element_name_;
1170
1171 bool defined() const { return value_set; };
1172 void set_values(tinyxml2::XMLElement* xml_elem);
1173
1176
1177 bool value_set = false;
1178};
1179
1180/// @brief Stores <Sphere> parameters for CEP stimulus spatial bounds.
1181class StimulusSphereParameters : public ParameterLists
1182{
1183 public:
1184 StimulusSphereParameters();
1185
1186 /// @brief XML element name for CEP stimulus sphere spatial bounds.
1187 static const std::string xml_element_name_;
1188
1189 bool defined() const { return value_set; };
1190 void set_values(tinyxml2::XMLElement* xml_elem);
1191
1193 Parameter<double> radius;
1194
1195 bool value_set = false;
1196};
1197
1198/// @brief Stores <Spatial_bounds> parameters for CEP stimulus geometry restrictions.
1200{
1201 public:
1202 /// @brief XML element name for CEP stimulus spatial bounds.
1203 static const std::string xml_element_name_;
1204
1205 bool defined() const { return value_set; };
1206 void set_values(tinyxml2::XMLElement* xml_elem);
1207
1210
1211 bool value_set = false;
1212};
1213
1214/// @brief The StimulusParameters class stores parameters for
1215/// 'Stimulus' XML element used to parameters for
1216/// pacemaker cells.
1217///
1218/// \code {.xml}
1219/// <Stimulus type="Istim" >
1220/// <Amplitude> -52.0 </Amplitude>
1221/// <Start_time> 0.0 </Start_time>
1222/// <Duration> 1.0 </Duration>
1223/// <Cycle_length> 10000.0 </Cycle_length>
1224/// <Spatial_bounds>
1225/// <Box>
1226/// <Minimum> 0.0 0.0 0.0 </Minimum>
1227/// <Maximum> 1.0 1.0 1.0 </Maximum>
1228/// </Box>
1229/// <Sphere>
1230/// <Center> 0.5 0.5 0.5 </Center>
1231/// <Radius> 0.25 </Radius>
1232/// </Sphere>
1233/// </Spatial_bounds>
1234/// </Stimulus>
1235/// \endcode
1236class StimulusParameters : public ParameterLists
1237{
1238 public:
1239 StimulusParameters();
1240
1241 /// @brief XML element name for CEP stimulus parameters.
1242 static const std::string xml_element_name_;
1243
1244 bool defined() const { return value_set; };
1245 void print_parameters();
1246 void set_values(tinyxml2::XMLElement* xml_elem);
1247
1249
1250 Parameter<double> amplitude;
1251 Parameter<double> cycle_length;
1252 Parameter<double> duration;
1253 Parameter<double> start_time;
1254
1255 StimulusSpatialBoundsParameters spatial_bounds;
1256
1257 bool value_set = false;
1258};
1259
1260class ECGLeadsParameters : public ParameterLists
1261{
1262 public:
1263 ECGLeadsParameters();
1264
1265 static const std::string xml_element_name_;
1266
1267 bool defined() const { return value_set; };
1268 void print_parameters();
1269 void set_values(tinyxml2::XMLElement* xml_elem);
1270
1271 Parameter<std::string> x_coords_file_path;
1272 Parameter<std::string> y_coords_file_path;
1273 Parameter<std::string> z_coords_file_path;
1274
1275 bool value_set = false;
1276};
1277
1278/// @brief The DirectionalDistributionParameters class stores directional
1279/// distribution parameters for active stress.
1280///
1281/// \code {.xml}
1282/// <Directional_distribution>
1283/// <Fiber_direction> 1.0 </Fiber_direction>
1284/// <Sheet_direction> 0.0 </Sheet_direction>
1285/// <Sheet_normal_direction> 0.0 </Sheet_normal_direction>
1286/// </Directional_distribution>
1287/// \endcode
1288class DirectionalDistributionParameters : public ParameterLists
1289{
1290 public:
1291 DirectionalDistributionParameters();
1292
1293 static const std::string xml_element_name_;
1294
1295 bool defined() const { return value_set; };
1296 void print_parameters() const;
1297 void set_values(const tinyxml2::XMLElement *xml_elem);
1298 void validate() const; // Validate directional fractions
1299
1300 Parameter<double> fiber_direction;
1301 Parameter<double> sheet_direction;
1302 Parameter<double> sheet_normal_direction;
1303
1304 bool value_set = false;
1305};
1306
1307/// @brief Generic ionic model initial conditions parameters.
1308class IonicInitialStateParameters : public ParameterLists {
1309public:
1310 /// Constructor.
1312 const std::string &xml_element_name_,
1313 const std::vector<std::pair<std::string, double>> &states);
1314
1315 /// Return whether the parameters represented by this object were defined.
1316 bool defined() const { return value_set; }
1317
1318 /// Print the value of parameters.
1319 void print_parameters() const;
1320
1321 /// Set the value of parameters in this object from an XML element.
1322 void set_values(const tinyxml2::XMLElement *xml_elem);
1323
1324 /// Get the value of a parameter by label.
1325 double operator[](const std::string &label) const {
1326 return parameters.at(label).value();
1327 }
1328
1329 /// Name of the XML element for this object.
1330 const std::string xml_element_name;
1331
1332 /// Flag indicating whether these XML section represented by this object is
1333 /// required. It is set to true if the number of states provided to the
1334 /// constructor is greater than zero.
1335 const bool required;
1336
1337protected:
1338 /// Parameter instances underlying this object.
1339 std::map<std::string, Parameter<double>> parameters;
1340
1341 /// Flag indicating whether the values of the parameters stored in this
1342 /// object have been set.
1343 bool value_set = false;
1344};
1345
1346/// @brief Parameters for a generic ionic model.
1347///
1348/// Bundles initial conditions for the model's ionic concentrations and gating
1349/// variables, represented by two instances of IonicInitialStateParameters.
1350class IonicModelParameters : public ParameterLists {
1351public:
1352 /// Constructor.
1354 const std::string &xml_element_name_,
1355 const std::vector<std::pair<std::string, double>> &initial_X,
1356 const std::vector<std::pair<std::string, double>> &initial_Xg);
1357
1358 /// Return whether the parameters represented by this object were defined.
1359 bool defined() const { return value_set; }
1360
1361 /// Print the value of parameters.
1362 void print_parameters() const;
1363
1364 /// Set the values of parameters in this object from an XML element.
1365 void set_values(const tinyxml2::XMLElement *xml_elem);
1366
1367 /// Get the parameters for the state variables.
1371
1372 /// Get the parameters for the gating variables.
1376
1377 /// Name of the XML element for this object.
1378 const std::string xml_element_name;
1379
1380 /// Get the value of a scalar parameter by label.
1381 double get_scalar(const std::string &label) const {
1382 return parameters.at(label).value();
1383 }
1384
1385 /// Set the value of a scalar parameter by label.
1386 void set_scalar(const std::string &label, double value) {
1387 auto parameter = parameters.find(label);
1388 svmp::check<svmp::FE::InvalidArgumentException>(
1389 parameter != parameters.end(),
1390 "Ionic model parameter '" + label + "' not found.");
1391
1392 parameter->second.value_ = value;
1393 parameter->second.value_set_ = true;
1394 value_set = true;
1395 }
1396
1397 /// Get the value of a vector parameter by label.
1398 Vector<double> get_vector(const std::string &label) const {
1399 auto param_value = vector_parameters.at(label).value();
1400
1401 Vector<double> param_vec(param_value.size());
1402 for (size_t i = 0; i < param_value.size(); ++i)
1403 param_vec[i] = param_value[i];
1404
1405 return param_vec;
1406 }
1407
1408protected:
1409 /// Add a new parameter to this object.
1410 void add_parameter(const std::string &label, double default_value,
1411 bool required) {
1412 set_parameter(label, default_value, required, parameters[label]);
1413 }
1414
1415 /// Add a new vector parameter to this object.
1416 void add_parameter(const std::string &label,
1417 std::initializer_list<double> default_value,
1418 bool required) {
1419 set_parameter(label, default_value, required, vector_parameters[label]);
1420 }
1421
1422 /// Parameters for the state variables.
1424
1425 /// Parameters for the gating variables.
1427
1428 /// Other parameters (i.e. other than initial conditions) are stored in a map
1429 /// as key-parameter pairs. Derived classes should add parameters to this map
1430 /// in their constructors by calling add_parameter.
1431 std::map<std::string, Parameter<double>> parameters;
1432
1433 /// Vector parameters are stored in a map as key-parameter pairs.
1434 std::map<std::string, VectorParameter<double>> vector_parameters;
1435
1436 /// Flag indicating whether the values of the parameters stored in this
1437 /// object have been set.
1438 bool value_set = false;
1439};
1440
1441/// @brief Parameters for a generic active stress model.
1442///
1443/// This class is meant to be inherited from to implement parameters for
1444/// specific active stress models. Derived classes will mostly have to call
1445/// add_parameter in their constructor to define the model-specific parameters.
1446///
1447/// In the XML file, this class, and the classes derived from it, correspond to
1448/// the element <Model_name> within the <Active_stress> element, where
1449/// Model_name is the name of a concrete active stress model.
1450class ActiveStressModelParameters : public ParameterLists {
1451public:
1452 /// Constructor.
1453 ActiveStressModelParameters(const std::string &xml_element_name_);
1454
1455 /// Return whether the parameters represented by this object were defined.
1456 bool defined() const { return value_set; }
1457
1458 /// Print the value of parameters.
1459 void print_parameters() const;
1460
1461 /// Set the values of parameters in this object from an XML element.
1462 void set_values(const tinyxml2::XMLElement *xml_elem);
1463
1464 /// Name of the XML element for this object.
1465 const std::string xml_element_name;
1466
1467 /// Get the value of a parameter by label.
1468 double get_scalar(const std::string &label) const {
1469 return double_parameters.at(label).value();
1470 }
1471
1472 /// Set the value of a scalar parameter by label.
1473 void set_scalar(const std::string &label, double value) {
1474 auto parameter = double_parameters.find(label);
1475 svmp::check<svmp::FE::InvalidArgumentException>(
1476 parameter != double_parameters.end(),
1477 "Active stress model parameter '" + label + "' not found.");
1478
1479 parameter->second.value_ = value;
1480 parameter->second.value_set_ = true;
1481 value_set = true;
1482 }
1483
1484 /// Get the value of a string parameter by label.
1485 std::string get_string(const std::string &label) const {
1486 return string_parameters.at(label).value();
1487 }
1488
1489 /// Get the value of a bool parameter by label.
1490 bool get_bool(const std::string &label) const {
1491 return bool_parameters.at(label).value();
1492 }
1493
1494protected:
1495 /// Add a new parameter to this object.
1496 void add_parameter(const std::string &label, double default_value,
1497 bool required) {
1498 set_parameter(label, default_value, required, double_parameters[label]);
1499 }
1500
1501 /// Add a new parameter to this object.
1502 void add_parameter(const std::string &label, const std::string &default_value,
1503 bool required) {
1504 set_parameter(label, default_value, required, string_parameters[label]);
1505 }
1506
1507 /// Add a new parameter to this object.
1508 void add_parameter(const std::string &label, bool default_value,
1509 bool required) {
1510 set_parameter(label, default_value, required, bool_parameters[label]);
1511 }
1512
1513 /// Parameters are stored in a map as key-parameter pairs. Derived classes
1514 /// should add parameters to this map in their constructors by calling
1515 /// add_parameter.
1516 /// @{
1517
1518 /// Double-valued parameters.
1519 std::map<std::string, Parameter<double>> double_parameters;
1520
1521 /// String-valued parameters.
1522 std::map<std::string, Parameter<std::string>> string_parameters;
1523
1524 /// Bool-valued parameters.
1525 std::map<std::string, Parameter<bool>> bool_parameters;
1526
1527 /// Flag indicating whether the values of the parameters stored in this
1528 /// object have been set.
1529 bool value_set = false;
1530};
1531
1532/// @brief Parameters for active stress models.
1533///
1534/// This class stores all the parameters related to active stress, including
1535/// e.g. the name of the specific selected model. The parameters specific to an
1536/// individual model are managed by the class @ref ActiveStressModelParameters,
1537/// of which this class owns an instance for every registered model.
1538///
1539/// In the XML file, this class corresponds to the <Active_stress> element.
1540class ActiveStressParameters : public ParameterLists {
1541public:
1542 /// Constructor.
1544
1545 /// Return whether the parameters represented by this object were defined.
1546 bool defined() const { return value_set; }
1547
1548 /// Print the value of parameters.
1549 void print_parameters() const;
1550
1551 /// Set the values of parameters in this object from an XML element.
1552 void set_values(const tinyxml2::XMLElement *xml_elem);
1553
1554 /// Get the name of the selected model. Throws an exception if it has not been
1555 /// set.
1556 std::string get_model_name() const;
1557
1558 /// Get the active tension coefficient along fibers.
1559 double get_eta_f() const;
1560
1561 /// Get the active tension coefficient along sheets.
1562 double get_eta_s() const;
1563
1564 /// Get the active tension coefficient along sheet normals.
1565 double get_eta_n() const;
1566
1567 /// Get whether the state of the active stress model is updated within the
1568 /// nonlinear iterations of the mechanics problem.
1569 bool get_implicit_state_coupling() const;
1570
1571 /// Get the factor applied to calcium before it is passed to the model.
1572 double get_calcium_scaling_factor() const;
1573
1574 /// Get whether the fiber stretch rate passed to the model is set to zero.
1576
1577 /// Get the parameters for a given active stress model.
1579 get_parameters(const std::string &model_name) const;
1580
1581 /// Name of the XML element for this object.
1582 static const std::string xml_element_name;
1583
1584protected:
1585 /// Parameter for the model name.
1587
1588 /// Parameter selecting whether the state of the active stress model is
1589 /// updated within the nonlinear iterations of the mechanics problem.
1591
1592 /// Parameter for the factor applied to calcium before it is passed to the
1593 /// model.
1595
1596 /// Parameter selecting whether the fiber stretch rate passed to the model is
1597 /// set to zero, disabling the force-strain-rate feedback.
1599
1600 /// Parameters for the directional distribution of active tension.
1602
1603 /// Active stress model parameters. Keys are the model names, as registered
1604 /// in the @ref ActiveStressModelFactory.
1605 std::map<std::string, std::unique_ptr<ActiveStressModelParameters>>
1607
1608 /// Flag indicating whether the values of the parameters stored in this
1609 /// object have been set.
1610 bool value_set = false;
1611};
1612
1613/// @brief The DomainParameters class stores parameters for the XML
1614/// 'Domain' element to specify properties for solving equations.
1615///
1616/// \code {.xml}
1617/// <Domain id="1" >
1618/// <Equation> fluid </Equation>
1619/// <Density> 1.06 </Density>
1620/// <Viscosity model="Constant" >
1621/// <Value> 0.04 </Value>
1622/// </Viscosity>
1623/// <Backflow_stabilization_coefficient> 0.2 </Backflow_stabilization_coefficient>
1624/// </Domain>
1625/// \endcode
1626class DomainParameters : public ParameterLists
1627{
1628 public:
1629 DomainParameters();
1630
1631 static const std::string xml_element_name_;
1632
1633 void print_parameters();
1634 void set_values(tinyxml2::XMLElement* xml_elem, bool from_external_xml = false);
1635
1636 // Parameters for sub-elements under the Domain element.
1637 ConstitutiveModelParameters constitutive_model;
1638 /// @todo This uses `unique_ptr` unlike most similar containers because
1639 /// `ParameterLists::params_map` stores pointers to members of each object.
1640 /// Revisit this when the `Parameters` classes are refactored.
1641 std::vector<std::unique_ptr<StimulusParameters>> stimuli;
1642 FluidViscosityParameters fluid_viscosity;
1643 SolidViscosityParameters solid_viscosity;
1644 ActiveStressParameters active_stress;
1645
1646 /// Ionic model parameters. Keys are the model names, as registered in the
1647 /// @ref IonicModelFactory.
1648 std::map<std::string, std::unique_ptr<IonicModelParameters>> ionic_models;
1649
1650 // Attributes.
1652
1653 Parameter<double> absolute_tolerance;
1654 Parameter<double> backflow_stabilization_coefficient;
1655
1656 Parameter<double> conductivity;
1657 //Parameter<std::string> constitutive_model_name;
1658 Parameter<double> continuity_stabilization_coefficient;
1659
1660 Parameter<double> density;
1661 Parameter<std::string> dilational_penalty_model;
1662
1663 Parameter<std::string> equation;
1664 Parameter<double> elasticity_modulus;
1665 Parameter<std::string> electrophysiology_model;
1666
1667 Parameter<double> feedback_parameter_for_stretch_activated_currents;
1668 Parameter<double> fluid_density;
1669 Parameter<double> force_x;
1670 Parameter<double> force_y;
1671 Parameter<double> force_z;
1672
1673 Parameter<std::string> include_xml;
1674
1675 /// Conductivities for CEP diffusion:
1676 /// @f[
1677 /// D = D_\mathrm{iso}\, I
1678 /// + D_f\, f\otimes f
1679 /// + D_s\, s\otimes s
1680 /// + D_n\, n\otimes n.
1681 /// @f]
1683 Parameter<double> fiber_conductivity;
1684 Parameter<double> sheet_conductivity;
1685 Parameter<double> sheet_normal_conductivity;
1686
1687 Parameter<double> mass_damping;
1688 Parameter<int> maximum_iterations;
1689 Parameter<double> momentum_stabilization_coefficient;
1690 Parameter<std::string> myocardial_zone;
1691
1692 Parameter<std::string> ode_solver;
1693 Parameter<double> penalty_parameter;
1694 Parameter<double> poisson_ratio;
1695 Parameter<double> relative_tolerance;
1696
1697 Parameter<double> shell_thickness;
1698 Parameter<double> solid_density;
1699 Parameter<double> source_term;
1700 Parameter<double> time_step_for_integration;
1701
1702 Parameter<double> darcy_permeability;
1703 Parameter<double> darcy_compressibility;
1704 Parameter<double> darcy_fluid_viscosity;
1705
1706 // Inverse permeability K^{-1} used in the Brinkman drag term
1707 // mu K^{-1} u. A value of zero disables Brinkman drag.
1708 Parameter<double> brinkman_inverse_permeability;
1709};
1710
1711/// @brief The RemesherParameters class stores parameters for the
1712/// 'Remesher' XML element used for remeshing.
1713///
1714/// \code {.xml}
1715/// <Remesher type="Tetgen" >
1716/// <Max_edge_size name="lumen" value="0.7"> </Max_edge_size>
1717/// <Max_edge_size name="wall" value="0.5"> </Max_edge_size>
1718/// <Min_dihedral_angle> 10.0 </Min_dihedral_angle>
1719/// <Max_radius_ratio> 1.1 </Max_radius_ratio>
1720/// <Remesh_frequency> 1000 </Remesh_frequency>
1721/// <Frequency_for_copying_data> 1 </Frequency_for_copying_data>
1722/// </Remesher>
1723/// \endcode
1724class RemesherParameters : public ParameterLists
1725{
1726 public:
1727 RemesherParameters();
1728
1729 static const std::string xml_element_name_;
1730 bool values_set_ = false;
1731
1732 bool defined() const { return values_set_; };
1733 void print_parameters();
1734 double get_edge_size(const std::string& name) const { return max_edge_sizes_.at(name); }
1735 bool has_edge_size(const std::string& name) const { return max_edge_sizes_.count(name) == 1; }
1736 void set_values(tinyxml2::XMLElement* mesh_elem);
1737
1738 // Values given in the 'Max_edge_size' element.
1739 std::map<std::string, double> max_edge_sizes_;
1740
1741 Parameter<std::string> type;
1742 Parameter<double> min_dihedral_angle;
1743 Parameter<double> max_radius_ratio;
1744 Parameter<int> remesh_frequency;
1745 Parameter<int> frequency_for_copying_data;
1746};
1747
1748/// @brief The ContactParameters class stores parameters for the 'Contact''
1749/// XML element used to specify parameter values for contact
1750/// computations.
1751class ContactParameters : public ParameterLists
1752{
1753 public:
1754 ContactParameters();
1755
1756 static const std::string xml_element_name_;
1757
1758 void print_parameters();
1759 void set_values(tinyxml2::XMLElement* xml_elem);
1760
1761 Parameter<double> closest_gap_to_activate_penalty;
1762
1763 Parameter<double> desired_separation;
1764
1765 Parameter<double> min_norm_of_face_normals;
1766
1768
1769 Parameter<double> penalty_constant;
1770};
1771
1772//----------------------
1773// LineSearchParameters
1774//----------------------
1775/// @brief Parameters of the line search shortening the increments of the
1776/// nonlinear iterations of an equation.
1777///
1778/// The line search is enabled by the presence of the XML element and disabled
1779/// by its absence.
1780///
1781/// XML element: \code {.xml}
1782/// <Line_search>
1783/// <Minimum_decrease> 1.0e-4 </Minimum_decrease>
1784/// <Step_reduction_factor> 0.5 </Step_reduction_factor>
1785/// <Minimum_step_length> 0.015625 </Minimum_step_length>
1786/// <Verbose> false </Verbose>
1787/// </Line_search>
1788/// \endcode
1789//
1790class LineSearchParameters : public ParameterLists
1791{
1792 public:
1793 LineSearchParameters();
1794
1795 static const std::string xml_element_name_;
1796
1797 bool defined() const { return value_set; };
1798 void set_values(tinyxml2::XMLElement* xml_elem);
1799 void print_parameters();
1800
1801 /// @brief Decrease of the residual norm that a step length must achieve to
1802 /// be accepted, as a fraction of the norm it starts from per unit step
1803 /// length. Any value small enough accepts every step that decreases the
1804 /// residual.
1806
1807 /// @brief Factor by which a rejected step length is multiplied.
1809
1810 /// @brief Shortest step length that is tried. It is applied without being
1811 /// measured, since there is no shorter one to fall back on.
1813
1814 /// @brief Report the step lengths that are rejected and accepted.
1816
1817 bool value_set = false;
1818};
1819
1820/// @brief The EquationParameters class stores parameters for the 'Add_equation'
1821/// XML element used to specify an equation to be solved (e.g. fluid).
1822///
1823/// \code {.xml}
1824/// <Add_equation type="FSI" >
1825/// <Coupled> true </Coupled>
1826/// <Min_iterations> 1 </Min_iterations>
1827/// <Max_iterations> 1 </Max_iterations>
1828/// .
1829/// .
1830/// .
1831/// </Add_equation>
1832/// \endcode
1833class EquationParameters : public ParameterLists
1834{
1835 public:
1836 EquationParameters();
1837
1838 static const std::string xml_element_name_;
1839
1840 void print_parameters();
1841 void set_values(tinyxml2::XMLElement* xml_elem, DomainParameters* default_domain=nullptr);
1842
1843 Parameter<double> backflow_stabilization_coefficient;
1844
1845 Parameter<double> conductivity;
1846 Parameter<double> continuity_stabilization_coefficient;
1847 Parameter<bool> coupled;
1848
1849 Parameter<double> density;
1850 Parameter<std::string> dilational_penalty_model;
1851
1852 Parameter<double> elasticity_modulus;
1853
1854 Parameter<std::string> include_xml;
1855 Parameter<std::string> initialize;
1856 Parameter<bool> initialize_rcr_from_flow;
1857
1858 Parameter<int> max_iterations;
1859 Parameter<int> min_iterations;
1860 Parameter<double> momentum_stabilization_coefficient;
1861
1862 Parameter<double> penalty_parameter;
1863 Parameter<double> poisson_ratio;
1864 Parameter<bool> prestress;
1865
1866 Parameter<double> source_term;
1867 Parameter<double> tolerance;
1868
1870 Parameter<bool> use_taylor_hood_type_basis;
1871
1872 // Explicit geometric coupling for FSI simulations: the fluid-structure equations
1873 // are solved to convergence using the mesh displacement from the previous time step,
1874 // and only then is the mesh equation solved.
1875 Parameter<bool> explicit_geometric_coupling;
1876
1877 // Sub-element parameters.
1878 //
1879 std::vector<BodyForceParameters*> body_forces;
1880
1881 std::vector<BoundaryConditionParameters*> boundary_conditions;
1882
1883 CoupleGenBCParameters couple_to_genBC;
1884
1885 svZeroDSolverInterfaceParameters svzerodsolver_interface_parameters;
1886
1887 svOneDSolverInterfaceParameters svonedsolver_interface_parameters;
1888
1889 DomainParameters* default_domain = nullptr;
1890
1891 std::vector<DomainParameters*> domains;
1892
1893 LinearSolverParameters linear_solver;
1894
1895 LineSearchParameters line_search;
1896
1897 std::vector<OutputParameters*> outputs;
1898
1899 RemesherParameters remesher;
1900
1901 VariableWallPropsParameters variable_wall_properties;
1902
1903 FluidViscosityParameters fluid_viscosity;
1904
1905 SolidViscosityParameters solid_viscosity;
1906
1907 ECGLeadsParameters ecg_leads;
1908
1909};
1910
1911/// @brief The GeneralSimulationParameters class stores paramaters for the
1912/// 'GeneralSimulationParameters' XML element.
1913///
1914/// \code {.xml}
1915/// <GeneralSimulationParameters>
1916/// <Continue_previous_simulation> 0 </Continue_previous_simulation>
1917/// <Number_of_spatial_dimensions> 3 </Number_of_spatial_dimensions>
1918/// <Number_of_time_steps> 1 </Number_of_time_steps>
1919/// <Time_step_size> 1e-4 </Time_step_size>
1920/// <Spectral_radius_of_infinite_time_step> 0.50 </Spectral_radius_of_infinite_time_step>
1921/// <Searched_file_name_to_trigger_stop> STOP_SIM </Searched_file_name_to_trigger_stop>
1922/// <Save_results_to_VTK_format> true </Save_results_to_VTK_format>
1923/// <Name_prefix_of_saved_VTK_files> result </Name_prefix_of_saved_VTK_files>
1924/// <Increment_in_saving_VTK_files> 1 </Increment_in_saving_VTK_files>
1925/// <Start_saving_after_time_step> 1 </Start_saving_after_time_step>
1926/// <Increment_in_saving_restart_files> 1 </Increment_in_saving_restart_files>
1927/// <Convert_BIN_to_VTK_format> 0 </Convert_BIN_to_VTK_format>
1928/// <Verbose> 1 </Verbose>
1929/// <Warning> 0 </Warning>
1930/// <Debug> 0 </Debug>
1931/// <Simulation_requires_remeshing> true </Simulation_requires_remeshing>
1932/// </GeneralSimulationParameters>
1933/// \endcode
1934class GeneralSimulationParameters : public ParameterLists
1935{
1936 public:
1938
1939 void print_parameters();
1940 void set_values(tinyxml2::XMLElement* xml_element, bool from_external_xml = false);
1941
1942 std::string xml_element_name;
1943
1944 Parameter<bool> check_ien_order;
1945 Parameter<bool> continue_previous_simulation;
1946 Parameter<bool> convert_bin_to_vtk_format;
1947 Parameter<bool> debug;
1948 Parameter<bool> overwrite_restart_file;
1949 Parameter<bool> save_averaged_results;
1950 Parameter<bool> save_domain_id_in_every_file;
1951 Parameter<bool> save_results_to_vtk_format;
1952 Parameter<bool> simulation_requires_remeshing;
1953 Parameter<bool> start_averaging_from_zero;
1954 Parameter<bool> verbose;
1955 Parameter<bool> warning;
1956
1957 Parameter<double> spectral_radius_of_infinite_time_step;
1958 Parameter<double> time_step_size;
1959 Parameter<double> initial_homogeneous_pressure;
1960
1961 Parameter<std::string> include_xml;
1962 Parameter<int> increment_in_saving_restart_files;
1963 Parameter<int> increment_in_saving_vtk_files;
1964 Parameter<int> number_of_spatial_dimensions;
1965 Parameter<int> number_of_initialization_time_steps;
1966 Parameter<int> start_saving_after_time_step;
1967 Parameter<int> starting_time_step;
1968 Parameter<int> number_of_time_steps;
1969
1970 Parameter<std::string> name_prefix_of_saved_vtk_files;
1971 Parameter<std::string> restart_file_name;
1972 Parameter<std::string> searched_file_name_to_trigger_stop;
1973 Parameter<std::string> save_results_in_folder;
1974 Parameter<std::string> simulation_initialization_file_path;
1975};
1976
1977/// @brief The FaceParameters class is used to store parameters for the
1978/// 'Add_face' XML element.
1979class FaceParameters : public ParameterLists
1980{
1981 public:
1982 FaceParameters();
1983
1984 void print_parameters();
1985 void set_values(tinyxml2::XMLElement* xml_elem);
1986
1987 static const std::string xml_element_name_;
1988
1989 Parameter<std::string> end_nodes_face_file_path;
1990 Parameter<std::string> face_file_path;
1992
1993 Parameter<double> quadrature_modifier_TRI3;
1994};
1995
1996/// @brief The MeshParameters class is used to store paramaters for the
1997/// 'Add_mesh' XML element.
1998///
1999/// \code {.xml}
2000/// <Add_mesh name="lumen" >
2001/// <Mesh_file_path> mesh/lumen/mesh-complete.mesh.vtu </Mesh_file_path>
2002///
2003/// <Add_face name="lumen_inlet">
2004/// <Face_file_path> mesh/lumen/mesh-surfaces/lumen_inlet.vtp </Face_file_path>
2005/// </Add_face>
2006///
2007/// <Add_face name="lumen_outlet">
2008/// <Face_file_path> mesh/lumen/mesh-surfaces/lumen_outlet.vtp </Face_file_path>
2009/// </Add_face>
2010///
2011/// <Add_face name="lumen_wall">
2012/// <Face_file_path> mesh/lumen/mesh-surfaces/lumen_wall.vtp </Face_file_path>
2013/// </Add_face>
2014///
2015/// <Domain> 0 </Domain>
2016///
2017/// </Add_mesh>
2018/// \endcode
2019class MeshParameters : public ParameterLists
2020{
2021 public:
2022 MeshParameters();
2023
2024 static const std::string xml_element_name_;
2025
2026 void print_parameters();
2027 void set_values(tinyxml2::XMLElement* mesh_elem, bool from_external_xml = false);
2028 std::string get_name() const { return name.value(); };
2029 std::string get_path() const { return mesh_file_path.value(); };
2030
2031 std::vector<FaceParameters*> face_parameters;
2032
2033 // Add_mesh name=
2034 Parameter<std::string> name;
2035
2036 // Parameters under Add_mesh
2037 //
2038 Parameter<int> domain_id;
2039 Parameter<std::string> domain_file_path;
2040
2041 // Constant fiber directions from <Fiber_direction_constant>.
2042 std::vector<VectorParameter<double>> fiber_direction_constant;
2043 // Fiber VTU paths from <Fiber_direction_from_file_points>.
2044 VectorParameter<std::string> fiber_direction_file_paths_points;
2045 // Fiber VTU paths from <Fiber_direction_from_file_cells>.
2046 VectorParameter<std::string> fiber_direction_file_paths_cells;
2047
2048 Parameter<std::string> include_xml;
2049 Parameter<std::string> initial_displacements_file_path;
2050 Parameter<std::string> initial_pressures_file_path;
2051 Parameter<bool> initialize_rcr_from_flow;
2052 Parameter<std::string> initial_velocities_file_path;
2053
2054 Parameter<std::string> mesh_file_path;
2055 Parameter<double> mesh_scale_factor;
2056 Parameter<std::string> prestress_file_path;
2057
2058 Parameter<bool> set_mesh_as_fibers;
2059 Parameter<bool> set_mesh_as_shell;
2060
2061 Parameter<double> quadrature_modifier_TET4;
2062};
2063
2064//////////////////////////////////////////////////////////
2065// Resistive immersed surfaces method //
2066//////////////////////////////////////////////////////////
2067
2068/// @brief The RISProjectionParameters class stores parameters for the
2069/// 'Add_RIS_projection' XML element used for RIS valve simulations.
2070/// \code {.xml}
2071/// <Add_RIS_projection name="left_ris" >
2072/// <Project_from_face> right_ris </Project_from_face>
2073/// <Resistance> 1.e6 </Resistance>
2074/// </Add_RIS_projection>
2075/// \endcode
2076class RISProjectionParameters : public ParameterLists
2077{
2078 public:
2079 RISProjectionParameters();
2080
2081 void set_values(tinyxml2::XMLElement* xml_elem);
2082
2083 static const std::string xml_element_name_;
2084
2086
2087 Parameter<std::string> project_from_face;
2088 Parameter<double> resistance;
2089 Parameter<double> projection_tolerance;
2090};
2091
2092/// @brief The URISFaceParameters class is used to store parameters for the
2093/// 'Add_URIS_face' XML element.
2094class URISFaceParameters : public ParameterLists
2095{
2096 public:
2097 URISFaceParameters();
2098
2099 void print_parameters();
2100 void set_values(tinyxml2::XMLElement* xml_elem);
2101
2102 static const std::string xml_element_name_;
2103
2104 Parameter<std::string> name; // Name of the valve surface
2105
2106 Parameter<std::string> face_file_path; // File path for the valve surface
2107 Parameter<std::string> open_motion_file_path; // File path for the open motion of the valve
2108 Parameter<std::string> close_motion_file_path; // File path for the close motion of the valve
2109
2110};
2111
2112/// @brief The URISMeshParameters class is used to store paramaters for the
2113/// 'Add_URIS_mesh' XML element.
2114///
2115/// \code {.xml}
2116/// <Add_uris_mesh name="MV" >
2117/// <Add_uris_face name="LCC" >
2118/// <Face_file_path> meshes/uris_face.vtu </Face_file_path>
2119/// <Open_motion_file_path> meshes/uris_facemotion_open.dat </Open_motion_file_path>
2120/// <Close_motion_file_path> meshes/uris_facemotion_close.dat </Close_motion_file_path>
2121/// </Add_uris_face>
2122/// <Mesh_scale_factor> 1.0 </Mesh_scale_factor>
2123/// <Thickness> 0.25 </Thickness>
2124/// <Resistance> 1.0e5 </Resistance>
2125/// <Positive_flow_normal_file> meshes/normal.dat </Positive_flow_normal_file>
2126/// </Add_uris_mesh>
2127/// \endcode
2128class URISMeshParameters : public ParameterLists
2129{
2130 public:
2131 URISMeshParameters();
2132
2133 static const std::string xml_element_name_;
2134
2135 void print_parameters();
2136 void set_values(tinyxml2::XMLElement* mesh_elem);
2137 std::string get_name() const { return name.value(); };
2138 // std::string get_path() const { return mesh_file_path.value(); };
2139
2140 std::vector<URISFaceParameters*> URIS_face_parameters;
2141
2142 // Add_mesh name
2143 Parameter<std::string> name; // Name of the valve mesh
2144
2145 // Parameters under Add_URIS_mesh
2146 Parameter<double> mesh_scale_factor; // Scale factor for the mesh
2147 Parameter<double> thickness; // Thickness of the valve
2148 Parameter<double> close_thickness; // Thickness of the valve when it is closed
2149 Parameter<double> resistance; // Resistance of the valve
2150 Parameter<bool> valve_starts_as_closed; // Whether the valve starts as closed
2151 Parameter<bool> invert_normal; // Whether to invert the valve surface normal vector
2152 Parameter<std::string> positive_flow_normal_file_path; // File path for the positive flow normal
2153 Parameter<std::string> scaffold_file_path; // File path for the valve scaffold mesh
2154 Parameter<bool> include_uris_velocity; // Whether to include the RIS velocity
2155};
2156
2157
2158
2159/// @brief The Parameters class stores parameter values read in from a solver input file.
2160class Parameters {
2161
2162 public:
2163 Parameters();
2164
2165 static const std::set<std::string> constitutive_model_names;
2166 static const std::set<std::string> equation_names;
2167 static const std::string FSI_FILE;
2168
2169 void get_logging_levels(int& verbose, int& warning, int& debug);
2170 void print_parameters();
2171 void read_xml(std::string file_name);
2172
2173 void set_contact_values(tinyxml2::XMLElement* root_element);
2174 void set_equation_values(tinyxml2::XMLElement* root_element);
2175 void set_mesh_values(tinyxml2::XMLElement* root_element);
2176 void set_precomputed_solution_values(tinyxml2::XMLElement* root_element);
2177 void set_projection_values(tinyxml2::XMLElement* root_element);
2178 void set_svzerodsolver_interface_values(tinyxml2::XMLElement* root_element);
2179
2180 void set_RIS_projection_values(tinyxml2::XMLElement* root_element);
2181 void set_URIS_mesh_values(tinyxml2::XMLElement* root_element);
2182
2183 // Objects representing each parameter section of XML file.
2184 ContactParameters contact_parameters;
2185 GeneralSimulationParameters general_simulation_parameters;
2186 std::vector<MeshParameters*> mesh_parameters;
2187 std::vector<EquationParameters*> equation_parameters;
2188 std::vector<ProjectionParameters*> projection_parameters;
2189 PrecomputedSolutionParameters precomputed_solution_parameters;
2190
2191 std::vector<RISProjectionParameters*> RIS_projection_parameters;
2192 std::vector<URISMeshParameters*> URIS_mesh_parameters;
2193
2194};
2195
2196#endif
Parameters for a generic active stress model.
Definition Parameters.h:1450
std::map< std::string, Parameter< bool > > bool_parameters
Bool-valued parameters.
Definition Parameters.h:1525
bool defined() const
Return whether the parameters represented by this object were defined.
Definition Parameters.h:1456
void set_scalar(const std::string &label, double value)
Set the value of a scalar parameter by label.
Definition Parameters.h:1473
std::map< std::string, Parameter< double > > double_parameters
Double-valued parameters.
Definition Parameters.h:1519
std::map< std::string, Parameter< std::string > > string_parameters
String-valued parameters.
Definition Parameters.h:1522
ActiveStressModelParameters(const std::string &xml_element_name_)
Constructor.
Definition Parameters.cpp:1860
std::string get_string(const std::string &label) const
Get the value of a string parameter by label.
Definition Parameters.h:1485
double get_scalar(const std::string &label) const
Get the value of a parameter by label.
Definition Parameters.h:1468
void set_values(const tinyxml2::XMLElement *xml_elem)
Set the values of parameters in this object from an XML element.
Definition Parameters.cpp:1888
bool get_bool(const std::string &label) const
Get the value of a bool parameter by label.
Definition Parameters.h:1490
void add_parameter(const std::string &label, const std::string &default_value, bool required)
Add a new parameter to this object.
Definition Parameters.h:1502
void add_parameter(const std::string &label, bool default_value, bool required)
Add a new parameter to this object.
Definition Parameters.h:1508
void add_parameter(const std::string &label, double default_value, bool required)
Add a new parameter to this object.
Definition Parameters.h:1496
bool value_set
Definition Parameters.h:1529
void print_parameters() const
Print the value of parameters.
Definition Parameters.cpp:1866
const std::string xml_element_name
Name of the XML element for this object.
Definition Parameters.h:1465
Parameters for active stress models.
Definition Parameters.h:1540
Parameter< bool > disable_force_strain_rate_feedback
Definition Parameters.h:1598
double get_calcium_scaling_factor() const
Get the factor applied to calcium before it is passed to the model.
Definition Parameters.cpp:1999
bool get_implicit_state_coupling() const
Definition Parameters.cpp:1995
Parameter< double > calcium_scaling_factor
Definition Parameters.h:1594
std::map< std::string, std::unique_ptr< ActiveStressModelParameters > > active_stress_models
Definition Parameters.h:1606
static const std::string xml_element_name
Name of the XML element for this object.
Definition Parameters.h:1582
Parameter< bool > implicit_state_coupling
Definition Parameters.h:1590
Parameter< std::string > model_name
Parameter for the model name.
Definition Parameters.h:1586
ActiveStressParameters()
Constructor.
Definition Parameters.cpp:1910
const ActiveStressModelParameters & get_parameters(const std::string &model_name) const
Get the parameters for a given active stress model.
Definition Parameters.cpp:2008
void print_parameters() const
Print the value of parameters.
Definition Parameters.cpp:1929
bool defined() const
Return whether the parameters represented by this object were defined.
Definition Parameters.h:1546
double get_eta_n() const
Get the active tension coefficient along sheet normals.
Definition Parameters.cpp:1991
bool get_disable_force_strain_rate_feedback() const
Get whether the fiber stretch rate passed to the model is set to zero.
Definition Parameters.cpp:2003
void set_values(const tinyxml2::XMLElement *xml_elem)
Set the values of parameters in this object from an XML element.
Definition Parameters.cpp:1943
DirectionalDistributionParameters directional_distribution
Parameters for the directional distribution of active tension.
Definition Parameters.h:1601
double get_eta_s() const
Get the active tension coefficient along sheets.
Definition Parameters.cpp:1987
std::string get_model_name() const
Definition Parameters.cpp:1974
bool value_set
Definition Parameters.h:1610
double get_eta_f() const
Get the active tension coefficient along fibers.
Definition Parameters.cpp:1983
static const std::string xml_element_name_
Define the XML element name for boundary condition parameters.
Definition Parameters.h:758
static const std::string xml_element_name_
Define the XML element name for equation boundary condition parameters.
Definition Parameters.h:858
RCR values for Neumann BC type.
Definition Parameters.h:788
BoundaryConditionRCRParameters()
RCR values for Neumann BC type.
Definition Parameters.cpp:461
The CANNParameters class stores the parameters table rows for xml element "Constitutive_model type=CA...
Definition Parameters.h:592
CANNParameters()
Constructor for CANNParameters class. Initializes parameter table.
Definition Parameters.cpp:1034
~CANNParameters()
Destructor for CANNParameters class. Deletes memory dynamically allocated to the rows of the table.
Definition Parameters.cpp:1045
static const std::string xml_element_name_
Process parameters for the "Add_row" xml element.
Definition Parameters.h:571
The ConstitutiveModelParameters class store parameters for various constitutive models.
Definition Parameters.h:608
void check_constitutive_model(const Parameter< std::string > &eq_type)
Check if a constitutive model is valid for the given equation.
Definition Parameters.cpp:1137
static const std::map< std::string, std::string > constitutive_model_types
Supported constitutive model types and their aliases.
Definition Parameters.h:673
static const std::string xml_element_name_
Process parameters for various constitutive models.
Definition Parameters.h:615
The ContactParameters class stores parameters for the 'Contact'' XML element used to specify paramete...
Definition Parameters.h:1752
static const std::string xml_element_name_
Process parameters for the 'Contact' XML element used to specify parameters for contact computation.
Definition Parameters.h:1756
Coupling to GenBC.
Definition Parameters.h:645
static const std::string xml_element_name_
Coupling to GenBC.
Definition Parameters.h:649
svZeroDSolver coupling options under Add_BC (with Time_dependence Coupled).
Definition Parameters.h:817
The DirectionalDistributionParameters class stores directional distribution parameters for active str...
Definition Parameters.h:1289
static const std::string xml_element_name_
Define the XML element name for directional distribution parameters.
Definition Parameters.h:1293
The DomainParameters class stores parameters for the XML 'Domain' element to specify properties for s...
Definition Parameters.h:1627
std::vector< std::unique_ptr< StimulusParameters > > stimuli
Definition Parameters.h:1641
Parameter< double > isotropic_conductivity
Definition Parameters.h:1682
static const std::string xml_element_name_
Define the XML element name for domain parameters.
Definition Parameters.h:1631
std::map< std::string, std::unique_ptr< IonicModelParameters > > ionic_models
Definition Parameters.h:1648
Definition Parameters.h:1261
static const std::string xml_element_name_
Define the XML element name for ECG leads parameters.
Definition Parameters.h:1265
static const std::string xml_element_name_
Define the XML element name for equation parameters.
Definition Parameters.h:1838
static const std::string xml_element_name_
Process parameters for the 'Add_face' XML element.
Definition Parameters.h:1987
Definition Parameters.h:1020
Definition Parameters.h:1034
Definition Parameters.h:1011
Definition Parameters.h:1045
static const std::string xml_element_name_
Process parameters for various fluid viscosity models.
Definition Parameters.h:1049
The GeneralSimulationParameters class stores paramaters for the 'GeneralSimulationParameters' XML ele...
Definition Parameters.h:1935
void set_values(tinyxml2::XMLElement *xml_element, bool from_external_xml=false)
Set general parameters values from XML.
Definition Parameters.cpp:2978
GeneralSimulationParameters()
Process paramaters for the 'GeneralSimulationParameters' XML element.
Definition Parameters.cpp:2898
Definition Parameters.h:479
Definition Parameters.h:517
Definition Parameters.h:496
Generic ionic model initial conditions parameters.
Definition Parameters.h:1308
const bool required
Definition Parameters.h:1335
void set_values(const tinyxml2::XMLElement *xml_elem)
Set the value of parameters in this object from an XML element.
Definition Parameters.cpp:1743
bool value_set
Definition Parameters.h:1343
IonicInitialStateParameters(const std::string &xml_element_name_, const std::vector< std::pair< std::string, double > > &states)
Constructor.
Definition Parameters.cpp:1723
void print_parameters() const
Print the value of parameters.
Definition Parameters.cpp:1734
bool defined() const
Return whether the parameters represented by this object were defined.
Definition Parameters.h:1316
double operator[](const std::string &label) const
Get the value of a parameter by label.
Definition Parameters.h:1325
const std::string xml_element_name
Name of the XML element for this object.
Definition Parameters.h:1330
std::map< std::string, Parameter< double > > parameters
Parameter instances underlying this object.
Definition Parameters.h:1339
const IonicInitialStateParameters & get_initial_X() const
Get the parameters for the state variables.
Definition Parameters.h:1368
std::map< std::string, VectorParameter< double > > vector_parameters
Vector parameters are stored in a map as key-parameter pairs.
Definition Parameters.h:1434
IonicInitialStateParameters initial_X_parameters
Parameters for the state variables.
Definition Parameters.h:1423
double get_scalar(const std::string &label) const
Get the value of a scalar parameter by label.
Definition Parameters.h:1381
void set_scalar(const std::string &label, double value)
Set the value of a scalar parameter by label.
Definition Parameters.h:1386
Vector< double > get_vector(const std::string &label) const
Get the value of a vector parameter by label.
Definition Parameters.h:1398
bool defined() const
Return whether the parameters represented by this object were defined.
Definition Parameters.h:1359
IonicInitialStateParameters initial_Xg_parameters
Parameters for the gating variables.
Definition Parameters.h:1426
void set_values(const tinyxml2::XMLElement *xml_elem)
Set the values of parameters in this object from an XML element.
Definition Parameters.cpp:1820
const std::string xml_element_name
Name of the XML element for this object.
Definition Parameters.h:1378
std::map< std::string, Parameter< double > > parameters
Definition Parameters.h:1431
bool value_set
Definition Parameters.h:1438
void add_parameter(const std::string &label, double default_value, bool required)
Add a new parameter to this object.
Definition Parameters.h:1410
void add_parameter(const std::string &label, std::initializer_list< double > default_value, bool required)
Add a new vector parameter to this object.
Definition Parameters.h:1416
void print_parameters() const
Print the value of parameters.
Definition Parameters.cpp:1788
const IonicInitialStateParameters & get_initial_Xg() const
Get the parameters for the gating variables.
Definition Parameters.h:1373
IonicModelParameters(const std::string &xml_element_name_, const std::vector< std::pair< std::string, double > > &initial_X, const std::vector< std::pair< std::string, double > > &initial_Xg)
Constructor.
Definition Parameters.cpp:1778
Definition Parameters.h:464
Parameters of the line search shortening the increments of the nonlinear iterations of an equation.
Definition Parameters.h:1791
Parameter< double > step_reduction_factor
Factor by which a rejected step length is multiplied.
Definition Parameters.h:1808
Parameter< double > minimum_step_length
Shortest step length that is tried. It is applied without being measured, since there is no shorter o...
Definition Parameters.h:1812
Parameter< bool > verbose
Report the step lengths that are rejected and accepted.
Definition Parameters.h:1815
Parameter< double > minimum_decrease
Decrease of the residual norm that a step length must achieve to be accepted, as a fraction of the no...
Definition Parameters.h:1805
The LinearAlgebraParameters class stores parameters for the 'Linear_algebra' XML element.
Definition Parameters.h:1115
void check_input_parameters()
Check the validity of the input parameters.
Definition Parameters.cpp:3655
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1117
The LinearSolverParameters class stores parameters for the 'LS' XML element.
Definition Parameters.h:1135
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1142
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:2024
Definition Parameters.h:532
Definition Parameters.h:544
NeoHookeanParameters()
There are no parameters associated with a Neohookean model.
Definition Parameters.cpp:943
std::string get_alias_value(const std::string &name)
Get the value of an alias by name.
Definition Parameters.cpp:1338
bool get_output_value(const std::string &name)
Get the value of an output by name.
Definition Parameters.cpp:1349
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:924
The Parameter class template is used to store a named paramater and its scalar value as a basic type:...
Definition Parameters.h:91
void set(const std::string &name, bool required, T value)
Set the parameter name and value, and if it is required.
Definition Parameters.h:122
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:129
std::string svalue()
Get the value of a parameter as a string.
Definition Parameters.h:108
void check_required()
Check if any required parameters have not been set.
Definition Parameters.h:395
void set_parameter(const std::string &name, const bool value, bool required, Parameter< bool > &param)
Set the name, default value and the parameter required flag.
Definition Parameters.h:304
void set_parameter_value_CANN(const std::string &name, const std::string &value)
set_parameter function to handle CANNRow
Definition Parameters.h:348
void set_parameter_value(const std::string &name, const std::string &value)
Set the value of a paramter from a string.
Definition Parameters.h:385
std::map< std::string, std::variant< Parameter< bool > *, Parameter< double > *, Parameter< int > *, Parameter< std::string > *, VectorParameter< double > *, VectorParameter< int > *, VectorParameter< std::string > * > > params_map
Map used for storing parameters by name / Parameter template union.
Definition Parameters.h:436
std::map< std::string, std::string > get_parameter_list() const
Get the defined parameters as a map of strings.
Definition Parameters.h:409
void print_parameter_list()
Print the parameters.
Definition Parameters.h:422
void read_xml(std::string file_name)
Set the simulation parameter values given in an XML format file.
Definition Parameters.cpp:235
The PrecomputedSolutionParameters class stores parameters for the 'Precomputed_solution' XML element ...
Definition Parameters.h:950
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:979
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:2083
The RemesherParameters class stores parameters for the 'Remesher' XML element used for remeshing.
Definition Parameters.h:1725
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1729
Definition Parameters.h:1074
Definition Parameters.h:1092
static const std::string xml_element_name_
Process parameters for various solid viscosity models.
Definition Parameters.h:1096
Definition Parameters.h:1083
Definition Parameters.h:553
StVenantKirchhoffParameters()
There are no parameters associated with a StVenantKirchhoff model.
Definition Parameters.cpp:952
Stores <Box> parameters for CEP stimulus spatial bounds.
Definition Parameters.h:1164
static const std::string xml_element_name_
XML element name for CEP stimulus box spatial bounds.
Definition Parameters.h:1169
static const std::string xml_element_name_
XML element name for CEP stimulus parameters.
Definition Parameters.h:1242
Stores <Spatial_bounds> parameters for CEP stimulus geometry restrictions.
Definition Parameters.h:1200
static const std::string xml_element_name_
XML element name for CEP stimulus spatial bounds.
Definition Parameters.h:1203
Stores <Sphere> parameters for CEP stimulus spatial bounds.
Definition Parameters.h:1182
static const std::string xml_element_name_
XML element name for CEP stimulus sphere spatial bounds.
Definition Parameters.h:1187
static const std::string xml_element_name_
Process parameters for the 'Add_URIS_face' XML element.
Definition Parameters.h:2102
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:2133
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:990
static const std::string xml_element_name_
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:993
The Vector template class is used for storing int and double data.
Definition Vector.h:26
The VectorParameter class template is used to store a named paramater and its vector of values as a b...
Definition Parameters.h:176
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:230
void set(const std::string &name, bool required, const std::vector< T > &value)
Set the parameter name and value, and if it is required.
Definition Parameters.h:222
std::string svalue()
Get the string representation of the parameter value.
Definition Parameters.h:196
Parameters for coupling to the svOneDSolver (1D blood-flow solver).
Definition Parameters.h:728
Parameters for coupling to the svZeroDSolver (0D lumped-parameter solver).
Definition Parameters.h:679
struct to define a row of CANN model parameter table
Definition Parameters.h:284