diff --git a/CHANGELOG.md b/CHANGELOG.md index f2148fac81..612428e62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to the Lethe project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). +## [Master] - 2024-09-20 + +### Added + +- MINOR Added dimensionality for the mobility and interface thickness in the CHNS solver, and surface tension related parameters in the VOF solver. [#1274](https://github.com/chaos-polymtl/lethe/pull/1274) + ## [Master] - 2024-09-12 ### Fixed diff --git a/include/core/dimensionality.h b/include/core/dimensionality.h index 920d01db7f..1b56d03fd8 100644 --- a/include/core/dimensionality.h +++ b/include/core/dimensionality.h @@ -102,6 +102,10 @@ namespace Parameters double enthalpy_scaling; double diffusivity_scaling; double thermal_expansion_scaling; + double surface_tension_scaling; + double surface_tension_gradient_scaling; + double cahn_hilliard_mobility_scaling; + double cahn_hilliard_epsilon_scaling; }; } // namespace Parameters diff --git a/include/core/parameters.h b/include/core/parameters.h index bddd5baa97..9a44fa9535 100644 --- a/include/core/parameters.h +++ b/include/core/parameters.h @@ -350,10 +350,24 @@ namespace Parameters // Liquidus temperature - Units in K double T_liquidus; + /** + * @brief Declare the parameters. + * + * @param[in,out] prm The ParameterHandler. + */ void declare_parameters(ParameterHandler &prm); void - parse_parameters(ParameterHandler &prm); + /** + * @brief Parse the parameters. + * + * @param[in,out] prm The ParameterHandler. + * + * @param[in] dimensions The Dimensionality object controling the + * fundamental dimensions (length, time, mass, temperature) of the problem. + */ + parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions); }; /** @@ -365,10 +379,25 @@ namespace Parameters // Mobility constant (M) in m^2/s double mobility_cahn_hilliard_constant; + /** + * @brief Declare the parameters. + * + * @param[in,out] prm The ParameterHandler. + */ void declare_parameters(ParameterHandler &prm); + + /** + * @brief Parse the parameters. + * + * @param[in,out] prm The ParameterHandler. + * + * @param[in] dimensions The Dimensionality object controling the + * fundamental dimensions (length, time, mass, temperature) of the problem. + */ void - parse_parameters(ParameterHandler &prm); + parse_parameters(ParameterHandler &prm, + const Parameters::Dimensionality dimensions); }; @@ -498,11 +527,30 @@ namespace Parameters std::pair, unsigned int> fluid_solid_interaction_with_material_interaction_id; + /** + * @brief Declare the parameters. + * + * @param[in,out] prm The ParameterHandler. + * + * @param[in] id The material id. + */ void declare_parameters(ParameterHandler &prm, unsigned int id); + /** + * @brief Parse the parameters. + * + * @param[in,out] prm The ParameterHandler. + * + * @param[in] id The material id. + * + * @param[in] dimensions The Dimensionality object controling the + * fundamental dimensions (length, time, mass, temperature) of the problem. + */ 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..5443506596 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,6 @@ class SimulationParameters simulation_control.parse_parameters(prm); velocity_sources.parse_parameters(prm); particlesParameters->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/dimensionality.cc b/source/core/dimensionality.cc index 49db4356ec..70916bfe60 100644 --- a/source/core/dimensionality.cc +++ b/source/core/dimensionality.cc @@ -13,14 +13,18 @@ namespace Parameters const double theta = temperature; const double T = time; - density_scaling = 1. * L * L * L / M; - specific_gas_constant_scaling = 1. / L / L * T * T * theta; - viscosity_scaling = 1. / L / L * T; - specific_heat_scaling = 1. / L / L * T * T * theta; - thermal_conductivity_scaling = 1. / M / L * T * T * T * theta; - enthalpy_scaling = 1. / M / L / L * T * T; - diffusivity_scaling = 1. / L / L * T; - thermal_expansion_scaling = T; + density_scaling = 1. * L * L * L / M; + specific_gas_constant_scaling = 1. / L / L * T * T * theta; + viscosity_scaling = 1. / L / L * T; + specific_heat_scaling = 1. / L / L * T * T * theta; + thermal_conductivity_scaling = 1. / M / L * T * T * T * theta; + enthalpy_scaling = 1. / M / L / L * T * T; + diffusivity_scaling = 1. / L / L * T; + thermal_expansion_scaling = 1. * theta; + surface_tension_scaling = 1. * T * T / M; + surface_tension_gradient_scaling = 1. * theta * T * T / M; + cahn_hilliard_mobility_scaling = 1. * M / L / L / L / T; + cahn_hilliard_epsilon_scaling = 1. / L; } void diff --git a/source/core/parameters.cc b/source/core/parameters.cc index 50fdac10cd..75dc1f3b41 100644 --- a/source/core/parameters.cc +++ b/source/core/parameters.cc @@ -514,15 +514,21 @@ 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"); - T_0 = prm.get_double("reference state temperature"); + surface_tension_coefficient *= dimensions.surface_tension_scaling; + T_0 = prm.get_double("reference state temperature"); + T_0 *= 1. / dimensions.temperature; surface_tension_gradient = prm.get_double("temperature-driven surface tension gradient"); - T_solidus = prm.get_double("solidus temperature"); + surface_tension_gradient *= dimensions.surface_tension_gradient_scaling; + T_solidus = prm.get_double("solidus temperature"); + T_solidus *= 1. / dimensions.temperature; T_liquidus = prm.get_double("liquidus temperature"); - + T_liquidus *= 1. / dimensions.temperature; Assert(T_liquidus > T_solidus, PhaseChangeIntervalError(T_liquidus, T_solidus)); } @@ -539,10 +545,14 @@ 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 @@ -962,7 +972,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) @@ -1304,7 +1314,10 @@ 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)); @@ -1339,39 +1352,36 @@ namespace Parameters if (op == "constant") { surface_tension_model = SurfaceTensionModel::constant; - surface_tension_parameters.parse_parameters(prm); } else if (op == "linear") { surface_tension_model = SurfaceTensionModel::linear; - surface_tension_parameters.parse_parameters(prm); } else if (op == "phase change") { surface_tension_model = SurfaceTensionModel::phase_change; - surface_tension_parameters.parse_parameters(prm); } else throw(std::runtime_error( "Invalid surface tension model. The choices are .")); - + surface_tension_parameters.parse_parameters(prm, dimensions); // Cahn-Hilliard mobility op = prm.get("cahn hilliard mobility model"); if (op == "constant") { mobility_cahn_hilliard_model = MobilityCahnHilliardModel::constant; - mobility_cahn_hilliard_parameters.parse_parameters(prm); } else if (op == "quartic") { mobility_cahn_hilliard_model = MobilityCahnHilliardModel::quartic; - mobility_cahn_hilliard_parameters.parse_parameters(prm); } else throw(std::runtime_error( "Invalid mobility model. The choices are .")); + + mobility_cahn_hilliard_parameters.parse_parameters(prm, dimensions); } prm.leave_subsection(); } @@ -1390,17 +1400,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..71b39ae97c 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(); }