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 : // This post processor returns the mass due to a flux from the boundary of a volume. 11 : // 12 : #include "RichardsPiecewiseLinearSinkFlux.h" 13 : #include "Function.h" 14 : 15 : registerMooseObject("RichardsApp", RichardsPiecewiseLinearSinkFlux); 16 : 17 : InputParameters 18 54 : RichardsPiecewiseLinearSinkFlux::validParams() 19 : { 20 54 : InputParameters params = SideIntegralVariablePostprocessor::validParams(); 21 108 : params.addRequiredParam<bool>( 22 : "use_mobility", 23 : "If true, then fluxes are multiplied by (density*permeability_nn/viscosity), " 24 : "where the '_nn' indicates the component normal to the boundary. In this " 25 : "case bare_flux is measured in Pa.s^-1. This can be used in conjunction " 26 : "with use_relperm."); 27 108 : params.addRequiredParam<bool>("use_relperm", 28 : "If true, then fluxes are multiplied by relative " 29 : "permeability. This can be used in conjunction " 30 : "with use_mobility"); 31 108 : params.addRequiredParam<std::vector<Real>>( 32 : "pressures", "Tuple of pressure values. Must be monotonically increasing."); 33 108 : params.addRequiredParam<std::vector<Real>>( 34 : "bare_fluxes", 35 : "Tuple of flux values (measured in kg.m^-2.s^-1 for use_mobility=false, and " 36 : "in Pa.s^-1 if use_mobility=true). This flux is OUT of the medium: hence " 37 : "positive values of flux means this will be a SINK, while negative values " 38 : "indicate this flux will be a SOURCE. A piecewise-linear fit is performed to " 39 : "the (pressure,bare_fluxes) pairs to obtain the flux at any arbitrary " 40 : "pressure, and the first or last bare_flux values are used if the quad-point " 41 : "pressure falls outside this range."); 42 108 : params.addRequiredParam<UserObjectName>( 43 : "richardsVarNames_UO", "The UserObject that holds the list of Richards variable names."); 44 108 : params.addParam<FunctionName>("multiplying_fcn", 45 108 : 1.0, 46 : "The flux will be multiplied by this spatially-and-temporally " 47 : "varying function. This is useful if the boundary is a moving " 48 : "boundary controlled by RichardsExcav."); 49 54 : params.addClassDescription("Records the fluid flow into a sink (positive values indicate fluid " 50 : "is flowing from porespace into the sink)."); 51 54 : return params; 52 0 : } 53 : 54 24 : RichardsPiecewiseLinearSinkFlux::RichardsPiecewiseLinearSinkFlux(const InputParameters & parameters) 55 : : SideIntegralVariablePostprocessor(parameters), 56 72 : _sink_func(getParam<std::vector<Real>>("pressures"), 57 : getParam<std::vector<Real>>("bare_fluxes")), 58 : 59 48 : _use_mobility(getParam<bool>("use_mobility")), 60 48 : _use_relperm(getParam<bool>("use_relperm")), 61 : 62 24 : _m_func(getFunction("multiplying_fcn")), 63 : 64 24 : _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")), 65 24 : _pvar(_richards_name_UO.richards_var_num(coupled("variable"))), 66 : 67 48 : _pp(getMaterialProperty<std::vector<Real>>("porepressure")), 68 : 69 48 : _viscosity(getMaterialProperty<std::vector<Real>>("viscosity")), 70 48 : _permeability(getMaterialProperty<RealTensorValue>("permeability")), 71 48 : _rel_perm(getMaterialProperty<std::vector<Real>>("rel_perm")), 72 72 : _density(getMaterialProperty<std::vector<Real>>("density")) 73 : { 74 24 : } 75 : 76 : Real 77 4824 : RichardsPiecewiseLinearSinkFlux::computeQpIntegral() 78 : { 79 4824 : Real flux = _sink_func.sample(_pp[_qp][_pvar]); 80 : 81 4824 : flux *= _m_func.value(_t, _q_point[_qp]); 82 : 83 4824 : if (_use_mobility) 84 : { 85 1608 : Real k = (_permeability[_qp] * _normals[_qp]) * _normals[_qp]; 86 1608 : flux *= _density[_qp][_pvar] * k / _viscosity[_qp][_pvar]; 87 : } 88 4824 : if (_use_relperm) 89 1608 : flux *= _rel_perm[_qp][_pvar]; 90 : 91 4824 : return flux * _dt; 92 : }