source: src/samples/discretization_poisson_fd_collatz.hpp@ d24c2f

Last change on this file since d24c2f was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 2.1 KB
Line 
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
17namespace VMG
18{
19
20class DiscretizationPoissonFDCollatz : public Discretization
21{
22public:
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 Multigrid& grid) const
49 {
50 return 1.0 / (sqr(grid.MeshWidth()));
51 }
52
53private:
54 void SetInnerBoundaryCompute(Multigrid& grid) const {}
55};
56
57class StencilPoissonCollatzRhs : public Stencil
58{
59public:
60 StencilPoissonCollatzRhs() : Stencil(0.5)
61 {
62 this->push_back(Displacement(-1, 0, 0, 1.0/12.0));
63 this->push_back(Displacement( 1, 0, 0, 1.0/12.0));
64 this->push_back(Displacement( 0, -1, 0, 1.0/12.0));
65 this->push_back(Displacement( 0, 1, 0, 1.0/12.0));
66 this->push_back(Displacement( 0, 0, -1, 1.0/12.0));
67 this->push_back(Displacement( 0, 0, 1, 1.0/12.0));
68 }
69};
70
71}
72
73#endif /* DISCRETIZATION_POISSON_FD_HPP_ */
Note: See TracBrowser for help on using the repository browser.