www.mooseframework.org
PorousFlowDiffusivityBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<PorousFlowMaterialVectorBase>();
17  params.addRequiredParam<std::vector<Real>>(
18  "diffusion_coeff",
19  "List of diffusion coefficients. Order is i) component 0 in phase 0; ii) "
20  "component 1 in phase 0 ...; component 0 in phase 1; ... component k in "
21  "phase n (m^2/s");
22  params.addClassDescription("Base class for effective diffusivity for each phase");
23  params.set<bool>("at_nodes") = false;
24  params.addPrivateParam<std::string>("pf_material_type", "diffusivity");
25  return params;
26 }
27 
28 PorousFlowDiffusivityBase::PorousFlowDiffusivityBase(const InputParameters & parameters)
29  : PorousFlowMaterialVectorBase(parameters),
30 
31  _tortuosity(declareProperty<std::vector<Real>>("PorousFlow_tortuosity_qp")),
32  _dtortuosity_dvar(
33  declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_tortuosity_qp_dvar")),
34  _diffusion_coeff(
35  declareProperty<std::vector<std::vector<Real>>>("PorousFlow_diffusion_coeff_qp")),
36  _ddiffusion_coeff_dvar(declareProperty<std::vector<std::vector<std::vector<Real>>>>(
37  "dPorousFlow_diffusion_coeff_qp_dvar")),
38  _input_diffusion_coeff(getParam<std::vector<Real>>("diffusion_coeff"))
39 {
40  // Also, the number of diffusion coefficients must be equal to the num_phases * num_components
42  paramError("diffusion_coeff",
43  "The number of diffusion coefficients entered is not equal to the number of phases "
44  "multiplied by the number of fluid components");
45 
46  if (_nodal_material == true)
47  mooseError("PorousFlowRelativeDiffusivity classes are only defined for at_nodes = false");
48 }
49 
50 void
52 {
53  _diffusion_coeff[_qp].resize(_num_phases);
55  _dtortuosity_dvar[_qp].resize(_num_phases);
56 
57  for (unsigned int ph = 0; ph < _num_phases; ++ph)
58  {
59  _diffusion_coeff[_qp][ph].resize(_num_components);
60  _ddiffusion_coeff_dvar[_qp][ph].resize(_num_components);
61  _dtortuosity_dvar[_qp][ph].assign(_num_var, 0.0);
62 
63  for (unsigned int comp = 0; comp < _num_components; ++comp)
64  {
65  _diffusion_coeff[_qp][ph][comp] = _input_diffusion_coeff[ph + comp];
66  _ddiffusion_coeff_dvar[_qp][ph][comp].assign(_num_var, 0.0);
67  }
68  }
69 }
const unsigned int _num_phases
Number of phases.
virtual void computeQpProperties() override
InputParameters validParams< PorousFlowMaterialVectorBase >()
Base class for all PorousFlow vector materials.
const unsigned int _num_components
Number of fluid components.
MaterialProperty< std::vector< std::vector< Real > > > & _diffusion_coeff
Diffusion coefficients of component k in fluid phase alpha.
const unsigned int _num_var
Number of PorousFlow variables.
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _ddiffusion_coeff_dvar
Derivative of the diffusion coefficients wrt PorousFlow variables.
InputParameters validParams< PorousFlowDiffusivityBase >()
PorousFlowDiffusivityBase(const InputParameters &parameters)
MaterialProperty< std::vector< std::vector< Real > > > & _dtortuosity_dvar
Derivative of tortuosity wrt PorousFlow variables.
const std::vector< Real > _input_diffusion_coeff
Input diffusion coefficients.