svMultiPhysics
Loading...
Searching...
No Matches
set_viscosity_props.h
1/* Copyright (c) Stanford University, The Regents of the University of California, and others.
2 *
3 * All Rights Reserved.
4 *
5 * See Copyright-SimVascular.txt for additional details.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject
13 * to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
22 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31///////////////////////////////////////////////////////////
32// S e t V i s c o s i t y P r o p e r t i e s //
33///////////////////////////////////////////////////////////
34//
35// The 'set_fluid_viscosity_props ' map defined here sets fluid
36// viscosity properties from values read in from a file.
37// The 'set_solid_viscosity_props ' map defined here sets solid
38// viscosity properties from values read in from a file.
39
40using SetFluidViscosityPropertiesMapType = std::map<consts::FluidViscosityModelType, std::function<void(Simulation*, FluidViscosityParameters&,
41 dmnType& lDmn)>>;
42
43SetFluidViscosityPropertiesMapType set_fluid_viscosity_props = {
44
45//---------------------------//
46// viscType_Const //
47//---------------------------//
48//
49{consts::FluidViscosityModelType::viscType_Const, [](Simulation* simulation, FluidViscosityParameters& params, dmnType& lDmn) -> void
50{
51 using namespace consts;
52 auto& com_mod = simulation->get_com_mod();
53
54 lDmn.fluid_visc.viscType = FluidViscosityModelType::viscType_Const;
55 lDmn.fluid_visc.mu_i = params.newtonian_model.constant_value.value();
56} },
57
58//---------------------------//
59// viscType_CY //
60//---------------------------//
61//
62{consts::FluidViscosityModelType::viscType_CY, [](Simulation* simulation, FluidViscosityParameters& params, dmnType& lDmn) -> void
63{
64 using namespace consts;
65 auto& com_mod = simulation->get_com_mod();
66 auto& model_params = params.carreau_yasuda_model;
67
68 lDmn.fluid_visc.viscType = FluidViscosityModelType::viscType_CY;
69
70 lDmn.fluid_visc.mu_i = model_params.limiting_high_shear_rate_viscosity.value();
71 lDmn.fluid_visc.mu_o = model_params.limiting_low_shear_rate_viscosity.value();
72 lDmn.fluid_visc.lam = model_params.shear_rate_tensor_multipler.value();
73 lDmn.fluid_visc.a = model_params.shear_rate_tensor_exponent.value();
74 lDmn.fluid_visc.n = model_params.power_law_index.value();
75
76 if (lDmn.fluid_visc.mu_i > lDmn.fluid_visc.mu_o) {
77 throw std::runtime_error("Unexpected inputs for Carreau-Yasuda model. "
78 "High shear-rate viscosity value (" + std::to_string(lDmn.fluid_visc.mu_i) +
79 " should be larger than low shear-rate value " + std::to_string(lDmn.fluid_visc.mu_i) + ".");
80 }
81
82} },
83
84//---------------------------//
85// viscType_Cass //
86//---------------------------//
87//
88{consts::FluidViscosityModelType::viscType_Cass, [](Simulation* simulation, FluidViscosityParameters& params, dmnType& lDmn) -> void
89{
90 using namespace consts;
91 auto& com_mod = simulation->get_com_mod();
92 auto& model_params = params.cassons_model;
93
94 lDmn.fluid_visc.viscType = FluidViscosityModelType::viscType_Cass;
95 lDmn.fluid_visc.mu_i = model_params.asymptotic_viscosity();
96 lDmn.fluid_visc.mu_o = model_params.yield_stress();
97
98 if (model_params.low_shear_rate_threshold.defined()) {
99 lDmn.fluid_visc.lam = model_params.low_shear_rate_threshold();
100 } else {
101 lDmn.fluid_visc.lam = 0.5;
102 }
103
104} },
105
106};
107
108
109
110
111
112using SetSolidViscosityPropertiesMapType = std::map<consts::SolidViscosityModelType, std::function<void(Simulation*, SolidViscosityParameters&,
113 dmnType& lDmn)>>;
114
115SetSolidViscosityPropertiesMapType set_solid_viscosity_props = {
116
117//---------------------------//
118// viscType_Newtonian //
119//---------------------------//
120//
121{consts::SolidViscosityModelType::viscType_Newtonian, [](Simulation* simulation, SolidViscosityParameters& params, dmnType& lDmn) -> void
122{
123 using namespace consts;
124 auto& com_mod = simulation->get_com_mod();
125
126 lDmn.solid_visc.viscType = SolidViscosityModelType::viscType_Newtonian;
127 lDmn.solid_visc.mu = params.newtonian_model.constant_value.value();
128} },
129
130//---------------------------//
131// viscType_Potential //
132//---------------------------//
133//
134{consts::SolidViscosityModelType::viscType_Potential, [](Simulation* simulation, SolidViscosityParameters& params, dmnType& lDmn) -> void
135{
136 using namespace consts;
137 auto& com_mod = simulation->get_com_mod();
138
139 lDmn.solid_visc.viscType = SolidViscosityModelType::viscType_Potential;
140 lDmn.solid_visc.mu = params.potential_model.constant_value.value();
141} },
142
143};
144
145
Definition Parameters.h:861
Definition Simulation.h:41
Definition Parameters.h:908
Domain type is to keep track with element belong to which domain and also different physical quantiti...
Definition ComMod.h:432