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