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