Mimetic Operators Library Enhanced 4.0
Loading...
Searching...
No Matches
RobinBC Class Reference

Mimetic Robin Boundary Condition operator. More...

#include <robinbc.h>

Inheritance diagram for RobinBC:

Public Member Functions

 RobinBC (u16 k, u32 m, Real dx, Real a, Real b)
 1-D Robin boundary constructor
 
 RobinBC (u16 k, u32 m, Real dx, u32 n, Real dy, Real a, Real b)
 2-D Robin boundary constructor
 
 RobinBC (u16 k, u32 m, Real dx, u32 n, Real dy, u32 o, Real dz, Real a, Real b)
 3-D Robin boundary constructor
 

Detailed Description

Mimetic Robin Boundary Condition operator.

Definition at line 23 of file robinbc.h.

Constructor & Destructor Documentation

◆ RobinBC() [1/3]

RobinBC::RobinBC ( u16 k,
u32 m,
Real dx,
Real a,
Real b )

1-D Robin boundary constructor

Parameters
kmimetic order of accuracy
mnumber of cells in x-dimension
dxcell width in x-direction
aCoefficient of the Dirichlet function
bCoefficient of the Neumann function

Definition at line 16 of file robinbc.cpp.

16 {
17 sp_mat A(m + 2, m + 2);
18 sp_mat BG(m + 2, m + 2);
19
20 A.at(0, 0) = a;
21 A.at(m + 1, m + 1) = a;
22
23 Gradient grad(k, m, dx);
24
25 BG.row(0) = -b * grad.row(0);
26 BG.row(m + 1) = b * grad.row(m);
27
28 *this = A + BG;
29}

◆ RobinBC() [2/3]

RobinBC::RobinBC ( u16 k,
u32 m,
Real dx,
u32 n,
Real dy,
Real a,
Real b )

2-D Robin boundary constructor

Parameters
kmimetic order of accuracy
mnumber of cells in x-dimension
dxcell width in x-direction
nnumber of cells in y-dimension
dycell width in y-direction
aCoefficient of the Dirichlet function
bCoefficient of the Neumann function
Note
Uses 1-D Robin to build the 2-D operator

Definition at line 32 of file robinbc.cpp.

32 {
33 RobinBC Bm(k, m, dx, a, b);
34 RobinBC Bn(k, n, dy, a, b);
35
36 sp_mat Im = speye(m + 2, m + 2);
37 sp_mat In = speye(n + 2, n + 2);
38
39 In.at(0, 0) = 0;
40 In.at(n + 1, n + 1) = 0;
41
42 sp_mat BC1 = Utils::spkron(In, Bm);
43 sp_mat BC2 = Utils::spkron(Bn, Im);
44
45 *this = BC1 + BC2;
46}
RobinBC(u16 k, u32 m, Real dx, Real a, Real b)
1-D Robin boundary constructor
Definition robinbc.cpp:16
static sp_mat spkron(const sp_mat &A, const sp_mat &B)
A wrappper for implementing a sparse Kroenecker product.
Definition utils.cpp:70

◆ RobinBC() [3/3]

RobinBC::RobinBC ( u16 k,
u32 m,
Real dx,
u32 n,
Real dy,
u32 o,
Real dz,
Real a,
Real b )

3-D Robin boundary constructor

Parameters
kmimetic order of accuracy
mnumber of cells in x-dimension
dxcell width in x-direction
nnumber of cells in y-dimension
dycell width in y-direction
onumber of cells in z-dimension
dzcell width in z-direction
aCoefficient of the Dirichlet function
bCoefficient of the Neumann function
Note
Uses 1-D Robin to build the 3-D operator

Definition at line 49 of file robinbc.cpp.

50 {
51 RobinBC Bm(k, m, dx, a, b);
52 RobinBC Bn(k, n, dy, a, b);
53 RobinBC Bo(k, o, dz, a, b);
54
55 sp_mat Im = speye(m + 2, m + 2);
56 sp_mat In = speye(n + 2, n + 2);
57 sp_mat Io = speye(o + 2, o + 2);
58
59 Io.at(0, 0) = 0;
60 Io.at(o + 1, o + 1) = 0;
61
62 sp_mat In2 = In;
63 In2.at(0, 0) = 0;
64 In2.at(n + 1, n + 1) = 0;
65
66 sp_mat BC1 = Utils::spkron(Utils::spkron(Io, In2), Bm);
67 sp_mat BC2 = Utils::spkron(Utils::spkron(Io, Bn), Im);
68 sp_mat BC3 = Utils::spkron(Utils::spkron(Bo, In), Im);
69
70 *this = BC1 + BC2 + BC3;
71}

The documentation for this class was generated from the following files: