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 "PorousFlowAdvectiveFluxCalculatorSaturated.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowAdvectiveFluxCalculatorSaturated); 13 : 14 : InputParameters 15 2845 : PorousFlowAdvectiveFluxCalculatorSaturated::validParams() 16 : { 17 2845 : InputParameters params = PorousFlowAdvectiveFluxCalculatorBase::validParams(); 18 2845 : params.addClassDescription( 19 : "Computes the advective flux of fluid of given phase, assuming fully-saturated conditions. " 20 : "Hence this UserObject is only relevant to single-phase situations. Explicitly, the " 21 : "UserObject computes (density / viscosity) * (- permeability * (grad(P) - density * " 22 : "gravity)), using the Kuzmin-Turek FEM-TVD multidimensional stabilization scheme"); 23 5690 : params.addParam<bool>( 24 : "multiply_by_density", 25 5690 : true, 26 : "If true, then the advective flux will be multiplied by density, so it is a mass flux, which " 27 : "is the most common way of using PorousFlow. If false, then the advective flux will be a " 28 : "volume flux, which is common in poro-mechanics"); 29 2845 : return params; 30 0 : } 31 : 32 1111 : PorousFlowAdvectiveFluxCalculatorSaturated::PorousFlowAdvectiveFluxCalculatorSaturated( 33 1111 : const InputParameters & parameters) 34 : : PorousFlowAdvectiveFluxCalculatorBase(parameters), 35 1103 : _multiply_by_density(getParam<bool>("multiply_by_density")), 36 2162 : _fluid_density_node(_multiply_by_density ? &getMaterialProperty<std::vector<Real>>( 37 : "PorousFlow_fluid_phase_density_nodal") 38 : : nullptr), 39 2206 : _dfluid_density_node_dvar(_multiply_by_density 40 2162 : ? &getMaterialProperty<std::vector<std::vector<Real>>>( 41 : "dPorousFlow_fluid_phase_density_nodal_dvar") 42 : : nullptr), 43 2206 : _fluid_viscosity(getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_nodal")), 44 1103 : _dfluid_viscosity_dvar( 45 2214 : getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_viscosity_nodal_dvar")) 46 : { 47 1103 : } 48 : 49 : Real 50 3458642 : PorousFlowAdvectiveFluxCalculatorSaturated::computeU(unsigned i) const 51 : { 52 : // The following is but one choice. 53 : // If you change this, you will probably have to change 54 : // - computeVelocity 55 : // - the derivative in executeOnElement 56 : // - computedU_dvar 57 3458642 : if (_multiply_by_density) 58 3442544 : return (*_fluid_density_node)[i][_phase] / _fluid_viscosity[i][_phase]; 59 16098 : return 1.0 / _fluid_viscosity[i][_phase]; 60 : } 61 : 62 : Real 63 2800020 : PorousFlowAdvectiveFluxCalculatorSaturated::computedU_dvar(unsigned i, unsigned pvar) const 64 : { 65 2800020 : Real du = -_dfluid_viscosity_dvar[i][_phase][pvar] / std::pow(_fluid_viscosity[i][_phase], 2); 66 2800020 : if (_multiply_by_density) 67 2789288 : du = du * (*_fluid_density_node)[i][_phase] + 68 2789288 : (*_dfluid_density_node_dvar)[i][_phase][pvar] / _fluid_viscosity[i][_phase]; 69 2800020 : return du; 70 : }