7#ifndef SVZERODSOLVER_SIMULATIONPARAMETERS_HPP_
8#define SVZERODSOLVER_SIMULATIONPARAMETERS_HPP_
11#include <nlohmann/json.hpp>
88 JsonWrapper(
const nlohmann::json& json,
const std::string& component,
89 const std::string& name_str,
const int&
id)
90 : nlohmann::json(json[component][id]),
103 if (!this->contains(key)) {
104 if (this->contains(name_str)) {
105 const std::string name = this->at(name_str);
106 throw std::runtime_error(
"Key " + std::string(key) +
107 " not found in element " + name +
108 " of component " + component);
110 throw std::runtime_error(
111 "Key " + std::string(key) +
" not found in element number " +
112 std::to_string(block_id) +
" of component " + component);
115 return this->at(key);
119 using nlohmann::json::contains;
120 using nlohmann::json::value;
121 using nlohmann::json::operator[];
124 std::string component;
125 std::string name_str;
143int generate_block(
Model& model,
const nlohmann::json& block_params_json,
144 const std::string& block_type,
const std::string_view& name,
145 bool internal =
false,
bool periodic =
true);
159std::unique_ptr<ActivationFunction> generate_activation_function(
160 Model& model,
const nlohmann::json& j,
const std::string& chamber_name);
174std::unique_ptr<SphereMaterial> generate_material(
175 const nlohmann::json& j,
const std::string& chamber_name);
184State load_initial_condition(
const nlohmann::json& config,
Model& model);
201void load_simulation_model(
const nlohmann::json& config,
Model& model);
208void validate_input(
const nlohmann::json& config);
222 std::vector<std::tuple<std::string, std::string>>& connections,
223 const nlohmann::json& config,
const std::string& component,
224 std::map<int, std::string>& vessel_id_map);
237void create_external_coupling(
239 std::vector<std::tuple<std::string, std::string>>& connections,
240 const nlohmann::json& config,
const std::string& component,
241 std::map<int, std::string>& vessel_id_map,
242 std::map<std::string, std::string>& bc_type_map);
254void create_boundary_conditions(
Model& model,
const nlohmann::json& config,
255 const std::string& component,
256 std::map<std::string, std::string>& bc_type_map,
257 std::vector<std::string>& closed_loop_bcs);
268void create_junctions(
270 std::vector<std::tuple<std::string, std::string>>& connections,
271 const nlohmann::json& config,
const std::string& component,
272 std::map<int, std::string>& vessel_id_map);
284void create_closed_loop(
286 std::vector<std::tuple<std::string, std::string>>& connections,
287 const nlohmann::json& config,
const std::string& component,
288 std::vector<std::string>& closed_loop_bcs);
300 std::vector<std::tuple<std::string, std::string>>& connections,
301 const nlohmann::json& config,
const std::string& component);
313 std::vector<std::tuple<std::string, std::string>>& connections,
314 const nlohmann::json& config,
const std::string& component);
Activation function classes for cardiac chamber models.
Material models for the ChamberSphere block.
const nlohmann::json & operator[](const char *key) const
Wrap error check around key retrieval (throws detailed error if key doesn't exist).
Definition SimulationParameters.h:102
JsonWrapper(const nlohmann::json &json, const std::string &component, const std::string &name_str, const int &id)
Wrap around JSON configuration with detailed error message in case key is not found in configuration.
Definition SimulationParameters.h:88
Model of 0D elements.
Definition Model.h:55
State of the system.
Definition State.h:19
Simulation parameters.
Definition SimulationParameters.h:39
bool sim_coupled
Running 0D simulation coupled with external solver.
Definition SimulationParameters.h:67
int sim_nliter
Definition SimulationParameters.h:55
bool output_all_cycles
Output all cardiac cycles.
Definition SimulationParameters.h:65
int sim_pts_per_cycle
Number of time steps per cardiac cycle.
Definition SimulationParameters.h:46
int sim_num_time_steps
Total number of time steps.
Definition SimulationParameters.h:54
double sim_external_step_size
Definition SimulationParameters.h:69
double sim_time_step_size
Simulation time step size.
Definition SimulationParameters.h:42
int sim_num_cycles
Number of cardiac cycles to simulate.
Definition SimulationParameters.h:45
bool output_mean_only
Output only the mean value.
Definition SimulationParameters.h:63
bool sim_max_iter_error_to_warning
Definition SimulationParameters.h:71
bool sim_steady_initial
Start from steady solution.
Definition SimulationParameters.h:60
int output_interval
Interval of writing output.
Definition SimulationParameters.h:58
bool output_variable_based
Output variable based instead of vessel based.
Definition SimulationParameters.h:61
double sim_abs_tol
Absolute tolerance for simulation.
Definition SimulationParameters.h:43
double sim_cardiac_period
Cardiac period.
Definition SimulationParameters.h:44
bool output_derivative
Output derivatives.
Definition SimulationParameters.h:64
double sim_cycle_to_cycle_error
Cycle-to-cycle error.
Definition SimulationParameters.h:53
bool use_cycle_to_cycle_error
Definition SimulationParameters.h:47
double sim_rho_infty
Spectral radius of generalized-alpha.
Definition SimulationParameters.h:57