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 "InitialConditionInterface.h" 13 : #include "MooseObject.h" 14 : #include "ScalarCoupleable.h" 15 : #include "FunctionInterface.h" 16 : #include "UserObjectInterface.h" 17 : #include "DependencyResolverInterface.h" 18 : 19 : class FeProblem; 20 : class SystemBase; 21 : class Assembly; 22 : class MooseVariableScalar; 23 : 24 : namespace libMesh 25 : { 26 : template <typename T> 27 : class DenseVector; 28 : } 29 : 30 : /** 31 : * InitialConditions are objects that set the initial value of variables. 32 : */ 33 : class ScalarInitialCondition : public MooseObject, 34 : public InitialConditionInterface, 35 : public ScalarCoupleable, 36 : public FunctionInterface, 37 : public UserObjectInterface, 38 : public DependencyResolverInterface 39 : { 40 : public: 41 : /** 42 : * Constructor 43 : * 44 : * @param parameters The parameters object holding data for the class to use. 45 : */ 46 : ScalarInitialCondition(const InputParameters & parameters); 47 : 48 : virtual ~ScalarInitialCondition(); 49 : 50 : static InputParameters validParams(); 51 : 52 1073 : MooseVariableScalar & variable() { return _var; } 53 : 54 : /** 55 : * Compute the initial condition 56 : */ 57 : virtual void compute(DenseVector<Number> & vals); 58 : 59 : /** 60 : * The value of the variable. 61 : * 62 : * This must be overridden by derived classes. 63 : */ 64 : virtual Real value() = 0; 65 : 66 : /** 67 : * Gets called at the beginning of the simulation before this object is asked to do its job. 68 : * Note: This method is normally inherited from SetupInterface. However in this case it makes 69 : * no sense to inherit the other virtuals available in that class so we are adding this virtual 70 : * directly to this class with out the extra inheritance. 71 : */ 72 1459 : virtual void initialSetup() {} 73 : 74 : virtual const std::set<std::string> & getRequestedItems(); 75 : 76 : virtual const std::set<std::string> & getSuppliedItems(); 77 : 78 : protected: 79 : FEProblemBase & _fe_problem; 80 : SystemBase & _sys; 81 : THREAD_ID _tid; 82 : 83 : /// Time 84 : Real & _t; 85 : 86 : /// Scalar variable this initial condition works on 87 : MooseVariableScalar & _var; 88 : 89 : /// The finite element/volume assembly object 90 : Assembly & _assembly; 91 : 92 : unsigned int _i; 93 : 94 : std::set<std::string> _depend_vars; 95 : std::set<std::string> _supplied_vars; 96 : };