11 #include "AddMaterialAction.h"
12 #include "ActionWarehouse.h"
13 #include "FEProblem.h"
15 #include "UserObject.h"
24 InputParameters params = validParams<Action>();
25 params.addClassDescription(
26 "Adds PorousFlowJoiner materials as required for each phase-dependent property");
31 : Action(params), _already_joined()
41 if (_current_task ==
"add_joiners")
44 std::vector<UserObject *> userobjects;
45 _problem->theWarehouse()
47 .condition<AttribSystem>(
"UserObject")
48 .condition<AttribThread>(0)
49 .queryInto(userobjects);
50 for (
auto & userobject : userobjects)
51 if (dynamic_cast<PorousFlowDictator *>(userobject))
55 auto materials = _problem->getMaterialWarehouse().getObjects();
56 for (
auto & mat : materials)
58 const InputParameters & params = mat->parameters();
61 if (params.isParamValid(
"pf_material_type"))
63 const std::string pf_material_type = params.get<std::string>(
"pf_material_type");
66 const bool at_nodes = params.get<
bool>(
"at_nodes");
69 if (pf_material_type ==
"fluid_properties")
72 if (params.get<
unsigned int>(
"phase") == 0)
75 if (params.get<
bool>(
"compute_density_and_viscosity"))
80 "PorousFlow_fluid_phase_density_nodal",
81 "PorousFlow_density_nodal_all");
82 addJoiner(at_nodes,
"PorousFlow_viscosity_nodal",
"PorousFlow_viscosity_nodal_all");
87 at_nodes,
"PorousFlow_fluid_phase_density_qp",
"PorousFlow_density_qp_all");
88 addJoiner(at_nodes,
"PorousFlow_viscosity_qp",
"PorousFlow_viscosity_qp_all");
93 if (params.get<
bool>(
"compute_enthalpy"))
97 "PorousFlow_fluid_phase_enthalpy_nodal",
98 "PorousFlow_enthalpy_nodal_all");
101 at_nodes,
"PorousFlow_fluid_phase_enthalpy_qp",
"PorousFlow_enthalpy_qp_all");
105 if (params.get<
bool>(
"compute_internal_energy"))
109 "PorousFlow_fluid_phase_internal_energy_nodal",
110 "PorousFlow_internal_energy_nodal_all");
113 "PorousFlow_fluid_phase_internal_energy_qp",
114 "PorousFlow_internal_energy_qp_all");
120 if (pf_material_type ==
"relative_permeability")
123 if (params.get<
unsigned int>(
"phase") == 0)
127 "PorousFlow_relative_permeability_nodal",
128 "PorousFlow_relative_permeability_nodal_all");
131 "PorousFlow_relative_permeability_qp",
132 "PorousFlow_relative_permeability_qp_all");
142 const std::string & material_property,
143 const std::string & output_name)
145 bool is_joined =
false;
157 std::string material_type =
"PorousFlowJoiner";
158 InputParameters params = _factory.getValidParams(material_type);
159 params.set<UserObjectName>(
"PorousFlowDictator") =
_dictator_name;
160 params.set<
bool>(
"at_nodes") = at_nodes;
161 params.set<std::string>(
"material_property") = material_property;
162 _problem->addMaterial(material_type, output_name, params);
173 auto actions = _awh.getActions<AddMaterialAction>();
175 for (
auto & action : actions)
177 AddMaterialAction * material = const_cast<AddMaterialAction *>(action);
179 if (material->getMooseObjectType() ==
"PorousFlowJoiner")
183 mooseDeprecated(
"PorousFlowJoiner materials are no longer required in the input "
184 "file.\nPlease remove all PorousFlowJoiner materials from this input file to "
185 "get rid of this warning");
187 const std::string joiner_property =
188 material->getObjectParams().get<std::string>(
"material_property");
191 if (joiner_property == property)