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 "FVInitialConditionBase.h" 13 : #include "MooseVariableFEBase.h" 14 : 15 : // libMesh 16 : #include "libmesh/point.h" 17 : #include "libmesh/vector_value.h" 18 : #include "libmesh/elem.h" 19 : 20 : // forward declarations 21 : class FEProblemBase; 22 : template <typename> 23 : class MooseVariableField; 24 : 25 : /** 26 : * This is a template class that implements the workhorse `compute` and `computeNodal` methods. The 27 : * former method is used for setting block initial conditions. It first projects the initial 28 : * condition field to nodes, then to edges, then to faces, then to interior dofs. The latter 29 : * `computeNodal` method sets dof values for boundary restricted initial conditions 30 : */ 31 : template <typename T> 32 : class FVInitialConditionTempl : public FVInitialConditionBase 33 : { 34 : public: 35 : /** 36 : * Constructor 37 : * 38 : * @param parameters The parameters object holding data for the class to use. 39 : */ 40 : FVInitialConditionTempl(const InputParameters & parameters); 41 : 42 : virtual ~FVInitialConditionTempl(); 43 : 44 : static InputParameters validParams(); 45 : 46 : virtual MooseVariableFEBase & variable() override; 47 : 48 : virtual void computeElement(const ElemInfo & elem_info) override; 49 : 50 : /** 51 : * The value of the variable at a point. 52 : * 53 : * This must be overridden by derived classes. 54 : */ 55 : virtual T value(const Point & p) = 0; 56 : 57 : protected: 58 : FEProblemBase & _fe_problem; 59 : THREAD_ID _tid; 60 : 61 : /// Time 62 : Real & _t; 63 : 64 : /// The variable that this initial condition is acting upon. 65 : MooseVariableField<T> & _base_var; 66 : 67 : /// the mesh dimension 68 : unsigned int _dim; 69 : }; 70 : 71 : template <typename T> 72 : InputParameters 73 33639 : FVInitialConditionTempl<T>::validParams() 74 : { 75 33639 : return FVInitialConditionBase::validParams(); 76 : } 77 : 78 : typedef FVInitialConditionTempl<Real> FVInitialCondition; 79 : 80 : // Prevent implicit instantiation in other translation units where these classes are used 81 : extern template class FVInitialConditionTempl<Real>;