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 "Maxwellian.h" 11 : #include "Normal.h" 12 : registerMooseObject("StochasticToolsApp", Maxwellian); 13 : 14 : InputParameters 15 14 : Maxwellian::validParams() 16 : { 17 14 : InputParameters params = Distribution::validParams(); 18 14 : params.addClassDescription("Maxwellian distribution"); 19 28 : params.addRequiredRangeCheckedParam<Real>( 20 : "temperature", "temperature > 0", "The temperature of the distribution in K."); 21 28 : params.addRequiredRangeCheckedParam<Real>( 22 : "mass", "mass > 0", "The mass of the species that are the given temperature in kg."); 23 14 : return params; 24 0 : } 25 : 26 7 : Maxwellian::Maxwellian(const InputParameters & parameters) 27 : : Distribution(parameters), 28 7 : _standard_deviation( 29 28 : Maxwellian::standardDeviation(getParam<Real>("mass"), getParam<Real>("temperature"))) 30 : 31 : { 32 7 : } 33 : 34 : Real 35 7 : Maxwellian::standardDeviation(const Real mass, const Real temperature) 36 : { 37 7 : return std::sqrt(k_B * temperature / mass); 38 : } 39 : 40 : Real 41 0 : Maxwellian::pdf(const Real & x, const Real & mass, const Real & temperature) 42 : { 43 0 : return Normal::pdf(x, 0, standardDeviation(mass, temperature)); 44 : } 45 : 46 : Real 47 0 : Maxwellian::cdf(const Real & x, const Real & mass, const Real & temperature) 48 : { 49 0 : return Normal::cdf(x, 0, standardDeviation(mass, temperature)); 50 : } 51 : 52 : Real 53 0 : Maxwellian::quantile(const Real & p, const Real & mass, const Real & temperature) 54 : { 55 0 : return Normal::quantile(p, 0, standardDeviation(mass, temperature)); 56 : } 57 : 58 : Real 59 7 : Maxwellian::pdf(const Real & x) const 60 : { 61 7 : return Normal::pdf(x, 0, _standard_deviation); 62 : } 63 : 64 : Real 65 7 : Maxwellian::cdf(const Real & x) const 66 : { 67 7 : return Normal::cdf(x, 0, _standard_deviation); 68 : } 69 : 70 : Real 71 7 : Maxwellian::quantile(const Real & p) const 72 : { 73 7 : return Normal::quantile(p, 0, _standard_deviation); 74 : }