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