Пример #1
0
PorousFlow2PhasePP::PorousFlow2PhasePP(const InputParameters & parameters)
  : PorousFlowVariableBase(parameters),

    _phase0_porepressure(_nodal_material ? coupledDofValues("phase0_porepressure")
                                         : coupledValue("phase0_porepressure")),
    _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
    _phase0_porepressure_varnum(coupled("phase0_porepressure")),
    _p0var(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum)
               ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum)
               : 0),

    _phase1_porepressure(_nodal_material ? coupledDofValues("phase1_porepressure")
                                         : coupledValue("phase1_porepressure")),
    _phase1_gradp_qp(coupledGradient("phase1_porepressure")),
    _phase1_porepressure_varnum(coupled("phase1_porepressure")),
    _p1var(_dictator.isPorousFlowVariable(_phase1_porepressure_varnum)
               ? _dictator.porousFlowVariableNum(_phase1_porepressure_varnum)
               : 0),
    _pc_uo(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
{
  if (_num_phases != 2)
    mooseError("The Dictator announces that the number of phases is ",
               _dictator.numPhases(),
               " whereas PorousFlow2PhasePP can only be used for 2-phase simulation.  When you "
               "have an efficient government, you have a dictatorship.");
}
Пример #2
0
InternalSideJump::InternalSideJump(const InputParameters & parameters)
  : InternalSidePostprocessor(parameters),
    _current_elem_volume(_assembly.elemVolume()),
    _current_neighbor_volume(_assembly.neighborVolume()),
    _sln_dofs(coupledDofValues("variable")),
    _sln_dofs_neig(coupledNeighborDofValues("variable"))
{
}
AdvectiveFluxCalculatorConstantVelocity::AdvectiveFluxCalculatorConstantVelocity(
    const InputParameters & parameters)
  : AdvectiveFluxCalculatorBase(parameters),
    _velocity(getParam<RealVectorValue>("velocity")),
    _u_at_nodes(coupledDofValues("u")),
    _phi(_assembly.fePhi<Real>(getVar("u", 0)->feType())),
    _grad_phi(_assembly.feGradPhi<Real>(getVar("u", 0)->feType()))
{
}
Пример #4
0
Q2PBorehole::Q2PBorehole(const InputParameters & parameters)
  : PeacemanBorehole(parameters),
    _density(getUserObject<RichardsDensity>("fluid_density")),
    _relperm(getUserObject<RichardsRelPerm>("fluid_relperm")),
    _other_var_nodal(coupledDofValues("other_var")),
    _other_var_num(coupled("other_var")),
    _var_is_pp(getParam<bool>("var_is_porepressure")),
    _viscosity(getParam<Real>("fluid_viscosity")),
    _permeability(getMaterialProperty<RealTensorValue>("permeability")),
    _num_nodes(0),
    _pp(0),
    _sat(0),
    _mobility(0),
    _dmobility_dp(0),
    _dmobility_ds(0)
{
}
PorousFlow1PhaseFullySaturated::PorousFlow1PhaseFullySaturated(const InputParameters & parameters)
  : PorousFlowVariableBase(parameters),

    _porepressure_var(_nodal_material ? coupledDofValues("porepressure")
                                      : coupledValue("porepressure")),
    _gradp_qp_var(coupledGradient("porepressure")),
    _porepressure_varnum(coupled("porepressure")),
    _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
                   ? _dictator.porousFlowVariableNum(_porepressure_varnum)
                   : 0)
{
  if (_num_phases != 1)
    mooseError("The Dictator proclaims that the number of phases is ",
               _dictator.numPhases(),
               " whereas PorousFlow1PhaseFullySaturated can only be used for 1-phase simulations."
               " Be aware that the Dictator has noted your mistake.");
}
Пример #6
0
Q2PSaturationFlux::Q2PSaturationFlux(const InputParameters & parameters)
  : Kernel(parameters),
    _density(getUserObject<RichardsDensity>("fluid_density")),
    _pp(coupledValue("porepressure_variable")),
    _grad_pp(coupledGradient("porepressure_variable")),
    _pp_nodal(coupledDofValues("porepressure_variable")),
    _pp_var(coupled("porepressure_variable")),
    _relperm(getUserObject<RichardsRelPerm>("fluid_relperm")),
    _viscosity(getParam<Real>("fluid_viscosity")),
    _gravity(getMaterialProperty<RealVectorValue>("gravity")),
    _permeability(getMaterialProperty<RealTensorValue>("permeability")),
    _num_nodes(0),
    _mobility(0),
    _dmobility_dp(0),
    _dmobility_ds(0)
{
}
Пример #7
0
GolemMaterialTH::GolemMaterialTH(const InputParameters & parameters)
  : GolemMaterialH(parameters),
    _has_T_source_sink(getParam<bool>("has_heat_source_sink")),
    _has_SUPG_upwind(isParamValid("supg_uo") ? true : false),
    _has_lumped_mass_matrix(getParam<bool>("has_lumped_mass_matrix")),
    _has_boussinesq(getParam<bool>("has_boussinesq")),
    _temp(coupledValue("temperature")),
    _pf(coupledValue("pore_pressure")),
    _grad_pf(coupledGradient("pore_pressure")),
    _grad_temp(coupledGradient("temperature")),
    _lambda_f(getParam<Real>("fluid_thermal_conductivity_initial")),
    _lambda_s(getParam<Real>("solid_thermal_conductivity_initial")),
    _c_f(getParam<Real>("fluid_heat_capacity_initial")),
    _c_s(getParam<Real>("solid_heat_capacity_initial")),
    _T_source_sink(getParam<Real>("heat_source_sink")),
    _supg_uo(_has_SUPG_upwind ? &getUserObject<GolemSUPG>("supg_uo") : NULL),
    _TH_kernel(declareProperty<RankTwoTensor>("TH_kernel")),
    _T_kernel_diff(declareProperty<Real>("T_kernel_diff")),
    _drho_dpf(declareProperty<Real>("drho_dp")),
    _drho_dT(declareProperty<Real>("drho_dT")),
    _dmu_dpf(declareProperty<Real>("dmu_dp")),
    _dmu_dT(declareProperty<Real>("dmu_dT")),
    _dH_kernel_dT(declareProperty<RankTwoTensor>("dH_kernel_dT")),
    _dH_kernel_grav_dpf(declareProperty<RealVectorValue>("dH_kernel_grav_dpf")),
    _dH_kernel_grav_dT(declareProperty<RealVectorValue>("dH_kernel_grav_dT")),
    _dTH_kernel_dpf(declareProperty<RankTwoTensor>("dTH_kernel_dpf")),
    _dTH_kernel_dT(declareProperty<RankTwoTensor>("dTH_kernel_dT")),
    _SUPG_N(declareProperty<RealVectorValue>("SUPG_N")),
    _SUPG_dtau_dgradpf(declareProperty<RankTwoTensor>("SUPG_dtau_dgradpf")),
    _SUPG_dtau_dpf(declareProperty<RealVectorValue>("SUPG_dtau_dpf")),
    _SUPG_dtau_dT(declareProperty<RealVectorValue>("SUPG_dtau_dT"))
{
  // scale properties if required
  if (_has_scaled_properties)
  {
    _lambda_s /= _scaling_uo->_s_conductivity;
    _lambda_f /= _scaling_uo->_s_conductivity;
    _c_s /= _scaling_uo->_s_specific_heat;
    _c_f /= _scaling_uo->_s_specific_heat;
    _T_source_sink /= _scaling_uo->_s_heat_production;
  }
  if (_fe_problem.isTransient())
  {
    _T_kernel_time = &declareProperty<Real>("T_kernel_time");
    _dT_kernel_time_dpf = &declareProperty<Real>("dT_kernel_time_dpf");
    _dT_kernel_time_dT = &declareProperty<Real>("dT_kernel_time_dT");
  }
  if (_has_T_source_sink)
    _T_kernel_source = &declareProperty<Real>("T_kernel_source");
  if (_has_lumped_mass_matrix)
  {
    if (!_fe_problem.isTransient())
      mooseError("_has_lumped_mass_matrix is set to ",
                 _has_lumped_mass_matrix,
                 " but simulation is Steady State");

    // Set the mapping from qps to nodes
    _node_number = &declareProperty<unsigned int>("node_number");
    // Pressure nodal
    _nodal_pf_var = &coupledDofValues("pore_pressure");
    _nodal_pf = &declareProperty<Real>("nodal_pf");
    if (_has_boussinesq)
    {
      _nodal_pf_var_old = &coupledDofValuesOld("pore_pressure");
      _nodal_pf_old = &declareProperty<Real>("nodal_pf_old");
    }
    // Temperature nodal
    _nodal_temp_var = &coupledDofValues("temperature");
    _nodal_temp_var_old = &coupledDofValuesOld("temperature");
    _nodal_temp = &declareProperty<Real>("nodal_temp");
    _nodal_temp_old = &declareProperty<Real>("nodal_temp_old");
  }
  if (_has_disp)
  {
    // Declare some property when this material is used for fractures or faults in a THM simulation
    _dT_kernel_diff_dev = &declareProperty<Real>("dT_kernel_diff_dev");
    _dT_kernel_diff_dpf = &declareProperty<Real>("dT_kernel_diff_dpf");
    _dT_kernel_diff_dT = &declareProperty<Real>("dT_kernel_diff_dT");
    _dTH_kernel_dev = &declareProperty<RankTwoTensor>("dTH_kernel_dev");
    if (_fe_problem.isTransient())
    {
      _dT_kernel_time_dev = &declareProperty<Real>("dT_kernel_time_dev");
      _dH_kernel_time_dT = &declareProperty<Real>("dH_kernel_time_dT");
    }
    _SUPG_dtau_dev = &declareProperty<RealVectorValue>("SUPG_dtau_dev");
  }
  else
    _dH_kernel_dpf = &declareProperty<RankTwoTensor>("dH_kernel_dpf");
}
Пример #8
0
PorousFlowPorosity::PorousFlowPorosity(const InputParameters & parameters)
  : PorousFlowPorosityExponentialBase(parameters),

    _mechanical(getParam<bool>("mechanical")),
    _fluid(getParam<bool>("fluid")),
    _thermal(getParam<bool>("thermal")),
    _chemical(getParam<bool>("chemical")),
    _phi0(coupledValue("porosity_zero")),
    _biot(getParam<Real>("biot_coefficient")),
    _exp_coeff(isParamValid("thermal_expansion_coeff") ? getParam<Real>("thermal_expansion_coeff")
                                                       : 0.0),
    _solid_bulk(isParamValid("solid_bulk") ? getParam<Real>("solid_bulk")
                                           : std::numeric_limits<Real>::max()),
    _coeff((_biot - 1.0) / _solid_bulk),

    _t_reference(_nodal_material ? coupledDofValues("reference_temperature")
                                 : coupledValue("reference_temperature")),
    _p_reference(_nodal_material ? coupledDofValues("reference_porepressure")
                                 : coupledValue("reference_porepressure")),
    _num_c_ref(coupledComponents("reference_chemistry")),
    _c_reference(_num_c_ref),
    _num_initial_c(coupledComponents("initial_mineral_concentrations")),
    _initial_c(_num_initial_c),
    _c_weights(isParamValid("chemical_weights") ? getParam<std::vector<Real>>("chemical_weights")
                                                : std::vector<Real>(_num_c_ref, 1.0)),

    _porosity_old(_nodal_material ? getMaterialPropertyOld<Real>("PorousFlow_porosity_nodal")
                                  : getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
    _vol_strain_qp(_mechanical ? &getMaterialProperty<Real>("PorousFlow_total_volumetric_strain_qp")
                               : nullptr),
    _dvol_strain_qp_dvar(_mechanical ? &getMaterialProperty<std::vector<RealGradient>>(
                                           "dPorousFlow_total_volumetric_strain_qp_dvar")
                                     : nullptr),

    _pf(_fluid ? (_nodal_material
                      ? &getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_nodal")
                      : &getMaterialProperty<Real>("PorousFlow_effective_fluid_pressure_qp"))
               : nullptr),
    _dpf_dvar(_fluid ? (_nodal_material ? &getMaterialProperty<std::vector<Real>>(
                                              "dPorousFlow_effective_fluid_pressure_nodal_dvar")
                                        : &getMaterialProperty<std::vector<Real>>(
                                              "dPorousFlow_effective_fluid_pressure_qp_dvar"))
                     : nullptr),

    _temperature(_thermal
                     ? (_nodal_material ? &getMaterialProperty<Real>("PorousFlow_temperature_nodal")
                                        : &getMaterialProperty<Real>("PorousFlow_temperature_qp"))
                     : nullptr),
    _dtemperature_dvar(
        _thermal
            ? (_nodal_material
                   ? &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
                   : &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar"))
            : nullptr),

    _mineral_conc_old(_chemical ? (_nodal_material ? &getMaterialPropertyOld<std::vector<Real>>(
                                                         "PorousFlow_mineral_concentration_nodal")
                                                   : &getMaterialPropertyOld<std::vector<Real>>(
                                                         "PorousFlow_mineral_concentration_qp"))
                                : nullptr),
    _reaction_rate(_chemical ? (_nodal_material ? &getMaterialProperty<std::vector<Real>>(
                                                      "PorousFlow_mineral_reaction_rate_nodal")
                                                : &getMaterialProperty<std::vector<Real>>(
                                                      "PorousFlow_mineral_reaction_rate_qp"))
                             : nullptr),
    _dreaction_rate_dvar(_chemical ? (_nodal_material
                                          ? &getMaterialProperty<std::vector<std::vector<Real>>>(
                                                "dPorousFlow_mineral_reaction_rate_nodal_dvar")
                                          : &getMaterialProperty<std::vector<std::vector<Real>>>(
                                                "dPorousFlow_mineral_reaction_rate_qp_dvar"))
                                   : nullptr),
    _aq_ph(_dictator.aqueousPhaseNumber()),
    _saturation(_chemical
                    ? (_nodal_material
                           ? &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
                           : &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp"))
                    : nullptr),
    _dsaturation_dvar(_chemical
                          ? (_nodal_material ? &getMaterialProperty<std::vector<std::vector<Real>>>(
                                                   "dPorousFlow_saturation_nodal_dvar")
                                             : &getMaterialProperty<std::vector<std::vector<Real>>>(
                                                   "dPorousFlow_saturation_qp_dvar"))
                          : nullptr)
{
  if (_thermal && !isParamValid("thermal_expansion_coeff"))
    mooseError("PorousFlowPorosity: When thermal=true you must provide a thermal_expansion_coeff");
  if (_fluid && !isParamValid("solid_bulk"))
    mooseError("PorousFlowPorosity: When fluid=true you must provide a solid_bulk");
  if (_chemical && _num_c_ref != _dictator.numAqueousKinetic())
    mooseError("PorousFlowPorosity: When chemical=true you must provide the reference_chemistry "
               "values.  The Dictator proclaims there should be ",
               _dictator.numAqueousKinetic(),
               " of these");
  if (_chemical && _num_initial_c != _dictator.numAqueousKinetic())
    mooseError("PorousFlowPorosity: When chemical=true you must provide the "
               "initial_mineral_concentrations.  "
               "The Dictator proclaims there should be ",
               _dictator.numAqueousKinetic(),
               " of these");
  if (_chemical && _c_weights.size() != _dictator.numAqueousKinetic())
    mooseError(
        "PorousFlowPorosity: When chemical=true you must provde the correct number of "
        "chemical_weights (which the Dictator knows is ",
        _dictator.numAqueousKinetic(),
        ") or do not provide any chemical_weights and use the default value of 1 for each mineral");

  for (unsigned i = 0; i < _num_c_ref; ++i)
  {
    _c_reference[i] = (_nodal_material ? &coupledDofValues("reference_chemistry", i)
                                       : &coupledValue("reference_chemistry", i));
    _initial_c[i] = (_nodal_material ? &coupledDofValues("initial_mineral_concentrations", i)
                                     : &coupledValue("initial_mineral_concentrations", i));
  }
}