| 1 | /**
|
|---|
| 2 | * @file discretization_poisson_fd.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 13:01:40 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Finite difference discretization of the
|
|---|
| 7 | * Poisson equation.
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | #ifndef DISCRETIZATION_POISSON_FD_HPP_
|
|---|
| 12 | #define DISCRETIZATION_POISSON_FD_HPP_
|
|---|
| 13 |
|
|---|
| 14 | #include "base/discretization.hpp"
|
|---|
| 15 |
|
|---|
| 16 | namespace VMG
|
|---|
| 17 | {
|
|---|
| 18 |
|
|---|
| 19 | static inline vmg_float sqr(const vmg_float& val) {return val*val;}
|
|---|
| 20 |
|
|---|
| 21 | class DiscretizationPoissonFD : public Discretization
|
|---|
| 22 | {
|
|---|
| 23 | public:
|
|---|
| 24 | DiscretizationPoissonFD()
|
|---|
| 25 | {
|
|---|
| 26 | stencil.SetDiag(6.0);
|
|---|
| 27 | stencil.push_back(-1, 0, 0, -1.0);
|
|---|
| 28 | stencil.push_back( 1, 0, 0, -1.0);
|
|---|
| 29 | stencil.push_back( 0, -1, 0, -1.0);
|
|---|
| 30 | stencil.push_back( 0, 1, 0, -1.0);
|
|---|
| 31 | stencil.push_back( 0, 0, -1, -1.0);
|
|---|
| 32 | stencil.push_back( 0, 0, 1, -1.0);
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | vmg_float OperatorPrefactor(const Grid& grid) const
|
|---|
| 36 | {
|
|---|
| 37 | return 1.0 / (sqr(grid.MeshWidth()));
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | private:
|
|---|
| 41 | void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {}
|
|---|
| 42 | };
|
|---|
| 43 |
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | #endif /* DISCRETIZATION_POISSON_FD_HPP_ */
|
|---|