The mesh module: build grid
Module mesh provides three classes to build meshes:
Mesh
: Build regular cartesian mesh
AdaptativeMesh
: Build adaptative cartesian mesh
CurvilinearMesh
: Build curvilinear mesh
- class fdgrid.mesh.AdaptativeMesh(shape, step, origin=(0, 0), bc='WWWW', obstacles=None, Npml=15, stencil=11, dilatation=3.0, Nd=23, only_pml=False)[source]
Bases:
fdgrid.mesh.Mesh
Build cartesian adaptative grid
- Parameters
See also
- class fdgrid.mesh.CurvilinearMesh(shape, step, origin=(0, 0), bc='WWWW', obstacles=None, Npml=15, stencil=11, fcurvxz=<function curv>)[source]
Bases:
fdgrid.mesh.Mesh
Build curvilinear grid
- Parameters
fcurvxz (function, optional) – Function taking as input arguments the numerical coordinates (‘xn’, ‘yn’) and returning the physical coordinates (‘xp’, ‘zp’).
See also
- plot_physical(figsize=(9, 4), legend=False, pml=False, bc_profiles=False, probes=False, filename=None)[source]
Plot physical and numerical domains.
- Parameters
legend (bool, optional) – Show legend.
N (int, optional) – Plot the grid with one point over N.
filename (string, optional) – Save to filename.
figsize (tuple, optional) – Size of the figure.
pml (bool, optional) – Show absorbing area in the figure.
bc_profiles (bool, optional) – Show velocity profiles for moving boundaries
- class fdgrid.mesh.Mesh(shape, step, origin=(0, 0), bc='WWWW', obstacles=None, Npml=15, stencil=11)[source]
Bases:
object
Build cartesian regular grid
- Parameters
shape (tuple) – Size of the domain. Must be a tuple with two int objects.
step (tuple) – Spatial steps. Must be a tuple with two float objects.
origin (tuple, optional) – Origin of the grid. Must be a tuple with two int objects.
bc ({'[ARZPW][ARZPW][ARZPW][ARZPW]'}, optional) – Boundary conditions. Must be a 4 characters string.
obstacles (
fdgrid.domains.Domain
, optional) – Obstacles in the computation domain.Npml (int, optional) – Number of points of the absorbing area (only if ‘A’ in bc).
stencil (int, optional) – Size of the finite difference stencil (used by
nsfds2
).
See also
- plot_domains(legend=False, N=4, figsize=(9, 18), bc_profiles=False, filename=None)[source]
Plot a scheme of the computation domain higlighting the subdomains.
- Parameters
See also
- plot_grid(figsize=(9, 5), N=4, axis=False, legend=False, pml=False, bc_profiles=False, probes=False, filename=None)[source]
Numerical grid representation.
- Parameters
legend (bool, optional) – Show legend.
N (int, optional) – Plot the grid with one point over N.
filename (string, optional) – Save to filename.
figsize (tuple, optional) – Size of the figure.
pml (bool, optional) – Show absorbing area in the figure.
bc_profiles (bool, optional) – Show velocity profiles for moving boundaries
Important
The curves \(dx'/dx\) are not representative on the edges because of the gradient.
See also
- plot_physical(figsize=(9, 4), legend=False, pml=False, bc_profiles=False, probes=False, filename=None)[source]
Physical grid representation.
See also