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 "PorousFlowHalfCubicSink.h" 11 : #include "libmesh/utility.h" 12 : 13 : registerMooseObject("PorousFlowApp", PorousFlowHalfCubicSink); 14 : 15 : InputParameters 16 193 : PorousFlowHalfCubicSink::validParams() 17 : { 18 193 : InputParameters params = PorousFlowSinkPTDefiner::validParams(); 19 386 : params.addRequiredParam<Real>( 20 : "max", 21 : "Maximum of the cubic flux multiplier. Denote x = porepressure - center (or in the " 22 : "case of a heat flux with no fluid, x = temperature - center). Then Flux out is " 23 : "multiplied by (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cutoff < x < 0. Flux " 24 : "out is multiplied by max for x >= 0. Flux out is multiplied by 0 for x <= cutoff."); 25 386 : params.addRequiredParam<FunctionName>("cutoff", 26 : "Cutoff of the cubic (measured in Pa (or K for " 27 : "temperature BCs)). This needs to be less than " 28 : "zero."); 29 386 : params.addRequiredParam<Real>( 30 : "center", "Center of the cubic flux multiplier (measured in Pa (or K for temperature BCs))."); 31 193 : params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by " 32 : "PorousFlowSink is multiplied by a cubic."); 33 193 : return params; 34 0 : } 35 : 36 110 : PorousFlowHalfCubicSink::PorousFlowHalfCubicSink(const InputParameters & parameters) 37 : : PorousFlowSinkPTDefiner(parameters), 38 110 : _maximum(getParam<Real>("max")), 39 110 : _cutoff(getFunction("cutoff")), 40 330 : _center(getParam<Real>("center")) 41 : { 42 110 : } 43 : 44 : Real 45 763840 : PorousFlowHalfCubicSink::multiplier() const 46 : { 47 763840 : const Real x = ptVar() - _center; 48 : 49 763840 : if (x >= 0) 50 125536 : return PorousFlowSink::multiplier() * _maximum; 51 : 52 638304 : const Real cutoff = _cutoff.value(_t, _q_point[_qp]); 53 638304 : if (x <= cutoff) 54 : return 0.0; 55 : 56 308572 : return PorousFlowSink::multiplier() * _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / 57 308572 : Utility::pow<3>(cutoff); 58 : } 59 : 60 : Real 61 70624 : PorousFlowHalfCubicSink::dmultiplier_dvar(unsigned int pvar) const 62 : { 63 70624 : const Real x = ptVar() - _center; 64 : 65 70624 : if (x >= 0) 66 10008 : return PorousFlowSink::dmultiplier_dvar(pvar) * _maximum; 67 : 68 60616 : const Real cutoff = _cutoff.value(_t, _q_point[_qp]); 69 60616 : if (x <= cutoff) 70 : return 0.0; 71 : 72 : const Real str = 73 27760 : _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / Utility::pow<3>(cutoff); 74 27760 : const Real deriv = _maximum * 6 * x * (x - cutoff) / Utility::pow<3>(cutoff); 75 27760 : return PorousFlowSink::dmultiplier_dvar(pvar) * str + 76 27760 : PorousFlowSink::multiplier() * deriv * dptVar(pvar); 77 : }