LCOV - code coverage report
Current view: top level - src/physics - PNSFVSolidHeatTransferPhysics.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 209 244 85.7 %
Date: 2026-05-29 20:37:52 Functions: 12 12 100.0 %
Legend: Lines: hit not hit

          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 "PNSFVSolidHeatTransferPhysics.h"
      11             : #include "WCNSFVCoupledAdvectionPhysicsHelper.h"
      12             : #include "WCNSFVFlowPhysics.h"
      13             : #include "WCNSFVFluidHeatTransferPhysics.h"
      14             : #include "NSFVBase.h"
      15             : 
      16             : registerPhysicsBaseTasks("NavierStokesApp", PNSFVSolidHeatTransferPhysics);
      17             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_variable");
      18             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_ic");
      19             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_fv_kernel");
      20             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_fv_bc");
      21             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_material");
      22             : registerMooseAction("NavierStokesApp", PNSFVSolidHeatTransferPhysics, "add_preconditioning");
      23             : 
      24             : InputParameters
      25          34 : PNSFVSolidHeatTransferPhysics::validParams()
      26             : {
      27          34 :   InputParameters params = HeatConductionFV::validParams();
      28          34 :   params.addClassDescription("Define the Navier Stokes porous media solid energy equation");
      29             : 
      30             :   // These boundary conditions parameters are not implemented yet
      31          34 :   params.suppressParameter<std::vector<BoundaryName>>("fixed_convection_boundaries");
      32          34 :   params.suppressParameter<std::vector<MooseFunctorName>>("fixed_convection_T_fluid");
      33          34 :   params.suppressParameter<std::vector<MooseFunctorName>>("fixed_convection_htc");
      34             : 
      35             :   // Swap out some parameters, base class is not specific to porous media
      36             :   // Variables
      37          68 :   params.renameParam("temperature_name",
      38             :                      "solid_temperature_variable",
      39             :                      "Name of the solid phase temperature variable");
      40          68 :   params.set<VariableName>("solid_temperature_variable") = NS::T_solid;
      41          68 :   params.addParam<NonlinearVariableName>(
      42             :       "fluid_temperature_variable", NS::T_fluid, "Name of the fluid temperature variable");
      43          68 :   MooseEnum face_interpol_types("average skewness-corrected", "average");
      44          68 :   params.addParam<MooseEnum>(
      45             :       "solid_temperature_face_interpolation",
      46             :       face_interpol_types,
      47             :       "The numerical scheme to interpolate the temperature/energy to the "
      48             :       "face for conduction (separate from the advected quantity interpolation).");
      49          68 :   params.addParam<bool>(
      50             :       "solid_temperature_two_term_bc_expansion",
      51          68 :       true,
      52             :       "If a two-term Taylor expansion is needed for the determination of the boundary values"
      53             :       "of the temperature/energy.");
      54             : 
      55             :   // Porous media parameters
      56             :   // TODO: ensure consistency with fluid energy physics
      57          34 :   params.transferParam<MooseFunctorName>(NSFVBase::validParams(), "porosity");
      58             : 
      59             :   // Material properties
      60          34 :   params.suppressParameter<MaterialPropertyName>("specific_heat");
      61          68 :   params.addParam<MooseFunctorName>("cp_solid", NS::cp + "_solid", "Specific heat functor");
      62          34 :   params.suppressParameter<MaterialPropertyName>("density");
      63          68 :   params.addParam<MooseFunctorName>("rho_solid", NS::density + "_solid", "Density functor");
      64          68 :   params.addParam<std::vector<std::vector<SubdomainName>>>(
      65             :       "thermal_conductivity_blocks", "Blocks which each thermal conductivity is defined");
      66          34 :   params.suppressParameter<MooseFunctorName>("thermal_conductivity_functor");
      67          68 :   params.addRequiredParam<std::vector<MooseFunctorName>>(
      68             :       "thermal_conductivity_solid",
      69             :       "Thermal conductivity, which may have different names depending on the subdomain");
      70             : 
      71             :   // Ambient convection with the liquid phase parameters
      72          68 :   params.addParam<std::vector<std::vector<SubdomainName>>>(
      73             :       "ambient_convection_blocks", {}, "The blocks where the ambient convection is present.");
      74          68 :   params.addParam<std::vector<MooseFunctorName>>(
      75             :       "ambient_convection_alpha",
      76             :       {},
      77             :       "The heat exchange coefficients for each block in 'ambient_convection_blocks'.");
      78         136 :   params.addParam<std::vector<MooseFunctorName>>(
      79             :       "ambient_convection_temperature",
      80             :       {NS::T_fluid},
      81             :       "The fluid temperature for each block in 'ambient_convection_blocks'.");
      82             : 
      83             :   // Heat source in solid porous medium parameters
      84          34 :   params.addParam<std::vector<SubdomainName>>("external_heat_source_blocks",
      85          34 :                                               std::vector<SubdomainName>(),
      86             :                                               "The blocks where the heat source is present.");
      87          68 :   params.addParam<MooseFunctorName>(
      88             :       "external_heat_source",
      89             :       "The name of a functor which contains the external heat source for the energy equation.");
      90          68 :   params.addParam<Real>(
      91          68 :       "external_heat_source_coeff", 1.0, "Multiplier for the coupled heat source term.");
      92          68 :   params.addParam<bool>("use_external_enthalpy_material",
      93          68 :                         false,
      94             :                         "To indicate if the enthalpy material is set up outside of the action.");
      95             : 
      96          34 :   params.suppressParameter<VariableName>("heat_source_var");
      97          34 :   params.suppressParameter<std::vector<SubdomainName>>("heat_source_blocks");
      98             : 
      99             :   // Numerical scheme
     100          68 :   params.addParam<unsigned short>(
     101          68 :       "ghost_layers", 2, "Number of layers of elements to ghost near process domain boundaries");
     102             :   // Preconditioning has not been derived for NSFV + porous heat transfer at this point
     103          68 :   MooseEnum pc_options("default none", "none");
     104          34 :   params.set<MooseEnum>("preconditioning") = pc_options;
     105          34 :   params.suppressParameter<MooseEnum>("preconditioning");
     106             : 
     107             :   // Parameter groups
     108          68 :   params.addParamNamesToGroup("rho_solid cp_solid thermal_conductivity_solid "
     109             :                               "thermal_conductivity_blocks use_external_enthalpy_material",
     110             :                               "Material properties");
     111          68 :   params.addParamNamesToGroup("ambient_convection_alpha ambient_convection_blocks "
     112             :                               "ambient_convection_temperature",
     113             :                               "Ambient convection");
     114          68 :   params.addParamNamesToGroup(
     115             :       "external_heat_source_blocks external_heat_source external_heat_source_coeff",
     116             :       "Solid porous medium heat source");
     117          68 :   params.addParamNamesToGroup(
     118             :       "solid_temperature_face_interpolation solid_temperature_two_term_bc_expansion",
     119             :       "Numerical scheme");
     120          68 :   params.addParamNamesToGroup("ghost_layers", "Advanced");
     121             : 
     122          34 :   return params;
     123          34 : }
     124             : 
     125          34 : PNSFVSolidHeatTransferPhysics::PNSFVSolidHeatTransferPhysics(const InputParameters & parameters)
     126             :   : HeatConductionFV(parameters),
     127          34 :     _solid_temperature_name(getParam<VariableName>("solid_temperature_variable")),
     128          68 :     _fluid_temperature_name(getParam<NonlinearVariableName>("fluid_temperature_variable")),
     129             :     _porosity_name(getParam<MooseFunctorName>(NS::porosity)),
     130          34 :     _density_name(getParam<MooseFunctorName>("rho_solid")),
     131          34 :     _specific_heat_name(getParam<MooseFunctorName>("cp_solid")),
     132          52 :     _thermal_conductivity_blocks(
     133          34 :         parameters.isParamValid("thermal_conductivity_blocks")
     134          34 :             ? getParam<std::vector<std::vector<SubdomainName>>>("thermal_conductivity_blocks")
     135             :             : std::vector<std::vector<SubdomainName>>()),
     136          68 :     _thermal_conductivity_name(
     137             :         getParam<std::vector<MooseFunctorName>>("thermal_conductivity_solid")),
     138          68 :     _ambient_convection_blocks(
     139             :         getParam<std::vector<std::vector<SubdomainName>>>("ambient_convection_blocks")),
     140          68 :     _ambient_convection_alpha(getParam<std::vector<MooseFunctorName>>("ambient_convection_alpha")),
     141         136 :     _ambient_temperature(getParam<std::vector<MooseFunctorName>>("ambient_convection_temperature"))
     142             : {
     143          34 :   saveSolverVariableName(_solid_temperature_name);
     144             : 
     145             :   // Parameter checks
     146          68 :   if (getParam<std::vector<MooseFunctorName>>("ambient_convection_temperature").size() != 1)
     147           0 :     checkVectorParamsSameLengthIfSet<MooseFunctorName, MooseFunctorName>(
     148             :         "ambient_convection_alpha", "ambient_convection_temperature");
     149          68 :   checkSecondParamSetOnlyIfFirstOneSet("external_heat_source", "external_heat_source_coeff");
     150          34 :   if (_solid_temperature_name == _fluid_temperature_name)
     151           0 :     paramError("solid_temperature_variable",
     152             :                "Solid and fluid cannot share the same temperature variable");
     153             :   // More parameter checks in ambient convection creation
     154          34 : }
     155             : 
     156             : void
     157          34 : PNSFVSolidHeatTransferPhysics::addSolverVariables()
     158             : {
     159             :   // Dont add if the user already defined the variable
     160          68 :   if (variableExists(_solid_temperature_name,
     161             :                      /*error_if_aux=*/true))
     162           0 :     checkBlockRestrictionIdentical(_solid_temperature_name,
     163           0 :                                    getProblem().getVariable(0, _solid_temperature_name).blocks());
     164             :   else
     165             :   {
     166          34 :     auto params = getFactory().getValidParams("INSFVEnergyVariable");
     167          34 :     assignBlocks(params, _blocks);
     168          68 :     params.set<SolverSystemName>("solver_sys") = getSolverSystem(_solid_temperature_name);
     169         102 :     params.set<std::vector<Real>>("scaling") = {getParam<Real>("temperature_scaling")};
     170          68 :     params.set<MooseEnum>("face_interp_method") =
     171          68 :         getParam<MooseEnum>("solid_temperature_face_interpolation");
     172          34 :     params.set<bool>("two_term_boundary_expansion") =
     173         102 :         getParam<bool>("solid_temperature_two_term_bc_expansion");
     174          34 :     getProblem().addVariable("INSFVEnergyVariable", _solid_temperature_name, params);
     175          34 :   }
     176          34 : }
     177             : 
     178             : void
     179          34 : PNSFVSolidHeatTransferPhysics::addFVKernels()
     180             : {
     181             :   // Check this physics against others
     182          34 :   checkFluidAndSolidHeatTransferPhysicsParameters();
     183             : 
     184          34 :   if (isTransient())
     185           7 :     addPINSSolidEnergyTimeKernels();
     186             : 
     187          34 :   addPINSSolidEnergyHeatConductionKernels();
     188          68 :   if (getParam<std::vector<MooseFunctorName>>("ambient_convection_alpha").size())
     189          25 :     addPINSSolidEnergyAmbientConvection();
     190          68 :   if (isParamValid("external_heat_source"))
     191          27 :     addPINSSolidEnergyExternalHeatSource();
     192          34 : }
     193             : 
     194             : void
     195           7 : PNSFVSolidHeatTransferPhysics::addPINSSolidEnergyTimeKernels()
     196             : {
     197             :   const auto kernel_type = "PINSFVEnergyTimeDerivative";
     198           7 :   const auto kernel_name = prefix() + "pins_solid_energy_time";
     199             : 
     200           7 :   InputParameters params = getFactory().getValidParams(kernel_type);
     201           7 :   assignBlocks(params, _blocks);
     202           7 :   params.set<NonlinearVariableName>("variable") = _solid_temperature_name;
     203           7 :   params.set<MooseFunctorName>(NS::density) = _density_name;
     204             : 
     205             :   // The '_solid' suffix has been declared when creating the INSFVEnthalpyMaterial
     206             :   // only for thermal functor material properties
     207             :   // Using this derivative we can model non-constant specific heat
     208          21 :   if (getProblem().hasFunctor(NS::time_deriv(NS::specific_enthalpy) + "_solid",
     209             :                               /*thread_id=*/0))
     210          14 :     params.set<MooseFunctorName>(NS::time_deriv(NS::specific_enthalpy)) =
     211          14 :         NS::time_deriv(NS::specific_enthalpy) + "_solid";
     212             :   else
     213           0 :     params.set<MooseFunctorName>(NS::cp) = _specific_heat_name;
     214             : 
     215           7 :   params.set<MooseFunctorName>(NS::porosity) = _porosity_name;
     216             :   // If modeling a variable density
     217          14 :   if (getProblem().hasFunctor(NS::time_deriv(_density_name),
     218             :                               /*thread_id=*/0))
     219             :   {
     220           0 :     params.set<MooseFunctorName>(NS::time_deriv(NS::density)) = NS::time_deriv(_density_name);
     221           0 :     params.set<MooseFunctorName>(NS::specific_enthalpy) = NS::specific_enthalpy + "_solid";
     222             :   }
     223           7 :   params.set<bool>("is_solid") = true;
     224             : 
     225           7 :   getProblem().addFVKernel(kernel_type, kernel_name, params);
     226          14 : }
     227             : 
     228             : void
     229          34 : PNSFVSolidHeatTransferPhysics::addPINSSolidEnergyHeatConductionKernels()
     230             : {
     231          34 :   const auto vector_conductivity = processThermalConductivity();
     232             : 
     233             :   const auto kernel_type =
     234          34 :       vector_conductivity ? "PINSFVEnergyAnisotropicDiffusion" : "PINSFVEnergyDiffusion";
     235             : 
     236          34 :   InputParameters params = getFactory().getValidParams(kernel_type);
     237          34 :   params.set<NonlinearVariableName>("variable") = _solid_temperature_name;
     238          34 :   params.set<MooseFunctorName>(NS::porosity) = _porosity_name;
     239             : 
     240             :   // Set block restrictions
     241             :   const bool combined = _thermal_conductivity_blocks.size() > 1;
     242             :   std::vector<SubdomainName> thermal_conductivity_blocks;
     243          61 :   for (const auto & block_group : _thermal_conductivity_blocks)
     244          27 :     thermal_conductivity_blocks.insert(thermal_conductivity_blocks.end(),
     245             :                                        std::make_move_iterator(block_group.begin()),
     246             :                                        std::make_move_iterator(block_group.end()));
     247             :   const auto block_names =
     248          34 :       _thermal_conductivity_blocks.size() ? thermal_conductivity_blocks : _blocks;
     249          34 :   assignBlocks(params, block_names);
     250             : 
     251             :   // Set thermal conductivity
     252          68 :   const auto conductivity_name = vector_conductivity ? NS::kappa : NS::k;
     253          34 :   if (combined)
     254          18 :     params.set<MooseFunctorName>(conductivity_name) = prefix() + "combined_thermal_conductivity";
     255             :   else
     256          25 :     params.set<MooseFunctorName>(conductivity_name) = _thermal_conductivity_name[0];
     257             : 
     258         136 :   getProblem().addFVKernel(kernel_type, prefix() + "pins_energy_diffusion", params);
     259          34 : }
     260             : 
     261             : void
     262          25 : PNSFVSolidHeatTransferPhysics::addPINSSolidEnergyAmbientConvection()
     263             : {
     264             :   const auto num_convection_blocks = _ambient_convection_blocks.size();
     265             :   const auto num_used_blocks = num_convection_blocks ? num_convection_blocks : 1;
     266             : 
     267             :   // Check parameter. Late check in case the block was added by a Component
     268          25 :   if (num_used_blocks != _ambient_convection_alpha.size())
     269           0 :     paramError("ambient_convection_alpha",
     270           0 :                "Number of ambient convection heat transfer coefficients (" +
     271           0 :                    std::to_string(_ambient_convection_alpha.size()) +
     272             :                    ") should match the number of "
     273           0 :                    "blocks (" +
     274           0 :                    std::to_string(num_convection_blocks) + ") each HTC is defined on.");
     275             : 
     276             :   const auto kernel_type = "PINSFVEnergyAmbientConvection";
     277          25 :   InputParameters params = getFactory().getValidParams(kernel_type);
     278          50 :   params.set<NonlinearVariableName>("variable") = _solid_temperature_name;
     279          25 :   params.set<MooseFunctorName>(NS::T_solid) = _solid_temperature_name;
     280          25 :   params.set<bool>("is_solid") = true;
     281             : 
     282          50 :   for (const auto block_i : make_range(num_used_blocks))
     283             :   {
     284          25 :     std::string block_name = "";
     285          25 :     if (num_convection_blocks)
     286             :     {
     287           9 :       params.set<std::vector<SubdomainName>>("block") = _ambient_convection_blocks[block_i];
     288          18 :       block_name = Moose::stringify(_ambient_convection_blocks[block_i]);
     289             :     }
     290             :     else
     291             :     {
     292          16 :       assignBlocks(params, _blocks);
     293          32 :       block_name = std::to_string(block_i);
     294             :     }
     295             : 
     296          50 :     params.set<MooseFunctorName>("h_solid_fluid") = _ambient_convection_alpha[block_i];
     297          25 :     if (_ambient_temperature.size() > 1)
     298           0 :       params.set<MooseFunctorName>(NS::T_fluid) = _ambient_temperature[block_i];
     299             :     else
     300          25 :       params.set<MooseFunctorName>(NS::T_fluid) = _ambient_temperature[0];
     301             : 
     302         100 :     getProblem().addFVKernel(kernel_type, prefix() + "ambient_convection_" + block_name, params);
     303             :   }
     304          25 : }
     305             : 
     306             : void
     307          27 : PNSFVSolidHeatTransferPhysics::addPINSSolidEnergyExternalHeatSource()
     308             : {
     309          27 :   const std::string kernel_type = "FVCoupledForce";
     310          27 :   InputParameters params = getFactory().getValidParams(kernel_type);
     311          27 :   params.set<NonlinearVariableName>("variable") = _solid_temperature_name;
     312          54 :   const auto & source_blocks = getParam<std::vector<SubdomainName>>("external_heat_source_blocks");
     313          27 :   if (source_blocks.size())
     314           9 :     assignBlocks(params, source_blocks);
     315             :   else
     316          18 :     assignBlocks(params, _blocks);
     317          81 :   params.set<MooseFunctorName>("v") = getParam<MooseFunctorName>("external_heat_source");
     318          54 :   params.set<Real>("coef") = getParam<Real>("external_heat_source_coeff");
     319             : 
     320          54 :   getProblem().addFVKernel(kernel_type, prefix() + "external_heat_source", params);
     321          54 : }
     322             : 
     323             : bool
     324          43 : PNSFVSolidHeatTransferPhysics::processThermalConductivity()
     325             : {
     326          86 :   if (isParamValid("thermal_conductivity_blocks"))
     327          36 :     checkBlockwiseConsistency<MooseFunctorName>("thermal_conductivity_blocks",
     328             :                                                 {"thermal_conductivity_solid"});
     329             :   bool have_scalar = false;
     330             :   bool have_vector = false;
     331             : 
     332         122 :   for (const auto i : index_range(_thermal_conductivity_name))
     333             :   {
     334             :     // First, check if the name is just a number (only in case of isotropic conduction)
     335          79 :     if (MooseUtils::parsesToReal(_thermal_conductivity_name[i]))
     336             :       have_scalar = true;
     337             :     // Now we determine what kind of functor we are dealing with
     338             :     else
     339             :     {
     340          18 :       if (getProblem().hasFunctorWithType<ADReal>(_thermal_conductivity_name[i],
     341             :                                                   /*thread_id=*/0))
     342             :         have_scalar = true;
     343             :       else
     344             :       {
     345           0 :         if (getProblem().hasFunctorWithType<ADRealVectorValue>(_thermal_conductivity_name[i],
     346             :                                                                /*thread_id=*/0))
     347             :           have_vector = true;
     348           0 :         else if (getProblem().hasFunctor(_thermal_conductivity_name[i],
     349             :                                          /*thread_id=*/0))
     350           0 :           paramError("thermal_conductivity_solid",
     351             :                      "We only allow functor of type (AD)Real or (AD)RealVectorValue for thermal "
     352           0 :                      "conductivity! Functor '" +
     353             :                          _thermal_conductivity_name[i] + "' is not of the requested type.");
     354             :         else
     355             :           // If another Physics is creating this functor, we could be running into an order of
     356             :           // creation problem
     357           0 :           paramWarning("thermal_conductivity_solid",
     358           0 :                        "Functor '" + _thermal_conductivity_name[i] +
     359             :                            "' was not found in the Problem. Did you mispell it?");
     360             :       }
     361             :     }
     362             :   }
     363             : 
     364          43 :   if (have_vector && (have_vector == have_scalar))
     365           0 :     paramError("thermal_conductivity_solid",
     366             :                "The entries on thermal conductivity shall either be scalars or vectors, mixing "
     367             :                "them is not supported!");
     368          43 :   return have_vector;
     369             : }
     370             : 
     371             : void
     372          34 : PNSFVSolidHeatTransferPhysics::addMaterials()
     373             : {
     374          68 :   if (!getParam<bool>("use_external_enthalpy_material"))
     375             :   {
     376          25 :     InputParameters params = getFactory().getValidParams("INSFVEnthalpyFunctorMaterial");
     377          25 :     assignBlocks(params, _blocks);
     378             : 
     379          25 :     params.set<MooseFunctorName>(NS::density) = _density_name;
     380          25 :     params.set<MooseFunctorName>(NS::cp) = _specific_heat_name;
     381          50 :     params.set<MooseFunctorName>("temperature") = _solid_temperature_name;
     382          50 :     params.set<MaterialPropertyName>("declare_suffix") = "solid";
     383             : 
     384          75 :     getProblem().addMaterial(
     385          25 :         "INSFVEnthalpyFunctorMaterial", prefix() + "ins_enthalpy_material", params);
     386          25 :   }
     387             : 
     388             :   // Combine the functors (combining scalars and vectors is not currently supported)
     389          34 :   if (_thermal_conductivity_name.size() > 1)
     390             :   {
     391           9 :     const auto vector_conductivity = processThermalConductivity();
     392           9 :     const auto combiner_functor = vector_conductivity ? "PiecewiseByBlockVectorFunctorMaterial"
     393             :                                                       : "PiecewiseByBlockFunctorMaterial";
     394          18 :     InputParameters params = getFactory().getValidParams(combiner_functor);
     395          27 :     params.set<MooseFunctorName>("prop_name") = prefix() + "combined_thermal_conductivity";
     396             :     std::vector<SubdomainName> blocks_list;
     397             :     std::map<std::string, std::string> blocks_to_functors;
     398          36 :     for (const auto i : index_range(_thermal_conductivity_name))
     399             :     {
     400          54 :       for (const auto & block : _thermal_conductivity_blocks[i])
     401             :       {
     402          27 :         blocks_list.push_back(block);
     403          27 :         blocks_to_functors.insert(
     404          54 :             std::pair<std::string, std::string>(block, _thermal_conductivity_name[i]));
     405             :       }
     406             :     }
     407           9 :     params.set<std::vector<SubdomainName>>("block") = blocks_list;
     408          18 :     params.set<std::map<std::string, std::string>>("subdomain_to_prop_value") = blocks_to_functors;
     409          36 :     getProblem().addMaterial(combiner_functor, prefix() + "thermal_conductivity_combiner", params);
     410           9 :   }
     411          34 : }
     412             : 
     413             : InputParameters
     414         102 : PNSFVSolidHeatTransferPhysics::getAdditionalRMParams() const
     415             : {
     416         204 :   unsigned short necessary_layers = getParam<unsigned short>("ghost_layers");
     417         306 :   if (getParam<MooseEnum>("solid_temperature_face_interpolation") == "skewness-corrected")
     418           0 :     necessary_layers = std::max(necessary_layers, (unsigned short)3);
     419             : 
     420             :   // Just an object that has a ghost_layers parameter and performs geometric, algebraic, and
     421             :   // coupling ghosting
     422         102 :   const std::string kernel_type = "INSFVMixingLengthReynoldsStress";
     423         102 :   InputParameters params = getFactory().getValidParams(kernel_type);
     424         102 :   params.template set<unsigned short>("ghost_layers") = necessary_layers;
     425             : 
     426         102 :   return params;
     427           0 : }
     428             : 
     429             : void
     430          34 : PNSFVSolidHeatTransferPhysics::checkFluidAndSolidHeatTransferPhysicsParameters() const
     431             : {
     432             :   // Get a pointer to a flow physics and a heat transfer physics on the same blocks, if it exists
     433             :   const WCNSFVFlowPhysics * flow_physics = nullptr;
     434             :   const WCNSFVFluidHeatTransferPhysics * fluid_energy_physics = nullptr;
     435          34 :   const auto all_flow_physics = getCoupledPhysics<const WCNSFVFlowPhysics>(/*allow_fail=*/true);
     436          50 :   for (const auto physics : all_flow_physics)
     437          16 :     if (checkBlockRestrictionIdentical(
     438             :             physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
     439             :     {
     440          16 :       if (flow_physics)
     441           0 :         mooseError("Two Fluid flow physics detected on the same blocks as the solid heat transfer "
     442             :                    "physics");
     443             :       flow_physics = physics;
     444             :     }
     445             :   const auto all_fluid_energy_physics =
     446          34 :       getCoupledPhysics<const WCNSFVFluidHeatTransferPhysics>(/*allow_fail=*/true);
     447          50 :   for (const auto physics : all_fluid_energy_physics)
     448          16 :     if (checkBlockRestrictionIdentical(
     449             :             physics->name(), physics->blocks(), /*error_if_not_identical=*/false))
     450             :     {
     451          16 :       if (fluid_energy_physics)
     452           0 :         mooseError("Two fluid heat transfer physics detected on the same blocks as the solid heat "
     453             :                    "transfer physics");
     454             :       fluid_energy_physics = physics;
     455             :     }
     456             : 
     457          34 :   if (!fluid_energy_physics && !flow_physics)
     458             :     return;
     459             : 
     460             :   // Check that the parameters seem reasonable
     461             :   // Different material properties
     462             :   // TODO: Does this error on numbers?
     463          16 :   if (flow_physics && flow_physics->densityName() == _density_name)
     464           0 :     paramError("rho_solid", "Fluid and solid density should be different");
     465          16 :   if (fluid_energy_physics && fluid_energy_physics->getSpecificHeatName() == _specific_heat_name)
     466           0 :     paramError("cp_solid", "Fluid and solid specific heat should be different");
     467             : 
     468             :   // Check ambient convection parameters
     469          16 :   if (fluid_energy_physics)
     470             :   {
     471             :     // The blocks should match
     472             :     // We only use a warning in case the blocks are matching, just specified differently
     473             :     // in the vector of vectors
     474          16 :     auto fluid_convection_blocks = fluid_energy_physics->getAmbientConvectionBlocks();
     475          16 :     std::sort(fluid_convection_blocks.begin(), fluid_convection_blocks.end());
     476          16 :     std::vector<std::vector<SubdomainName>> copy_solid_blocks = _ambient_convection_blocks;
     477          16 :     std::sort(copy_solid_blocks.begin(), copy_solid_blocks.end());
     478          16 :     if (fluid_convection_blocks != _ambient_convection_blocks)
     479           0 :       paramWarning("Ambient convection blocks in the solid phase :" +
     480           0 :                    Moose::stringify(_ambient_convection_blocks) + " and in the fluid phase " +
     481           0 :                    Moose::stringify(fluid_convection_blocks) + " do not seem to match.");
     482             : 
     483             :     // The coefficients should also match
     484          16 :     auto fluid_convection_coeffs = fluid_energy_physics->getAmbientConvectionHTCs();
     485          16 :     fluid_convection_blocks = fluid_energy_physics->getAmbientConvectionBlocks();
     486          16 :     for (const auto i : index_range(fluid_energy_physics->getAmbientConvectionBlocks()))
     487           0 :       for (const auto j : index_range(_ambient_convection_blocks))
     488           0 :         if (fluid_convection_blocks[i] == _ambient_convection_blocks[j] &&
     489           0 :             fluid_convection_coeffs[i] != _ambient_convection_alpha[j])
     490           0 :           paramWarning("Ambient convection HTCs in the solid phase :" +
     491           0 :                        Moose::stringify(_ambient_convection_alpha) + " and in the fluid phase " +
     492           0 :                        Moose::stringify(fluid_convection_coeffs) + " do not seem to match.");
     493          16 :   }
     494          34 : }

Generated by: LCOV version 1.14