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 WCNSFVFluidHeatTransferPhysics; 17 : class WCNSFVScalarTransportPhysics; 18 : 19 : /** 20 : * Creates all the objects needed to add a turbulence model to an incompressible / 21 : * weakly-compressible Navier Stokes finite volume flow simulation 22 : */ 23 : class WCNSFVTurbulencePhysics final : public NavierStokesPhysicsBase, 24 : public WCNSFVCoupledAdvectionPhysicsHelper 25 : { 26 : public: 27 : static InputParameters validParams(); 28 : 29 : WCNSFVTurbulencePhysics(const InputParameters & parameters); 30 : 31 : /// Whether a turbulence model is in use 32 296 : bool hasTurbulenceModel() const { return _turbulence_model != "none"; } 33 : /// The names of the boundaries with turbulence wall functions 34 0 : std::vector<BoundaryName> turbulenceWalls() const { return _turbulence_walls; } 35 : /// The turbulence epsilon wall treatment (same for all turbulence walls currently) 36 : MooseEnum turbulenceEpsilonWallTreatment() const { return _wall_treatment_eps; } 37 : /// The turbulence temperature wall treatment (same for all turbulence walls currently) 38 54 : MooseEnum turbulenceTemperatureWallTreatment() const { return _wall_treatment_temp; } 39 : /// The name of the turbulent kinetic energy variable 40 54 : MooseFunctorName tkeName() const { return _tke_name; } 41 : 42 : protected: 43 : unsigned short getNumberAlgebraicGhostingLayersNeeded() const override; 44 : 45 : private: 46 : virtual void initializePhysicsAdditional() override; 47 : virtual void actOnAdditionalTasks() override; 48 : /// Retrieve the other WCNSFVPhysics at play in the simulation to be able 49 : /// to add the relevant terms (turbulent diffusion notably) 50 : void retrieveCoupledPhysics(); 51 : 52 : virtual void addSolverVariables() override; 53 : virtual void addAuxiliaryVariables() override; 54 : virtual void addFVKernels() override; 55 : virtual void addFVBCs() override; 56 : virtual void addInitialConditions() override; 57 : virtual void addAuxiliaryKernels() override; 58 : virtual void addMaterials() override; 59 : 60 : /** 61 : * Functions adding kernels for turbulence in the other equation(s) 62 : */ 63 : void addFlowTurbulenceKernels(); 64 : void addFluidEnergyTurbulenceKernels(); 65 : void addScalarAdvectionTurbulenceKernels(); 66 : 67 : /** 68 : * Functions adding kernels for the k-epsilon to the k-epsilon equations 69 : */ 70 : void addKEpsilonTimeDerivatives(); 71 : void addKEpsilonAdvection(); 72 : void addKEpsilonDiffusion(); 73 : void addKEpsilonSink(); 74 : 75 : /// Turbulence model to create the equation(s) for 76 : const MooseEnum _turbulence_model; 77 : 78 : bool _has_flow_equations; 79 : bool _has_energy_equation; 80 : bool _has_scalar_equations; 81 : 82 : /// The heat advection physics to add turbulent mixing for 83 : const WCNSFVFluidHeatTransferPhysics * _fluid_energy_physics; 84 : /// The scalar advection physics to add turbulent mixing for 85 : const WCNSFVScalarTransportPhysics * _scalar_transport_physics; 86 : 87 : private: 88 : /// Name of the mixing length auxiliary variable 89 : const VariableName _mixing_length_name; 90 : /// List of boundaries to act as walls for turbulence models 91 : std::vector<BoundaryName> _turbulence_walls; 92 : /// Turbulence wall treatment for epsilon (same for all walls currently) 93 : MooseEnum _wall_treatment_eps; 94 : /// Turbulence wall treatment for temperature (same for all walls currently) 95 : MooseEnum _wall_treatment_temp; 96 : /// Name of the turbulent kinetic energy 97 : const VariableName _tke_name; 98 : /// Name of the turbulent kinetic energy dissipation 99 : const VariableName _tked_name; 100 : /// Name of the turbulence viscosity auxiliary variable (or property) 101 : const VariableName _turbulent_viscosity_name = NS::mu_t; 102 : };