Discontinuous Galerkin Library
#include "dg/algorithm.h"
derivatives.h
Go to the documentation of this file.
1#pragma once
2
3#include "grid.h"
4#include "dx.h"
5
10namespace dg{
11
12
16namespace create{
17
20
21//dx, dy, jumpX, jumpY
22
32template<class real_type>
34{
36 dx = dx_normed( g.nx(), g.Nx(), g.hx(), bcx, dir);
37 dx.set_left_size( g.ny()*g.Ny());
38 return dx;
39}
40
50template<class real_type>
52 return dx( g, g.bcx(), dir);
53}
54
64template<class real_type>
66{
68 dy = dx_normed( g.ny(), g.Ny(), g.hy(), bcy, dir);
69 dy.set_right_size( g.nx()*g.Nx());
70 return dy;
71}
72
81template<class real_type>
83 return dy( g, g.bcy(), dir);
84}
85
94template<class real_type>
96{
98 jx = jump( g.nx(), g.Nx(), g.hx(), bcx);
99 jx.set_left_size( g.ny()*g.Ny());
100 return jx;
101}
102
111template<class real_type>
113{
115 jy = jump( g.ny(), g.Ny(), g.hy(), bcy);
116 jy.set_right_size( g.nx()*g.Nx());
117 return jy;
118}
119
127template<class real_type>
129 return jumpX( g, g.bcx());
130}
131
139template<class real_type>
141 return jumpY( g, g.bcy());
142}
143
145//jumpX, jumpY, jumpZ, dx, dy, dz
154template<class real_type>
156{
158 jx = jump( g.nx(), g.Nx(), g.hx(), bcx);
159 jx.set_left_size( g.ny()*g.Ny()*g.nz()*g.Nz());
160 return jx;
161}
162
171template<class real_type>
173{
175 jy = jump( g.ny(), g.Ny(), g.hy(), bcy);
176 jy.set_right_size( g.nx()*g.Nx());
177 jy.set_left_size( g.nz()*g.Nz());
178 return jy;
179}
180
189template<class real_type>
191{
193 jz = jump( g.nz(), g.Nz(), g.hz(), bcz);
194 jz.set_right_size( g.nx()*g.Nx()*g.ny()*g.Ny());
195 return jz;
196}
197
205template<class real_type>
207 return jumpX( g, g.bcx());
208}
209
217template<class real_type>
219 return jumpY( g, g.bcy());
220}
221
229template<class real_type>
231 return jumpZ( g, g.bcz());
232}
233
234
244template<class real_type>
246{
248 dx = dx_normed( g.nx(), g.Nx(), g.hx(), bcx, dir);
249 dx.set_left_size( g.ny()*g.Ny()*g.nz()*g.Nz());
250 return dx;
251}
252
261template<class real_type>
263 return dx( g, g.bcx(), dir);
264}
265
275template<class real_type>
277{
279 dy = dx_normed( g.ny(), g.Ny(), g.hy(), bcy, dir);
280 dy.set_right_size( g.nx()*g.Nx());
281 dy.set_left_size( g.nz()*g.Nz());
282 return dy;
283}
284
293template<class real_type>
295 return dy( g, g.bcy(), dir);
296}
297
307template<class real_type>
309{
311 dz = dx_normed( g.nz(), g.Nz(), g.hz(), bcz, dir);
312 dz.set_right_size( g.nx()*g.ny()*g.Nx()*g.Ny());
313 return dz;
314
315}
316
325template<class real_type>
327 return dz( g, g.bcz(), dir);
328}
329
330
331
333
334} //namespace create
335
336} //namespace dg
337
Simple 1d derivatives.
base topology classes
EllSparseBlockMat< real_type > dz(const aRealTopology3d< real_type > &g, bc bcz, direction dir=centered)
Create 3d derivative in z-direction.
Definition: derivatives.h:308
EllSparseBlockMat< real_type > dx(const aRealTopology2d< real_type > &g, bc bcx, direction dir=centered)
Create 2d derivative in x-direction.
Definition: derivatives.h:33
EllSparseBlockMat< real_type > jumpZ(const aRealTopology3d< real_type > &g, bc bcz)
Matrix that contains jump terms in Z direction in 3D.
Definition: derivatives.h:190
bc
Switch between boundary conditions.
Definition: enums.h:15
EllSparseBlockMat< real_type > jumpX(const aRealTopology2d< real_type > &g, bc bcx)
Matrix that contains 2d jump terms in X direction.
Definition: derivatives.h:95
EllSparseBlockMat< real_type > dy(const aRealTopology2d< real_type > &g, bc bcy, direction dir=centered)
Create 2d derivative in y-direction.
Definition: derivatives.h:65
direction
Direction of a discrete derivative.
Definition: enums.h:97
EllSparseBlockMat< real_type > jumpY(const aRealTopology2d< real_type > &g, bc bcy)
Matrix that contains 2d jump terms in Y direction.
Definition: derivatives.h:112
@ centered
centered derivative (cell to the left and right and current cell)
Definition: enums.h:100
EllSparseBlockMat< real_type > dx_normed(int n, int N, real_type h, bc bcx, direction dir)
Create and assemble a host Matrix for normed derivative in 1d.
Definition: dx.h:402
EllSparseBlockMat< real_type > jump(int n, int N, real_type h, bc bcx)
Create and assemble a host Matrix for the jump terms in 1d.
Definition: dx.h:310
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Ell Sparse Block Matrix format.
Definition: sparseblockmat.h:46
void set_right_size(int new_right_size)
Set right_size = new_right_size; set_default_range();
Definition: sparseblockmat.h:110
void set_left_size(int new_left_size)
Set left_size = new_left_size;
Definition: sparseblockmat.h:115
An abstract base class for two-dimensional grids.
Definition: grid.h:277
real_type hy() const
cell size in y
Definition: grid.h:330
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:340
bc bcx() const
boundary conditions in x
Definition: grid.h:358
real_type hx() const
cell size in x
Definition: grid.h:324
unsigned Nx() const
number of cells in x
Definition: grid.h:346
bc bcy() const
boundary conditions in y
Definition: grid.h:364
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:338
unsigned Ny() const
number of cells in y
Definition: grid.h:352
An abstract base class for three-dimensional grids.
Definition: grid.h:523
unsigned nz() const
number of polynomial coefficients in z
Definition: grid.h:616
bc bcz() const
boundary conditions in z
Definition: grid.h:652
unsigned Nx() const
number of points in x
Definition: grid.h:622
unsigned ny() const
number of polynomial coefficients in y
Definition: grid.h:614
real_type hy() const
cell size in y
Definition: grid.h:598
real_type hx() const
cell size in x
Definition: grid.h:592
unsigned Ny() const
number of points in y
Definition: grid.h:628
bc bcy() const
boundary conditions in y
Definition: grid.h:646
bc bcx() const
boundary conditions in x
Definition: grid.h:640
real_type hz() const
cell size in z
Definition: grid.h:604
unsigned Nz() const
number of points in z
Definition: grid.h:634
unsigned nx() const
number of polynomial coefficients in x
Definition: grid.h:612