From 9f3c1dc95be5bbe954cacc50d6795c198cdbf401 Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Tue, 24 Dec 2024 22:27:35 +0100 Subject: [PATCH] Add parameter setting routines for two phase mixtures to be shared between linear and nonlinear implementations --- .../physics/WCNSFVTwoPhaseMixturePhysics.h | 2 + .../physics/WCNSFVTwoPhaseMixturePhysics.C | 93 +++++++++++-------- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/modules/navier_stokes/include/physics/WCNSFVTwoPhaseMixturePhysics.h b/modules/navier_stokes/include/physics/WCNSFVTwoPhaseMixturePhysics.h index b72e6a96d5c0..d14d5de6718b 100644 --- a/modules/navier_stokes/include/physics/WCNSFVTwoPhaseMixturePhysics.h +++ b/modules/navier_stokes/include/physics/WCNSFVTwoPhaseMixturePhysics.h @@ -22,6 +22,8 @@ class WCNSFVTwoPhaseMixturePhysics final : public WCNSFVScalarTransportPhysics { public: static InputParameters validParams(); + static InputParameters commonMixtureParams(); + static void renamePassiveScalarToMixtureParams(InputParameters & params); WCNSFVTwoPhaseMixturePhysics(const InputParameters & parameters); diff --git a/modules/navier_stokes/src/physics/WCNSFVTwoPhaseMixturePhysics.C b/modules/navier_stokes/src/physics/WCNSFVTwoPhaseMixturePhysics.C index 8e20c7ba6309..f46d3f22ae52 100644 --- a/modules/navier_stokes/src/physics/WCNSFVTwoPhaseMixturePhysics.C +++ b/modules/navier_stokes/src/physics/WCNSFVTwoPhaseMixturePhysics.C @@ -19,22 +19,32 @@ InputParameters WCNSFVTwoPhaseMixturePhysics::validParams() { InputParameters params = WCNSFVScalarTransportPhysics::validParams(); - params.addClassDescription("Define the additional terms for a mixture model for the two phase " - "weakly-compressible Navier Stokes equations"); - // It can be useful to define the mixture materials with a fixed phase fraction instead - // of solving the equations - params.addParam("add_scalar_equation", true, ""); - params.renameParam("add_scalar_equation", - "add_phase_transport_equation", - "Whether to add the phase transport equation."); + // First rename the parameters from passive scalar to mixture + renamePassiveScalarToMixtureParams(params); + params.renameParam("passive_scalar_face_interpolation", + "phase_face_interpolation", + "The numerical scheme to interpolate the phase fraction variable to the " + "face (separate from the advected quantity interpolation)"); + // Then add parameters specific to mixtures // The flow physics is obtained from the scalar transport base class // The fluid heat transfer physics is retrieved even if unspecified params.addParam( "fluid_heat_transfer_physics", "NavierStokesFV", "WCNSFVFluidHeatTransferPhysics generating the fluid energy equation"); + params += commonMixtureParams(); + params.addParamNamesToGroup("fluid_heat_transfer_physics", "Phase change"); + params.addClassDescription("Define the additional terms for a mixture model for the two phase " + "weakly-compressible Navier Stokes equations"); + return params; +} + +InputParameters +WCNSFVTwoPhaseMixturePhysics::commonMixtureParams() +{ + InputParameters params = emptyInputParameters(); params.addParam( "use_external_mixture_properties", @@ -45,13 +55,6 @@ WCNSFVTwoPhaseMixturePhysics::validParams() false, "Whether to output every functor material property defined to Exodus"); - params.renameParam("initial_scalar_variables", - "initial_phase_fraction", - "Initial value of the main phase fraction variable"); - params.renameParam("passive_scalar_diffusivity", - "phase_fraction_diffusivity", - "Functor names for the diffusivities used for the main phase fraction."); - // Phase change parameters params.addParam( NS::alpha_exchange, 0, "Name of the volumetric phase exchange coefficient"); @@ -89,9 +92,6 @@ WCNSFVTwoPhaseMixturePhysics::validParams() "Name of the thermal conductivity functor for phase 1"); // Properties of phase 2 (can be solid, another liquid, or gaseous) - params.renameParam("passive_scalar_names", - "phase_2_fraction_name", - "Name of the second phase fraction variable (can be a dispersed phase)"); params.addRequiredParam("phase_2_density_name", "Name of the density functor for phase 2"); params.addRequiredParam("phase_2_viscosity_name", @@ -108,6 +108,43 @@ WCNSFVTwoPhaseMixturePhysics::validParams() false, "Adds a linear friction term with the dispersed phase drag model"); + // Parameter groups + params.addParamNamesToGroup("phase_1_density_name phase_1_viscosity_name " + "phase_1_specific_heat_name phase_1_thermal_conductivity_name " + "phase_2_density_name phase_2_viscosity_name " + "phase_2_specific_heat_name phase_2_thermal_conductivity_name " + "use_external_mixture_properties", + "Mixture material properties"); + + params.addParamNamesToGroup(NS::alpha_exchange + " add_phase_change_energy_term", + "Phase change"); + params.addParamNamesToGroup("add_drift_flux_momentum_terms density_interp_method", + "Drift flux model"); + params.addParamNamesToGroup("add_advection_slip_term", "Advection slip model"); + return params; +} + +void +WCNSFVTwoPhaseMixturePhysics::renamePassiveScalarToMixtureParams(InputParameters & params) +{ + // It can be useful to define the mixture materials with a fixed phase fraction instead + // of solving the equations + params.addParam("add_scalar_equation", true, ""); + params.renameParam("add_scalar_equation", + "add_phase_transport_equation", + "Whether to add the phase transport equation."); + + params.renameParam("initial_scalar_variables", + "initial_phase_fraction", + "Initial value of the main phase fraction variable"); + params.renameParam("passive_scalar_diffusivity", + "phase_fraction_diffusivity", + "Functor names for the diffusivities used for the main phase fraction."); + + params.renameParam("passive_scalar_names", + "phase_2_fraction_name", + "Name of the second phase fraction variable (can be a dispersed phase)"); + // Not applicable currently params.suppressParameter>("passive_scalar_source"); params.suppressParameter>>( @@ -127,10 +164,6 @@ WCNSFVTwoPhaseMixturePhysics::validParams() "phase_advection_interpolation", "The numerical scheme to use for interpolating the phase fraction variable, " "as an advected quantity, to the face."); - params.renameParam("passive_scalar_face_interpolation", - "phase_face_interpolation", - "The numerical scheme to interpolate the phase fraction variable to the " - "face (separate from the advected quantity interpolation)"); params.renameParam( "passive_scalar_two_term_bc_expansion", "phase_two_term_bc_expansion", @@ -142,23 +175,7 @@ WCNSFVTwoPhaseMixturePhysics::validParams() "phase_scaling", "The scaling factor for the phase transport equation"); - // Parameter groups params.renameParameterGroup("Passive scalar control", "Mixture transport control"); - params.addParamNamesToGroup("phase_1_density_name phase_1_viscosity_name " - "phase_1_specific_heat_name phase_1_thermal_conductivity_name " - "phase_2_density_name phase_2_viscosity_name " - "phase_2_specific_heat_name phase_2_thermal_conductivity_name " - "use_external_mixture_properties", - "Mixture material properties"); - - params.addParamNamesToGroup("fluid_heat_transfer_physics " + NS::alpha_exchange + - " add_phase_change_energy_term", - "Phase change"); - params.addParamNamesToGroup("add_drift_flux_momentum_terms density_interp_method", - "Drift flux model"); - params.addParamNamesToGroup("add_advection_slip_term", "Advection slip model"); - - return params; } WCNSFVTwoPhaseMixturePhysics::WCNSFVTwoPhaseMixturePhysics(const InputParameters & parameters)