PRISMS-PF Manual v3.0-pre
Loading...
Searching...
No Matches
initialConditions.h
1#ifndef INCLUDE_INITIALCONDITIONS_H_
2#define INCLUDE_INITIALCONDITIONS_H_
3
4#include <core/matrixFreePDE.h>
5#include <core/userInputParameters.h>
6
7template <int dim, int degree>
8class InitialCondition : public dealii::Function<dim>
9{
10public:
11 const unsigned int index;
12 const userInputParameters<dim> userInputs;
13 dealii::Vector<double> values;
14
15 InitialCondition(const unsigned int _index,
16 const userInputParameters<dim> _userInputs,
17 MatrixFreePDE<dim, degree> *_matrix_free_pde)
18 : dealii::Function<dim>(1)
19 , index(_index)
20 , userInputs(_userInputs)
21 , matrix_free_pde(_matrix_free_pde)
22 {
23 std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) + 1);
24 }
25
26 // IC for scalar values
27 [[nodiscard]] double
28 value(const dealii::Point<dim> &p,
29 [[maybe_unused]] const unsigned int component = 0) const override
30 {
31 double scalar_IC = 0.0;
32 dealii::Vector<double> vector_IC(dim);
33
34 matrix_free_pde->setInitialCondition(p, index, scalar_IC, vector_IC);
35 return scalar_IC;
36 };
37
38private:
39 MatrixFreePDE<dim, degree> *matrix_free_pde;
40};
41
42template <int dim, int degree>
43class InitialConditionVector : public dealii::Function<dim>
44{
45public:
46 const unsigned int index;
47 const userInputParameters<dim> userInputs;
48 dealii::Vector<double> values;
49
50 InitialConditionVector(const unsigned int _index,
51 const userInputParameters<dim> _userInputs,
52 MatrixFreePDE<dim, degree> *_matrix_free_pde)
53 : dealii::Function<dim>(dim)
54 , index(_index)
55 , userInputs(_userInputs)
56 , matrix_free_pde(_matrix_free_pde)
57 {
58 std::srand(dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) + 1);
59 }
60
61 // IC for vector values
62 void
63 vector_value(const dealii::Point<dim> &p,
64 dealii::Vector<double> &vector_IC) const override
65 {
66 double scalar_IC = 0.0;
67 vector_IC.reinit(dim);
68 matrix_free_pde->setInitialCondition(p, index, scalar_IC, vector_IC);
69 };
70
71private:
72 MatrixFreePDE<dim, degree> *matrix_free_pde;
73};
74
75#endif
Definition initialConditions.h:44
Definition initialConditions.h:9
This is the abstract base class for the matrix free implementation of parabolic and elliptic BVP's,...
Definition matrixFreePDE.h:54
Definition userInputParameters.h:47