From 5fa855d712f97aa8c40048e1a9e95d0ade7f0a9b Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 5 Sep 2024 10:11:54 -0400 Subject: [PATCH] added dimensionality for surface tension, epsilon and mobility --- include/core/parameters.h | 9 +++++--- include/core/parameters_multiphysics.h | 4 ++-- include/solvers/simulation_parameters.h | 4 ++-- source/core/parameters.cc | 30 +++++++++++++++---------- source/core/parameters_multiphysics.cc | 9 +++++--- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/include/core/parameters.h b/include/core/parameters.h index f9970e66df..9f97685326 100644 --- a/include/core/parameters.h +++ b/include/core/parameters.h @@ -353,7 +353,8 @@ namespace Parameters void declare_parameters(ParameterHandler &prm); void - parse_parameters(ParameterHandler &prm); + parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions); }; /** @@ -368,7 +369,8 @@ namespace Parameters void declare_parameters(ParameterHandler &prm); void - parse_parameters(ParameterHandler &prm); + parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions); }; @@ -502,7 +504,8 @@ namespace Parameters declare_parameters(ParameterHandler &prm, unsigned int id); void - parse_parameters(ParameterHandler &prm, const unsigned int id); + parse_parameters(ParameterHandler &prm, const unsigned int id, + const Parameters::Dimensionality dimensions); }; /** diff --git a/include/core/parameters_multiphysics.h b/include/core/parameters_multiphysics.h index b4e8893839..b0ba924a27 100644 --- a/include/core/parameters_multiphysics.h +++ b/include/core/parameters_multiphysics.h @@ -217,7 +217,7 @@ namespace Parameters void declare_parameters(ParameterHandler &prm); void - parse_parameters(ParameterHandler &prm); + parse_parameters(ParameterHandler &prm, const Dimensionality dimensions); }; /** @@ -242,7 +242,7 @@ namespace Parameters void declare_parameters(ParameterHandler &prm); void - parse_parameters(ParameterHandler &prm); + parse_parameters(ParameterHandler &prm, const Dimensionality dimensions); }; } // namespace Parameters #endif diff --git a/include/solvers/simulation_parameters.h b/include/solvers/simulation_parameters.h index 58e271f63e..a7c27f8045 100644 --- a/include/solvers/simulation_parameters.h +++ b/include/solvers/simulation_parameters.h @@ -162,7 +162,7 @@ class SimulationParameters mesh_box_refinement->parse_parameters(prm); nitsche->parse_parameters(prm); physical_properties.parse_parameters(prm, dimensionality); - multiphysics.parse_parameters(prm); + multiphysics.parse_parameters(prm,dimensionality); timer.parse_parameters(prm); fem_parameters.parse_parameters(prm); laser_parameters->parse_parameters(prm); @@ -182,7 +182,7 @@ class SimulationParameters simulation_control.parse_parameters(prm); velocity_sources.parse_parameters(prm); particlesParameters->parse_parameters(prm); - multiphysics.parse_parameters(prm); + //multiphysics.parse_parameters(prm); constrain_solid_domain.parse_parameters(prm); stabilization.parse_parameters(prm); ale.parse_parameters(prm); diff --git a/source/core/parameters.cc b/source/core/parameters.cc index 2412e0dbe2..17955204f8 100644 --- a/source/core/parameters.cc +++ b/source/core/parameters.cc @@ -514,9 +514,11 @@ namespace Parameters } void - SurfaceTensionParameters::parse_parameters(ParameterHandler &prm) + SurfaceTensionParameters::parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions) { surface_tension_coefficient = prm.get_double("surface tension coefficient"); + surface_tension_coefficient *= dimensions.surface_tension_scaling; T_0 = prm.get_double("reference state temperature"); surface_tension_gradient = prm.get_double("temperature-driven surface tension gradient"); @@ -539,10 +541,13 @@ namespace Parameters } void - MobilityCahnHilliardParameters::parse_parameters(ParameterHandler &prm) + MobilityCahnHilliardParameters::parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions) { mobility_cahn_hilliard_constant = prm.get_double("cahn hilliard mobility constant"); + mobility_cahn_hilliard_constant *= + dimensions.cahn_hilliard_mobility_scaling; } template @@ -954,7 +959,7 @@ namespace Parameters ++i_material_interaction) { material_interactions[i_material_interaction].parse_parameters( - prm, i_material_interaction); + prm, i_material_interaction,dimensions); if (material_interactions[i_material_interaction] .material_interaction_type == MaterialInteractions::MaterialInteractionsType::fluid_fluid) @@ -1296,7 +1301,8 @@ namespace Parameters } void - MaterialInteractions::parse_parameters(ParameterHandler &prm, unsigned int id) + MaterialInteractions::parse_parameters(ParameterHandler &prm, unsigned int id, + const Parameters::Dimensionality dimensions) { prm.enter_subsection("material interaction " + Utilities::int_to_string(id, 1)); @@ -1331,17 +1337,17 @@ namespace Parameters if (op == "constant") { surface_tension_model = SurfaceTensionModel::constant; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else if (op == "linear") { surface_tension_model = SurfaceTensionModel::linear; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else if (op == "phase change") { surface_tension_model = SurfaceTensionModel::phase_change; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else throw(std::runtime_error( @@ -1353,13 +1359,13 @@ namespace Parameters { mobility_cahn_hilliard_model = MobilityCahnHilliardModel::constant; - mobility_cahn_hilliard_parameters.parse_parameters(prm); + mobility_cahn_hilliard_parameters.parse_parameters(prm,dimensions); } else if (op == "quartic") { mobility_cahn_hilliard_model = MobilityCahnHilliardModel::quartic; - mobility_cahn_hilliard_parameters.parse_parameters(prm); + mobility_cahn_hilliard_parameters.parse_parameters(prm,dimensions); } else throw(std::runtime_error( @@ -1382,17 +1388,17 @@ namespace Parameters if (op == "constant") { surface_tension_model = SurfaceTensionModel::constant; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else if (op == "linear") { surface_tension_model = SurfaceTensionModel::linear; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else if (op == "phase change") { surface_tension_model = SurfaceTensionModel::phase_change; - surface_tension_parameters.parse_parameters(prm); + surface_tension_parameters.parse_parameters(prm,dimensions); } else throw(std::runtime_error( diff --git a/source/core/parameters_multiphysics.cc b/source/core/parameters_multiphysics.cc index 5874df09c6..89bc7d0af5 100644 --- a/source/core/parameters_multiphysics.cc +++ b/source/core/parameters_multiphysics.cc @@ -73,7 +73,8 @@ Parameters::Multiphysics::declare_parameters(ParameterHandler &prm) } void -Parameters::Multiphysics::parse_parameters(ParameterHandler &prm) +Parameters::Multiphysics::parse_parameters(ParameterHandler &prm, + const Dimensionality dimensions) { prm.enter_subsection("multiphysics"); { @@ -89,7 +90,7 @@ Parameters::Multiphysics::parse_parameters(ParameterHandler &prm) } prm.leave_subsection(); vof_parameters.parse_parameters(prm); - cahn_hilliard_parameters.parse_parameters(prm); + cahn_hilliard_parameters.parse_parameters(prm, dimensions); } void @@ -525,7 +526,8 @@ Parameters::CahnHilliard::declare_parameters(ParameterHandler &prm) } void -Parameters::CahnHilliard::parse_parameters(ParameterHandler &prm) +Parameters::CahnHilliard::parse_parameters(ParameterHandler &prm, + const Dimensionality dimensions) { prm.enter_subsection("cahn hilliard"); { @@ -552,6 +554,7 @@ Parameters::CahnHilliard::parse_parameters(ParameterHandler &prm) "Options are 'automatic' or 'manual'.")); epsilon = prm.get_double("value"); + epsilon *= dimensions.cahn_hilliard_epsilon_scaling; } prm.leave_subsection(); }