| 1 | /**
|
|---|
| 2 | * @file discretization_poisson_fd_collatz.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Apr 18 13:02:26 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Collatz finite difference discretization of the
|
|---|
| 7 | * Poisson equation for a higher order discretization
|
|---|
| 8 | * while preserving compactness of the stencil.
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #ifndef DISCRETIZATION_POISSON_FD_COLLATZ_HPP_
|
|---|
| 13 | #define DISCRETIZATION_POISSON_FD_COLLATZ_HPP_
|
|---|
| 14 |
|
|---|
| 15 | #include "base/discretization.hpp"
|
|---|
| 16 |
|
|---|
| 17 | namespace VMG
|
|---|
| 18 | {
|
|---|
| 19 |
|
|---|
| 20 | class DiscretizationPoissonFDCollatz : public Discretization
|
|---|
| 21 | {
|
|---|
| 22 | public:
|
|---|
| 23 | DiscretizationPoissonFDCollatz()
|
|---|
| 24 | {
|
|---|
| 25 | stencil.SetDiag(24.0/6.0);
|
|---|
| 26 |
|
|---|
| 27 | stencil.push_back(-1, 0, 0, -2.0/6.0);
|
|---|
| 28 | stencil.push_back( 1, 0, 0, -2.0/6.0);
|
|---|
| 29 | stencil.push_back( 0, -1, 0, -2.0/6.0);
|
|---|
| 30 | stencil.push_back( 0, 1, 0, -2.0/6.0);
|
|---|
| 31 | stencil.push_back( 0, 0, -1, -2.0/6.0);
|
|---|
| 32 | stencil.push_back( 0, 0, 1, -2.0/6.0);
|
|---|
| 33 |
|
|---|
| 34 | stencil.push_back(-1, -1, 0, -1.0/6.0);
|
|---|
| 35 | stencil.push_back(-1, 1, 0, -1.0/6.0);
|
|---|
| 36 | stencil.push_back( 1, -1, 0, -1.0/6.0);
|
|---|
| 37 | stencil.push_back( 1, 1, 0, -1.0/6.0);
|
|---|
| 38 | stencil.push_back(-1, 0, -1, -1.0/6.0);
|
|---|
| 39 | stencil.push_back(-1, 0, 1, -1.0/6.0);
|
|---|
| 40 | stencil.push_back( 1, 0, -1, -1.0/6.0);
|
|---|
| 41 | stencil.push_back( 1, 0, 1, -1.0/6.0);
|
|---|
| 42 | stencil.push_back( 0, -1, -1, -1.0/6.0);
|
|---|
| 43 | stencil.push_back( 0, -1, 1, -1.0/6.0);
|
|---|
| 44 | stencil.push_back( 0, 1, -1, -1.0/6.0);
|
|---|
| 45 | stencil.push_back( 0, 1, 1, -1.0/6.0);
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | vmg_float OperatorPrefactor(const Grid& grid) const
|
|---|
| 49 | {
|
|---|
| 50 | return 1.0 / Helper::pow_2(grid.Extent().MeshWidth().Max());
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | private:
|
|---|
| 54 | void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {}
|
|---|
| 55 | };
|
|---|
| 56 |
|
|---|
| 57 | class StencilPoissonCollatzRhs : public Stencil
|
|---|
| 58 | {
|
|---|
| 59 | public:
|
|---|
| 60 | StencilPoissonCollatzRhs() :
|
|---|
| 61 | Stencil(0.5)
|
|---|
| 62 | {
|
|---|
| 63 | this->push_back(-1, 0, 0, 1.0/12.0);
|
|---|
| 64 | this->push_back( 1, 0, 0, 1.0/12.0);
|
|---|
| 65 | this->push_back( 0, -1, 0, 1.0/12.0);
|
|---|
| 66 | this->push_back( 0, 1, 0, 1.0/12.0);
|
|---|
| 67 | this->push_back( 0, 0, -1, 1.0/12.0);
|
|---|
| 68 | this->push_back( 0, 0, 1, 1.0/12.0);
|
|---|
| 69 | }
|
|---|
| 70 | };
|
|---|
| 71 |
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | #endif /* DISCRETIZATION_POISSON_FD_HPP_ */
|
|---|