Line data Source code
1 : //* This file is part of the MOOSE framework
2 : //* https://mooseframework.inl.gov
3 : //*
4 : //* All rights reserved, see COPYRIGHT for full restrictions
5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 : //*
7 : //* Licensed under LGPL 2.1, please see LICENSE for details
8 : //* https://www.gnu.org/licenses/lgpl-2.1.html
9 :
10 : #include "WCNSFVTwoPhaseMixturePhysics.h"
11 : #include "WCNSFVFluidHeatTransferPhysics.h"
12 : #include "WCNSFVFlowPhysics.h"
13 :
14 : registerNavierStokesPhysicsBaseTasks("NavierStokesApp", WCNSFVTwoPhaseMixturePhysics);
15 : registerWCNSFVScalarTransportBaseTasks("NavierStokesApp", WCNSFVTwoPhaseMixturePhysics);
16 : registerMooseAction("NavierStokesApp", WCNSFVTwoPhaseMixturePhysics, "add_functor_material");
17 :
18 : InputParameters
19 16 : WCNSFVTwoPhaseMixturePhysics::validParams()
20 : {
21 16 : InputParameters params = WCNSFVScalarTransportPhysics::validParams();
22 :
23 : // First rename the parameters from passive scalar to mixture
24 16 : renamePassiveScalarToMixtureParams(params);
25 32 : params.renameParam("passive_scalar_face_interpolation",
26 : "phase_face_interpolation",
27 : "The numerical scheme to interpolate the phase fraction variable to the "
28 : "face (separate from the advected quantity interpolation)");
29 :
30 : // Then add parameters specific to mixtures
31 : // The flow physics is obtained from the scalar transport base class
32 : // The fluid heat transfer physics is retrieved even if unspecified
33 32 : params.addParam<PhysicsName>(
34 : "fluid_heat_transfer_physics",
35 : "NavierStokesFV",
36 : "WCNSFVFluidHeatTransferPhysics generating the fluid energy equation");
37 16 : params += commonMixtureParams();
38 32 : params.addParamNamesToGroup("fluid_heat_transfer_physics", "Phase change");
39 16 : params.addClassDescription("Define the additional terms for a mixture model for the two phase "
40 : "weakly-compressible Navier Stokes equations");
41 16 : return params;
42 0 : }
43 :
44 : InputParameters
45 33 : WCNSFVTwoPhaseMixturePhysics::commonMixtureParams()
46 : {
47 33 : InputParameters params = emptyInputParameters();
48 :
49 66 : params.addParam<bool>(
50 : "use_external_mixture_properties",
51 66 : false,
52 : "Whether to use the simple NSFVMixtureFunctorMaterial or use a more complex model "
53 : "defined outside of the Physics");
54 66 : params.addParam<bool>("output_all_properties",
55 66 : false,
56 : "Whether to output every functor material property defined to Exodus");
57 :
58 : // Phase change parameters
59 33 : params.addParam<MooseFunctorName>(
60 33 : NS::alpha_exchange, 0, "Name of the volumetric phase exchange coefficient");
61 66 : params.addParam<bool>("add_phase_change_energy_term",
62 66 : false,
63 : "Whether to add a phase change term based on the latent heat of fusion in "
64 : "the energy equation");
65 :
66 : // Drift flux model parameters
67 66 : params.addParam<bool>("add_drift_flux_momentum_terms",
68 66 : false,
69 : "Whether to add the drift flux terms to the momentum equation");
70 66 : MooseEnum coeff_interp_method("average harmonic", "harmonic");
71 66 : params.addParam<MooseEnum>("density_interp_method",
72 : coeff_interp_method,
73 : "Face interpolation method for the density in the drift flux term.");
74 66 : params.addParam<bool>(
75 66 : "add_advection_slip_term", false, "Whether to use the advection-slip model");
76 66 : params.addParam<MooseFunctorName>(
77 : "slip_linear_friction_name",
78 : "Name of the functor providing the scalar linear friction coefficient");
79 :
80 : // Properties of the first phase (can be a liquid or a gas)
81 66 : params.addRequiredParam<MooseFunctorName>(
82 : "phase_1_fraction_name",
83 : "Name of the first phase fraction variable, it will be created as a functor material "
84 : "property if it does not exist already.");
85 66 : params.addRequiredParam<MooseFunctorName>("phase_1_density_name",
86 : "Name of the density functor for phase 1");
87 66 : params.addRequiredParam<MooseFunctorName>("phase_1_viscosity_name",
88 : "Name of the viscosity functor for phase 1");
89 66 : params.addRequiredParam<MooseFunctorName>("phase_1_specific_heat_name",
90 : "Name of the specific heat functor for phase 1");
91 66 : params.addRequiredParam<MooseFunctorName>("phase_1_thermal_conductivity_name",
92 : "Name of the thermal conductivity functor for phase 1");
93 :
94 : // Properties of phase 2 (can be solid, another liquid, or gaseous)
95 66 : params.addRequiredParam<MooseFunctorName>("phase_2_density_name",
96 : "Name of the density functor for phase 2");
97 66 : params.addRequiredParam<MooseFunctorName>("phase_2_viscosity_name",
98 : "Name of the viscosity functor for phase 2");
99 66 : params.addRequiredParam<MooseFunctorName>("phase_2_specific_heat_name",
100 : "Name of the specific heat functor for phase 2");
101 66 : params.addRequiredParam<MooseFunctorName>("phase_2_thermal_conductivity_name",
102 : "Name of the thermal conductivity functor for phase 2");
103 :
104 : // Dispersed phase properties
105 66 : params.addParam<MooseFunctorName>(
106 66 : "particle_diameter", 1, "Particle size if using a dispersed phase");
107 66 : params.addParam<bool>("use_dispersed_phase_drag_model",
108 66 : false,
109 : "Adds a linear friction term with the dispersed phase drag model");
110 :
111 : // Parameter groups
112 66 : params.addParamNamesToGroup("phase_1_density_name phase_1_viscosity_name "
113 : "phase_1_specific_heat_name phase_1_thermal_conductivity_name "
114 : "phase_2_density_name phase_2_viscosity_name "
115 : "phase_2_specific_heat_name phase_2_thermal_conductivity_name "
116 : "use_external_mixture_properties",
117 : "Mixture material properties");
118 :
119 66 : params.addParamNamesToGroup("slip_linear_friction_name use_dispersed_phase_drag_model",
120 : "Friction model");
121 66 : params.addParamNamesToGroup(NS::alpha_exchange + " add_phase_change_energy_term", "Phase change");
122 66 : params.addParamNamesToGroup("add_drift_flux_momentum_terms density_interp_method",
123 : "Drift flux model");
124 66 : params.addParamNamesToGroup("add_advection_slip_term", "Advection slip model");
125 33 : return params;
126 33 : }
127 :
128 : void
129 33 : WCNSFVTwoPhaseMixturePhysics::renamePassiveScalarToMixtureParams(InputParameters & params)
130 : {
131 : // It can be useful to define the mixture materials with a fixed phase fraction instead
132 : // of solving the equations
133 66 : params.addParam<bool>("add_scalar_equation", true, "");
134 66 : params.renameParam("add_scalar_equation",
135 : "add_phase_transport_equation",
136 : "Whether to add the phase transport equation.");
137 :
138 66 : params.renameParam("initial_scalar_variables",
139 : "initial_phase_fraction",
140 : "Initial value of the main phase fraction variable");
141 66 : params.renameParam("passive_scalar_diffusivity",
142 : "phase_fraction_diffusivity",
143 : "Functor names for the diffusivities used for the main phase fraction.");
144 :
145 66 : params.renameParam("passive_scalar_names",
146 : "phase_2_fraction_name",
147 : "Name of the second phase fraction variable (can be a dispersed phase)");
148 :
149 : // Not applicable currently
150 33 : params.suppressParameter<std::vector<MooseFunctorName>>("passive_scalar_source");
151 33 : params.suppressParameter<std::vector<std::vector<MooseFunctorName>>>(
152 : "passive_scalar_coupled_source");
153 33 : params.suppressParameter<std::vector<std::vector<Real>>>("passive_scalar_coupled_source_coeff");
154 :
155 : // Boundary conditions
156 66 : params.renameParam("passive_scalar_inlet_types",
157 : "phase_fraction_inlet_type",
158 : "Types for the inlet boundary for the phase fraction.");
159 66 : params.renameParam("passive_scalar_inlet_functors",
160 : "phase_fraction_inlet_functors",
161 : "Functors describing the inlet phase fraction boundary condition.");
162 :
163 : // Spatial finite volume discretization scheme
164 66 : params.renameParam("passive_scalar_advection_interpolation",
165 : "phase_advection_interpolation",
166 : "The numerical scheme to use for interpolating the phase fraction variable, "
167 : "as an advected quantity, to the face.");
168 66 : params.renameParam(
169 : "passive_scalar_two_term_bc_expansion",
170 : "phase_two_term_bc_expansion",
171 : "If a two-term Taylor expansion is needed for the determination of the boundary values"
172 : "of the phase fraction.");
173 :
174 : // Numerical system parameters
175 66 : params.renameParam("passive_scalar_scaling",
176 : "phase_scaling",
177 : "The scaling factor for the phase transport equation");
178 :
179 66 : params.renameParameterGroup("Passive scalar control", "Mixture transport control");
180 33 : }
181 :
182 16 : WCNSFVTwoPhaseMixturePhysics::WCNSFVTwoPhaseMixturePhysics(const InputParameters & parameters)
183 : : WCNSFVScalarTransportPhysics(parameters),
184 16 : _add_phase_equation(_has_scalar_equation),
185 16 : _phase_1_fraction_name(getParam<MooseFunctorName>("phase_1_fraction_name")),
186 16 : _phase_2_fraction_name(_passive_scalar_names[0]),
187 16 : _phase_1_density(getParam<MooseFunctorName>("phase_1_density_name")),
188 16 : _phase_1_viscosity(getParam<MooseFunctorName>("phase_1_viscosity_name")),
189 16 : _phase_1_specific_heat(getParam<MooseFunctorName>("phase_1_specific_heat_name")),
190 16 : _phase_1_thermal_conductivity(getParam<MooseFunctorName>("phase_1_thermal_conductivity_name")),
191 16 : _phase_2_density(getParam<MooseFunctorName>("phase_2_density_name")),
192 16 : _phase_2_viscosity(getParam<MooseFunctorName>("phase_2_viscosity_name")),
193 16 : _phase_2_specific_heat(getParam<MooseFunctorName>("phase_2_specific_heat_name")),
194 16 : _phase_2_thermal_conductivity(getParam<MooseFunctorName>("phase_2_thermal_conductivity_name")),
195 32 : _use_external_mixture_properties(getParam<bool>("use_external_mixture_properties")),
196 32 : _use_drift_flux(getParam<bool>("add_drift_flux_momentum_terms")),
197 48 : _use_advection_slip(getParam<bool>("add_advection_slip_term"))
198 : {
199 : // Check that only one scalar was passed, as we are using vector parameters
200 16 : if (_passive_scalar_names.size() > 1)
201 0 : paramError("phase_fraction_name", "Only one phase fraction currently supported.");
202 16 : if (_passive_scalar_inlet_functors.size() > 1)
203 0 : paramError("phase_fraction_inlet_functors", "Only one phase fraction currently supported");
204 :
205 : // Retrieve the fluid energy equation if it exists
206 32 : if (isParamValid("fluid_heat_transfer_physics"))
207 : {
208 32 : _fluid_energy_physics = getCoupledPhysics<WCNSFVFluidHeatTransferPhysics>(
209 : getParam<PhysicsName>("fluid_heat_transfer_physics"), true);
210 : // Check for a missing parameter / do not support isolated physics for now
211 32 : if (!_fluid_energy_physics &&
212 32 : !getCoupledPhysics<const WCNSFVFluidHeatTransferPhysics>(true).empty())
213 0 : paramError(
214 : "fluid_heat_transfer_physics",
215 : "We currently do not support creating both a phase transport equation and fluid heat "
216 : "transfer physics that are not coupled together");
217 16 : if (_fluid_energy_physics && _fluid_energy_physics->hasEnergyEquation())
218 0 : _has_energy_equation = true;
219 : else
220 16 : _has_energy_equation = false;
221 : }
222 : else
223 : {
224 0 : _has_energy_equation = false;
225 0 : _fluid_energy_physics = nullptr;
226 : }
227 :
228 : // Check that the mixture parameters are correctly in use in the other physics
229 16 : if (_has_energy_equation)
230 : {
231 0 : if (_fluid_energy_physics->densityName() != "rho_mixture")
232 0 : mooseError("Density name should for Physics '",
233 : _fluid_energy_physics->name(),
234 : "' should be 'rho_mixture'");
235 0 : if (_fluid_energy_physics->getSpecificHeatName() != "cp_mixture")
236 0 : mooseError("Specific heat name should for Physics '",
237 : _fluid_energy_physics->name(),
238 : "' should be 'cp_mixture'");
239 : }
240 16 : if (_flow_equations_physics)
241 : {
242 16 : if (_flow_equations_physics->densityName() != "rho_mixture")
243 0 : mooseError("Density name should for Physics ,",
244 : _flow_equations_physics->name(),
245 : "' should be 'rho_mixture'");
246 : }
247 :
248 16 : if (_verbose)
249 : {
250 0 : if (_flow_equations_physics)
251 0 : mooseInfoRepeated("Coupled to fluid flow physics " + _flow_equations_physics->name());
252 0 : if (_has_energy_equation)
253 0 : mooseInfoRepeated("Coupled to fluid heat transfer physics " + _fluid_energy_physics->name());
254 : }
255 :
256 : // Parameter checking
257 : // The two models are not consistent
258 50 : if (isParamSetByUser("alpha_exchange") && getParam<bool>("add_phase_change_energy_term"))
259 0 : paramError("alpha_exchange",
260 : "A phase exchange coefficient cannot be specified if the phase change is handled "
261 : "with a phase change heat loss model");
262 16 : if (_phase_1_fraction_name == _phase_2_fraction_name)
263 0 : paramError("phase_1_fraction_name",
264 : "First phase fraction name should be different from second phase fraction name");
265 16 : if (_use_drift_flux && _use_advection_slip)
266 0 : paramError("add_drift_flux_momentum_terms",
267 : "Drift flux model cannot be used at the same time as the advection slip model");
268 32 : if (!getParam<bool>("add_drift_flux_momentum_terms"))
269 32 : errorDependentParameter("add_drift_flux_momentum_terms", "true", {"density_interp_method"});
270 32 : if (!getParam<bool>("use_dispersed_phase_drag_model"))
271 0 : errorDependentParameter("use_dispersed_phase_drag_model", "true", {"particle_diameter"});
272 16 : }
273 :
274 : void
275 16 : WCNSFVTwoPhaseMixturePhysics::addFVKernels()
276 : {
277 16 : WCNSFVScalarTransportPhysics::addFVKernels();
278 :
279 48 : if (_add_phase_equation && isParamSetByUser("alpha_exchange"))
280 9 : addPhaseInterfaceTerm();
281 :
282 16 : if (_fluid_energy_physics && _fluid_energy_physics->hasEnergyEquation() &&
283 16 : getParam<bool>("add_phase_change_energy_term"))
284 0 : addPhaseChangeEnergySource();
285 :
286 16 : if (_flow_equations_physics && _flow_equations_physics->hasFlowEquations() && _use_drift_flux)
287 0 : addPhaseDriftFluxTerm();
288 16 : if (_flow_equations_physics && _flow_equations_physics->hasFlowEquations() && _use_advection_slip)
289 9 : addAdvectionSlipTerm();
290 16 : }
291 :
292 : void
293 16 : WCNSFVTwoPhaseMixturePhysics::setSlipVelocityParams(InputParameters & params) const
294 : {
295 32 : params.set<MooseFunctorName>("u_slip") = "vel_slip_x";
296 16 : if (dimension() >= 2)
297 32 : params.set<MooseFunctorName>("v_slip") = "vel_slip_y";
298 16 : if (dimension() >= 3)
299 0 : params.set<MooseFunctorName>("w_slip") = "vel_slip_z";
300 16 : }
301 :
302 : void
303 9 : WCNSFVTwoPhaseMixturePhysics::addPhaseInterfaceTerm()
304 : {
305 9 : auto params = getFactory().getValidParams("NSFVMixturePhaseInterface");
306 9 : assignBlocks(params, _blocks);
307 18 : params.set<NonlinearVariableName>("variable") = _phase_2_fraction_name;
308 18 : params.set<MooseFunctorName>("phase_coupled") = _phase_1_fraction_name;
309 18 : params.set<MooseFunctorName>("alpha") = getParam<MooseFunctorName>(NS::alpha_exchange);
310 27 : getProblem().addFVKernel("NSFVMixturePhaseInterface", prefix() + "phase_interface", params);
311 9 : }
312 :
313 : void
314 0 : WCNSFVTwoPhaseMixturePhysics::addPhaseChangeEnergySource()
315 : {
316 0 : auto params = getFactory().getValidParams("NSFVPhaseChangeSource");
317 0 : assignBlocks(params, _blocks);
318 0 : params.set<NonlinearVariableName>("variable") = _fluid_energy_physics->getFluidTemperatureName();
319 0 : params.set<MooseFunctorName>("liquid_fraction") = _phase_1_fraction_name;
320 0 : params.set<MooseFunctorName>("L") = NS::latent_heat;
321 0 : params.set<MooseFunctorName>(NS::density) = "rho_mixture";
322 0 : params.set<MooseFunctorName>("T_solidus") = NS::T_solidus;
323 0 : params.set<MooseFunctorName>("T_liquidus") = NS::T_liquidus;
324 0 : getProblem().addFVKernel("NSFVPhaseChangeSource", prefix() + "phase_change_energy", params);
325 :
326 : // TODO add phase equation source term corresponding to this term
327 0 : }
328 :
329 : void
330 0 : WCNSFVTwoPhaseMixturePhysics::addPhaseDriftFluxTerm()
331 : {
332 0 : const std::vector<std::string> components = {"x", "y", "z"};
333 0 : for (const auto dim : make_range(dimension()))
334 : {
335 0 : auto params = getFactory().getValidParams("WCNSFV2PMomentumDriftFlux");
336 0 : assignBlocks(params, _blocks);
337 0 : params.set<NonlinearVariableName>("variable") =
338 0 : _flow_equations_physics->getVelocityNames()[dim];
339 0 : params.set<MooseFunctorName>("u_slip") = "vel_slip_x";
340 0 : if (dimension() >= 2)
341 0 : params.set<MooseFunctorName>("v_slip") = "vel_slip_y";
342 0 : if (dimension() >= 3)
343 0 : params.set<MooseFunctorName>("w_slip") = "vel_slip_z";
344 0 : params.set<MooseFunctorName>("rho_d") = _phase_2_density;
345 0 : params.set<MooseFunctorName>("fraction_dispersed") = _phase_2_fraction_name;
346 0 : params.set<MooseEnum>("momentum_component") = components[dim];
347 0 : params.set<MooseEnum>("density_interp_method") = getParam<MooseEnum>("density_interp_method");
348 0 : params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
349 0 : getProblem().addFVKernel(
350 0 : "WCNSFV2PMomentumDriftFlux", prefix() + "drift_flux_" + components[dim], params);
351 0 : }
352 0 : }
353 :
354 : void
355 9 : WCNSFVTwoPhaseMixturePhysics::addAdvectionSlipTerm()
356 : {
357 9 : const std::vector<std::string> components = {"x", "y", "z"};
358 36 : for (const auto dim : make_range(dimension()))
359 : {
360 18 : auto params = getFactory().getValidParams("WCNSFV2PMomentumAdvectionSlip");
361 18 : assignBlocks(params, _blocks);
362 36 : params.set<NonlinearVariableName>("variable") =
363 36 : _flow_equations_physics->getVelocityNames()[dim];
364 36 : params.set<MooseFunctorName>("u_slip") = "vel_slip_x";
365 18 : if (dimension() >= 2)
366 36 : params.set<MooseFunctorName>("v_slip") = "vel_slip_y";
367 18 : if (dimension() >= 3)
368 0 : params.set<MooseFunctorName>("w_slip") = "vel_slip_z";
369 18 : params.set<MooseFunctorName>(NS::density) = _phase_1_density;
370 18 : params.set<MooseFunctorName>("rho_d") = _phase_2_density;
371 36 : params.set<MooseFunctorName>("fraction_dispersed") = _phase_2_fraction_name;
372 18 : params.set<MooseEnum>("momentum_component") = components[dim];
373 18 : params.set<MooseEnum>("advected_interp_method") =
374 36 : _flow_equations_physics->getMomentumFaceInterpolationMethod();
375 18 : params.set<MooseEnum>("velocity_interp_method") =
376 36 : _flow_equations_physics->getVelocityFaceInterpolationMethod();
377 36 : params.set<UserObjectName>("rhie_chow_user_object") = _flow_equations_physics->rhieChowUOName();
378 54 : getProblem().addFVKernel(
379 18 : "WCNSFV2PMomentumAdvectionSlip", prefix() + "advection_slip_" + components[dim], params);
380 18 : }
381 9 : }
382 :
383 : void
384 16 : WCNSFVTwoPhaseMixturePhysics::addFunctorMaterials()
385 : {
386 : // Add the phase fraction variable, for output purposes mostly
387 16 : if (!getProblem().hasFunctor(_phase_1_fraction_name, /*thread_id=*/0))
388 : {
389 16 : auto params = getFactory().getValidParams("ADParsedFunctorMaterial");
390 16 : assignBlocks(params, _blocks);
391 32 : params.set<std::string>("expression") = "1 - " + _phase_2_fraction_name;
392 48 : params.set<std::vector<std::string>>("functor_names") = {_phase_2_fraction_name};
393 16 : params.set<std::string>("property_name") = _phase_1_fraction_name;
394 48 : params.set<std::vector<std::string>>("output_properties") = {_phase_1_fraction_name};
395 48 : params.set<std::vector<OutputName>>("outputs") = {"all"};
396 64 : getProblem().addMaterial("ADParsedFunctorMaterial", prefix() + "phase_1_fraction", params);
397 :
398 : // One of the phase fraction should exist though (either as a variable or set by a
399 : // NSLiquidFractionAux)
400 16 : if (!getProblem().hasFunctor(_phase_2_fraction_name, /*thread_id=*/0))
401 0 : paramError("Phase 2 fraction should be defined as a variable or auxiliary variable");
402 16 : }
403 16 : if (!getProblem().hasFunctor(_phase_2_fraction_name, /*thread_id=*/0))
404 : {
405 0 : auto params = getFactory().getValidParams("ADParsedFunctorMaterial");
406 0 : assignBlocks(params, _blocks);
407 0 : params.set<std::string>("expression") = "1 - " + _phase_1_fraction_name;
408 0 : params.set<std::vector<std::string>>("functor_names") = {_phase_1_fraction_name};
409 0 : params.set<std::string>("property_name") = _phase_2_fraction_name;
410 0 : params.set<std::vector<std::string>>("output_properties") = {_phase_2_fraction_name};
411 0 : params.set<std::vector<OutputName>>("outputs") = {"all"};
412 0 : getProblem().addMaterial("ADParsedFunctorMaterial", prefix() + "phase_2_fraction", params);
413 0 : }
414 :
415 : // Compute mixture properties
416 16 : if (!_use_external_mixture_properties)
417 : {
418 16 : auto params = getFactory().getValidParams("NSFVMixtureFunctorMaterial");
419 16 : assignBlocks(params, _blocks);
420 32 : params.set<std::vector<MooseFunctorName>>("prop_names") = {
421 112 : "rho_mixture", "mu_mixture", "cp_mixture", "k_mixture"};
422 : // The phase_1 and phase_2 assignments are only local to this object.
423 : // We use the phase 2 variable to save a functor evaluation as we expect
424 : // the phase 2 variable to be a nonlinear variable in the phase transport equation
425 32 : params.set<std::vector<MooseFunctorName>>("phase_2_names") = {_phase_1_density,
426 : _phase_1_viscosity,
427 : _phase_1_specific_heat,
428 112 : _phase_1_thermal_conductivity};
429 32 : params.set<std::vector<MooseFunctorName>>("phase_1_names") = {_phase_2_density,
430 : _phase_2_viscosity,
431 : _phase_2_specific_heat,
432 112 : _phase_2_thermal_conductivity};
433 16 : params.set<MooseFunctorName>("phase_1_fraction") = _phase_2_fraction_name;
434 32 : if (getParam<bool>("output_all_properties"))
435 48 : params.set<std::vector<OutputName>>("outputs") = {"all"};
436 48 : getProblem().addMaterial("NSFVMixtureFunctorMaterial", prefix() + "mixture_material", params);
437 16 : }
438 :
439 : // Compute slip terms as functors, used by the drift flux kernels
440 16 : if (_use_advection_slip || _use_drift_flux || _add_phase_equation)
441 : {
442 16 : const std::vector<std::string> vel_components = {"u", "v", "w"};
443 16 : const std::vector<std::string> components = {"x", "y", "z"};
444 64 : for (const auto dim : make_range(dimension()))
445 : {
446 32 : auto params = getFactory().getValidParams("WCNSFV2PSlipVelocityFunctorMaterial");
447 32 : assignBlocks(params, _blocks);
448 128 : params.set<MooseFunctorName>("slip_velocity_name") = "vel_slip_" + components[dim];
449 32 : params.set<MooseEnum>("momentum_component") = components[dim];
450 128 : for (const auto j : make_range(dimension()))
451 64 : params.set<std::vector<VariableName>>(vel_components[j]) = {
452 192 : _flow_equations_physics->getVelocityNames()[j]};
453 32 : params.set<MooseFunctorName>(NS::density) = _phase_1_density;
454 32 : params.set<MooseFunctorName>(NS::mu) = "mu_mixture";
455 32 : params.set<MooseFunctorName>("rho_d") = _phase_2_density;
456 32 : params.set<RealVectorValue>("gravity") = _flow_equations_physics->gravityVector();
457 64 : if (isParamValid("slip_linear_friction_name"))
458 0 : params.set<MooseFunctorName>("linear_coef_name") =
459 0 : getParam<MooseFunctorName>("slip_linear_friction_name");
460 64 : else if (getParam<bool>("use_dispersed_phase_drag_model"))
461 64 : params.set<MooseFunctorName>("linear_coef_name") = "Darcy_coefficient";
462 0 : else if (_flow_equations_physics)
463 : {
464 0 : if (!_flow_equations_physics->getLinearFrictionCoefName().empty())
465 0 : params.set<MooseFunctorName>("linear_coef_name") =
466 0 : _flow_equations_physics->getLinearFrictionCoefName();
467 : else
468 0 : params.set<MooseFunctorName>("linear_coef_name") = "0";
469 : }
470 : else
471 0 : paramError("slip_linear_friction_name",
472 : "WCNSFV2PSlipVelocityFunctorMaterial created by this Physics required a scalar "
473 : "field linear friction factor.");
474 64 : params.set<MooseFunctorName>("particle_diameter") =
475 32 : getParam<MooseFunctorName>("particle_diameter");
476 64 : if (getParam<bool>("output_all_properties"))
477 : {
478 32 : if (!isTransient())
479 54 : params.set<std::vector<OutputName>>("outputs") = {"all"};
480 : else
481 28 : paramInfo("output_all_properties",
482 : "Slip velocity functor material output currently unsupported in Physics "
483 : "in transient conditions.");
484 : }
485 96 : getProblem().addMaterial(
486 32 : "WCNSFV2PSlipVelocityFunctorMaterial", prefix() + "slip_" + components[dim], params);
487 32 : }
488 16 : }
489 :
490 : // Add a default drag model for a dispersed phase
491 32 : if (getParam<bool>("use_dispersed_phase_drag_model"))
492 : {
493 16 : const std::vector<std::string> vel_components = {"u", "v", "w"};
494 :
495 16 : auto params = getFactory().getValidParams("NSFVDispersePhaseDragFunctorMaterial");
496 16 : assignBlocks(params, _blocks);
497 32 : params.set<MooseFunctorName>("drag_coef_name") = "Darcy_coefficient";
498 64 : for (const auto j : make_range(dimension()))
499 32 : params.set<MooseFunctorName>(vel_components[j]) = {
500 64 : _flow_equations_physics->getVelocityNames()[j]};
501 32 : params.set<MooseFunctorName>(NS::density) = "rho_mixture";
502 16 : params.set<MooseFunctorName>(NS::mu) = "mu_mixture";
503 32 : params.set<MooseFunctorName>("particle_diameter") =
504 16 : getParam<MooseFunctorName>("particle_diameter");
505 32 : if (getParam<bool>("output_all_properties"))
506 48 : params.set<std::vector<OutputName>>("outputs") = {"all"};
507 48 : getProblem().addMaterial(
508 16 : "NSFVDispersePhaseDragFunctorMaterial", prefix() + "dispersed_drag", params);
509 16 : }
510 48 : }
|