LCOV - code coverage report
Current view: top level - src/actions - PorousFlowActionBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #32971 (54bef8) with base c6cf66 Lines: 445 471 94.5 %
Date: 2026-05-29 20:38:56 Functions: 28 29 96.6 %
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 "PorousFlowActionBase.h"
      11             : 
      12             : #include "FEProblem.h"
      13             : #include "MooseMesh.h"
      14             : #include "libmesh/string_to_enum.h"
      15             : #include "Conversion.h"
      16             : #include "AddKernelAction.h"
      17             : #include "AddPostprocessorAction.h"
      18             : #include "AddBCAction.h"
      19             : #include "AddDiracKernelAction.h"
      20             : 
      21             : InputParameters
      22        3236 : PorousFlowActionBase::validParams()
      23             : {
      24        3236 :   InputParameters params = Action::validParams();
      25        6472 :   params.addParam<std::string>(
      26             :       "dictator_name",
      27             :       "dictator",
      28             :       "The name of the dictator user object that is created by this Action");
      29        3236 :   params.addClassDescription("Adds the PorousFlowDictator UserObject.  This class also contains "
      30             :                              "many utility functions for adding other pieces of an input file, "
      31             :                              "which may be used by derived classes.");
      32        6472 :   params.addParam<std::vector<SubdomainName>>(
      33             :       "block", {}, "The list of block ids (SubdomainID) on which the porous flow is defined on");
      34        6472 :   params.addParamNamesToGroup("block", "Advanced");
      35             : 
      36        3236 :   params.addParam<RealVectorValue>("gravity",
      37        3236 :                                    RealVectorValue(0.0, 0.0, -10.0),
      38             :                                    "Gravitational acceleration vector downwards (m/s^2)");
      39        6472 :   params.addCoupledVar("temperature",
      40             :                        293.0,
      41             :                        "For isothermal simulations, this is the temperature "
      42             :                        "at which fluid properties (and stress-free strains) "
      43             :                        "are evaluated at.  Otherwise, this is the name of "
      44             :                        "the temperature variable.  Units = Kelvin");
      45        6472 :   params.addCoupledVar("mass_fraction_vars",
      46             :                        "List of variables that represent the mass fractions.  Format is 'f_ph0^c0 "
      47             :                        "f_ph0^c1 f_ph0^c2 ... f_ph0^c(N-1) f_ph1^c0 f_ph1^c1 fph1^c2 ... "
      48             :                        "fph1^c(N-1) ... fphP^c0 f_phP^c1 fphP^c2 ... fphP^c(N-1)' where "
      49             :                        "N=num_components and P=num_phases, and it is assumed that "
      50             :                        "f_ph^cN=1-sum(f_ph^c,{c,0,N-1}) so that f_ph^cN need not be given.  If no "
      51             :                        "variables are provided then num_phases=1=num_components.");
      52        6472 :   params.addParam<unsigned int>("number_aqueous_equilibrium",
      53        6472 :                                 0,
      54             :                                 "The number of secondary species in the aqueous-equilibrium "
      55             :                                 "reaction system.  (Leave as zero if the simulation does not "
      56             :                                 "involve chemistry)");
      57        6472 :   params.addParam<unsigned int>("number_aqueous_kinetic",
      58        6472 :                                 0,
      59             :                                 "The number of secondary species in the aqueous-kinetic reaction "
      60             :                                 "system involved in precipitation and dissolution.  (Leave as zero "
      61             :                                 "if the simulation does not involve chemistry)");
      62        6472 :   params.addParam<std::vector<VariableName>>(
      63             :       "displacements",
      64             :       {},
      65             :       "The name of the displacement variables (relevant only for "
      66             :       "mechanically-coupled simulations)");
      67        6472 :   params.addParam<std::vector<MaterialPropertyName>>(
      68             :       "eigenstrain_names",
      69             :       {},
      70             :       "List of all eigenstrain models used in mechanics calculations. "
      71             :       "Typically the eigenstrain_name used in "
      72             :       "ComputeThermalExpansionEigenstrain.  Only needed for "
      73             :       "thermally-coupled simulations with thermal expansion.");
      74        6472 :   params.addParam<bool>(
      75        6472 :       "use_displaced_mesh", false, "Use displaced mesh computations in mechanical kernels");
      76        6472 :   MooseEnum flux_limiter_type("MinMod VanLeer MC superbee None", "VanLeer");
      77        6472 :   params.addParam<MooseEnum>(
      78             :       "flux_limiter_type",
      79             :       flux_limiter_type,
      80             :       "Type of flux limiter to use if stabilization=KT.  'None' means that no antidiffusion "
      81             :       "will be added in the Kuzmin-Turek scheme");
      82        6472 :   MooseEnum stabilization("None Full KT", "Full");
      83        6472 :   params.addParam<MooseEnum>("stabilization",
      84             :                              stabilization,
      85             :                              "Numerical stabilization used.  'Full' means full upwinding.  'KT' "
      86             :                              "means FEM-TVD stabilization of Kuzmin-Turek");
      87        6472 :   params.addParam<bool>(
      88             :       "strain_at_nearest_qp",
      89        6472 :       false,
      90             :       "Only relevant for models in which porosity depends on strain.  If true, then when "
      91             :       "calculating nodal porosity that depends on strain, the strain at the nearest quadpoint will "
      92             :       "be used.  This adds a small extra computational burden, and is only necessary for "
      93             :       "simulations involving: (1) elements that are not linear lagrange or (2) certain PorousFlow "
      94             :       "Dirac Kernels (as specified in their documentation).  If you set this to true, you will "
      95             :       "also want to set the same parameter to true for related Kernels and Materials (which is "
      96             :       "probably easiest to do in the GlobalParams block)");
      97        3236 :   return params;
      98        3236 : }
      99             : 
     100        3236 : PorousFlowActionBase::PorousFlowActionBase(const InputParameters & params)
     101             :   : Action(params),
     102             :     PorousFlowDependencies(),
     103             :     _included_objects(),
     104        6472 :     _dictator_name(getParam<std::string>("dictator_name")),
     105        6472 :     _subdomain_names(getParam<std::vector<SubdomainName>>("block")),
     106        6472 :     _subdomain_names_set(isParamSetByUser("block")),
     107        6472 :     _num_aqueous_equilibrium(getParam<unsigned int>("number_aqueous_equilibrium")),
     108        6472 :     _num_aqueous_kinetic(getParam<unsigned int>("number_aqueous_kinetic")),
     109        6472 :     _gravity(getParam<RealVectorValue>("gravity")),
     110        7612 :     _mass_fraction_vars(isParamValid("mass_fraction_vars")
     111        3236 :                             ? getParam<std::vector<VariableName>>("mass_fraction_vars")
     112             :                             : std::vector<VariableName>{}),
     113        3236 :     _num_mass_fraction_vars(_mass_fraction_vars.size()),
     114        8866 :     _temperature_var(isParamValid("temperature")
     115        3236 :                          ? getParam<std::vector<VariableName>>("temperature")
     116             :                          : std::vector<VariableName>{}),
     117        6472 :     _displacements(getParam<std::vector<VariableName>>("displacements")),
     118        3236 :     _ndisp(_displacements.size()),
     119        3236 :     _coupled_displacements(_ndisp),
     120        6472 :     _flux_limiter_type(getParam<MooseEnum>("flux_limiter_type")),
     121        6472 :     _stabilization(getParam<MooseEnum>("stabilization").getEnum<StabilizationEnum>()),
     122        9708 :     _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp"))
     123             : {
     124             :   // convert vector of VariableName to vector of VariableName
     125        6341 :   for (unsigned int i = 0; i < _ndisp; ++i)
     126        3105 :     _coupled_displacements[i] = _displacements[i];
     127        3236 : }
     128             : 
     129             : void
     130        9380 : PorousFlowActionBase::addRelationshipManagers(Moose::RelationshipManagerType input_rm_type)
     131             : {
     132        9380 :   InputParameters ips = (_stabilization == StabilizationEnum::KT
     133        9380 :                              ? _factory.getValidParams("PorousFlowAdvectiveFluxCalculatorSaturated")
     134        9380 :                              : emptyInputParameters());
     135        9380 :   addRelationshipManagers(input_rm_type, ips);
     136        9380 : }
     137             : 
     138             : void
     139        3156 : PorousFlowActionBase::act()
     140             : {
     141             :   // Check if the simulation is transient (note: can't do this in the ctor)
     142        3156 :   _transient = _problem->isTransient();
     143             : 
     144             :   // get subdomain IDs
     145             :   std::set<SubdomainID> _subdomain_ids;
     146        3921 :   for (auto & name : _subdomain_names)
     147             :   {
     148         765 :     auto id = _mesh->getSubdomainID(name);
     149         765 :     if (id == Moose::INVALID_BLOCK_ID)
     150           0 :       paramError("block", "Subdomain \"" + name + "\" not found in mesh.");
     151             :     else
     152         765 :       _subdomain_ids.insert(id);
     153             :   }
     154             : 
     155             :   // Make sure that all mesh subdomains have the same coordinate system
     156             :   const auto & all_subdomains =
     157        3156 :       _subdomain_names.empty() ? _problem->mesh().meshSubdomains() : _subdomain_ids;
     158             : 
     159        3156 :   if (all_subdomains.empty())
     160           0 :     mooseError("No subdomains found");
     161        3156 :   _coord_system = _problem->getCoordSystem(*all_subdomains.begin());
     162        7092 :   for (const auto & subdomain : all_subdomains)
     163        3936 :     if (_problem->getCoordSystem(subdomain) != _coord_system)
     164           0 :       mooseError(
     165             :           "The PorousFlow Actions require all subdomains to have the same coordinate system.");
     166             : 
     167             :   // Note: this must be called before addMaterials!
     168        3156 :   addMaterialDependencies();
     169             : 
     170             :   // Make the vector of added objects unique
     171        3156 :   std::sort(_included_objects.begin(), _included_objects.end());
     172        3156 :   _included_objects.erase(std::unique(_included_objects.begin(), _included_objects.end()),
     173             :                           _included_objects.end());
     174             : 
     175        3156 :   if (_current_task == "add_user_object")
     176         644 :     addUserObjects();
     177             : 
     178        3156 :   if (_current_task == "add_aux_variable" || _current_task == "add_aux_kernel")
     179        1262 :     addAuxObjects();
     180             : 
     181        3156 :   if (_current_task == "add_kernel")
     182         616 :     addKernels();
     183             : 
     184        3156 :   if (_current_task == "add_material")
     185         634 :     addMaterials();
     186        3156 : }
     187             : 
     188             : void
     189        3156 : PorousFlowActionBase::addMaterialDependencies()
     190             : {
     191        3156 :   if (_strain_at_nearest_qp)
     192         150 :     _included_objects.push_back("PorousFlowNearestQp");
     193             : 
     194             :   // Check to see if there are any other PorousFlow objects like BCs that
     195             :   // may require specific versions of materials added using this action
     196             : 
     197             :   // Unique list of auxkernels added in input file
     198        3156 :   auto auxkernels = _awh.getActions<AddKernelAction>();
     199        6293 :   for (auto & auxkernel : auxkernels)
     200        3137 :     _included_objects.push_back(auxkernel->getMooseObjectType());
     201             : 
     202             :   // Unique list of postprocessors added in input file
     203        3156 :   auto postprocessors = _awh.getActions<AddPostprocessorAction>();
     204       16686 :   for (auto & postprocessor : postprocessors)
     205       13530 :     _included_objects.push_back(postprocessor->getMooseObjectType());
     206             : 
     207             :   // Unique list of BCs added in input file
     208        3156 :   auto bcs = _awh.getActions<AddBCAction>();
     209       11461 :   for (auto & bc : bcs)
     210        8305 :     _included_objects.push_back(bc->getMooseObjectType());
     211             : 
     212             :   // Unique list of Dirac kernels added in input file
     213        3156 :   auto diracs = _awh.getActions<AddDiracKernelAction>();
     214        4641 :   for (auto & dirac : diracs)
     215        1485 :     _included_objects.push_back(dirac->getMooseObjectType());
     216        3156 : }
     217             : 
     218             : void
     219         644 : PorousFlowActionBase::addUserObjects()
     220             : {
     221         644 :   addDictator();
     222         644 : }
     223             : 
     224             : void
     225        1262 : PorousFlowActionBase::addAuxObjects()
     226             : {
     227        1262 : }
     228             : 
     229             : void
     230         616 : PorousFlowActionBase::addKernels()
     231             : {
     232         616 : }
     233             : 
     234             : void
     235         634 : PorousFlowActionBase::addMaterials()
     236             : {
     237         649 :   if (_strain_at_nearest_qp && _deps.dependsOn(_included_objects, "nearest_qp_nodal"))
     238          15 :     addNearestQpMaterial();
     239         634 : }
     240             : 
     241             : void
     242         284 : PorousFlowActionBase::addSaturationAux(unsigned phase)
     243             : {
     244             :   std::string phase_str = Moose::stringify(phase);
     245             : 
     246         284 :   if (_current_task == "add_aux_variable")
     247             :   {
     248         147 :     auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
     249         147 :     if (_subdomain_names_set)
     250          54 :       var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     251         294 :     _problem->addAuxVariable("MooseVariableConstMonomial", "saturation" + phase_str, var_params);
     252         147 :   }
     253             : 
     254         284 :   if (_current_task == "add_aux_kernel")
     255             :   {
     256         137 :     std::string aux_kernel_type = "MaterialStdVectorAux";
     257         137 :     InputParameters params = _factory.getValidParams(aux_kernel_type);
     258             : 
     259         137 :     std::string aux_kernel_name = "PorousFlowActionBase_SaturationAux" + phase_str;
     260         274 :     params.set<MaterialPropertyName>("property") = "PorousFlow_saturation_qp";
     261         137 :     params.set<unsigned>("index") = phase;
     262         411 :     params.set<AuxVariableName>("variable") = "saturation" + phase_str;
     263         137 :     params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     264         137 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     265         137 :   }
     266         284 : }
     267             : 
     268             : void
     269        1070 : PorousFlowActionBase::addDarcyAux(const RealVectorValue & gravity)
     270             : {
     271        1070 :   if (_current_task == "add_aux_variable")
     272             :   {
     273         548 :     auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
     274         548 :     if (_subdomain_names_set)
     275         270 :       var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     276             : 
     277        1096 :     _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_x", var_params);
     278        1096 :     _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_y", var_params);
     279        1096 :     _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_z", var_params);
     280         548 :   }
     281             : 
     282        1070 :   if (_current_task == "add_aux_kernel")
     283             :   {
     284         522 :     std::string aux_kernel_type = "PorousFlowDarcyVelocityComponent";
     285         522 :     InputParameters params = _factory.getValidParams(aux_kernel_type);
     286         522 :     if (_subdomain_names_set)
     287         270 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     288             : 
     289         522 :     params.set<RealVectorValue>("gravity") = gravity;
     290        1044 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     291         522 :     params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     292             : 
     293         522 :     std::string aux_kernel_name = "PorousFlowActionBase_Darcy_x_Aux";
     294        1044 :     params.set<MooseEnum>("component") = "x";
     295        1044 :     params.set<AuxVariableName>("variable") = "darcy_vel_x";
     296         522 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     297             : 
     298             :     aux_kernel_name = "PorousFlowActionBase_Darcy_y_Aux";
     299        1044 :     params.set<MooseEnum>("component") = "y";
     300        1044 :     params.set<AuxVariableName>("variable") = "darcy_vel_y";
     301         522 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     302             : 
     303             :     aux_kernel_name = "PorousFlowActionBase_Darcy_z_Aux";
     304        1044 :     params.set<MooseEnum>("component") = "z";
     305        1044 :     params.set<AuxVariableName>("variable") = "darcy_vel_z";
     306         522 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     307         522 :   }
     308        1070 : }
     309             : 
     310             : void
     311         390 : PorousFlowActionBase::addStressAux()
     312             : {
     313         390 :   if (_current_task == "add_aux_variable")
     314             :   {
     315         195 :     auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
     316         195 :     if (_subdomain_names_set)
     317         270 :       var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     318         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xx", var_params);
     319         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xy", var_params);
     320         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xz", var_params);
     321         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yx", var_params);
     322         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yy", var_params);
     323         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yz", var_params);
     324         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zx", var_params);
     325         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zy", var_params);
     326         390 :     _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zz", var_params);
     327         195 :   }
     328             : 
     329         390 :   if (_current_task == "add_aux_kernel")
     330             :   {
     331         195 :     std::string aux_kernel_type = "RankTwoAux";
     332         195 :     InputParameters params = _factory.getValidParams(aux_kernel_type);
     333             : 
     334         390 :     params.set<MaterialPropertyName>("rank_two_tensor") = "stress";
     335         195 :     params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
     336             : 
     337         195 :     std::string aux_kernel_name = "PorousFlowAction_stress_xx";
     338         390 :     params.set<AuxVariableName>("variable") = "stress_xx";
     339         195 :     params.set<unsigned>("index_i") = 0;
     340         195 :     params.set<unsigned>("index_j") = 0;
     341         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     342             : 
     343             :     aux_kernel_name = "PorousFlowAction_stress_xy";
     344         390 :     params.set<AuxVariableName>("variable") = "stress_xy";
     345         195 :     params.set<unsigned>("index_i") = 0;
     346         195 :     params.set<unsigned>("index_j") = 1;
     347         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     348             : 
     349             :     aux_kernel_name = "PorousFlowAction_stress_xz";
     350         390 :     params.set<AuxVariableName>("variable") = "stress_xz";
     351         195 :     params.set<unsigned>("index_i") = 0;
     352         195 :     params.set<unsigned>("index_j") = 2;
     353         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     354             : 
     355             :     aux_kernel_name = "PorousFlowAction_stress_yx";
     356         390 :     params.set<AuxVariableName>("variable") = "stress_yx";
     357         195 :     params.set<unsigned>("index_i") = 1;
     358         195 :     params.set<unsigned>("index_j") = 0;
     359         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     360             : 
     361             :     aux_kernel_name = "PorousFlowAction_stress_yy";
     362         390 :     params.set<AuxVariableName>("variable") = "stress_yy";
     363         195 :     params.set<unsigned>("index_i") = 1;
     364         195 :     params.set<unsigned>("index_j") = 1;
     365         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     366             : 
     367             :     aux_kernel_name = "PorousFlowAction_stress_yz";
     368         390 :     params.set<AuxVariableName>("variable") = "stress_yz";
     369         195 :     params.set<unsigned>("index_i") = 1;
     370         195 :     params.set<unsigned>("index_j") = 2;
     371         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     372             : 
     373             :     aux_kernel_name = "PorousFlowAction_stress_zx";
     374         390 :     params.set<AuxVariableName>("variable") = "stress_zx";
     375         195 :     params.set<unsigned>("index_i") = 2;
     376         195 :     params.set<unsigned>("index_j") = 0;
     377         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     378             : 
     379             :     aux_kernel_name = "PorousFlowAction_stress_zy";
     380         390 :     params.set<AuxVariableName>("variable") = "stress_zy";
     381         195 :     params.set<unsigned>("index_i") = 2;
     382         195 :     params.set<unsigned>("index_j") = 1;
     383         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     384             : 
     385             :     aux_kernel_name = "PorousFlowAction_stress_zz";
     386         390 :     params.set<AuxVariableName>("variable") = "stress_zz";
     387         195 :     params.set<unsigned>("index_i") = 2;
     388         195 :     params.set<unsigned>("index_j") = 2;
     389         195 :     _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
     390         195 :   }
     391         390 : }
     392             : 
     393             : void
     394        1144 : PorousFlowActionBase::addTemperatureMaterial(bool at_nodes)
     395             : {
     396        1144 :   if (_current_task == "add_material")
     397             :   {
     398        2288 :     if (!parameters().hasDefaultCoupledValue("temperature"))
     399           0 :       mooseError("Attempt to add a PorousFlowTemperature material without setting a temperature "
     400             :                  "variable");
     401             : 
     402        1144 :     std::string material_type = "PorousFlowTemperature";
     403        1144 :     InputParameters params = _factory.getValidParams(material_type);
     404        1144 :     if (_subdomain_names_set)
     405         504 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     406             : 
     407        1144 :     params.applySpecificParameters(parameters(), {"temperature"});
     408        2288 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     409             : 
     410        1144 :     std::string material_name = "PorousFlowActionBase_Temperature_qp";
     411        1144 :     if (at_nodes)
     412             :       material_name = "PorousFlowActionBase_Temperature";
     413             : 
     414        1144 :     params.set<bool>("at_nodes") = at_nodes;
     415        1144 :     _problem->addMaterial(material_type, material_name, params);
     416        1144 :   }
     417        1144 : }
     418             : 
     419             : void
     420         716 : PorousFlowActionBase::addMassFractionMaterial(bool at_nodes)
     421             : {
     422         716 :   if (_current_task == "add_material")
     423             :   {
     424        1432 :     if (!(parameters().hasDefaultCoupledValue("mass_fraction_vars") ||
     425         716 :           parameters().hasCoupledValue("mass_fraction_vars")))
     426           0 :       mooseError("Attempt to add a PorousFlowMassFraction material without setting the "
     427             :                  "mass_fraction_vars");
     428             : 
     429         716 :     std::string material_type = "PorousFlowMassFraction";
     430         716 :     InputParameters params = _factory.getValidParams(material_type);
     431         716 :     if (_subdomain_names_set)
     432         306 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     433             : 
     434         716 :     params.applySpecificParameters(parameters(), {"mass_fraction_vars"});
     435        1432 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     436             : 
     437         716 :     std::string material_name = "PorousFlowActionBase_MassFraction_qp";
     438         716 :     if (at_nodes)
     439             :       material_name = "PorousFlowActionBase_MassFraction";
     440             : 
     441         716 :     params.set<bool>("at_nodes") = at_nodes;
     442         716 :     _problem->addMaterial(material_type, material_name, params);
     443         716 :   }
     444         716 : }
     445             : 
     446             : void
     447        1069 : PorousFlowActionBase::addEffectiveFluidPressureMaterial(bool at_nodes)
     448             : {
     449        1069 :   if (_current_task == "add_material")
     450             :   {
     451        1069 :     std::string material_type = "PorousFlowEffectiveFluidPressure";
     452        1069 :     InputParameters params = _factory.getValidParams(material_type);
     453        1069 :     if (_subdomain_names_set)
     454         486 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     455             : 
     456        2138 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     457             : 
     458        1069 :     std::string material_name = "PorousFlowUnsaturated_EffectiveFluidPressure_qp";
     459        1069 :     if (at_nodes)
     460             :       material_name = "PorousFlowUnsaturated_EffectiveFluidPressure";
     461             : 
     462        1069 :     params.set<bool>("at_nodes") = at_nodes;
     463        1069 :     _problem->addMaterial(material_type, material_name, params);
     464        1069 :   }
     465        1069 : }
     466             : 
     467             : void
     468          15 : PorousFlowActionBase::addNearestQpMaterial()
     469             : {
     470          15 :   if (_current_task == "add_material")
     471             :   {
     472          15 :     std::string material_type = "PorousFlowNearestQp";
     473          15 :     InputParameters params = _factory.getValidParams(material_type);
     474          15 :     if (_subdomain_names_set)
     475           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     476             : 
     477          30 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     478          15 :     params.set<bool>("nodal_material") = true;
     479             : 
     480          15 :     std::string material_name = "PorousFlowActionBase_NearestQp";
     481          15 :     _problem->addMaterial(material_type, material_name, params);
     482          15 :   }
     483          15 : }
     484             : 
     485             : void
     486         195 : PorousFlowActionBase::addVolumetricStrainMaterial(const std::vector<VariableName> & displacements,
     487             :                                                   const std::string & base_name)
     488             : {
     489         195 :   if (_current_task == "add_material")
     490             :   {
     491         195 :     std::string material_type = "PorousFlowVolumetricStrain";
     492         195 :     InputParameters params = _factory.getValidParams(material_type);
     493         195 :     if (_subdomain_names_set)
     494         270 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     495             : 
     496         195 :     std::string material_name = "PorousFlowActionBase_VolumetricStrain";
     497         390 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     498         390 :     params.set<std::vector<VariableName>>("displacements") = displacements;
     499         195 :     if (!base_name.empty())
     500           0 :       params.set<std::string>("base_name") = base_name;
     501         195 :     _problem->addMaterial(material_type, material_name, params);
     502         195 :   }
     503         195 : }
     504             : 
     505             : void
     506        1126 : PorousFlowActionBase::addSingleComponentFluidMaterial(bool at_nodes,
     507             :                                                       unsigned phase,
     508             :                                                       bool compute_density_and_viscosity,
     509             :                                                       bool compute_internal_energy,
     510             :                                                       bool compute_enthalpy,
     511             :                                                       const UserObjectName & fp,
     512             :                                                       const MooseEnum & temperature_unit,
     513             :                                                       const MooseEnum & pressure_unit,
     514             :                                                       const MooseEnum & time_unit)
     515             : {
     516        1126 :   if (_current_task == "add_material")
     517             :   {
     518        1126 :     std::string material_type = "PorousFlowSingleComponentFluid";
     519        1126 :     InputParameters params = _factory.getValidParams(material_type);
     520        1126 :     if (_subdomain_names_set)
     521         468 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     522             : 
     523        2252 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     524        1126 :     params.set<unsigned int>("phase") = phase;
     525        1126 :     params.set<bool>("compute_density_and_viscosity") = compute_density_and_viscosity;
     526        1126 :     params.set<bool>("compute_internal_energy") = compute_internal_energy;
     527        1126 :     params.set<bool>("compute_enthalpy") = compute_enthalpy;
     528        1126 :     params.set<UserObjectName>("fp") = fp;
     529        1126 :     params.set<MooseEnum>("temperature_unit") = temperature_unit;
     530        1126 :     params.set<MooseEnum>("pressure_unit") = pressure_unit;
     531        1126 :     params.set<MooseEnum>("time_unit") = time_unit;
     532             : 
     533        1126 :     std::string material_name = "PorousFlowActionBase_FluidProperties_qp";
     534        1126 :     if (at_nodes)
     535             :       material_name = "PorousFlowActionBase_FluidProperties";
     536             : 
     537        1126 :     params.set<bool>("at_nodes") = at_nodes;
     538        1126 :     _problem->addMaterial(material_type, material_name, params);
     539        1126 :   }
     540        1126 : }
     541             : 
     542             : void
     543          18 : PorousFlowActionBase::addBrineMaterial(VariableName nacl_brine,
     544             :                                        bool at_nodes,
     545             :                                        unsigned phase,
     546             :                                        bool compute_density_and_viscosity,
     547             :                                        bool compute_internal_energy,
     548             :                                        bool compute_enthalpy,
     549             :                                        const MooseEnum & temperature_unit)
     550             : {
     551          18 :   if (_current_task == "add_material")
     552             :   {
     553          18 :     std::string material_type = "PorousFlowBrine";
     554          18 :     InputParameters params = _factory.getValidParams(material_type);
     555          18 :     if (_subdomain_names_set)
     556          36 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     557             : 
     558          54 :     params.set<std::vector<VariableName>>("xnacl") = {nacl_brine};
     559          36 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     560          18 :     params.set<unsigned int>("phase") = phase;
     561          18 :     params.set<bool>("compute_density_and_viscosity") = compute_density_and_viscosity;
     562          18 :     params.set<bool>("compute_internal_energy") = compute_internal_energy;
     563          18 :     params.set<bool>("compute_enthalpy") = compute_enthalpy;
     564          18 :     params.set<MooseEnum>("temperature_unit") = temperature_unit;
     565             : 
     566          18 :     std::string material_name = "PorousFlowActionBase_FluidProperties_qp";
     567          18 :     if (at_nodes)
     568             :       material_name = "PorousFlowActionBase_FluidProperties";
     569             : 
     570          18 :     params.set<bool>("at_nodes") = at_nodes;
     571          18 :     _problem->addMaterial(material_type, material_name, params);
     572          18 :   }
     573          18 : }
     574             : 
     575             : void
     576         558 : PorousFlowActionBase::addRelativePermeabilityConst(bool at_nodes, unsigned phase, Real kr)
     577             : {
     578         558 :   if (_current_task == "add_material")
     579             :   {
     580         558 :     std::string material_type = "PorousFlowRelativePermeabilityConst";
     581         558 :     InputParameters params = _factory.getValidParams(material_type);
     582         558 :     if (_subdomain_names_set)
     583         216 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     584             : 
     585        1116 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     586         558 :     params.set<unsigned int>("phase") = phase;
     587         558 :     params.set<Real>("kr") = kr;
     588         558 :     std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
     589         558 :     if (at_nodes)
     590             :       material_name = "PorousFlowActionBase_RelativePermeability_nodal";
     591             : 
     592         558 :     params.set<bool>("at_nodes") = at_nodes;
     593         558 :     _problem->addMaterial(material_type, material_name, params);
     594         558 :   }
     595         558 : }
     596             : 
     597             : void
     598          81 : PorousFlowActionBase::addRelativePermeabilityCorey(
     599             :     bool at_nodes, unsigned phase, Real n, Real s_res, Real sum_s_res)
     600             : {
     601          81 :   if (_current_task == "add_material")
     602             :   {
     603          81 :     std::string material_type = "PorousFlowRelativePermeabilityCorey";
     604          81 :     InputParameters params = _factory.getValidParams(material_type);
     605          81 :     if (_subdomain_names_set)
     606         126 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     607             : 
     608         162 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     609          81 :     params.set<Real>("n") = n;
     610          81 :     params.set<unsigned int>("phase") = phase;
     611          81 :     params.set<Real>("s_res") = s_res;
     612          81 :     params.set<Real>("sum_s_res") = sum_s_res;
     613             : 
     614          81 :     std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
     615          81 :     if (at_nodes)
     616             :       material_name = "PorousFlowActionBase_RelativePermeability_nodal";
     617             : 
     618          81 :     params.set<bool>("at_nodes") = at_nodes;
     619          81 :     _problem->addMaterial(material_type, material_name, params);
     620          81 :   }
     621          81 : }
     622             : 
     623             : void
     624         191 : PorousFlowActionBase::addRelativePermeabilityFLAC(
     625             :     bool at_nodes, unsigned phase, Real m, Real s_res, Real sum_s_res)
     626             : {
     627         191 :   if (_current_task == "add_material")
     628             :   {
     629         191 :     std::string material_type = "PorousFlowRelativePermeabilityFLAC";
     630         191 :     InputParameters params = _factory.getValidParams(material_type);
     631         191 :     if (_subdomain_names_set)
     632           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     633             : 
     634         382 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     635         191 :     params.set<Real>("m") = m;
     636         191 :     params.set<unsigned int>("phase") = phase;
     637         191 :     params.set<Real>("s_res") = s_res;
     638         191 :     params.set<Real>("sum_s_res") = sum_s_res;
     639             : 
     640         191 :     std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
     641         191 :     if (at_nodes)
     642             :       material_name = "PorousFlowActionBase_RelativePermeability_nodal";
     643             : 
     644         191 :     params.set<bool>("at_nodes") = at_nodes;
     645         191 :     _problem->addMaterial(material_type, material_name, params);
     646         191 :   }
     647         191 : }
     648             : 
     649             : void
     650         156 : PorousFlowActionBase::addCapillaryPressureVG(Real m,
     651             :                                              Real alpha,
     652             :                                              std::string userobject_name,
     653             :                                              Real sat_lr)
     654             : {
     655         156 :   if (_current_task == "add_user_object")
     656             :   {
     657         156 :     std::string userobject_type = "PorousFlowCapillaryPressureVG";
     658         156 :     InputParameters params = _factory.getValidParams(userobject_type);
     659         156 :     if (_subdomain_names_set)
     660          72 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     661         156 :     params.set<Real>("m") = m;
     662         156 :     params.set<Real>("alpha") = alpha;
     663         156 :     params.set<Real>("sat_lr") = sat_lr;
     664         156 :     _problem->addUserObject(userobject_type, userobject_name, params);
     665         156 :   }
     666         156 : }
     667             : 
     668             : void
     669          16 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturated(unsigned phase,
     670             :                                                           bool multiply_by_density,
     671             :                                                           std::string userobject_name)
     672             : {
     673          16 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     674             :   {
     675          16 :     const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturated";
     676          16 :     InputParameters params = _factory.getValidParams(userobject_type);
     677          16 :     if (_subdomain_names_set)
     678           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     679          16 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     680          16 :     params.set<RealVectorValue>("gravity") = _gravity;
     681          32 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     682          16 :     params.set<unsigned>("phase") = phase;
     683          16 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     684          16 :     _problem->addUserObject(userobject_type, userobject_name, params);
     685          16 :   }
     686          16 : }
     687             : 
     688             : void
     689           9 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturated(unsigned phase,
     690             :                                                             bool multiply_by_density,
     691             :                                                             std::string userobject_name)
     692             : {
     693           9 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     694             :   {
     695           9 :     const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorUnsaturated";
     696           9 :     InputParameters params = _factory.getValidParams(userobject_type);
     697           9 :     if (_subdomain_names_set)
     698          18 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     699           9 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     700           9 :     params.set<RealVectorValue>("gravity") = _gravity;
     701          18 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     702           9 :     params.set<unsigned>("phase") = phase;
     703           9 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     704           9 :     _problem->addUserObject(userobject_type, userobject_name, params);
     705           9 :   }
     706           9 : }
     707             : 
     708             : void
     709          16 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturatedHeat(unsigned phase,
     710             :                                                               bool multiply_by_density,
     711             :                                                               std::string userobject_name)
     712             : {
     713          16 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     714             :   {
     715          16 :     const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturatedHeat";
     716          16 :     InputParameters params = _factory.getValidParams(userobject_type);
     717          16 :     if (_subdomain_names_set)
     718           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     719          16 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     720          16 :     params.set<RealVectorValue>("gravity") = _gravity;
     721          32 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     722          16 :     params.set<unsigned>("phase") = phase;
     723          16 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     724          16 :     _problem->addUserObject(userobject_type, userobject_name, params);
     725          16 :   }
     726          16 : }
     727             : 
     728             : void
     729           9 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturatedHeat(unsigned phase,
     730             :                                                                 bool multiply_by_density,
     731             :                                                                 std::string userobject_name)
     732             : {
     733           9 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     734             :   {
     735           9 :     const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat";
     736           9 :     InputParameters params = _factory.getValidParams(userobject_type);
     737           9 :     if (_subdomain_names_set)
     738          18 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     739           9 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     740           9 :     params.set<RealVectorValue>("gravity") = _gravity;
     741          18 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     742           9 :     params.set<unsigned>("phase") = phase;
     743           9 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     744           9 :     _problem->addUserObject(userobject_type, userobject_name, params);
     745           9 :   }
     746           9 : }
     747             : 
     748             : void
     749          18 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturatedMultiComponent(unsigned phase,
     750             :                                                                         unsigned fluid_component,
     751             :                                                                         bool multiply_by_density,
     752             :                                                                         std::string userobject_name)
     753             : {
     754          18 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     755             :   {
     756          18 :     const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent";
     757          18 :     InputParameters params = _factory.getValidParams(userobject_type);
     758          18 :     if (_subdomain_names_set)
     759           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     760          18 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     761          18 :     params.set<RealVectorValue>("gravity") = _gravity;
     762          36 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     763          18 :     params.set<unsigned>("phase") = phase;
     764          18 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     765          18 :     params.set<unsigned>("fluid_component") = fluid_component;
     766          18 :     _problem->addUserObject(userobject_type, userobject_name, params);
     767          18 :   }
     768          18 : }
     769             : 
     770             : void
     771           0 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturatedMultiComponent(
     772             :     unsigned phase, unsigned fluid_component, bool multiply_by_density, std::string userobject_name)
     773             : {
     774           0 :   if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
     775             :   {
     776             :     const std::string userobject_type =
     777           0 :         "PorousFlowAdvectiveFluxCalculatorUnsaturatedMultiComponent";
     778           0 :     InputParameters params = _factory.getValidParams(userobject_type);
     779           0 :     if (_subdomain_names_set)
     780           0 :       params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
     781           0 :     params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
     782           0 :     params.set<RealVectorValue>("gravity") = _gravity;
     783           0 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     784           0 :     params.set<unsigned>("phase") = phase;
     785           0 :     params.set<bool>("multiply_by_density") = multiply_by_density;
     786           0 :     params.set<unsigned>("fluid_component") = fluid_component;
     787           0 :     _problem->addUserObject(userobject_type, userobject_name, params);
     788           0 :   }
     789           0 : }

Generated by: LCOV version 1.14