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 "PorousFlowPolyLineSink.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowPolyLineSink); 13 : 14 : InputParameters 15 938 : PorousFlowPolyLineSink::validParams() 16 : { 17 938 : InputParameters params = PorousFlowLineSink::validParams(); 18 1876 : params.addRequiredParam<std::vector<Real>>( 19 : "p_or_t_vals", 20 : "Tuple of pressure (or temperature) values. Must be monotonically increasing."); 21 1876 : params.addRequiredParam<std::vector<Real>>( 22 : "fluxes", 23 : "Tuple of flux values (measured in kg.m^-1.s^-1 if no 'use_*' are employed). " 24 : "These flux values are multiplied by the line-segment length to achieve a flux in " 25 : "kg.s^-1. A piecewise-linear fit is performed to the (p_or_t_vals,flux) pairs to " 26 : "obtain the flux at any arbitrary pressure (or temperature). If a quad-point " 27 : "pressure is less than the first pressure value, the first flux value is used. If " 28 : "quad-point pressure exceeds the final pressure value, the final flux value is " 29 : "used. This flux is OUT of the medium: hence positive values of flux means this " 30 : "will be a SINK, while negative values indicate this flux will be a SOURCE."); 31 938 : params.addClassDescription( 32 : "Approximates a polyline sink by using a number of point sinks with " 33 : "given weighting whose positions are read from a file. NOTE: if you are using " 34 : "PorousFlowPorosity that depends on volumetric strain, you should set " 35 : "strain_at_nearest_qp=true in your GlobalParams, to ensure the nodal Porosity Material uses " 36 : "the volumetric strain at the Dirac quadpoints, and can therefore be computed"); 37 938 : return params; 38 0 : } 39 : 40 521 : PorousFlowPolyLineSink::PorousFlowPolyLineSink(const InputParameters & parameters) 41 : : PorousFlowLineSink(parameters), 42 2084 : _sink_func(getParam<std::vector<Real>>("p_or_t_vals"), getParam<std::vector<Real>>("fluxes")) 43 : { 44 521 : } 45 : 46 : Real 47 154852 : PorousFlowPolyLineSink::computeQpBaseOutflow(unsigned current_dirac_ptid) const 48 : { 49 : Real outflow = 0.0; 50 : 51 154852 : if (current_dirac_ptid > 0) 52 : // contribution from half-segment "behind" this point (must have >1 point for 53 : // current_dirac_ptid>0) 54 76688 : outflow += _half_seg_len[current_dirac_ptid - 1]; 55 : 56 154852 : if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1) 57 : // contribution from half-segment "ahead of" this point, or we only have one point 58 138580 : outflow += _half_seg_len[current_dirac_ptid]; 59 : 60 154852 : return outflow * _test[_i][_qp] * _sink_func.sample(ptqp()) * _weight->at(current_dirac_ptid); 61 : } 62 : 63 : void 64 138176 : PorousFlowPolyLineSink::computeQpBaseOutflowJacobian(unsigned jvar, 65 : unsigned current_dirac_ptid, 66 : Real & outflow, 67 : Real & outflowp) const 68 : { 69 138176 : outflow = 0.0; 70 138176 : outflowp = 0.0; 71 : 72 138176 : if (_dictator.notPorousFlowVariable(jvar)) 73 : return; 74 138176 : const unsigned pvar = _dictator.porousFlowVariableNum(jvar); 75 : 76 138176 : if (current_dirac_ptid > 0) 77 : // contribution from half-segment "behind" this point (must have >1 point for 78 : // current_dirac_ptid>0) 79 66432 : outflow += _half_seg_len[current_dirac_ptid - 1]; 80 : 81 138176 : if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1) 82 : // contribution from half-segment "ahead of" this point, or we only have one point 83 112512 : outflow += _half_seg_len[current_dirac_ptid]; 84 : 85 138176 : outflowp = outflow * _test[_i][_qp] * _sink_func.sampleDerivative(ptqp()) * dptqp(pvar) * 86 138176 : _phi[_j][_qp] * _weight->at(current_dirac_ptid); 87 138176 : outflow *= _test[_i][_qp] * _sink_func.sample(ptqp()) * _weight->at(current_dirac_ptid); 88 : }