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 : #pragma once 11 : 12 : #include "NavierStokesPhysicsBase.h" 13 : #include "WCNSFVCoupledAdvectionPhysicsHelper.h" 14 : #include "NS.h" 15 : 16 : class WCNSFVFluidHeatTransferPhysicsBase; 17 : class WCNSFVScalarTransportPhysicsBase; 18 : 19 : #define registerWCNSFVTurbulenceBaseTasks(app_name, derived_name) \ 20 : registerNavierStokesPhysicsBaseTasks(app_name, derived_name); \ 21 : registerMooseAction(app_name, derived_name, "get_turbulence_physics"); \ 22 : registerMooseAction(app_name, derived_name, "add_variables_physics"); \ 23 : registerMooseAction(app_name, derived_name, "add_ics_physics"); \ 24 : registerMooseAction(app_name, derived_name, "add_fv_kernel"); \ 25 : registerMooseAction(app_name, derived_name, "add_fv_bc"); \ 26 : registerMooseAction(app_name, derived_name, "add_aux_variable"); \ 27 : registerMooseAction(app_name, derived_name, "add_aux_kernel"); \ 28 : registerMooseAction(app_name, derived_name, "add_materials_physics") 29 : 30 : /** 31 : * Base class for a Physics that creates all the objects needed to add a turbulence model to an 32 : * incompressible / weakly-compressible Navier Stokes finite volume flow simulation 33 : */ 34 : class WCNSFVTurbulencePhysicsBase : public NavierStokesPhysicsBase, 35 : public WCNSFVCoupledAdvectionPhysicsHelper 36 : { 37 : public: 38 : static InputParameters validParams(); 39 : 40 : WCNSFVTurbulencePhysicsBase(const InputParameters & parameters); 41 : 42 : /// Whether a turbulence model is in use 43 1284 : bool hasTurbulenceModel() const { return _turbulence_model != "none"; } 44 : /// The names of the boundaries with turbulence wall functions 45 0 : std::vector<BoundaryName> turbulenceWalls() const { return _turbulence_walls; } 46 : /// The turbulence epsilon wall treatment (same for all turbulence walls currently) 47 : MooseEnum turbulenceEpsilonWallTreatment() const { return _wall_treatment_eps; } 48 : /// The turbulence temperature wall treatment (same for all turbulence walls currently) 49 30 : MooseEnum turbulenceTemperatureWallTreatment() const { return _wall_treatment_temp; } 50 : /// The name of the turbulent kinetic energy variable 51 30 : MooseFunctorName tkeName() const { return _tke_name; } 52 : 53 : protected: 54 : virtual void actOnAdditionalTasks() override; 55 : /// Retrieve the other WCNSFVPhysics at play in the simulation to be able 56 : /// to add the relevant terms (turbulent diffusion notably) 57 : void retrieveCoupledPhysics(); 58 : 59 : virtual void addSolverVariables() override = 0; 60 : virtual void addAuxiliaryVariables() override; 61 : virtual void addFVKernels() override = 0; 62 : virtual void addFVBCs() override = 0; 63 : virtual void addAuxiliaryKernels() override; 64 : virtual void addInitialConditions() override; 65 : virtual void addMaterials() override; 66 : 67 : /// Turbulence model to create the equation(s) for 68 : const MooseEnum _turbulence_model; 69 : 70 : bool _has_flow_equations; 71 : bool _has_energy_equation; 72 : bool _has_scalar_equations; 73 : 74 : /// The heat advection physics to add turbulent mixing for 75 : const WCNSFVFluidHeatTransferPhysicsBase * _fluid_energy_physics; 76 : /// The scalar advection physics to add turbulent mixing for 77 : const WCNSFVScalarTransportPhysicsBase * _scalar_transport_physics; 78 : 79 : /// List of boundaries to act as walls for turbulence models 80 : std::vector<BoundaryName> _turbulence_walls; 81 : /// Turbulence wall treatment for epsilon (same for all walls currently) 82 : MooseEnum _wall_treatment_eps; 83 : /// Turbulence wall treatment for temperature (same for all walls currently) 84 : MooseEnum _wall_treatment_temp; 85 : /// Name of the turbulent kinetic energy 86 : const VariableName _tke_name; 87 : /// Name of the turbulent kinetic energy dissipation 88 : const VariableName _tked_name; 89 : /// Name of the turbulence viscosity auxiliary variable (or property) 90 : const VariableName _turbulent_viscosity_name = NS::mu_t; 91 : };