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 "PorousFlowDarcyVelocityComponent.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowDarcyVelocityComponent); 13 : registerMooseObject("PorousFlowApp", ADPorousFlowDarcyVelocityComponent); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 6131 : PorousFlowDarcyVelocityComponentTempl<is_ad>::validParams() 18 : { 19 6131 : InputParameters params = AuxKernel::validParams(); 20 12262 : params.addRequiredParam<RealVectorValue>("gravity", 21 : "Gravitational acceleration vector downwards (m/s^2)"); 22 12262 : params.addRequiredParam<UserObjectName>( 23 : "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names"); 24 12262 : params.addParam<unsigned int>("fluid_phase", 0, "The index corresponding to the fluid phase"); 25 12262 : MooseEnum component("x=0 y=1 z=2"); 26 12262 : params.addRequiredParam<MooseEnum>( 27 : "component", component, "The spatial component of the Darcy flux to return"); 28 6131 : params.addClassDescription("Darcy velocity (in m^3.s^-1.m^-2, or m.s^-1) -(k_ij * krel /mu " 29 : "(nabla_j P - w_j)), where k_ij is the permeability tensor, krel is " 30 : "the relative permeability, mu is the fluid viscosity, P is the fluid " 31 : "pressure, and w_j is the fluid weight."); 32 6131 : return params; 33 6131 : } 34 : 35 : template <bool is_ad> 36 4443 : PorousFlowDarcyVelocityComponentTempl<is_ad>::PorousFlowDarcyVelocityComponentTempl( 37 : const InputParameters & parameters) 38 : : AuxKernel(parameters), 39 4443 : _relative_permeability(getGenericMaterialProperty<std::vector<Real>, is_ad>( 40 : "PorousFlow_relative_permeability_qp")), 41 4443 : _fluid_viscosity( 42 4443 : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_viscosity_qp")), 43 4443 : _permeability(getGenericMaterialProperty<RealTensorValue, is_ad>("PorousFlow_permeability_qp")), 44 4443 : _grad_p(getGenericMaterialProperty<std::vector<RealGradient>, is_ad>( 45 : "PorousFlow_grad_porepressure_qp")), 46 4443 : _fluid_density_qp( 47 4443 : getGenericMaterialProperty<std::vector<Real>, is_ad>("PorousFlow_fluid_phase_density_qp")), 48 4443 : _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")), 49 8886 : _ph(getParam<unsigned int>("fluid_phase")), 50 8886 : _component(getParam<MooseEnum>("component")), 51 13329 : _gravity(getParam<RealVectorValue>("gravity")) 52 : { 53 4443 : if (_ph >= _dictator.numPhases()) 54 0 : paramError("fluid_phase", 55 : "The Dictator proclaims that the maximum phase index in this simulation is ", 56 0 : _dictator.numPhases() - 1, 57 : " whereas you have used ", 58 0 : _ph, 59 : ". Remember that indexing starts at 0. The Dictator is watching you, to " 60 : "ensure your wellbeing."); 61 4443 : } 62 : 63 : template <bool is_ad> 64 : Real 65 3506116 : PorousFlowDarcyVelocityComponentTempl<is_ad>::computeValue() 66 : { 67 : return -MetaPhysicL::raw_value( 68 3506116 : (_permeability[_qp] * (_grad_p[_qp][_ph] - _fluid_density_qp[_qp][_ph] * _gravity) * 69 3506116 : _relative_permeability[_qp][_ph] / _fluid_viscosity[_qp][_ph])(_component)); 70 : } 71 : 72 : template class PorousFlowDarcyVelocityComponentTempl<false>; 73 : template class PorousFlowDarcyVelocityComponentTempl<true>;