LCOV - code coverage report
Current view: top level - src/actions - PorousFlowBasicTHM.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 63 72 87.5 %
Date: 2017-11-21 14:47:27 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************/
       2             : /* MOOSE - Multiphysics Object Oriented Simulation Environment  */
       3             : /*                                                              */
       4             : /*          All contents are licensed under LGPL V2.1           */
       5             : /*             See LICENSE for full restrictions                */
       6             : /****************************************************************/
       7             : #include "PorousFlowBasicTHM.h"
       8             : 
       9             : #include "FEProblem.h"
      10             : #include "Conversion.h"
      11             : #include "libmesh/string_to_enum.h"
      12             : 
      13             : template <>
      14             : InputParameters
      15          30 : validParams<PorousFlowBasicTHM>()
      16             : {
      17          30 :   InputParameters params = validParams<PorousFlowSinglePhaseBase>();
      18          90 :   params.addParam<bool>("multiply_by_density",
      19             :                         false,
      20             :                         "If true, then the Kernels for fluid flow are multiplied by "
      21             :                         "the fluid density.  If false, this multiplication is not "
      22             :                         "performed, which means the problem linearises, but that care "
      23          30 :                         "must be taken when using other PorousFlow objects.");
      24          60 :   params.addClassDescription("Adds Kernels and fluid-property Materials necessary to simulate a "
      25             :                              "single-phase, single-component fully-saturated flow problem.  No "
      26             :                              "upwinding and no mass lumping of the fluid mass are used.  The "
      27             :                              "fluid-mass time derivative is close to linear, and is perfectly "
      28             :                              "linear if multiply_by_density=false.  These features mean the "
      29             :                              "results may differ slightly from the "
      30             :                              "Unsaturated Action case.  To run a simulation "
      31             :                              "you will also need to provide various other Materials for each mesh "
      32             :                              "block, depending on your simulation type, viz: permeability, "
      33             :                              "constant Biot modulus, constant thermal expansion coefficient, "
      34             :                              "porosity, elasticity tensor, strain calculator, stress calculator, "
      35          30 :                              "matrix internal energy, thermal conductivity, diffusivity");
      36          30 :   return params;
      37             : }
      38             : 
      39          30 : PorousFlowBasicTHM::PorousFlowBasicTHM(const InputParameters & params)
      40          90 :   : PorousFlowSinglePhaseBase(params), _multiply_by_density(getParam<bool>("multiply_by_density"))
      41             : {
      42          30 :   if (_num_mass_fraction_vars != 0)
      43             :     mooseError("PorousFlowBasicTHM can only be used for a single-component fluid, so that no "
      44           0 :                "mass-fraction variables should be provided");
      45          60 :   _objects_to_add.push_back("PorousFlowFullySaturatedDarcyBase");
      46          30 :   if (_simulation_type == SimulationTypeChoiceEnum::TRANSIENT)
      47          30 :     _objects_to_add.push_back("PorousFlowFullySaturatedMassTimeDerivative");
      48          30 :   if (_coupling_type == CouplingTypeEnum::ThermoHydro ||
      49             :       _coupling_type == CouplingTypeEnum::ThermoHydroMechanical)
      50          30 :     _objects_to_add.push_back("PorousFlowFullySaturatedHeatAdvection");
      51          30 : }
      52             : 
      53             : void
      54          30 : PorousFlowBasicTHM::act()
      55             : {
      56          30 :   PorousFlowSinglePhaseBase::act();
      57             : 
      58             :   // add the kernels
      59          60 :   if (_current_task == "add_kernel")
      60             :   {
      61           6 :     std::string kernel_name = "PorousFlowBasicTHM_DarcyFlow";
      62           6 :     std::string kernel_type = "PorousFlowFullySaturatedDarcyBase";
      63          12 :     InputParameters params = _factory.getValidParams(kernel_type);
      64          18 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
      65          12 :     params.set<RealVectorValue>("gravity") = _gravity;
      66          12 :     params.set<bool>("multiply_by_density") = _multiply_by_density;
      67          12 :     params.set<NonlinearVariableName>("variable") = _pp_var;
      68           6 :     _problem->addKernel(kernel_type, kernel_name, params);
      69             :   }
      70          60 :   if (_current_task == "add_kernel" && _simulation_type == SimulationTypeChoiceEnum::TRANSIENT)
      71             :   {
      72           3 :     std::string kernel_name = "PorousFlowBasicTHM_MassTimeDerivative";
      73           3 :     std::string kernel_type = "PorousFlowFullySaturatedMassTimeDerivative";
      74           6 :     InputParameters params = _factory.getValidParams(kernel_type);
      75           9 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
      76           6 :     params.set<NonlinearVariableName>("variable") = _pp_var;
      77           6 :     params.set<Real>("biot_coefficient") = _biot_coefficient;
      78           6 :     params.set<bool>("multiply_by_density") = _multiply_by_density;
      79           9 :     params.set<MooseEnum>("coupling_type") = parameters().get<MooseEnum>("coupling_type");
      80           3 :     _problem->addKernel(kernel_type, kernel_name, params);
      81             :   }
      82             : 
      83          60 :   if ((_coupling_type == CouplingTypeEnum::ThermoHydro ||
      84          45 :        _coupling_type == CouplingTypeEnum::ThermoHydroMechanical) &&
      85          15 :       _current_task == "add_kernel")
      86             :   {
      87           3 :     std::string kernel_name = "PorousFlowBasicTHM_HeatAdvection";
      88           3 :     std::string kernel_type = "PorousFlowFullySaturatedHeatAdvection";
      89           6 :     InputParameters params = _factory.getValidParams(kernel_type);
      90          12 :     params.set<NonlinearVariableName>("variable") = _temperature_var[0];
      91           9 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
      92           6 :     params.set<RealVectorValue>("gravity") = _gravity;
      93           3 :     _problem->addKernel(kernel_type, kernel_name, params);
      94             :   }
      95             : 
      96             :   // add Materials
      97          90 :   if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_qp") && _current_task == "add_material")
      98             :   {
      99           6 :     std::string material_type = "PorousFlow1PhaseFullySaturated";
     100          12 :     InputParameters params = _factory.getValidParams(material_type);
     101           6 :     std::string material_name = "PorousFlowBasicTHM_1PhaseP_qp";
     102          18 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     103          18 :     params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
     104           6 :     _problem->addMaterial(material_type, material_name, params);
     105             :   }
     106          60 :   if (_deps.dependsOn(_objects_to_add, "PorousFlowPS_nodal") && _current_task == "add_material")
     107             :   {
     108           0 :     std::string material_type = "PorousFlow1PhaseFullySaturated";
     109           0 :     InputParameters params = _factory.getValidParams(material_type);
     110           0 :     std::string material_name = "PorousFlowBasicTHM_1PhaseP";
     111           0 :     params.set<UserObjectName>("PorousFlowDictator") = _dictator_name;
     112           0 :     params.set<std::vector<VariableName>>("porepressure") = {_pp_var};
     113           0 :     params.set<bool>("at_nodes") = true;
     114           0 :     _problem->addMaterial(material_type, material_name, params);
     115             :   }
     116             : 
     117          75 :   if ((_deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_qp") ||
     118          60 :        _deps.dependsOn(_objects_to_add, "PorousFlowVolumetricStrain_nodal")) &&
     119          15 :       (_coupling_type == CouplingTypeEnum::HydroMechanical ||
     120             :        _coupling_type == CouplingTypeEnum::ThermoHydroMechanical))
     121          15 :     addVolumetricStrainMaterial(_coupled_displacements, false);
     122             : 
     123          60 :   if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_qp"))
     124          30 :     addRelativePermeabilityCorey(false, 0, 0.0, 0.0, 0.0);
     125          60 :   if (_deps.dependsOn(_objects_to_add, "PorousFlowRelativePermeability_nodal"))
     126           0 :     addRelativePermeabilityCorey(true, 0, 0.0, 0.0, 0.0);
     127        2529 : }

Generated by: LCOV version 1.11