OpenFPM_pdata  1.1.0
Project that contain the implementation of distributed structures
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Pages
FDScheme< Sys_eqs > Class Template Reference

Finite Differences. More...

Detailed Description

template<typename Sys_eqs>
class FDScheme< Sys_eqs >

Finite Differences.

This class is able to discretize on a Matrix any system of equations producing a linear system of type \(Ax=b\). In order to create a consistent Matrix it is required that each processor must contain a contiguous range on grid points without holes. In order to ensure this, each processor produce a contiguous local labeling of its local points. Each processor also add an offset equal to the number of local points of the processors with id smaller than him, to produce a global and non overlapping labeling. An example is shown in the figures down, here we have a grid 8x6 divided across four processors each processor label locally its grid points

 *
+--------------------------+
| 1   2   3   4| 1  2  3  4|
|              |           |
| 5   6   7   8| 5  6  7  8|
|              |           |
| 9  10  11  12| 9 10 11 12|
+--------------------------+
|13  14  15| 13 14 15 16 17|
|          |               |
|16  17  18| 18 19 20 21 22|
|          |               |
|19  20  21| 23 24 25 26 27|
+--------------------------+

 *
 *
 * 

To the local relabelling is added an offset to make the local id global and non overlapping

 *
+--------------------------+
| 1   2   3   4|23 24 25 26|
|              |           |
| 5   6   7   8|27 28 29 30|
|              |           |
| 9  10  12  13|31 32 33 34|
+--------------------------+
|14  15  16| 35 36 37 38 39|
|          |               |
|17  18  19| 40 41 42 43 44|
|          |               |
|20  21  22| 45 46 47 48 49|
+--------------------------+
 *
 *
 * 
Template Parameters
Sys_eqsDefinition of the system of equations

Examples

Solve lid-driven cavity 2D for incompressible fluid (inertia=0 –> Re=0)

In this case the system of equation to solve is

\( \left\{ \begin{array}{c} \eta\nabla v_x + \partial_x P = 0 \quad Eq1 \\ \eta\nabla v_y + \partial_y P = 0 \quad Eq2 \\ \partial_x v_x + \partial_y v_y = 0 \quad Eq3 \end{array} \right. \)

and boundary conditions

\( \left\{ \begin{array}{c} v_x = 0, v_y = 0 \quad x = 0 \quad B1\\ v_x = 0, v_y = 1.0 \quad x = L \quad B2\\ v_x = 0, v_y = 0 \quad y = 0 \quad B3\\ v_x = 0, v_y = 0 \quad y = L \quad B4\\ \end{array} \right. \)

with \(v_x\) and \(v_y\) the velocity in x and y and \(P\) Pressure

In order to solve such system first we define the general properties of the system

struct lid_nn
{
// dimensionaly of the equation (2D problem 3D problem ...)
static const unsigned int dims = 2;
// number of fields in the system v_x, v_y, P so a total of 3
static const unsigned int nvar = 3;
// boundary conditions PERIODIC OR NON_PERIODIC
static const bool boundary[];
// type of space float, double, ...
typedef float stype;
// type of base grid, it is the distributed grid that will store the result
// Note the first property is a 2D vector (velocity), the second is a scalar (Pressure)
// type of SparseMatrix, for the linear system, this parameter is bounded by the solver
// that you are using, in case of umfpack it is the only possible choice
typedef SparseMatrix<double,int> SparseMatrix_type;
// type of Vector for the linear system, this parameter is bounded by the solver
// that you are using, in case of umfpack it is the only possible choice
typedef Vector<double> Vector_type;
// Define that the underline grid where we discretize the system of equation is staggered
static const int grid_type = STAGGERED_GRID;
};
const bool lid_nn::boundary[] = {NON_PERIODIC,NON_PERIODIC};

Define the equations of the system

// Constant Field
struct eta
{
typedef void const_field;
static float val() {return 1.0;}
};
// Convenient constants
constexpr unsigned int v[] = {0,1};
constexpr unsigned int P = 2;
constexpr unsigned int ic = 2;
// Create field that we have v_x, v_y, P
typedef Field<v[x],lid_nn> v_x;
typedef Field<v[y],lid_nn> v_y;
typedef Field<P,lid_nn> Prs;
// Eq1 V_x
typedef mul<eta,Lap<v_x,lid_nn>,lid_nn> eta_lap_vx;
typedef D<x,Prs,lid_nn> p_x;
typedef minus<p_x,lid_nn> m_p_x;
// Eq2 V_y
typedef mul<eta,Lap<v_y,lid_nn>,lid_nn> eta_lap_vy;
typedef D<y,Prs,lid_nn> p_y;
typedef minus<p_y,lid_nn> m_p_y;
// Eq3 Incompressibility
// Equation for boundary conditions
/* Consider the staggered cell
*
\verbatim
+--$--+
| |
# * #
| |
0--$--+
# = velocity(y)
$ = velocity(x)
* = pressure
\endverbatim
*
*
* If we want to impose v_y = 0 on 0 we have to interpolate between # of this cell
* and # of the previous cell on y, (Average) or Avg operator
*
*/
// Directional Avg
typedef Avg<x,v_y,lid_nn> avg_vy;
typedef Avg<y,v_x,lid_nn> avg_vx;
typedef Avg<x,v_y,lid_nn,FORWARD> avg_vy_f;
typedef Avg<y,v_x,lid_nn,FORWARD> avg_vx_f;
#define EQ_1 0
#define EQ_2 1
#define EQ_3 2

Define the domain and impose the equations

// velocity in the grid is the property 0, pressure is the property 1
constexpr int velocity = 0;
constexpr int pressure = 1;
// Domain, a rectangle
Box<2,float> domain({0.0,0.0},{3.0,1.0});
// Ghost (Not important in this case but required)
Ghost<2,float> g(0.01);
// Grid points on x=256 and y=64
long int sz[] = {256,64};
size_t szu[2];
szu[0] = (size_t)sz[0];
szu[1] = (size_t)sz[1];
// We need one more point on the left and down part of the domain
// This is given by the boundary conditions that we impose, the
// reason is mathematical in order to have a well defined system
// and cannot be discussed here
Padding<2> pd({1,1},{0,0});
// Distributed grid that store the solution
// It is the maximum extension of the stencil
Ghost<2,long int> stencil_max(1);
// Finite difference scheme
FDScheme<lid_nn> fd(pd, stencil_max, domain,g_dist);
// Here we impose the equation, we start from the incompressibility Eq imposed in the bulk with the
// exception of the first point {0,0} and than we set P = 0 in {0,0}, why we are doing this is again
// mathematical to have a well defined system, an intuitive explanation is that P and P + c are both
// solution for the incompressibility equation, this produce an ill-posed problem to make it well posed
// we set one point in this case {0,0} the pressure to a fixed constant for convenience P = 0
fd.impose(ic_eq(),0.0, EQ_3, {0,0},{sz[0]-2,sz[1]-2},true);
fd.impose(Prs(), 0.0, EQ_3, {0,0},{0,0});
// Here we impose the Eq1 and Eq2
fd.impose(vx_eq(),0.0, EQ_1, {1,0},{sz[0]-2,sz[1]-2});
fd.impose(vy_eq(),0.0, EQ_2, {0,1},{sz[0]-2,sz[1]-2});
// v_x and v_y
// Imposing B1
fd.impose(v_x(),0.0, EQ_1, {0,0},{0,sz[1]-2});
fd.impose(avg_vy_f(),0.0, EQ_2 , {-1,0},{-1,sz[1]-1});
// Imposing B2
fd.impose(v_x(),0.0, EQ_1, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
fd.impose(avg_vy(),1.0, EQ_2, {sz[0]-1,0},{sz[0]-1,sz[1]-1});
// Imposing B3
fd.impose(avg_vx_f(),0.0, EQ_1, {0,-1},{sz[0]-1,-1});
fd.impose(v_y(), 0.0, EQ_2, {0,0},{sz[0]-2,0});
// Imposing B4
fd.impose(avg_vx(),0.0, EQ_1, {0,sz[1]-1},{sz[0]-1,sz[1]-1});
fd.impose(v_y(), 0.0, EQ_2, {0,sz[1]-1},{sz[0]-2,sz[1]-1});
// When we pad the grid, there are points of the grid that are not
// touched by the previous condition. Mathematically this lead
// to have too many variables for the conditions that we are imposing.
// Here we are imposing variables that we do not touch to zero
//
// Padding pressure
fd.impose(Prs(), 0.0, EQ_3, {-1,-1},{sz[0]-1,-1});
fd.impose(Prs(), 0.0, EQ_3, {-1,sz[1]-1},{sz[0]-1,sz[1]-1});
fd.impose(Prs(), 0.0, EQ_3, {-1,0},{-1,sz[1]-2});
fd.impose(Prs(), 0.0, EQ_3, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
// Impose v_x Padding Impose v_y padding
fd.impose(v_x(), 0.0, EQ_1, {-1,-1},{-1,sz[1]-1});
fd.impose(v_y(), 0.0, EQ_2, {-1,-1},{sz[0]-1,-1});
solver_type solver;
auto x = solver.solve(fd.getA(),fd.getB());

3D

A 3D case is given in the examples

Definition at line 124 of file FDScheme.hpp.

#include <FDScheme.hpp>

Data Structures

struct  constant_b
 Encapsulation of the b term as constant. More...
 
struct  grid_b
 Encapsulation of the b term as grid. More...
 
struct  key_and_eq
 Equation id + space position. More...
 

Public Types

typedef grid_dist_id
< Sys_eqs::dims, typename
Sys_eqs::stype, aggregate
< size_t >, typename
Sys_eqs::b_grid::decomposition::extended_type > 
g_map_type
 Distributed grid map.
 
typedef Sys_eqs Sys_eqs_typ
 Type that specify the properties of the system of equations.
 

Public Member Functions

void setStagPos (comb< Sys_eqs::dims >(&sp)[Sys_eqs::nvar])
 set the staggered position for each property More...
 
void computeStag ()
 compute the staggered position for each property More...
 
const Padding< Sys_eqs::dims > & getPadding ()
 Get the specified padding. More...
 
const g_map_typegetMap ()
 Return the map between the grid index position and the position in the distributed vector. More...
 
 FDScheme (const Ghost< Sys_eqs::dims, long int > &stencil, const Box< Sys_eqs::dims, typename Sys_eqs::stype > &domain, const typename Sys_eqs::b_grid &b_g)
 Constructor. More...
 
 gs (b_g.getGridInfoVoid())
 
 g_map (b_g, stencil, pd)
 
 row (0)
 
 row_b (0)
 
 FDScheme (Padding< Sys_eqs::dims > &pd, const Ghost< Sys_eqs::dims, long int > &stencil, const Box< Sys_eqs::dims, typename Sys_eqs::stype > &domain, const typename Sys_eqs::b_grid &b_g)
 Constructor. More...
 
template<typename T >
void impose (const T &op, typename Sys_eqs::stype num, long int id, const long int(&start)[Sys_eqs::dims], const long int(&stop)[Sys_eqs::dims], bool skip_first=false)
 Impose an operator. More...
 
void new_b ()
 In case we want to impose a new b re-using FDScheme we have to call This function.
 
void new_A ()
 In case we want to impose a new A re-using FDScheme we have to call This function. More...
 
template<unsigned int prp, typename b_term , typename iterator >
void impose_dit_b (b_term &b_t, const iterator &it_d, long int id=0)
 Impose an operator. More...
 
template<typename T >
void impose_dit (const T &op, typename Sys_eqs::stype num, long int id, grid_dist_iterator_sub< Sys_eqs::dims, typename g_map_type::d_grid > it_d)
 Impose an operator. More...
 
template<unsigned int prp, typename T , typename b_term , typename iterator >
void impose_dit (const T &op, b_term &b_t, const iterator &it_d, long int id=0)
 Impose an operator. More...
 
Sys_eqs::SparseMatrix_type & getA ()
 produce the Matrix More...
 
Sys_eqs::Vector_type & getB ()
 produce the B vector More...
 
template<unsigned int... pos, typename Vct , typename Grid_dst >
void copy (Vct &v, const long int(&start)[Sys_eqs_typ::dims], const long int(&stop)[Sys_eqs_typ::dims], Grid_dst &g_dst)
 Copy the vector into the grid. More...
 
template<unsigned int... pos, typename Vct , typename Grid_dst >
void copy (Vct &v, Grid_dst &g_dst)
 Copy the vector into the grid. More...
 

Data Fields

Sys_eqs::SparseMatrix_type A
 type of the sparse matrix
 

Private Types

typedef
Sys_eqs::SparseMatrix_type::triplet_type 
triplet
 Sparse matrix triplet type.
 

Private Member Functions

key_and_eq from_row_to_key (size_t row)
 From the row Matrix position to the spatial position. More...
 
const std::vector< size_t > padding (const size_t(&sz)[Sys_eqs::dims], Padding< Sys_eqs::dims > &pd)
 calculate the mapping grid size with padding More...
 
void consistency ()
 Check if the Matrix is consistent. More...
 
template<typename Vct , typename Grid_dst , unsigned int... pos>
void copy_staggered (Vct &v, Grid_dst &g_dst)
 Copy a given solution vector in a staggered grid. More...
 
template<typename Vct , typename Grid_dst , unsigned int... pos>
void copy_normal (Vct &v, Grid_dst &g_dst)
 Copy a given solution vector in a normal grid. More...
 
template<typename bop , typename iterator >
void impose_dit_b (bop num, long int id, const iterator &it_d)
 Impose an operator. More...
 
template<typename T , typename bop , typename iterator >
void impose_dit (const T &op, bop num, long int id, const iterator &it_d)
 Impose an operator. More...
 
template<typename T , typename bop , typename iterator >
void impose_git (const T &op, bop num, long int id, const iterator &it_d)
 Impose an operator. More...
 
void construct_gmap ()
 Construct the gmap structure. More...
 
void Initialize (const Box< Sys_eqs::dims, typename Sys_eqs::stype > &domain)
 

Private Attributes

Padding< Sys_eqs::dims > pd
 Padding.
 
Sys_eqs::Vector_type b
 Vector b.
 
const grid_sm< Sys_eqs::dims,
void > & 
gs
 Domain Grid informations.
 
Sys_eqs::stype spacing [Sys_eqs::dims]
 Get the grid spacing.
 
g_map_type g_map
 mapping grid
 
size_t row
 row of the matrix
 
size_t row_b
 row on b
 
openfpm::vector< size_t > pnt
 Grid points that has each processor.
 
comb< Sys_eqs::dims > s_pos [Sys_eqs::nvar]
 Staggered position for each property.
 
size_t s_pnt
 

Constructor & Destructor Documentation

template<typename Sys_eqs>
FDScheme< Sys_eqs >::FDScheme ( const Ghost< Sys_eqs::dims, long int > &  stencil,
const Box< Sys_eqs::dims, typename Sys_eqs::stype > &  domain,
const typename Sys_eqs::b_grid &  b_g 
)
inline

Constructor.

The periodicity is given by the grid b_g

Parameters
stencilmaximum extension of the stencil on each directions
domainthe domain
b_gobject grid that will store the solution

Definition at line 773 of file FDScheme.hpp.

template<typename Sys_eqs>
FDScheme< Sys_eqs >::FDScheme ( Padding< Sys_eqs::dims > &  pd,
const Ghost< Sys_eqs::dims, long int > &  stencil,
const Box< Sys_eqs::dims, typename Sys_eqs::stype > &  domain,
const typename Sys_eqs::b_grid &  b_g 
)
inline

Constructor.

The periodicity is given by the grid b_g

Parameters
pdPadding, how many points out of boundary are present
stencilmaximum extension of the stencil on each directions
domainthe domain
b_gobject grid that will store the solution

Definition at line 791 of file FDScheme.hpp.

Member Function Documentation

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::computeStag ( )
inline

compute the staggered position for each property

This is compute from the value_type stored by Sys_eqs::b_grid::value_type the position of the staggered properties

Definition at line 731 of file FDScheme.hpp.

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::consistency ( )
inlineprivate

Check if the Matrix is consistent.

Definition at line 295 of file FDScheme.hpp.

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::construct_gmap ( )
inlineprivate

Construct the gmap structure.

Definition at line 644 of file FDScheme.hpp.

template<typename Sys_eqs>
template<unsigned int... pos, typename Vct , typename Grid_dst >
void FDScheme< Sys_eqs >::copy ( Vct &  v,
const long int(&)  start[Sys_eqs_typ::dims],
const long int(&)  stop[Sys_eqs_typ::dims],
Grid_dst &  g_dst 
)
inline

Copy the vector into the grid.

Copy the solution into the grid

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Template Parameters
schemeDiscretization scheme
Grid_dsttype of the target grid
postarget properties
Parameters
vVector that contain the solution of the system
startpoint
stoppoint
g_dstDestination grid

Definition at line 992 of file FDScheme.hpp.

template<typename Sys_eqs>
template<unsigned int... pos, typename Vct , typename Grid_dst >
void FDScheme< Sys_eqs >::copy ( Vct &  v,
Grid_dst &  g_dst 
)
inline

Copy the vector into the grid.

Copy the solution into the grid

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Template Parameters
schemeDiscretization scheme
Grid_dsttype of the target grid
postarget properties
Parameters
vVector that contain the solution of the system
g_dstDestination grid

Definition at line 1040 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename Vct , typename Grid_dst , unsigned int... pos>
void FDScheme< Sys_eqs >::copy_normal ( Vct &  v,
Grid_dst &  g_dst 
)
inlineprivate

Copy a given solution vector in a normal grid.

Template Parameters
VctVector type
Grid_dsttarget grid
posset of property
Parameters
vVector
g_dsttarget normal grid

Definition at line 401 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename Vct , typename Grid_dst , unsigned int... pos>
void FDScheme< Sys_eqs >::copy_staggered ( Vct &  v,
Grid_dst &  g_dst 
)
inlineprivate

Copy a given solution vector in a staggered grid.

Template Parameters
VctVector type
Grid_dsttarget grid
posset of properties
Parameters
vVector
g_dsttarget staggered grid

Definition at line 351 of file FDScheme.hpp.

template<typename Sys_eqs>
key_and_eq FDScheme< Sys_eqs >::from_row_to_key ( size_t  row)
inlineprivate

From the row Matrix position to the spatial position.

Parameters
rowMatrix row
Returns
spatial position + equation id

Definition at line 251 of file FDScheme.hpp.

template<typename Sys_eqs>
Sys_eqs::SparseMatrix_type& FDScheme< Sys_eqs >::getA ( )
inline

produce the Matrix

Returns
the Sparse matrix produced

Definition at line 950 of file FDScheme.hpp.

template<typename Sys_eqs>
Sys_eqs::Vector_type& FDScheme< Sys_eqs >::getB ( )
inline

produce the B vector

Returns
the vector produced

Definition at line 968 of file FDScheme.hpp.

template<typename Sys_eqs>
const g_map_type& FDScheme< Sys_eqs >::getMap ( )
inline

Return the map between the grid index position and the position in the distributed vector.

It is the map explained in the intro of the FDScheme

Returns
the map

Definition at line 759 of file FDScheme.hpp.

template<typename Sys_eqs>
const Padding<Sys_eqs::dims>& FDScheme< Sys_eqs >::getPadding ( )
inline

Get the specified padding.

Returns
the padding specified

Definition at line 747 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename T >
void FDScheme< Sys_eqs >::impose ( const T &  op,
typename Sys_eqs::stype  num,
long int  id,
const long int(&)  start[Sys_eqs::dims],
const long int(&)  stop[Sys_eqs::dims],
bool  skip_first = false 
)
inline

Impose an operator.

This function impose an operator on a box region to produce the system

Ax = b

Stokes equation, lid driven cavity with one splipping wall

// velocity in the grid is the property 0, pressure is the property 1
constexpr int velocity = 0;
constexpr int pressure = 1;
// Domain, a rectangle
Box<2,float> domain({0.0,0.0},{3.0,1.0});
// Ghost (Not important in this case but required)
Ghost<2,float> g(0.01);
// Grid points on x=256 and y=64
long int sz[] = {256,64};
size_t szu[2];
szu[0] = (size_t)sz[0];
szu[1] = (size_t)sz[1];
// We need one more point on the left and down part of the domain
// This is given by the boundary conditions that we impose, the
// reason is mathematical in order to have a well defined system
// and cannot be discussed here
Padding<2> pd({1,1},{0,0});
// Distributed grid that store the solution
grid_dist_id<2,float,aggregate<float[2],float>,CartDecomposition<2,float>> g_dist(szu,domain,g);
// It is the maximum extension of the stencil
Ghost<2,long int> stencil_max(1);
// Finite difference scheme
FDScheme<lid_nn> fd(pd, stencil_max, domain,g_dist);
// Here we impose the equation, we start from the incompressibility Eq imposed in the bulk with the
// exception of the first point {0,0} and than we set P = 0 in {0,0}, why we are doing this is again
// mathematical to have a well defined system, an intuitive explanation is that P and P + c are both
// solution for the incompressibility equation, this produce an ill-posed problem to make it well posed
// we set one point in this case {0,0} the pressure to a fixed constant for convenience P = 0
fd.impose(ic_eq(),0.0, EQ_3, {0,0},{sz[0]-2,sz[1]-2},true);
fd.impose(Prs(), 0.0, EQ_3, {0,0},{0,0});
// Here we impose the Eq1 and Eq2
fd.impose(vx_eq(),0.0, EQ_1, {1,0},{sz[0]-2,sz[1]-2});
fd.impose(vy_eq(),0.0, EQ_2, {0,1},{sz[0]-2,sz[1]-2});
// v_x and v_y
// Imposing B1
fd.impose(v_x(),0.0, EQ_1, {0,0},{0,sz[1]-2});
fd.impose(avg_vy_f(),0.0, EQ_2 , {-1,0},{-1,sz[1]-1});
// Imposing B2
fd.impose(v_x(),0.0, EQ_1, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
fd.impose(avg_vy(),1.0, EQ_2, {sz[0]-1,0},{sz[0]-1,sz[1]-1});
// Imposing B3
fd.impose(avg_vx_f(),0.0, EQ_1, {0,-1},{sz[0]-1,-1});
fd.impose(v_y(), 0.0, EQ_2, {0,0},{sz[0]-2,0});
// Imposing B4
fd.impose(avg_vx(),0.0, EQ_1, {0,sz[1]-1},{sz[0]-1,sz[1]-1});
fd.impose(v_y(), 0.0, EQ_2, {0,sz[1]-1},{sz[0]-2,sz[1]-1});
// When we pad the grid, there are points of the grid that are not
// touched by the previous condition. Mathematically this lead
// to have too many variables for the conditions that we are imposing.
// Here we are imposing variables that we do not touch to zero
//
// Padding pressure
fd.impose(Prs(), 0.0, EQ_3, {-1,-1},{sz[0]-1,-1});
fd.impose(Prs(), 0.0, EQ_3, {-1,sz[1]-1},{sz[0]-1,sz[1]-1});
fd.impose(Prs(), 0.0, EQ_3, {-1,0},{-1,sz[1]-2});
fd.impose(Prs(), 0.0, EQ_3, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
// Impose v_x Padding Impose v_y padding
fd.impose(v_x(), 0.0, EQ_1, {-1,-1},{-1,sz[1]-1});
fd.impose(v_y(), 0.0, EQ_2, {-1,-1},{sz[0]-1,-1});
solver_type solver;
auto x = solver.solve(fd.getA(),fd.getB());
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
startstarting point of the box
stopstop point of the box
skip_firstskip the first point

Definition at line 817 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename T , typename bop , typename iterator >
void FDScheme< Sys_eqs >::impose_dit ( const T &  op,
bop  num,
long int  id,
const iterator &  it_d 
)
inlineprivate

Impose an operator.

This function impose an operator on a particular grid region to produce the system

Ax = b

Stokes equation 2D, lid driven cavity with one splipping wall

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 499 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename T >
void FDScheme< Sys_eqs >::impose_dit ( const T &  op,
typename Sys_eqs::stype  num,
long int  id,
grid_dist_iterator_sub< Sys_eqs::dims, typename g_map_type::d_grid it_d 
)
inline

Impose an operator.

This function impose an operator on a particular grid region to produce the system

Ax = b

Stokes equation 2D, lid driven cavity with one splipping wall

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 907 of file FDScheme.hpp.

template<typename Sys_eqs>
template<unsigned int prp, typename T , typename b_term , typename iterator >
void FDScheme< Sys_eqs >::impose_dit ( const T &  op,
b_term &  b_t,
const iterator &  it_d,
long int  id = 0 
)
inline

Impose an operator.

This function impose an operator on a particular grid region to produce the system

Ax = b

Stokes equation 2D, lid driven cavity with one splipping wall

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 932 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename bop , typename iterator >
void FDScheme< Sys_eqs >::impose_dit_b ( bop  num,
long int  id,
const iterator &  it_d 
)
inlineprivate

Impose an operator.

This function the RHS no matrix is imposed. This function is usefull if the Matrix has been constructed and only the right hand side b must be changed

Ax = b

Parameters
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 458 of file FDScheme.hpp.

template<typename Sys_eqs>
template<unsigned int prp, typename b_term , typename iterator >
void FDScheme< Sys_eqs >::impose_dit_b ( b_term &  b_t,
const iterator &  it_d,
long int  id = 0 
)
inline

Impose an operator.

This function impose an operator on a particular grid region to produce the system

Ax = b

Stokes equation 2D, lid driven cavity with one splipping wall

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 883 of file FDScheme.hpp.

template<typename Sys_eqs>
template<typename T , typename bop , typename iterator >
void FDScheme< Sys_eqs >::impose_git ( const T &  op,
bop  num,
long int  id,
const iterator &  it_d 
)
inlineprivate

Impose an operator.

This function impose an operator on a particular grid region to produce the system

Ax = b

Stokes equation 2D, lid driven cavity with one splipping wall

fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
std::string s = std::string(demangle(typeid(solver_type).name()));
s += "_";
Parameters
opOperator to impose (A term)
numright hand side of the term (b term)
idEquation id in the system that we are imposing
it_diterator that define where you want to impose

Definition at line 579 of file FDScheme.hpp.

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::Initialize ( const Box< Sys_eqs::dims, typename Sys_eqs::stype > &  domain)
inlineprivate

the object FDScheme

Parameters
domainsimulation domain

Definition at line 690 of file FDScheme.hpp.

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::new_A ( )
inline

In case we want to impose a new A re-using FDScheme we have to call This function.

Definition at line 864 of file FDScheme.hpp.

template<typename Sys_eqs>
const std::vector<size_t> FDScheme< Sys_eqs >::padding ( const size_t(&)  sz[Sys_eqs::dims],
Padding< Sys_eqs::dims > &  pd 
)
inlineprivate

calculate the mapping grid size with padding

Parameters
szoriginal grid size
pdpadding
Returns
padded grid size

Definition at line 282 of file FDScheme.hpp.

template<typename Sys_eqs>
void FDScheme< Sys_eqs >::setStagPos ( comb< Sys_eqs::dims >(&)  sp[Sys_eqs::nvar])
inline

set the staggered position for each property

Parameters
spvector containing the staggered position for each property

Definition at line 718 of file FDScheme.hpp.

Field Documentation

template<typename Sys_eqs>
size_t FDScheme< Sys_eqs >::s_pnt
private

Each point in the grid has a global id, to decompose correctly the Matrix each processor contain a contiguos range of global id, example processor 0 can have from 0 to 234 and processor 1 from 235 to 512 no processors can have holes in the sequence, this number indicate where the sequence start for this processor

Definition at line 230 of file FDScheme.hpp.


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