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 "PorousFlowHalfGaussianSink.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowHalfGaussianSink); 13 : 14 : InputParameters 15 117 : PorousFlowHalfGaussianSink::validParams() 16 : { 17 117 : InputParameters params = PorousFlowSinkPTDefiner::validParams(); 18 234 : params.addRequiredParam<Real>("max", 19 : "Maximum of the Gaussian flux multiplier. Flux out is " 20 : "multiplied by max*exp((-0.5*(p - center)/sd)^2) for " 21 : "p<center, and by = max for p>center. Here p is the nodal " 22 : "porepressure for the fluid_phase specified (or, for heat " 23 : "fluxes, it is the temperature)."); 24 234 : params.addRequiredParam<Real>("sd", 25 : "Standard deviation of the Gaussian flux multiplier " 26 : "(measured in Pa (or K for heat fluxes))."); 27 234 : params.addRequiredParam<Real>( 28 : "center", "Center of the Gaussian flux multiplier (measured in Pa (or K for heat fluxes))."); 29 117 : params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by " 30 : "PorousFlowSink is multiplied by a Gaussian."); 31 117 : return params; 32 0 : } 33 : 34 66 : PorousFlowHalfGaussianSink::PorousFlowHalfGaussianSink(const InputParameters & parameters) 35 : : PorousFlowSinkPTDefiner(parameters), 36 66 : _maximum(getParam<Real>("max")), 37 132 : _sd(getParam<Real>("sd")), 38 198 : _center(getParam<Real>("center")) 39 : { 40 66 : } 41 : 42 : Real 43 458336 : PorousFlowHalfGaussianSink::multiplier() const 44 : { 45 458336 : if (ptVar() >= _center) 46 276912 : return PorousFlowSink::multiplier() * _maximum; 47 181424 : return PorousFlowSink::multiplier() * _maximum * 48 181424 : std::exp(-0.5 * std::pow((ptVar() - _center) / _sd, 2)); 49 : } 50 : 51 : Real 52 40576 : PorousFlowHalfGaussianSink::dmultiplier_dvar(unsigned int pvar) const 53 : { 54 40576 : if (ptVar() >= _center) 55 26368 : return PorousFlowSink::dmultiplier_dvar(pvar) * _maximum; 56 14208 : const Real str = _maximum * std::exp(-0.5 * std::pow((ptVar() - _center) / _sd, 2)); 57 14208 : return PorousFlowSink::dmultiplier_dvar(pvar) * str + 58 14208 : PorousFlowSink::multiplier() * str * (_center - ptVar()) / std::pow(_sd, 2) * dptVar(pvar); 59 : }