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 : #pragma once 11 : 12 : #include "FunctionIC.h" 13 : 14 : /** 15 : * Initial conditions specifying an initial condition as a general function 16 : * while preserving a total integral magnitude. 17 : */ 18 : class IntegralPreservingFunctionIC : public FunctionIC 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : IntegralPreservingFunctionIC(const InputParameters & parameters); 24 : 25 : virtual void initialSetup() override; 26 : 27 : /** 28 : * @returns The magnitude of the function 29 : */ 30 4028 : Real magnitude() const { return _magnitude; } 31 : 32 : protected: 33 : virtual Real value(const Point & p) override; 34 : 35 : /// Name of postprocessor providing the integral of the function 36 : const PostprocessorName & _pp_name; 37 : 38 : /// Integral of the function 39 : const PostprocessorValue & _integral; 40 : 41 : /// Magnitude of the initial condition upon integration 42 : const Real & _magnitude; 43 : };