OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
FD_scheme< Sys_eqs, grid_type > Class Template Reference

Finite Differences. More...

Detailed Description

template<typename Sys_eqs, typename grid_type>
class FD_scheme< Sys_eqs, grid_type >

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

Define the equations of the system

Define the domain and impose the equations

3D

A 3D case is given in the examples

Definition at line 127 of file FD_Solver.hpp.

#include <FD_Solver.hpp>

Data Structures

struct  constant_b
 Encapsulation of the b term as constant. More...
 
struct  function_b
 Encapsulation of the b term as a function. More...
 
struct  key_and_eq
 Equation id + space position. More...
 
struct  variable_b
 Encapsulation of the b term as constant. More...
 

Public Types

typedef grid_dist_id< Sys_eqs::dims, typename Sys_eqs::stype, aggregate< size_t >, typename grid_type::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
 
void computeStag ()
 compute the staggered position for each property
 
const Padding< Sys_eqs::dims > & getPadding ()
 Get the specified padding.
 
const g_map_typegetMap ()
 Return the map between the grid index position and the position in the distributed vector.
 
 FD_scheme (const Ghost< Sys_eqs::dims, long int > &stencil, grid_type &b_g, options_solver opt=options_solver::STANDARD)
 Constructor.
 
 FD_scheme (Padding< Sys_eqs::dims > &pd, const Ghost< Sys_eqs::dims, long int > &stencil, grid_type &b_g, options_solver opt=options_solver::STANDARD)
 Constructor.
 
template<typename T >
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, typename Sys_eqs::stype num, eq_id id, comb< Sys_eqs::dims > c_where)
 Impose an operator.
 
template<typename T , unsigned int prp_id>
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, prop_id< prp_id > num, eq_id id, comb< Sys_eqs::dims > c_where)
 Impose an operator.
 
template<typename T >
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, const std::function< double(double, double)> &f, eq_id id, comb< Sys_eqs::dims > c_where)
 Impose an operator.
 
template<typename T >
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, typename Sys_eqs::stype num, eq_id id=eq_id(), bool skip_first=false)
 Impose an operator.
 
template<typename T , unsigned int prp_id>
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, prop_id< prp_id > num, eq_id id=eq_id(), bool skip_first=false)
 Impose an operator.
 
template<typename T , typename RHS_type , typename sfinae = typename std::enable_if<!std::is_fundamental<RHS_type>::type::value>::type>
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, const RHS_type &rhs, eq_id id=eq_id(), bool skip_first=false)
 Impose an operator.
 
template<typename T >
void impose (const T &op, const grid_key_dx< Sys_eqs::dims > start_k, const grid_key_dx< Sys_eqs::dims > stop_k, const std::function< double(double, double)> &f, eq_id id=eq_id(), bool skip_first=false)
 Impose an operator.
 
void new_b ()
 In case we want to impose a new b re-using FD_scheme we have to call This function.
 
void new_A ()
 In case we want to impose a new A re-using FD_scheme we have to call This function.
 
Sys_eqs::SparseMatrix_type & getA (options_solver opt=options_solver::STANDARD)
 produce the Matrix
 
Sys_eqs::Vector_type & getB (options_solver opt=options_solver::STANDARD)
 produce the B vector
 
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.
 
template<typename ... expr_type>
void solve (expr_type ... exps)
 Solve an equation.
 
template<typename SolverType , typename ... expr_type>
void solve_with_solver (SolverType &solver, expr_type ... exps)
 Solve an equation.
 
template<typename SolverType , typename ... expr_type>
void solve_with_constant_nullspace_solver (SolverType &solver, expr_type ... exps)
 
template<typename SolverType , typename ... expr_type>
void try_solve_with_solver (SolverType &solver, expr_type ... exps)
 Solve an equation.
 
template<unsigned int ... pos, typename Vct , typename Grid_dst >
void copy (Vct &v, Grid_dst &g_dst)
 Copy the vector into the grid.
 

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.
 
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
 
void consistency ()
 Check if the Matrix is consistent.
 
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.
 
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.
 
template<typename bop , typename iterator >
void impose_dit_b (bop num, long int id, const iterator &it_d)
 Impose an operator.
 
template<typename T , typename col , typename trp , typename iterator , typename cmb , typename Key >
void impose_git_it (const T &op, col &cols, trp &trpl, long int &id, const iterator &it_d, cmb &c_where, Key &key, grid_key_dx< Sys_eqs::dims > &shift)
 
template<typename T , typename bop , typename iterator >
void impose_git (const T &op, bop num, long int id, const iterator &it_d, comb< Sys_eqs::dims > c_where)
 Impose an operator.
 
void construct_gmap ()
 Construct the gmap structure.
 
void Initialize (const Box< Sys_eqs::dims, typename Sys_eqs::stype > &domain)
 
template<typename solType , typename expr_type >
void copy_impl (solType &x, expr_type exp, unsigned int comp)
 Solve an equation.
 
template<typename solType , typename exp1 , typename ... othersExp>
void copy_nested (solType &x, unsigned int &comp, exp1 exp, othersExp ... exps)
 
template<typename solType , typename exp1 >
void copy_nested (solType &x, unsigned int &comp, exp1 exp)
 

Private Attributes

grid_typegrid
 our base grid
 
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
 
options_solver opt
 solver options
 
size_t tot
 Total number of points.
 
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
 

Member Typedef Documentation

◆ g_map_type

template<typename Sys_eqs , typename grid_type >
typedef grid_dist_id<Sys_eqs::dims,typename Sys_eqs::stype,aggregate<size_t>,typename grid_type::decomposition::extended_type> FD_scheme< Sys_eqs, grid_type >::g_map_type

Distributed grid map.

Definition at line 132 of file FD_Solver.hpp.

◆ Sys_eqs_typ

template<typename Sys_eqs , typename grid_type >
typedef Sys_eqs FD_scheme< Sys_eqs, grid_type >::Sys_eqs_typ

Type that specify the properties of the system of equations.

Definition at line 135 of file FD_Solver.hpp.

◆ triplet

template<typename Sys_eqs , typename grid_type >
typedef Sys_eqs::SparseMatrix_type::triplet_type FD_scheme< Sys_eqs, grid_type >::triplet
private

Sparse matrix triplet type.

Definition at line 254 of file FD_Solver.hpp.

Constructor & Destructor Documentation

◆ FD_scheme() [1/2]

template<typename Sys_eqs , typename grid_type >
FD_scheme< Sys_eqs, grid_type >::FD_scheme ( const Ghost< Sys_eqs::dims, long int > &  stencil,
grid_type b_g,
options_solver  opt = options_solver::STANDARD 
)
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 867 of file FD_Solver.hpp.

◆ FD_scheme() [2/2]

template<typename Sys_eqs , typename grid_type >
FD_scheme< Sys_eqs, grid_type >::FD_scheme ( Padding< Sys_eqs::dims > &  pd,
const Ghost< Sys_eqs::dims, long int > &  stencil,
grid_type b_g,
options_solver  opt = options_solver::STANDARD 
)
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 885 of file FD_Solver.hpp.

Member Function Documentation

◆ computeStag()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::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 825 of file FD_Solver.hpp.

◆ consistency()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::consistency ( )
inlineprivate

Check if the Matrix is consistent.

Definition at line 355 of file FD_Solver.hpp.

◆ construct_gmap()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::construct_gmap ( )
inlineprivate

Construct the gmap structure.

Definition at line 680 of file FD_Solver.hpp.

◆ copy() [1/2]

template<typename Sys_eqs , typename grid_type >
template<unsigned int ... pos, typename Vct , typename Grid_dst >
void FD_scheme< Sys_eqs, grid_type >::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

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 1308 of file FD_Solver.hpp.

◆ copy() [2/2]

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

Copy the vector into the grid.

Copy the solution into the grid

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 1438 of file FD_Solver.hpp.

◆ copy_impl()

template<typename Sys_eqs , typename grid_type >
template<typename solType , typename expr_type >
void FD_scheme< Sys_eqs, grid_type >::copy_impl ( solType &  x,
expr_type  exp,
unsigned int  comp 
)
inlineprivate

Solve an equation.

Warning
exp must be a scalar type
Parameters
expwhere to store the result

Definition at line 757 of file FD_Solver.hpp.

◆ copy_nested() [1/2]

template<typename Sys_eqs , typename grid_type >
template<typename solType , typename exp1 >
void FD_scheme< Sys_eqs, grid_type >::copy_nested ( solType &  x,
unsigned int &  comp,
exp1  exp 
)
inlineprivate

Definition at line 798 of file FD_Solver.hpp.

◆ copy_nested() [2/2]

template<typename Sys_eqs , typename grid_type >
template<typename solType , typename exp1 , typename ... othersExp>
void FD_scheme< Sys_eqs, grid_type >::copy_nested ( solType &  x,
unsigned int &  comp,
exp1  exp,
othersExp ...  exps 
)
inlineprivate

Definition at line 788 of file FD_Solver.hpp.

◆ copy_normal()

template<typename Sys_eqs , typename grid_type >
template<typename Vct , typename Grid_dst , unsigned int ... pos>
void FD_scheme< Sys_eqs, grid_type >::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 461 of file FD_Solver.hpp.

◆ copy_staggered()

template<typename Sys_eqs , typename grid_type >
template<typename Vct , typename Grid_dst , unsigned int ... pos>
void FD_scheme< Sys_eqs, grid_type >::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 411 of file FD_Solver.hpp.

◆ from_row_to_key()

template<typename Sys_eqs , typename grid_type >
key_and_eq FD_scheme< Sys_eqs, grid_type >::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 311 of file FD_Solver.hpp.

◆ getA()

template<typename Sys_eqs , typename grid_type >
Sys_eqs::SparseMatrix_type & FD_scheme< Sys_eqs, grid_type >::getA ( options_solver  opt = options_solver::STANDARD)
inline

produce the Matrix

Returns
the Sparse matrix produced

Definition at line 1193 of file FD_Solver.hpp.

◆ getB()

template<typename Sys_eqs , typename grid_type >
Sys_eqs::Vector_type & FD_scheme< Sys_eqs, grid_type >::getB ( options_solver  opt = options_solver::STANDARD)
inline

produce the B vector

Returns
the vector produced

Definition at line 1275 of file FD_Solver.hpp.

◆ getMap()

template<typename Sys_eqs , typename grid_type >
const g_map_type & FD_scheme< Sys_eqs, grid_type >::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 FD_scheme

Returns
the map

Definition at line 853 of file FD_Solver.hpp.

◆ getPadding()

template<typename Sys_eqs , typename grid_type >
const Padding< Sys_eqs::dims > & FD_scheme< Sys_eqs, grid_type >::getPadding ( )
inline

Get the specified padding.

Returns
the padding specified

Definition at line 841 of file FD_Solver.hpp.

◆ impose() [1/7]

template<typename Sys_eqs , typename grid_type >
template<typename T , typename RHS_type , typename sfinae = typename std::enable_if<!std::is_fundamental<RHS_type>::type::value>::type>
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
const RHS_type &  rhs,
eq_id  id = eq_id(),
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

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 1097 of file FD_Solver.hpp.

◆ impose() [2/7]

template<typename Sys_eqs , typename grid_type >
template<typename T >
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
const std::function< double(double, double)> &  f,
eq_id  id,
comb< Sys_eqs::dims >  c_where 
)
inline

Impose an operator.

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

Ax = b

Parameters
opOperator to impose (A term)
fright 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 971 of file FD_Solver.hpp.

◆ impose() [3/7]

template<typename Sys_eqs , typename grid_type >
template<typename T >
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
const std::function< double(double, double)> &  f,
eq_id  id = eq_id(),
bool  skip_first = false 
)
inline

Impose an operator.

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

Ax = b

Parameters
opOperator to impose (A term)
fright 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 1141 of file FD_Solver.hpp.

◆ impose() [4/7]

template<typename Sys_eqs , typename grid_type >
template<typename T , unsigned int prp_id>
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
prop_id< prp_id >  num,
eq_id  id,
comb< Sys_eqs::dims >  c_where 
)
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

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 942 of file FD_Solver.hpp.

◆ impose() [5/7]

template<typename Sys_eqs , typename grid_type >
template<typename T , unsigned int prp_id>
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
prop_id< prp_id >  num,
eq_id  id = eq_id(),
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

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 1049 of file FD_Solver.hpp.

◆ impose() [6/7]

template<typename Sys_eqs , typename grid_type >
template<typename T >
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
typename Sys_eqs::stype  num,
eq_id  id,
comb< Sys_eqs::dims >  c_where 
)
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

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 911 of file FD_Solver.hpp.

◆ impose() [7/7]

template<typename Sys_eqs , typename grid_type >
template<typename T >
void FD_scheme< Sys_eqs, grid_type >::impose ( const T &  op,
const grid_key_dx< Sys_eqs::dims >  start_k,
const grid_key_dx< Sys_eqs::dims >  stop_k,
typename Sys_eqs::stype  num,
eq_id  id = eq_id(),
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

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 1003 of file FD_Solver.hpp.

◆ impose_dit_b()

template<typename Sys_eqs , typename grid_type >
template<typename bop , typename iterator >
void FD_scheme< Sys_eqs, grid_type >::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 518 of file FD_Solver.hpp.

◆ impose_git()

template<typename Sys_eqs , typename grid_type >
template<typename T , typename bop , typename iterator >
void FD_scheme< Sys_eqs, grid_type >::impose_git ( const T &  op,
bop  num,
long int  id,
const iterator &  it_d,
comb< Sys_eqs::dims >  c_where 
)
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

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 598 of file FD_Solver.hpp.

◆ impose_git_it()

template<typename Sys_eqs , typename grid_type >
template<typename T , typename col , typename trp , typename iterator , typename cmb , typename Key >
void FD_scheme< Sys_eqs, grid_type >::impose_git_it ( const T &  op,
col &  cols,
trp &  trpl,
long int &  id,
const iterator &  it_d,
cmb &  c_where,
Key &  key,
grid_key_dx< Sys_eqs::dims > &  shift 
)
inlineprivate

Definition at line 544 of file FD_Solver.hpp.

◆ Initialize()

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

\initialize the object FD_scheme

Parameters
domainsimulation domain

Definition at line 728 of file FD_Solver.hpp.

◆ new_A()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::new_A ( )
inline

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

Definition at line 1181 of file FD_Solver.hpp.

◆ new_b()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::new_b ( )
inline

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

Definition at line 1174 of file FD_Solver.hpp.

◆ padding()

template<typename Sys_eqs , typename grid_type >
const std::vector< size_t > FD_scheme< Sys_eqs, grid_type >::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 342 of file FD_Solver.hpp.

◆ setStagPos()

template<typename Sys_eqs , typename grid_type >
void FD_scheme< Sys_eqs, grid_type >::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 812 of file FD_Solver.hpp.

◆ solve()

template<typename Sys_eqs , typename grid_type >
template<typename ... expr_type>
void FD_scheme< Sys_eqs, grid_type >::solve ( expr_type ...  exps)
inline

Solve an equation.

Warning
exp must be a scalar type
Parameters
expwhere to store the result

Definition at line 1351 of file FD_Solver.hpp.

◆ solve_with_constant_nullspace_solver()

template<typename Sys_eqs , typename grid_type >
template<typename SolverType , typename ... expr_type>
void FD_scheme< Sys_eqs, grid_type >::solve_with_constant_nullspace_solver ( SolverType &  solver,
expr_type ...  exps 
)
inline

Definition at line 1389 of file FD_Solver.hpp.

◆ solve_with_solver()

template<typename Sys_eqs , typename grid_type >
template<typename SolverType , typename ... expr_type>
void FD_scheme< Sys_eqs, grid_type >::solve_with_solver ( SolverType &  solver,
expr_type ...  exps 
)
inline

Solve an equation.

Warning
exp must be a scalar type
Parameters
expwhere to store the result

Definition at line 1373 of file FD_Solver.hpp.

◆ try_solve_with_solver()

template<typename Sys_eqs , typename grid_type >
template<typename SolverType , typename ... expr_type>
void FD_scheme< Sys_eqs, grid_type >::try_solve_with_solver ( SolverType &  solver,
expr_type ...  exps 
)
inline

Solve an equation.

Warning
exp must be a scalar type
Parameters
expwhere to store the result

Definition at line 1412 of file FD_Solver.hpp.

Field Documentation

◆ A

template<typename Sys_eqs , typename grid_type >
Sys_eqs::SparseMatrix_type FD_scheme< Sys_eqs, grid_type >::A

type of the sparse matrix

Definition at line 1186 of file FD_Solver.hpp.

◆ b

template<typename Sys_eqs , typename grid_type >
Sys_eqs::Vector_type FD_scheme< Sys_eqs, grid_type >::b
private

Vector b.

Definition at line 257 of file FD_Solver.hpp.

◆ g_map

template<typename Sys_eqs , typename grid_type >
g_map_type FD_scheme< Sys_eqs, grid_type >::g_map
private

mapping grid

Definition at line 266 of file FD_Solver.hpp.

◆ grid

template<typename Sys_eqs , typename grid_type >
grid_type& FD_scheme< Sys_eqs, grid_type >::grid
private

our base grid

Definition at line 248 of file FD_Solver.hpp.

◆ gs

template<typename Sys_eqs , typename grid_type >
const grid_sm<Sys_eqs::dims,void>& FD_scheme< Sys_eqs, grid_type >::gs
private

Domain Grid informations.

Definition at line 260 of file FD_Solver.hpp.

◆ opt

template<typename Sys_eqs , typename grid_type >
options_solver FD_scheme< Sys_eqs, grid_type >::opt
private

solver options

Definition at line 275 of file FD_Solver.hpp.

◆ pd

template<typename Sys_eqs , typename grid_type >
Padding<Sys_eqs::dims> FD_scheme< Sys_eqs, grid_type >::pd
private

Padding.

Definition at line 251 of file FD_Solver.hpp.

◆ pnt

template<typename Sys_eqs , typename grid_type >
openfpm::vector<size_t> FD_scheme< Sys_eqs, grid_type >::pnt
private

Grid points that has each processor.

Definition at line 281 of file FD_Solver.hpp.

◆ row

template<typename Sys_eqs , typename grid_type >
size_t FD_scheme< Sys_eqs, grid_type >::row
private

row of the matrix

Definition at line 269 of file FD_Solver.hpp.

◆ row_b

template<typename Sys_eqs , typename grid_type >
size_t FD_scheme< Sys_eqs, grid_type >::row_b
private

row on b

Definition at line 272 of file FD_Solver.hpp.

◆ s_pnt

template<typename Sys_eqs , typename grid_type >
size_t FD_scheme< Sys_eqs, grid_type >::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 290 of file FD_Solver.hpp.

◆ s_pos

template<typename Sys_eqs , typename grid_type >
comb<Sys_eqs::dims> FD_scheme< Sys_eqs, grid_type >::s_pos[Sys_eqs::nvar]
private

Staggered position for each property.

Definition at line 284 of file FD_Solver.hpp.

◆ spacing

template<typename Sys_eqs , typename grid_type >
Sys_eqs::stype FD_scheme< Sys_eqs, grid_type >::spacing[Sys_eqs::dims]
private

Get the grid spacing.

Definition at line 263 of file FD_Solver.hpp.

◆ tot

template<typename Sys_eqs , typename grid_type >
size_t FD_scheme< Sys_eqs, grid_type >::tot
private

Total number of points.

Definition at line 278 of file FD_Solver.hpp.


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