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 "INSADObjectTracker.h" 11 : 12 : registerMooseObject("NavierStokesApp", INSADObjectTracker); 13 : 14 : InputParameters 15 2562 : INSADObjectTracker::validParams() 16 : { 17 2562 : InputParameters params = GeneralUserObject::validParams(); 18 2562 : params.addClassDescription("User object used to track the kernels added to an INS simulation " 19 : "and determine what properties to calculate in INSADMaterial"); 20 2562 : return params; 21 0 : } 22 : 23 : InputParameters 24 4797 : INSADObjectTracker::validTrackerParams() 25 : { 26 4797 : InputParameters params = emptyInputParameters(); 27 9594 : params.addParam<bool>("integrate_p_by_parts", "Whether to integrate the pressure by parts"); 28 9594 : MooseEnum viscous_form("traction laplace", "laplace"); 29 9594 : params.addParam<MooseEnum>("viscous_form", 30 : viscous_form, 31 : "The form of the viscous term. Options are 'traction' or 'laplace'"); 32 9594 : params.addParam<bool>( 33 9594 : "has_boussinesq", false, "Whether the simulation has the boussinesq approximation"); 34 9594 : params.addParam<MaterialPropertyName>( 35 : "alpha", "The alpha material property for the boussinesq approximation"); 36 9594 : params.addParam<MaterialPropertyName>("ref_temp", "The reference temperature material property"); 37 9594 : params.addParam<std::string>("temperature", "The temperature variable"); 38 9594 : params.addParam<RealVectorValue>("gravity", "Direction of the gravity vector"); 39 9594 : params.addParam<bool>( 40 : "has_gravity", 41 9594 : false, 42 : "Whether the simulation has a gravity force imposed on the momentum equation"); 43 9594 : params.addParam<bool>("has_transient", false, "Whether the momentum equations are transient"); 44 9594 : params.addParam<bool>("has_energy_transient", false, "Whether the energy equation is transient"); 45 : 46 4797 : addAmbientConvectionParams(params); 47 : 48 9594 : params.addParam<bool>( 49 9594 : "has_heat_source", false, "Whether there is a heat source function object in the simulation"); 50 9594 : params.addParam<FunctionName>("heat_source_function", "The function describing the heat source"); 51 9594 : params.addParam<std::string>( 52 : "heat_source_var", 53 : "Variable describing the volumetric heat source. Note that if this variable evaluates to a " 54 : "negative number, then this object will be an energy sink"); 55 : 56 9594 : params.addParam<bool>( 57 : "has_coupled_force", 58 9594 : false, 59 : "Whether the simulation has a force due to a coupled vector variable/vector function"); 60 9594 : params.addParam<std::vector<VariableName>>("coupled_force_var", 61 : "Variables imposing coupled forces"); 62 9594 : params.addParam<std::vector<FunctionName>>("coupled_force_vector_function", 63 : "The function(s) standing in as a coupled force(s)"); 64 : 65 9594 : params.addParam<bool>("has_advected_mesh", 66 9594 : false, 67 : "Whether the fluid domain is undergoing displacement in which case we must " 68 : "add an advecting mesh term to correct the material velocity."); 69 9594 : params.addParam<VariableName>("disp_x", "The x displacement"); 70 9594 : params.addParam<VariableName>("disp_y", "The y displacement"); 71 9594 : params.addParam<VariableName>("disp_z", "The z displacement"); 72 9594 : params.addParamNamesToGroup("has_advected_mesh disp_x disp_y disp_z", "Moving mesh"); 73 4797 : return params; 74 4797 : } 75 : 76 1281 : INSADObjectTracker::INSADObjectTracker(const InputParameters & parameters) 77 1281 : : GeneralUserObject(parameters) 78 : { 79 1281 : } 80 : 81 : void 82 5221 : addAmbientConvectionParams(InputParameters & params) 83 : { 84 10442 : params.addParam<bool>( 85 : "has_ambient_convection", 86 10442 : false, 87 : "Whether for the energy equation there is a heat source/sink due to convection " 88 : "from ambient surroundings"); 89 10442 : params.addParam<Real>("ambient_convection_alpha", 90 : "The heat transfer coefficient from from ambient surroundings"); 91 10442 : params.addParam<Real>("ambient_temperature", "The ambient temperature"); 92 5221 : } 93 : 94 : template <> 95 : bool 96 338 : INSADObjectTracker::notEqual(const MooseEnum & val1, const MooseEnum & val2) 97 : { 98 338 : return !val1.compareCurrent(val2); 99 : } 100 : 101 : void 102 4731 : INSADObjectTracker::addBlockIDs(const std::set<SubdomainID> & additional_block_ids) 103 : { 104 9528 : for (const auto sub_id : additional_block_ids) 105 9594 : _block_id_to_params.emplace(sub_id, validTrackerParams()); 106 4731 : } 107 : 108 : bool 109 156896 : INSADObjectTracker::isTrackerParamValid(const std::string & name, const SubdomainID sub_id) const 110 : { 111 156896 : return getParams(sub_id).isParamValid(name); 112 : } 113 : 114 : const InputParameters & 115 5817742 : INSADObjectTracker::getParams(const SubdomainID sub_id) const 116 : { 117 : auto map_it = _block_id_to_params.find(sub_id); 118 5817742 : if (map_it == _block_id_to_params.end()) 119 0 : mooseError("The requested sub_id is not a key in INSADObjectTracker::_block_id_to_params. Make " 120 : "sure that your INSAD residual objects have block restrictions that are covered by " 121 : "INSADMaterial (and derived) material objects"); 122 : 123 5817742 : return map_it->second; 124 : }