source: src/samples/discretization_poisson_fd_collatz.hpp@ 66f24d

Last change on this file since 66f24d was 48b662, checked in by Olaf Lenz <olenz@…>, 14 years ago

Moved files in scafacos_fcs one level up.

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

  • Property mode set to 100644
File size: 2.4 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
13#ifndef DISCRETIZATION_POISSON_FD_COLLATZ_HPP_
14#define DISCRETIZATION_POISSON_FD_COLLATZ_HPP_
15
16#include "base/discretization.hpp"
17
18namespace VMG
19{
20
21static inline vmg_float sqr(const vmg_float& val) {return val*val;}
22
23class DiscretizationPoissonFDCollatz : public Discretization
24{
25public:
26 DiscretizationPoissonFDCollatz()
27 {
28 stencil.SetDiag(24.0/6.0);
29
30 stencil.push_back(Displacement(-1, 0, 0, -2.0/6.0));
31 stencil.push_back(Displacement( 1, 0, 0, -2.0/6.0));
32 stencil.push_back(Displacement( 0, -1, 0, -2.0/6.0));
33 stencil.push_back(Displacement( 0, 1, 0, -2.0/6.0));
34 stencil.push_back(Displacement( 0, 0, -1, -2.0/6.0));
35 stencil.push_back(Displacement( 0, 0, 1, -2.0/6.0));
36
37 stencil.push_back(Displacement(-1, -1, 0, -1.0/6.0));
38 stencil.push_back(Displacement(-1, 1, 0, -1.0/6.0));
39 stencil.push_back(Displacement( 1, -1, 0, -1.0/6.0));
40 stencil.push_back(Displacement( 1, 1, 0, -1.0/6.0));
41 stencil.push_back(Displacement(-1, 0, -1, -1.0/6.0));
42 stencil.push_back(Displacement(-1, 0, 1, -1.0/6.0));
43 stencil.push_back(Displacement( 1, 0, -1, -1.0/6.0));
44 stencil.push_back(Displacement( 1, 0, 1, -1.0/6.0));
45 stencil.push_back(Displacement( 0, -1, -1, -1.0/6.0));
46 stencil.push_back(Displacement( 0, -1, 1, -1.0/6.0));
47 stencil.push_back(Displacement( 0, 1, -1, -1.0/6.0));
48 stencil.push_back(Displacement( 0, 1, 1, -1.0/6.0));
49 }
50
51 vmg_float OperatorPrefactor(const Multigrid& grid) const
52 {
53 return 1.0 / (sqr(grid.MeshWidth()));
54 }
55
56private:
57 void SetInnerBoundaryCompute(Multigrid& grid) const {}
58};
59
60class StencilPoissonCollatzRhs : public Stencil
61{
62public:
63 StencilPoissonCollatzRhs() : Stencil(0.5)
64 {
65 this->push_back(Displacement(-1, 0, 0, 1.0/12.0));
66 this->push_back(Displacement( 1, 0, 0, 1.0/12.0));
67 this->push_back(Displacement( 0, -1, 0, 1.0/12.0));
68 this->push_back(Displacement( 0, 1, 0, 1.0/12.0));
69 this->push_back(Displacement( 0, 0, -1, 1.0/12.0));
70 this->push_back(Displacement( 0, 0, 1, 1.0/12.0));
71 }
72};
73
74}
75
76#endif /* DISCRETIZATION_POISSON_FD_HPP_ */
Note: See TracBrowser for help on using the repository browser.