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 6401 : PorousFlowActionBase::validParams()
23 : {
24 6401 : InputParameters params = Action::validParams();
25 12802 : params.addParam<std::string>(
26 : "dictator_name",
27 : "dictator",
28 : "The name of the dictator user object that is created by this Action");
29 6401 : 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 12802 : params.addParam<std::vector<SubdomainName>>(
33 : "block", {}, "The list of block ids (SubdomainID) on which the porous flow is defined on");
34 12802 : params.addParamNamesToGroup("block", "Advanced");
35 :
36 6401 : params.addParam<RealVectorValue>("gravity",
37 6401 : RealVectorValue(0.0, 0.0, -10.0),
38 : "Gravitational acceleration vector downwards (m/s^2)");
39 12802 : 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 12802 : 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 12802 : params.addParam<unsigned int>("number_aqueous_equilibrium",
53 12802 : 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 12802 : params.addParam<unsigned int>("number_aqueous_kinetic",
58 12802 : 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 12802 : params.addParam<std::vector<VariableName>>(
63 : "displacements",
64 : {},
65 : "The name of the displacement variables (relevant only for "
66 : "mechanically-coupled simulations)");
67 12802 : 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 12802 : params.addParam<bool>(
75 12802 : "use_displaced_mesh", false, "Use displaced mesh computations in mechanical kernels");
76 12802 : MooseEnum flux_limiter_type("MinMod VanLeer MC superbee None", "VanLeer");
77 12802 : 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 12802 : MooseEnum stabilization("None Full KT", "Full");
83 12802 : params.addParam<MooseEnum>("stabilization",
84 : stabilization,
85 : "Numerical stabilization used. 'Full' means full upwinding. 'KT' "
86 : "means FEM-TVD stabilization of Kuzmin-Turek");
87 12802 : params.addParam<bool>(
88 : "strain_at_nearest_qp",
89 12802 : 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 6401 : return params;
98 6401 : }
99 :
100 6401 : PorousFlowActionBase::PorousFlowActionBase(const InputParameters & params)
101 : : Action(params),
102 : PorousFlowDependencies(),
103 : _included_objects(),
104 12802 : _dictator_name(getParam<std::string>("dictator_name")),
105 12802 : _subdomain_names(getParam<std::vector<SubdomainName>>("block")),
106 12802 : _subdomain_names_set(isParamSetByUser("block")),
107 12802 : _num_aqueous_equilibrium(getParam<unsigned int>("number_aqueous_equilibrium")),
108 12802 : _num_aqueous_kinetic(getParam<unsigned int>("number_aqueous_kinetic")),
109 12802 : _gravity(getParam<RealVectorValue>("gravity")),
110 15002 : _mass_fraction_vars(isParamValid("mass_fraction_vars")
111 6401 : ? getParam<std::vector<VariableName>>("mass_fraction_vars")
112 : : std::vector<VariableName>{}),
113 6401 : _num_mass_fraction_vars(_mass_fraction_vars.size()),
114 17426 : _temperature_var(isParamValid("temperature")
115 6401 : ? getParam<std::vector<VariableName>>("temperature")
116 : : std::vector<VariableName>{}),
117 12802 : _displacements(getParam<std::vector<VariableName>>("displacements")),
118 6401 : _ndisp(_displacements.size()),
119 6401 : _coupled_displacements(_ndisp),
120 12802 : _flux_limiter_type(getParam<MooseEnum>("flux_limiter_type")),
121 12802 : _stabilization(getParam<MooseEnum>("stabilization").getEnum<StabilizationEnum>()),
122 19203 : _strain_at_nearest_qp(getParam<bool>("strain_at_nearest_qp"))
123 : {
124 : // convert vector of VariableName to vector of VariableName
125 12886 : for (unsigned int i = 0; i < _ndisp; ++i)
126 6485 : _coupled_displacements[i] = _displacements[i];
127 6401 : }
128 :
129 : void
130 18875 : PorousFlowActionBase::addRelationshipManagers(Moose::RelationshipManagerType input_rm_type)
131 : {
132 18875 : InputParameters ips = (_stabilization == StabilizationEnum::KT
133 18875 : ? _factory.getValidParams("PorousFlowAdvectiveFluxCalculatorSaturated")
134 18875 : : emptyInputParameters());
135 18875 : addRelationshipManagers(input_rm_type, ips);
136 18875 : }
137 :
138 : void
139 6321 : PorousFlowActionBase::act()
140 : {
141 : // Check if the simulation is transient (note: can't do this in the ctor)
142 6321 : _transient = _problem->isTransient();
143 :
144 : // get subdomain IDs
145 : std::set<SubdomainID> _subdomain_ids;
146 7936 : for (auto & name : _subdomain_names)
147 : {
148 1615 : auto id = _mesh->getSubdomainID(name);
149 1615 : if (id == Moose::INVALID_BLOCK_ID)
150 0 : paramError("block", "Subdomain \"" + name + "\" not found in mesh.");
151 : else
152 1615 : _subdomain_ids.insert(id);
153 : }
154 :
155 : // Make sure that all mesh subdomains have the same coordinate system
156 : const auto & all_subdomains =
157 6321 : _subdomain_names.empty() ? _problem->mesh().meshSubdomains() : _subdomain_ids;
158 :
159 6321 : if (all_subdomains.empty())
160 0 : mooseError("No subdomains found");
161 6321 : _coord_system = _problem->getCoordSystem(*all_subdomains.begin());
162 14232 : for (const auto & subdomain : all_subdomains)
163 7911 : 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 6321 : addMaterialDependencies();
169 :
170 : // Make the vector of added objects unique
171 6321 : std::sort(_included_objects.begin(), _included_objects.end());
172 6321 : _included_objects.erase(std::unique(_included_objects.begin(), _included_objects.end()),
173 : _included_objects.end());
174 :
175 6321 : if (_current_task == "add_user_object")
176 1277 : addUserObjects();
177 :
178 6321 : if (_current_task == "add_aux_variable" || _current_task == "add_aux_kernel")
179 2528 : addAuxObjects();
180 :
181 6321 : if (_current_task == "add_kernel")
182 1249 : addKernels();
183 :
184 6321 : if (_current_task == "add_material")
185 1267 : addMaterials();
186 6321 : }
187 :
188 : void
189 6321 : PorousFlowActionBase::addMaterialDependencies()
190 : {
191 6321 : if (_strain_at_nearest_qp)
192 270 : _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 6321 : auto auxkernels = _awh.getActions<AddKernelAction>();
199 12888 : for (auto & auxkernel : auxkernels)
200 6567 : _included_objects.push_back(auxkernel->getMooseObjectType());
201 :
202 : // Unique list of postprocessors added in input file
203 6321 : auto postprocessors = _awh.getActions<AddPostprocessorAction>();
204 35536 : for (auto & postprocessor : postprocessors)
205 29215 : _included_objects.push_back(postprocessor->getMooseObjectType());
206 :
207 : // Unique list of BCs added in input file
208 6321 : auto bcs = _awh.getActions<AddBCAction>();
209 23441 : for (auto & bc : bcs)
210 17120 : _included_objects.push_back(bc->getMooseObjectType());
211 :
212 : // Unique list of Dirac kernels added in input file
213 6321 : auto diracs = _awh.getActions<AddDiracKernelAction>();
214 9551 : for (auto & dirac : diracs)
215 3230 : _included_objects.push_back(dirac->getMooseObjectType());
216 6321 : }
217 :
218 : void
219 1277 : PorousFlowActionBase::addUserObjects()
220 : {
221 1277 : addDictator();
222 1277 : }
223 :
224 : void
225 2528 : PorousFlowActionBase::addAuxObjects()
226 : {
227 2528 : }
228 :
229 : void
230 1249 : PorousFlowActionBase::addKernels()
231 : {
232 1249 : }
233 :
234 : void
235 1267 : PorousFlowActionBase::addMaterials()
236 : {
237 1294 : if (_strain_at_nearest_qp && _deps.dependsOn(_included_objects, "nearest_qp_nodal"))
238 27 : addNearestQpMaterial();
239 1267 : }
240 :
241 : void
242 584 : PorousFlowActionBase::addSaturationAux(unsigned phase)
243 : {
244 : std::string phase_str = Moose::stringify(phase);
245 :
246 584 : if (_current_task == "add_aux_variable")
247 : {
248 297 : auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
249 297 : if (_subdomain_names_set)
250 114 : var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
251 594 : _problem->addAuxVariable("MooseVariableConstMonomial", "saturation" + phase_str, var_params);
252 297 : }
253 :
254 584 : if (_current_task == "add_aux_kernel")
255 : {
256 287 : std::string aux_kernel_type = "MaterialStdVectorAux";
257 287 : InputParameters params = _factory.getValidParams(aux_kernel_type);
258 :
259 287 : std::string aux_kernel_name = "PorousFlowActionBase_SaturationAux" + phase_str;
260 574 : params.set<MaterialPropertyName>("property") = "PorousFlow_saturation_qp";
261 287 : params.set<unsigned>("index") = phase;
262 861 : params.set<AuxVariableName>("variable") = "saturation" + phase_str;
263 287 : params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
264 287 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
265 287 : }
266 584 : }
267 :
268 : void
269 2174 : PorousFlowActionBase::addDarcyAux(const RealVectorValue & gravity)
270 : {
271 2174 : if (_current_task == "add_aux_variable")
272 : {
273 1100 : auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
274 1100 : if (_subdomain_names_set)
275 570 : var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
276 :
277 2200 : _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_x", var_params);
278 2200 : _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_y", var_params);
279 2200 : _problem->addAuxVariable("MooseVariableConstMonomial", "darcy_vel_z", var_params);
280 1100 : }
281 :
282 2174 : if (_current_task == "add_aux_kernel")
283 : {
284 1074 : std::string aux_kernel_type = "PorousFlowDarcyVelocityComponent";
285 1074 : InputParameters params = _factory.getValidParams(aux_kernel_type);
286 1074 : if (_subdomain_names_set)
287 570 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
288 :
289 1074 : params.set<RealVectorValue>("gravity") = gravity;
290 2148 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
291 1074 : params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
292 :
293 1074 : std::string aux_kernel_name = "PorousFlowActionBase_Darcy_x_Aux";
294 2148 : params.set<MooseEnum>("component") = "x";
295 2148 : params.set<AuxVariableName>("variable") = "darcy_vel_x";
296 1074 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
297 :
298 : aux_kernel_name = "PorousFlowActionBase_Darcy_y_Aux";
299 2148 : params.set<MooseEnum>("component") = "y";
300 2148 : params.set<AuxVariableName>("variable") = "darcy_vel_y";
301 1074 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
302 :
303 : aux_kernel_name = "PorousFlowActionBase_Darcy_z_Aux";
304 2148 : params.set<MooseEnum>("component") = "z";
305 2148 : params.set<AuxVariableName>("variable") = "darcy_vel_z";
306 1074 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
307 1074 : }
308 2174 : }
309 :
310 : void
311 814 : PorousFlowActionBase::addStressAux()
312 : {
313 814 : if (_current_task == "add_aux_variable")
314 : {
315 407 : auto var_params = _factory.getValidParams("MooseVariableConstMonomial");
316 407 : if (_subdomain_names_set)
317 570 : var_params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
318 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xx", var_params);
319 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xy", var_params);
320 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_xz", var_params);
321 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yx", var_params);
322 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yy", var_params);
323 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_yz", var_params);
324 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zx", var_params);
325 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zy", var_params);
326 814 : _problem->addAuxVariable("MooseVariableConstMonomial", "stress_zz", var_params);
327 407 : }
328 :
329 814 : if (_current_task == "add_aux_kernel")
330 : {
331 407 : std::string aux_kernel_type = "RankTwoAux";
332 407 : InputParameters params = _factory.getValidParams(aux_kernel_type);
333 :
334 814 : params.set<MaterialPropertyName>("rank_two_tensor") = "stress";
335 407 : params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
336 :
337 407 : std::string aux_kernel_name = "PorousFlowAction_stress_xx";
338 814 : params.set<AuxVariableName>("variable") = "stress_xx";
339 407 : params.set<unsigned>("index_i") = 0;
340 407 : params.set<unsigned>("index_j") = 0;
341 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
342 :
343 : aux_kernel_name = "PorousFlowAction_stress_xy";
344 814 : params.set<AuxVariableName>("variable") = "stress_xy";
345 407 : params.set<unsigned>("index_i") = 0;
346 407 : params.set<unsigned>("index_j") = 1;
347 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
348 :
349 : aux_kernel_name = "PorousFlowAction_stress_xz";
350 814 : params.set<AuxVariableName>("variable") = "stress_xz";
351 407 : params.set<unsigned>("index_i") = 0;
352 407 : params.set<unsigned>("index_j") = 2;
353 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
354 :
355 : aux_kernel_name = "PorousFlowAction_stress_yx";
356 814 : params.set<AuxVariableName>("variable") = "stress_yx";
357 407 : params.set<unsigned>("index_i") = 1;
358 407 : params.set<unsigned>("index_j") = 0;
359 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
360 :
361 : aux_kernel_name = "PorousFlowAction_stress_yy";
362 814 : params.set<AuxVariableName>("variable") = "stress_yy";
363 407 : params.set<unsigned>("index_i") = 1;
364 407 : params.set<unsigned>("index_j") = 1;
365 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
366 :
367 : aux_kernel_name = "PorousFlowAction_stress_yz";
368 814 : params.set<AuxVariableName>("variable") = "stress_yz";
369 407 : params.set<unsigned>("index_i") = 1;
370 407 : params.set<unsigned>("index_j") = 2;
371 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
372 :
373 : aux_kernel_name = "PorousFlowAction_stress_zx";
374 814 : params.set<AuxVariableName>("variable") = "stress_zx";
375 407 : params.set<unsigned>("index_i") = 2;
376 407 : params.set<unsigned>("index_j") = 0;
377 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
378 :
379 : aux_kernel_name = "PorousFlowAction_stress_zy";
380 814 : params.set<AuxVariableName>("variable") = "stress_zy";
381 407 : params.set<unsigned>("index_i") = 2;
382 407 : params.set<unsigned>("index_j") = 1;
383 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
384 :
385 : aux_kernel_name = "PorousFlowAction_stress_zz";
386 814 : params.set<AuxVariableName>("variable") = "stress_zz";
387 407 : params.set<unsigned>("index_i") = 2;
388 407 : params.set<unsigned>("index_j") = 2;
389 407 : _problem->addAuxKernel(aux_kernel_type, aux_kernel_name, params);
390 407 : }
391 814 : }
392 :
393 : void
394 2296 : PorousFlowActionBase::addTemperatureMaterial(bool at_nodes)
395 : {
396 2296 : if (_current_task == "add_material")
397 : {
398 4592 : if (!parameters().hasDefaultCoupledValue("temperature"))
399 0 : mooseError("Attempt to add a PorousFlowTemperature material without setting a temperature "
400 : "variable");
401 :
402 2296 : std::string material_type = "PorousFlowTemperature";
403 2296 : InputParameters params = _factory.getValidParams(material_type);
404 2296 : if (_subdomain_names_set)
405 1064 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
406 :
407 2296 : params.applySpecificParameters(parameters(), {"temperature"});
408 4592 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
409 :
410 2296 : std::string material_name = "PorousFlowActionBase_Temperature_qp";
411 2296 : if (at_nodes)
412 : material_name = "PorousFlowActionBase_Temperature";
413 :
414 2296 : params.set<bool>("at_nodes") = at_nodes;
415 2296 : _problem->addMaterial(material_type, material_name, params);
416 2296 : }
417 2296 : }
418 :
419 : void
420 1457 : PorousFlowActionBase::addMassFractionMaterial(bool at_nodes)
421 : {
422 1457 : if (_current_task == "add_material")
423 : {
424 2914 : if (!(parameters().hasDefaultCoupledValue("mass_fraction_vars") ||
425 1457 : parameters().hasCoupledValue("mass_fraction_vars")))
426 0 : mooseError("Attempt to add a PorousFlowMassFraction material without setting the "
427 : "mass_fraction_vars");
428 :
429 1457 : std::string material_type = "PorousFlowMassFraction";
430 1457 : InputParameters params = _factory.getValidParams(material_type);
431 1457 : if (_subdomain_names_set)
432 646 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
433 :
434 1457 : params.applySpecificParameters(parameters(), {"mass_fraction_vars"});
435 2914 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
436 :
437 1457 : std::string material_name = "PorousFlowActionBase_MassFraction_qp";
438 1457 : if (at_nodes)
439 : material_name = "PorousFlowActionBase_MassFraction";
440 :
441 1457 : params.set<bool>("at_nodes") = at_nodes;
442 1457 : _problem->addMaterial(material_type, material_name, params);
443 1457 : }
444 1457 : }
445 :
446 : void
447 2139 : PorousFlowActionBase::addEffectiveFluidPressureMaterial(bool at_nodes)
448 : {
449 2139 : if (_current_task == "add_material")
450 : {
451 2139 : std::string material_type = "PorousFlowEffectiveFluidPressure";
452 2139 : InputParameters params = _factory.getValidParams(material_type);
453 2139 : if (_subdomain_names_set)
454 1026 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
455 :
456 4278 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
457 :
458 2139 : std::string material_name = "PorousFlowUnsaturated_EffectiveFluidPressure_qp";
459 2139 : if (at_nodes)
460 : material_name = "PorousFlowUnsaturated_EffectiveFluidPressure";
461 :
462 2139 : params.set<bool>("at_nodes") = at_nodes;
463 2139 : _problem->addMaterial(material_type, material_name, params);
464 2139 : }
465 2139 : }
466 :
467 : void
468 27 : PorousFlowActionBase::addNearestQpMaterial()
469 : {
470 27 : if (_current_task == "add_material")
471 : {
472 27 : std::string material_type = "PorousFlowNearestQp";
473 27 : InputParameters params = _factory.getValidParams(material_type);
474 27 : if (_subdomain_names_set)
475 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
476 :
477 54 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
478 27 : params.set<bool>("nodal_material") = true;
479 :
480 27 : std::string material_name = "PorousFlowActionBase_NearestQp";
481 27 : _problem->addMaterial(material_type, material_name, params);
482 27 : }
483 27 : }
484 :
485 : void
486 407 : PorousFlowActionBase::addVolumetricStrainMaterial(const std::vector<VariableName> & displacements,
487 : const std::string & base_name)
488 : {
489 407 : if (_current_task == "add_material")
490 : {
491 407 : std::string material_type = "PorousFlowVolumetricStrain";
492 407 : InputParameters params = _factory.getValidParams(material_type);
493 407 : if (_subdomain_names_set)
494 570 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
495 :
496 407 : std::string material_name = "PorousFlowActionBase_VolumetricStrain";
497 814 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
498 814 : params.set<std::vector<VariableName>>("displacements") = displacements;
499 407 : if (!base_name.empty())
500 0 : params.set<std::string>("base_name") = base_name;
501 407 : _problem->addMaterial(material_type, material_name, params);
502 407 : }
503 407 : }
504 :
505 : void
506 2258 : 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 2258 : if (_current_task == "add_material")
517 : {
518 2258 : std::string material_type = "PorousFlowSingleComponentFluid";
519 2258 : InputParameters params = _factory.getValidParams(material_type);
520 2258 : if (_subdomain_names_set)
521 988 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
522 :
523 4516 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
524 2258 : params.set<unsigned int>("phase") = phase;
525 2258 : params.set<bool>("compute_density_and_viscosity") = compute_density_and_viscosity;
526 2258 : params.set<bool>("compute_internal_energy") = compute_internal_energy;
527 2258 : params.set<bool>("compute_enthalpy") = compute_enthalpy;
528 2258 : params.set<UserObjectName>("fp") = fp;
529 2258 : params.set<MooseEnum>("temperature_unit") = temperature_unit;
530 2258 : params.set<MooseEnum>("pressure_unit") = pressure_unit;
531 2258 : params.set<MooseEnum>("time_unit") = time_unit;
532 :
533 2258 : std::string material_name = "PorousFlowActionBase_FluidProperties_qp";
534 2258 : if (at_nodes)
535 : material_name = "PorousFlowActionBase_FluidProperties";
536 :
537 2258 : params.set<bool>("at_nodes") = at_nodes;
538 2258 : _problem->addMaterial(material_type, material_name, params);
539 2258 : }
540 2258 : }
541 :
542 : void
543 38 : 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 38 : if (_current_task == "add_material")
552 : {
553 38 : std::string material_type = "PorousFlowBrine";
554 38 : InputParameters params = _factory.getValidParams(material_type);
555 38 : if (_subdomain_names_set)
556 76 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
557 :
558 114 : params.set<std::vector<VariableName>>("xnacl") = {nacl_brine};
559 76 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
560 38 : params.set<unsigned int>("phase") = phase;
561 38 : params.set<bool>("compute_density_and_viscosity") = compute_density_and_viscosity;
562 38 : params.set<bool>("compute_internal_energy") = compute_internal_energy;
563 38 : params.set<bool>("compute_enthalpy") = compute_enthalpy;
564 38 : params.set<MooseEnum>("temperature_unit") = temperature_unit;
565 :
566 38 : std::string material_name = "PorousFlowActionBase_FluidProperties_qp";
567 38 : if (at_nodes)
568 : material_name = "PorousFlowActionBase_FluidProperties";
569 :
570 38 : params.set<bool>("at_nodes") = at_nodes;
571 38 : _problem->addMaterial(material_type, material_name, params);
572 38 : }
573 38 : }
574 :
575 : void
576 1105 : PorousFlowActionBase::addRelativePermeabilityConst(bool at_nodes, unsigned phase, Real kr)
577 : {
578 1105 : if (_current_task == "add_material")
579 : {
580 1105 : std::string material_type = "PorousFlowRelativePermeabilityConst";
581 1105 : InputParameters params = _factory.getValidParams(material_type);
582 1105 : if (_subdomain_names_set)
583 456 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
584 :
585 2210 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
586 1105 : params.set<unsigned int>("phase") = phase;
587 1105 : params.set<Real>("kr") = kr;
588 1105 : std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
589 1105 : if (at_nodes)
590 : material_name = "PorousFlowActionBase_RelativePermeability_nodal";
591 :
592 1105 : params.set<bool>("at_nodes") = at_nodes;
593 1105 : _problem->addMaterial(material_type, material_name, params);
594 1105 : }
595 1105 : }
596 :
597 : void
598 171 : PorousFlowActionBase::addRelativePermeabilityCorey(
599 : bool at_nodes, unsigned phase, Real n, Real s_res, Real sum_s_res)
600 : {
601 171 : if (_current_task == "add_material")
602 : {
603 171 : std::string material_type = "PorousFlowRelativePermeabilityCorey";
604 171 : InputParameters params = _factory.getValidParams(material_type);
605 171 : if (_subdomain_names_set)
606 266 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
607 :
608 342 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
609 171 : params.set<Real>("n") = n;
610 171 : params.set<unsigned int>("phase") = phase;
611 171 : params.set<Real>("s_res") = s_res;
612 171 : params.set<Real>("sum_s_res") = sum_s_res;
613 :
614 171 : std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
615 171 : if (at_nodes)
616 : material_name = "PorousFlowActionBase_RelativePermeability_nodal";
617 :
618 171 : params.set<bool>("at_nodes") = at_nodes;
619 171 : _problem->addMaterial(material_type, material_name, params);
620 171 : }
621 171 : }
622 :
623 : void
624 420 : PorousFlowActionBase::addRelativePermeabilityFLAC(
625 : bool at_nodes, unsigned phase, Real m, Real s_res, Real sum_s_res)
626 : {
627 420 : if (_current_task == "add_material")
628 : {
629 420 : std::string material_type = "PorousFlowRelativePermeabilityFLAC";
630 420 : InputParameters params = _factory.getValidParams(material_type);
631 420 : if (_subdomain_names_set)
632 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
633 :
634 840 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
635 420 : params.set<Real>("m") = m;
636 420 : params.set<unsigned int>("phase") = phase;
637 420 : params.set<Real>("s_res") = s_res;
638 420 : params.set<Real>("sum_s_res") = sum_s_res;
639 :
640 420 : std::string material_name = "PorousFlowActionBase_RelativePermeability_qp";
641 420 : if (at_nodes)
642 : material_name = "PorousFlowActionBase_RelativePermeability_nodal";
643 :
644 420 : params.set<bool>("at_nodes") = at_nodes;
645 420 : _problem->addMaterial(material_type, material_name, params);
646 420 : }
647 420 : }
648 :
649 : void
650 316 : PorousFlowActionBase::addCapillaryPressureVG(Real m, Real alpha, std::string userobject_name)
651 : {
652 316 : if (_current_task == "add_user_object")
653 : {
654 316 : std::string userobject_type = "PorousFlowCapillaryPressureVG";
655 316 : InputParameters params = _factory.getValidParams(userobject_type);
656 316 : if (_subdomain_names_set)
657 152 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
658 316 : params.set<Real>("m") = m;
659 316 : params.set<Real>("alpha") = alpha;
660 316 : _problem->addUserObject(userobject_type, userobject_name, params);
661 316 : }
662 316 : }
663 :
664 : void
665 30 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturated(unsigned phase,
666 : bool multiply_by_density,
667 : std::string userobject_name)
668 : {
669 30 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
670 : {
671 30 : const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturated";
672 30 : InputParameters params = _factory.getValidParams(userobject_type);
673 30 : if (_subdomain_names_set)
674 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
675 30 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
676 30 : params.set<RealVectorValue>("gravity") = _gravity;
677 60 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
678 30 : params.set<unsigned>("phase") = phase;
679 30 : params.set<bool>("multiply_by_density") = multiply_by_density;
680 30 : _problem->addUserObject(userobject_type, userobject_name, params);
681 30 : }
682 30 : }
683 :
684 : void
685 19 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturated(unsigned phase,
686 : bool multiply_by_density,
687 : std::string userobject_name)
688 : {
689 19 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
690 : {
691 19 : const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorUnsaturated";
692 19 : InputParameters params = _factory.getValidParams(userobject_type);
693 19 : if (_subdomain_names_set)
694 38 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
695 19 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
696 19 : params.set<RealVectorValue>("gravity") = _gravity;
697 38 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
698 19 : params.set<unsigned>("phase") = phase;
699 19 : params.set<bool>("multiply_by_density") = multiply_by_density;
700 19 : _problem->addUserObject(userobject_type, userobject_name, params);
701 19 : }
702 19 : }
703 :
704 : void
705 30 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturatedHeat(unsigned phase,
706 : bool multiply_by_density,
707 : std::string userobject_name)
708 : {
709 30 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
710 : {
711 30 : const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturatedHeat";
712 30 : InputParameters params = _factory.getValidParams(userobject_type);
713 30 : if (_subdomain_names_set)
714 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
715 30 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
716 30 : params.set<RealVectorValue>("gravity") = _gravity;
717 60 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
718 30 : params.set<unsigned>("phase") = phase;
719 30 : params.set<bool>("multiply_by_density") = multiply_by_density;
720 30 : _problem->addUserObject(userobject_type, userobject_name, params);
721 30 : }
722 30 : }
723 :
724 : void
725 19 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturatedHeat(unsigned phase,
726 : bool multiply_by_density,
727 : std::string userobject_name)
728 : {
729 19 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
730 : {
731 19 : const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat";
732 19 : InputParameters params = _factory.getValidParams(userobject_type);
733 19 : if (_subdomain_names_set)
734 38 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
735 19 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
736 19 : params.set<RealVectorValue>("gravity") = _gravity;
737 38 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
738 19 : params.set<unsigned>("phase") = phase;
739 19 : params.set<bool>("multiply_by_density") = multiply_by_density;
740 19 : _problem->addUserObject(userobject_type, userobject_name, params);
741 19 : }
742 19 : }
743 :
744 : void
745 38 : PorousFlowActionBase::addAdvectiveFluxCalculatorSaturatedMultiComponent(unsigned phase,
746 : unsigned fluid_component,
747 : bool multiply_by_density,
748 : std::string userobject_name)
749 : {
750 38 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
751 : {
752 38 : const std::string userobject_type = "PorousFlowAdvectiveFluxCalculatorSaturatedMultiComponent";
753 38 : InputParameters params = _factory.getValidParams(userobject_type);
754 38 : if (_subdomain_names_set)
755 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
756 38 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
757 38 : params.set<RealVectorValue>("gravity") = _gravity;
758 76 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
759 38 : params.set<unsigned>("phase") = phase;
760 38 : params.set<bool>("multiply_by_density") = multiply_by_density;
761 38 : params.set<unsigned>("fluid_component") = fluid_component;
762 38 : _problem->addUserObject(userobject_type, userobject_name, params);
763 38 : }
764 38 : }
765 :
766 : void
767 0 : PorousFlowActionBase::addAdvectiveFluxCalculatorUnsaturatedMultiComponent(
768 : unsigned phase, unsigned fluid_component, bool multiply_by_density, std::string userobject_name)
769 : {
770 0 : if (_stabilization == StabilizationEnum::KT && _current_task == "add_user_object")
771 : {
772 : const std::string userobject_type =
773 0 : "PorousFlowAdvectiveFluxCalculatorUnsaturatedMultiComponent";
774 0 : InputParameters params = _factory.getValidParams(userobject_type);
775 0 : if (_subdomain_names_set)
776 0 : params.set<std::vector<SubdomainName>>("block") = _subdomain_names;
777 0 : params.set<MooseEnum>("flux_limiter_type") = _flux_limiter_type;
778 0 : params.set<RealVectorValue>("gravity") = _gravity;
779 0 : params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
780 0 : params.set<unsigned>("phase") = phase;
781 0 : params.set<bool>("multiply_by_density") = multiply_by_density;
782 0 : params.set<unsigned>("fluid_component") = fluid_component;
783 0 : _problem->addUserObject(userobject_type, userobject_name, params);
784 0 : }
785 0 : }
|