/** * @file discretization_poisson_fd_collatz.hpp * @author Julian Iseringhausen * @date Mon Apr 18 13:02:26 2011 * * @brief Collatz finite difference discretization of the * Poisson equation for a higher order discretization * while preserving compactness of the stencil. * */ #ifndef DISCRETIZATION_POISSON_FD_COLLATZ_HPP_ #define DISCRETIZATION_POISSON_FD_COLLATZ_HPP_ #include "base/discretization.hpp" namespace VMG { class DiscretizationPoissonFDCollatz : public Discretization { public: DiscretizationPoissonFDCollatz() { stencil.SetDiag(24.0/6.0); stencil.push_back(-1, 0, 0, -2.0/6.0); stencil.push_back( 1, 0, 0, -2.0/6.0); stencil.push_back( 0, -1, 0, -2.0/6.0); stencil.push_back( 0, 1, 0, -2.0/6.0); stencil.push_back( 0, 0, -1, -2.0/6.0); stencil.push_back( 0, 0, 1, -2.0/6.0); stencil.push_back(-1, -1, 0, -1.0/6.0); stencil.push_back(-1, 1, 0, -1.0/6.0); stencil.push_back( 1, -1, 0, -1.0/6.0); stencil.push_back( 1, 1, 0, -1.0/6.0); stencil.push_back(-1, 0, -1, -1.0/6.0); stencil.push_back(-1, 0, 1, -1.0/6.0); stencil.push_back( 1, 0, -1, -1.0/6.0); stencil.push_back( 1, 0, 1, -1.0/6.0); stencil.push_back( 0, -1, -1, -1.0/6.0); stencil.push_back( 0, -1, 1, -1.0/6.0); stencil.push_back( 0, 1, -1, -1.0/6.0); stencil.push_back( 0, 1, 1, -1.0/6.0); } vmg_float OperatorPrefactor(const Grid& grid) const { return 1.0 / Helper::pow_2(grid.Extent().MeshWidth().Max()); } private: void SetInnerBoundaryCompute(Grid& sol_fine, Grid& rhs_fine, Grid& sol_coarse) const {} }; class StencilPoissonCollatzRhs : public Stencil { public: StencilPoissonCollatzRhs() : Stencil(0.5) { this->push_back(-1, 0, 0, 1.0/12.0); this->push_back( 1, 0, 0, 1.0/12.0); this->push_back( 0, -1, 0, 1.0/12.0); this->push_back( 0, 1, 0, 1.0/12.0); this->push_back( 0, 0, -1, 1.0/12.0); this->push_back( 0, 0, 1, 1.0/12.0); } }; } #endif /* DISCRETIZATION_POISSON_FD_HPP_ */