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 123 : PorousFlowHalfCubicSink::validParams() 17 : { 18 123 : InputParameters params = PorousFlowSinkPTDefiner::validParams(); 19 246 : 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 246 : 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 246 : params.addRequiredParam<Real>( 30 : "center", "Center of the cubic flux multiplier (measured in Pa (or K for temperature BCs))."); 31 123 : params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by " 32 : "PorousFlowSink is multiplied by a cubic."); 33 123 : return params; 34 0 : } 35 : 36 66 : PorousFlowHalfCubicSink::PorousFlowHalfCubicSink(const InputParameters & parameters) 37 : : PorousFlowSinkPTDefiner(parameters), 38 66 : _maximum(getParam<Real>("max")), 39 66 : _cutoff(getFunction("cutoff")), 40 198 : _center(getParam<Real>("center")) 41 : { 42 66 : } 43 : 44 : Real 45 535168 : PorousFlowHalfCubicSink::multiplier() const 46 : { 47 535168 : const Real x = ptVar() - _center; 48 : 49 535168 : if (x >= 0) 50 90488 : return PorousFlowSink::multiplier() * _maximum; 51 : 52 444680 : const Real cutoff = _cutoff.value(_t, _q_point[_qp]); 53 444680 : if (x <= cutoff) 54 : return 0.0; 55 : 56 218436 : return PorousFlowSink::multiplier() * _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / 57 218436 : Utility::pow<3>(cutoff); 58 : } 59 : 60 : Real 61 48320 : PorousFlowHalfCubicSink::dmultiplier_dvar(unsigned int pvar) const 62 : { 63 48320 : const Real x = ptVar() - _center; 64 : 65 48320 : if (x >= 0) 66 6996 : return PorousFlowSink::dmultiplier_dvar(pvar) * _maximum; 67 : 68 41324 : const Real cutoff = _cutoff.value(_t, _q_point[_qp]); 69 41324 : if (x <= cutoff) 70 : return 0.0; 71 : 72 : const Real str = 73 19112 : _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / Utility::pow<3>(cutoff); 74 19112 : const Real deriv = _maximum * 6 * x * (x - cutoff) / Utility::pow<3>(cutoff); 75 19112 : return PorousFlowSink::dmultiplier_dvar(pvar) * str + 76 19112 : PorousFlowSink::multiplier() * deriv * dptVar(pvar); 77 : }