https://mooseframework.inl.gov
WCNSLinearFVFlowPhysics.C
Go to the documentation of this file.
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 
12 #include "NSFVBase.h"
13 #include "INSFVMomentumAdvection.h"
14 #include "RhieChowMassFlux.h"
15 #include "INSFVTimeKernel.h"
16 #include "MapConversionUtils.h"
17 #include "NS.h"
18 
20 registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_linear_fv_kernel");
21 registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_linear_fv_bc");
22 registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_functor_material");
23 
26 {
28  params.addClassDescription(
29  "Define the Navier Stokes weakly-compressible equations with the linear "
30  "solver implementation of the SIMPLE scheme");
31 
32  params.addParam<bool>(
33  "orthogonality_correction", false, "Whether to use orthogonality correction");
34  params.set<unsigned short>("ghost_layers") = 1;
35 
36  // This will be adapted based on the dimension
37  params.set<std::vector<SolverSystemName>>("system_names") = {
38  "u_system", "v_system", "w_system", "pressure_system"};
39 
40  // Implemented in the executioner
41  params.suppressParameter<MooseEnum>("pinned_pressure_type");
42  params.suppressParameter<Point>("pinned_pressure_point");
43  params.suppressParameter<PostprocessorName>("pinned_pressure_value");
44 
45  // Not supported
46  params.suppressParameter<bool>("add_flow_equations");
47  params.set<bool>("porous_medium_treatment") = false;
48  params.suppressParameter<bool>("porous_medium_treatment");
49  params.set<MooseFunctorName>("porosity") = "1";
50  params.suppressParameter<MooseFunctorName>("porosity");
51  params.suppressParameter<MooseEnum>("mu_interp_method");
52  // Not needed
53  params.suppressParameter<bool>("add_flow_equations");
54  params.suppressParameter<MooseEnum>("preconditioning");
55 
56  // No other options so far
57  params.set<MooseEnum>("velocity_interpolation") = "rc";
58  params.suppressParameter<MooseEnum>("velocity_interpolation");
59 
60  return params;
61 }
62 
64  : WCNSFVFlowPhysicsBase(parameters),
65  _non_orthogonal_correction(getParam<bool>("orthogonality_correction"))
66 {
68  paramError("porous_medium_treatment", "Porous media unsupported");
70  mooseError("Not supported");
71 
72  if (_hydraulic_separators.size())
73  paramError("hydraulic_separator_sidesets",
74  "Flow separators are not supported yet for linearFV!");
75  if (getParam<bool>("pin_pressure"))
76  paramError("pin_pressure",
77  "Pressure pinning is implemented in the executioner for the linear finite volume "
78  "segregated solves");
79 }
80 
81 void
83 {
85  // TODO Add support for multi-system by either:
86  // - creating the problem in the Physics or,
87  // - checking that the right systems are being created
89  // TODO Ban all other nonlinear Physics for now
90 
91  // Fix the default system names if using a different dimension
92  if (!isParamSetByUser("system_name"))
93  {
94  if (dimension() == 1)
95  _system_names = {"u_system", "pressure_system"};
96  else if (dimension() == 2)
97  _system_names = {"u_system", "v_system", "pressure_system"};
98  }
99 }
100 
101 void
103 {
104  if (!_has_flow_equations)
105  return;
106 
107  for (const auto d : make_range(dimension()))
110 
111  const std::vector<std::string> v_short = {"u", "v", "w"};
112 
113  // Check number of variables
114  if (_velocity_names.size() != dimension() && _velocity_names.size() != 3)
115  paramError("velocity_variable",
116  "The number of velocity variable names supplied to the NSFVAction is not " +
117  Moose::stringify(dimension()) + " (mesh dimension)" +
118  ((dimension() == 3) ? "" : " or 3!") + "\nVelocity variables " +
120 
121  // Velocities
122  for (const auto d : make_range(dimension()))
123  {
124  if (!shouldCreateVariable(_velocity_names[d], _blocks, /*error if aux*/ true))
125  reportPotentiallyMissedParameters({"system_names"}, "MooseLinearVariableFVReal");
126  else if (_define_variables)
127  {
128  std::string variable_type = "MooseLinearVariableFVReal";
129 
130  auto params = getFactory().getValidParams(variable_type);
131  assignBlocks(params, _blocks);
132  params.set<SolverSystemName>("solver_sys") = getSolverSystem(_velocity_names[d]);
133 
134  getProblem().addVariable(variable_type, _velocity_names[d], params);
135  }
136  else
137  paramError("velocity_variable",
138  "Variable (" + _velocity_names[d] +
139  ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
140  }
141 
142  // Pressure
143  if (!shouldCreateVariable(_pressure_name, _blocks, /*error if aux*/ true))
144  reportPotentiallyMissedParameters({"system_names"}, "MooseLinearVariableFVReal");
145  else if (_define_variables)
146  {
147  const auto pressure_type = "MooseLinearVariableFVReal";
148 
149  auto params = getFactory().getValidParams(pressure_type);
150  assignBlocks(params, _blocks);
151  params.set<SolverSystemName>("solver_sys") = getSolverSystem(_pressure_name);
152 
153  getProblem().addVariable(pressure_type, _pressure_name, params);
154  }
155  else
156  paramError("pressure_variable",
157  "Variable (" + _pressure_name +
158  ") supplied to the WCNSLinearFVFlowPhysics does not exist!");
159 }
160 
161 void
163 {
164  if (!_has_flow_equations)
165  return;
166 
167  // Pressure correction equation: divergence of momentum
169 
170  // Momentum equation: time derivative
171  if (isTransient())
173 
174  // Momentum equation: flux terms
176 
177  // Momentum equation: pressure term
179 
180  // Momentum equation: friction term
181  if (_friction_types.size())
183 
184  // Momentum equation: gravity source term
186 
187  // Momentum equation: boussinesq approximation
188  if (getParam<bool>("boussinesq_approximation"))
190 }
191 
192 void
194 {
195  {
196  std::string kernel_type = "LinearFVAnisotropicDiffusion";
197  std::string kernel_name = prefix() + "p_diffusion";
198 
199  InputParameters params = getFactory().getValidParams(kernel_type);
200  assignBlocks(params, _blocks);
201  params.set<LinearVariableName>("variable") = _pressure_name;
202  params.set<MooseFunctorName>("diffusion_tensor") = "Ainv";
203  params.set<bool>("use_nonorthogonal_correction") = _non_orthogonal_correction;
204 
205  getProblem().addLinearFVKernel(kernel_type, kernel_name, params);
206  }
207  {
208  std::string kernel_type = "LinearFVDivergence";
209  std::string kernel_name = prefix() + "HbyA_divergence";
210 
211  InputParameters params = getFactory().getValidParams(kernel_type);
212  assignBlocks(params, _blocks);
213  params.set<LinearVariableName>("variable") = _pressure_name;
214  params.set<MooseFunctorName>("face_flux") = "HbyA";
215  params.set<bool>("force_boundary_execution") = true;
216 
217  getProblem().addLinearFVKernel(kernel_type, kernel_name, params);
218  }
219 }
220 
221 void
223 {
224  std::string kernel_type = "LinearFVTimeDerivative";
225  std::string kernel_name = prefix() + "ins_momentum_time";
226 
227  InputParameters params = getFactory().getValidParams(kernel_type);
228  assignBlocks(params, _blocks);
229  params.set<MooseFunctorName>("factor") = _density_name;
230 
231  for (const auto d : make_range(dimension()))
232  {
233  params.set<LinearVariableName>("variable") = _velocity_names[d];
234  if (shouldCreateTimeDerivative(_velocity_names[d], _blocks, /*error if already defined*/ false))
235  getProblem().addLinearFVKernel(kernel_type, kernel_name + "_" + NS::directions[d], params);
236  }
237 }
238 
239 void
241 {
242  const std::string u_names[3] = {"u", "v", "w"};
243  std::string kernel_type = "LinearWCNSFVMomentumFlux";
244  std::string kernel_name = prefix() + "ins_momentum_flux_";
245 
246  InputParameters params = getFactory().getValidParams(kernel_type);
247  assignBlocks(params, _blocks);
248  params.set<MooseFunctorName>(NS::mu) = _dynamic_viscosity_name;
249  params.set<UserObjectName>("rhie_chow_user_object") = rhieChowUOName();
250  params.set<MooseEnum>("advected_interp_method") = _momentum_advection_interpolation;
251  params.set<bool>("use_nonorthogonal_correction") = _non_orthogonal_correction;
252  params.set<bool>("use_deviatoric_terms") = getParam<bool>("include_deviatoric_stress");
253 
254  for (unsigned int i = 0; i < dimension(); ++i)
255  params.set<SolverVariableName>(u_names[i]) = _velocity_names[i];
256 
257  for (const auto d : make_range(dimension()))
258  {
259  params.set<LinearVariableName>("variable") = _velocity_names[d];
260  params.set<MooseEnum>("momentum_component") = NS::directions[d];
261 
262  getProblem().addLinearFVKernel(kernel_type, kernel_name + NS::directions[d], params);
263  }
264 }
265 
266 void
268 {
269  std::string kernel_type = "LinearFVMomentumPressure";
270  std::string kernel_name = prefix() + "ins_momentum_pressure_";
271 
272  InputParameters params = getFactory().getValidParams(kernel_type);
273  assignBlocks(params, _blocks);
274  params.set<VariableName>("pressure") = _pressure_name;
275 
276  for (const auto d : make_range(dimension()))
277  {
278  params.set<MooseEnum>("momentum_component") = NS::directions[d];
279  params.set<LinearVariableName>("variable") = _velocity_names[d];
280  getProblem().addLinearFVKernel(kernel_type, kernel_name + NS::directions[d], params);
281  }
282 }
283 
284 void
286 {
287  unsigned int num_friction_blocks = _friction_blocks.size();
288  unsigned int num_used_blocks = num_friction_blocks ? num_friction_blocks : 1;
289 
290  const std::string kernel_type = "LinearFVMomentumFriction";
291  InputParameters params = getFactory().getValidParams(kernel_type);
292 
293  for (const auto block_i : make_range(num_used_blocks))
294  {
295  std::string block_name = "";
296  if (num_friction_blocks)
297  {
298  params.set<std::vector<SubdomainName>>("block") = _friction_blocks[block_i];
299  block_name = Moose::stringify(_friction_blocks[block_i]);
300  }
301  else
302  {
303  assignBlocks(params, _blocks);
304  block_name = std::to_string(block_i);
305  }
306 
307  for (const auto d : make_range(dimension()))
308  {
309  params.set<LinearVariableName>("variable") = _velocity_names[d];
310  params.set<MooseEnum>("momentum_component") = NS::directions[d];
311  for (unsigned int type_i = 0; type_i < _friction_types[block_i].size(); ++type_i)
312  {
313  const auto upper_name = MooseUtils::toUpper(_friction_types[block_i][type_i]);
314  if (upper_name == "DARCY")
315  {
316  params.set<MooseFunctorName>(NS::mu) = _dynamic_viscosity_name;
317  params.set<MooseFunctorName>("Darcy_name") = _friction_coeffs[block_i][type_i];
318  }
319  else
320  paramError("momentum_friction_types",
321  "Friction type '",
322  _friction_types[block_i][type_i],
323  "' is not implemented");
324  }
325 
326  getProblem().addLinearFVKernel(kernel_type,
327  prefix() + "momentum_friction_" + block_name + "_" +
328  NS::directions[d],
329  params);
330  }
331  }
332 }
333 
334 void
336 {
338  {
339  std::string kernel_type = "LinearFVSource";
340  std::string kernel_name = prefix() + "ins_momentum_gravity_";
341 
342  InputParameters params = getFactory().getValidParams(kernel_type);
343  assignBlocks(params, _blocks);
344  const auto gravity_vector = getParam<RealVectorValue>("gravity");
345  const std::vector<std::string> comp_axis({"x", "y", "z"});
346 
347  for (const auto d : make_range(dimension()))
348  if (gravity_vector(d) != 0)
349  {
350  params.set<MooseFunctorName>("source_density") = "rho_g_" + comp_axis[d];
351  params.set<LinearVariableName>("variable") = _velocity_names[d];
352 
353  getProblem().addLinearFVKernel(kernel_type, kernel_name + NS::directions[d], params);
354  }
355  }
356 }
357 
358 void
360 {
361  if (_compressibility == "weakly-compressible")
362  paramError("boussinesq_approximation",
363  "We cannot use boussinesq approximation while running in weakly-compressible mode!");
364 
365  std::string kernel_type = "LinearFVMomentumBoussinesq";
366  std::string kernel_name = prefix() + "ins_momentum_boussinesq_";
367 
368  InputParameters params = getFactory().getValidParams(kernel_type);
369  assignBlocks(params, _blocks);
370  params.set<VariableName>(NS::T_fluid) = _fluid_temperature_name;
371  params.set<MooseFunctorName>(NS::density) = _density_gravity_name;
372  params.set<RealVectorValue>("gravity") = getParam<RealVectorValue>("gravity");
373  params.set<Real>("ref_temperature") = getParam<Real>("ref_temperature");
374  params.set<MooseFunctorName>("alpha_name") = getParam<MooseFunctorName>("thermal_expansion");
375 
376  for (const auto d : make_range(dimension()))
377  {
378  params.set<MooseEnum>("momentum_component") = NS::directions[d];
379  params.set<LinearVariableName>("variable") = _velocity_names[d];
380 
381  getProblem().addLinearFVKernel(kernel_type, kernel_name + NS::directions[d], params);
382  }
383 }
384 
385 void
387 {
388  // Check the size of the BC parameters
389  unsigned int num_velocity_functor_inlets = 0;
390  for (const auto & [bdy, momentum_inlet_type] : _momentum_inlet_types)
391  if (momentum_inlet_type == "fixed-velocity" || momentum_inlet_type == "fixed-pressure")
392  num_velocity_functor_inlets++;
393 
394  if (num_velocity_functor_inlets != _momentum_inlet_functors.size())
395  paramError("momentum_inlet_functors",
396  "Size (" + std::to_string(_momentum_inlet_functors.size()) +
397  ") is not the same as the number of entries in the momentum_inlet_types "
398  "subvector for fixed-velocities/pressures functors (size " +
399  std::to_string(num_velocity_functor_inlets) + ")");
400 
401  unsigned int velocity_pressure_counter = 0;
402  for (const auto & [inlet_bdy, momentum_inlet_type] : _momentum_inlet_types)
403  {
404  if (momentum_inlet_type == "fixed-velocity")
405  {
406  const std::string bc_type = "LinearFVAdvectionDiffusionFunctorDirichletBC";
407  InputParameters params = getFactory().getValidParams(bc_type);
408  params.set<std::vector<BoundaryName>>("boundary") = {inlet_bdy};
409  if (_momentum_inlet_functors.size() < velocity_pressure_counter + 1)
410  paramError("momentum_inlet_functors",
411  "More non-flux inlets than inlet functors (" +
412  std::to_string(_momentum_inlet_functors.size()) + ")");
413 
414  // Check that enough functors have been provided for the dimension of the problem
415  const auto momentum_functors = libmesh_map_find(_momentum_inlet_functors, inlet_bdy);
416  if (momentum_functors.size() < dimension())
417  paramError("momentum_inlet_functors",
418  "Subvector for boundary '" + inlet_bdy + "' (size " +
419  std::to_string(momentum_functors.size()) +
420  ") is not the same size as the number of dimensions of the physics (" +
421  std::to_string(dimension()) + ")");
422 
423  for (const auto d : make_range(dimension()))
424  {
425  params.set<LinearVariableName>("variable") = _velocity_names[d];
426  params.set<MooseFunctorName>("functor") = momentum_functors[d];
427 
428  getProblem().addLinearFVBC(bc_type, _velocity_names[d] + "_" + inlet_bdy, params);
429  }
430  ++velocity_pressure_counter;
431 
432  // Add the two term BC expansion for pressure if requested
433  if (getParam<bool>("pressure_two_term_bc_expansion"))
434  {
435  const std::string bc_type = "LinearFVExtrapolatedPressureBC";
436  InputParameters params = getFactory().getValidParams(bc_type);
437  params.set<std::vector<BoundaryName>>("boundary") = {inlet_bdy};
438  params.set<LinearVariableName>("variable") = _pressure_name;
439  params.set<bool>("use_two_term_expansion") = true;
440  getProblem().addLinearFVBC(bc_type,
441  _pressure_name + "_extrapolation_inlet_" +
442  Moose::stringify(inlet_bdy),
443  params);
444  }
445  }
446  else if (momentum_inlet_type == "fixed-pressure")
447  {
448  const std::string bc_type = "LinearFVAdvectionDiffusionFunctorDirichletBC";
449  InputParameters params = getFactory().getValidParams(bc_type);
450  params.set<LinearVariableName>("variable") = _pressure_name;
451  if (_momentum_inlet_functors.size() < velocity_pressure_counter + 1)
452  paramError("momentum_inlet_functors",
453  "More non-flux inlets than inlet functors (" +
454  std::to_string(_momentum_inlet_functors.size()) + ")");
455 
456  params.set<MooseFunctorName>("functor") =
457  libmesh_map_find(_momentum_inlet_functors, inlet_bdy)[0];
458  params.set<std::vector<BoundaryName>>("boundary") = {inlet_bdy};
459 
460  getProblem().addLinearFVBC(bc_type, _pressure_name + "_" + inlet_bdy, params);
461  ++velocity_pressure_counter;
462  }
463  else
464  mooseError("Unsupported inlet boundary condition type: ", momentum_inlet_type);
465  }
466 }
467 
468 void
470 {
471  // Check the BCs size
472  unsigned int num_pressure_outlets = 0;
473  for (const auto & [bdy, momentum_outlet_type] : _momentum_outlet_types)
474  if (momentum_outlet_type == "fixed-pressure" ||
475  momentum_outlet_type == "fixed-pressure-zero-gradient")
476  num_pressure_outlets++;
477 
478  if (num_pressure_outlets != _pressure_functors.size())
479  paramError("pressure_functors",
480  "Size (" + std::to_string(_pressure_functors.size()) +
481  ") is not the same as the number of pressure outlet boundaries in "
482  "'fixed-pressure/fixed-pressure-zero-gradient' (size " +
483  std::to_string(num_pressure_outlets) + ")");
484 
485  const std::string u_names[3] = {"u", "v", "w"};
486  for (const auto & [outlet_bdy, momentum_outlet_type] : _momentum_outlet_types)
487  {
488  // Zero tangeantial gradient condition on velocity
489  if (momentum_outlet_type == "zero-gradient" || momentum_outlet_type == "fixed-pressure" ||
490  momentum_outlet_type == "fixed-pressure-zero-gradient")
491  {
492  const std::string bc_type = "LinearFVAdvectionDiffusionOutflowBC";
493  InputParameters params = getFactory().getValidParams(bc_type);
494  params.set<std::vector<BoundaryName>>("boundary") = {outlet_bdy};
495  params.set<bool>("use_two_term_expansion") = getParam<bool>("momentum_two_term_bc_expansion");
496 
497  for (const auto d : make_range(dimension()))
498  {
499  params.set<LinearVariableName>("variable") = _velocity_names[d];
500  getProblem().addLinearFVBC(bc_type, _velocity_names[d] + "_" + outlet_bdy, params);
501  }
502  }
503 
504  // Fixed pressure condition, coming in the pressure correction equation
505  if (momentum_outlet_type == "fixed-pressure" ||
506  momentum_outlet_type == "fixed-pressure-zero-gradient")
507  {
508  const std::string bc_type = "LinearFVAdvectionDiffusionFunctorDirichletBC";
509  InputParameters params = getFactory().getValidParams(bc_type);
510  params.set<LinearVariableName>("variable") = _pressure_name;
511  params.set<MooseFunctorName>("functor") = libmesh_map_find(_pressure_functors, outlet_bdy);
512  params.set<std::vector<BoundaryName>>("boundary") = {outlet_bdy};
513 
514  getProblem().addLinearFVBC(bc_type, _pressure_name + "_" + outlet_bdy, params);
515  }
516  }
517 }
518 
519 void
521 {
522  const std::string u_names[3] = {"u", "v", "w"};
523 
524  for (const auto & [boundary_name, momentum_wall_type] : _momentum_wall_types)
525  {
526  if (momentum_wall_type == "noslip")
527  {
528  const std::string bc_type = "LinearFVAdvectionDiffusionFunctorDirichletBC";
529  InputParameters params = getFactory().getValidParams(bc_type);
530  params.set<std::vector<BoundaryName>>("boundary") = {boundary_name};
531 
532  for (const auto d : make_range(dimension()))
533  {
534  params.set<LinearVariableName>("variable") = _velocity_names[d];
535  if (_momentum_wall_functors.count(boundary_name) == 0)
536  params.set<MooseFunctorName>("functor") = "0";
537  else
538  params.set<MooseFunctorName>("functor") = _momentum_wall_functors[boundary_name][d];
539 
540  getProblem().addLinearFVBC(bc_type, _velocity_names[d] + "_" + boundary_name, params);
541  }
542  }
543  else
544  mooseError("Unsupported wall boundary condition type: " + std::string(momentum_wall_type));
545  }
546 
547  if (getParam<bool>("pressure_two_term_bc_expansion"))
548  {
549  const std::string bc_type = "LinearFVExtrapolatedPressureBC";
550  InputParameters params = getFactory().getValidParams(bc_type);
551  params.set<std::vector<BoundaryName>>("boundary") = _wall_boundaries;
552  params.set<LinearVariableName>("variable") = _pressure_name;
553  params.set<bool>("use_two_term_expansion") = true;
555  bc_type, _pressure_name + "_extrapolation_" + Moose::stringify(_wall_boundaries), params);
556  }
557 }
558 
559 void
561 {
562  // Rhie Chow user object for interpolation velocities
564 }
565 
566 void
568 {
569  mooseAssert(dimension(), "0-dimension not supported");
570 
571  // First make sure that we only add this object once
572  // Potential cases:
573  // - there is a flow physics, and an advection one (UO should be added by one)
574  // - there is only an advection physics (UO should be created)
575  // - there are two advection physics on different blocks with set velocities (first one picks)
576  // Counting RC UOs defined on the same blocks seems to be the most fool proof option
577  std::vector<UserObject *> objs;
578  getProblem()
579  .theWarehouse()
580  .query()
581  .condition<AttribSystem>("UserObject")
582  .condition<AttribThread>(0)
583  .queryInto(objs);
584  unsigned int num_rc_uo = 0;
585  for (const auto & obj : objs)
586  if (dynamic_cast<RhieChowMassFlux *>(obj))
587  {
588  const auto rc_obj = dynamic_cast<RhieChowMassFlux *>(obj);
589  if (rc_obj->blocks() == _blocks)
590  num_rc_uo++;
591  // one of the RC user object is defined everywhere
592  else if (rc_obj->blocks().size() == 0 || _blocks.size() == 0)
593  num_rc_uo++;
594  }
595 
596  if (num_rc_uo)
597  return;
598 
599  const std::string u_names[3] = {"u", "v", "w"};
600  const auto object_type = "RhieChowMassFlux";
601 
602  auto params = getFactory().getValidParams(object_type);
603  assignBlocks(params, _blocks);
604  for (unsigned int d = 0; d < dimension(); ++d)
605  params.set<VariableName>(u_names[d]) = _velocity_names[d];
606 
607  params.set<VariableName>("pressure") = _pressure_name;
608  params.set<std::string>("p_diffusion_kernel") = prefix() + "p_diffusion";
609  params.set<MooseFunctorName>(NS::density) = _density_name;
610 
611  getProblem().addUserObject(object_type, rhieChowUOName(), params);
612 }
613 
614 void
616 {
617  if (parameters().isParamValid("gravity"))
618  {
619  const auto gravity_vector = getParam<RealVectorValue>("gravity");
620  const std::vector<std::string> comp_axis({"x", "y", "z"});
621  for (const auto d : make_range(dimension()))
622  if (gravity_vector(d) != 0)
623  {
624  // Add rho * g functor for each relevant direction
625  // TODO: we could avoid using an AD functor material for non-AD density functor
626  auto params = getFactory().getValidParams("ADParsedFunctorMaterial");
627  assignBlocks(params, _blocks);
628  params.set<std::string>("expression") =
629  _density_gravity_name + " * " + std::to_string(gravity_vector(d));
631  params.set<std::vector<std::string>>("functor_names") = {_density_gravity_name};
632  params.set<std::string>("property_name") = "rho_g_" + comp_axis[d];
633  // We don't output this helper material
635  "ADParsedFunctorMaterial", prefix() + "gravity_helper_" + comp_axis[d], params);
636  }
637  }
638 }
639 
640 UserObjectName
642 {
643  mooseAssert(!_porous_medium_treatment, "Not implemented");
644  return "ins_rhie_chow_interpolator";
645 }
646 
647 unsigned short
649 {
650  return 1;
651 }
virtual void addFVKernels() override
std::string prefix() const
Creates all the objects needed to solve the Navier-Stokes equations with the SIMPLE algorithm using t...
bool parsesToReal(const std::string &input)
unsigned short getNumberAlgebraicGhostingLayersNeeded() const override
Return the number of algebraic ghosting layers needed.
const bool _has_flow_equations
Boolean to keep track of whether the flow equations should be created.
void assignBlocks(InputParameters &params, const std::vector< SubdomainName > &blocks) const
bool shouldCreateVariable(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_aux)
virtual void addInletBC() override
Functions adding boundary conditions for the flow simulation.
User object responsible for determining the face fluxes using the Rhie-Chow interpolation in a segreg...
Factory & getFactory()
std::vector< std::vector< std::string > > _friction_types
The friction correlation types used for each block.
std::map< BoundaryName, MooseEnum > _momentum_inlet_types
Momentum inlet boundary types.
std::string toUpper(const std::string &name)
virtual void addMomentumPressureKernels() override
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual void initializePhysicsAdditional() override
const MooseFunctorName _density_name
Name of the density material property.
const MooseFunctorName _density_gravity_name
Name of the density material property used for gravity and Boussinesq terms.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
virtual void addFunctorMaterials() override
T & set(const std::string &name, bool quiet_mode=false)
virtual void addRhieChowUserObjects() override
Function which adds the RhieChow interpolator user objects for weakly and incompressible formulations...
void addMomentumTimeKernels() override
Functions adding kernels for the incompressible momentum equation If the material properties are not ...
static const std::string density
Definition: NS.h:33
InputParameters getValidParams(const std::string &name) const
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_inlet_functors
Functors describing the momentum inlet for each boundary.
virtual void initializePhysicsAdditional() override
const MooseEnum _momentum_advection_interpolation
The momentum face interpolation method for being advected.
std::map< BoundaryName, std::vector< MooseFunctorName > > _momentum_wall_functors
Functors describing the momentum for each wall boundary.
const NonlinearVariableName _pressure_name
Pressure name.
void addPressureCorrectionKernels()
Function adding kernels for the incompressible pressure correction equation.
bool shouldCreateTimeDerivative(const VariableName &var_name, const std::vector< SubdomainName > &blocks, const bool error_if_already_defined) const
static InputParameters validParams()
const bool _porous_medium_treatment
Whether to use the porous medium treatment.
std::vector< SubdomainName > _blocks
const std::vector< BoundaryName > _wall_boundaries
Boundaries which define a wall (slip/noslip/etc.)
unsigned int dimension() const
static const std::string directions[3]
Definition: NS.h:22
void suppressParameter(const std::string &name)
bool isParamValid(const std::string &name) const
virtual void addWallsBC() override
virtual FEProblemBase & getProblem()
const SolverSystemName & getSolverSystem(unsigned int variable_index) const
static const std::string T_fluid
Definition: NS.h:106
std::vector< std::vector< SubdomainName > > _friction_blocks
Subdomains where we want to have volumetric friction.
TheWarehouse & theWarehouse() const
virtual void addMomentumGravityKernels() override
std::map< BoundaryName, MooseEnum > _momentum_outlet_types
Momentum outlet boundary types.
static const std::string mu
Definition: NS.h:123
const std::vector< std::string > _velocity_names
Velocity names.
Base class for Physics which create the Navier Stokes flow equations.
WCNSLinearFVFlowPhysics(const InputParameters &parameters)
registerMooseAction("NavierStokesApp", WCNSLinearFVFlowPhysics, "add_linear_fv_kernel")
virtual void addUserObjects() override
void needSolutionState(unsigned int oldest_needed, Moose::SolutionIterationType iteration_type)
void paramError(const std::string &param, Args... args) const
const MooseFunctorName _dynamic_viscosity_name
Name of the dynamic viscosity material property.
std::string stringify(const T &t)
const bool _solve_for_dynamic_pressure
Whether we are solving for the total or dynamic pressure.
const bool _non_orthogonal_correction
Whether to use the correction term for non-orthogonality.
virtual void addVariable(const std::string &var_type, const std::string &var_name, InputParameters &params)
const MooseEnum _compressibility
Compressibility type, can be compressible, incompressible or weakly-compressible. ...
bool _define_variables
Whether to define variables if they do not exist.
virtual void addLinearFVKernel(const std::string &kernel_name, const std::string &name, InputParameters &parameters)
registerWCNSFVFlowPhysicsBaseTasks("NavierStokesApp", WCNSLinearFVFlowPhysics)
bool isParamSetByUser(const std::string &nm) const
std::map< BoundaryName, MooseEnum > _momentum_wall_types
Momentum wall boundary types.
const NonlinearVariableName _fluid_temperature_name
Fluid temperature name.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void addMomentumFrictionKernels() override
virtual void addMomentumBoussinesqKernels() override
std::map< BoundaryName, MooseFunctorName > _pressure_functors
Functors describing the outlet pressure on each boundary.
virtual void addLinearFVBC(const std::string &fv_bc_name, const std::string &name, InputParameters &parameters)
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters &parameters)
Query query()
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
const std::vector< BoundaryName > _hydraulic_separators
Hydraulic separator boundaries.
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
const InputParameters & parameters() const
UserObjectName rhieChowUOName() const override
Return the name of the Rhie Chow user object.
virtual void addOutletBC() override
void reportPotentiallyMissedParameters(const std::vector< std::string > &param_names, const std::string &object_type) const
void saveSolverVariableName(const VariableName &var_name)
virtual void addSolverVariables() override
std::vector< SolverSystemName > _system_names
bool isTransient() const
std::vector< std::vector< std::string > > _friction_coeffs
The coefficients used for each item if friction type.