GRIDMAN
grid managment library
Functions/Subroutines
grid2d.f File Reference

Basic subroutines, calculation of geometrical properties. More...

Go to the source code of this file.

Functions/Subroutines

subroutine gridman_grid2d_check (GRID, RES, IERR)
 Check correctness of the 2D grid object. More...
 
subroutine gridman_grid2d_chains (GRID, CHAINS, IERR)
 Find closed chain of points which form each cell. More...
 
subroutine gridman_grid2d_lengths (GRID, LEDGES, IERR)
 Calculate lengths of the cell edges. More...
 
subroutine gridman_grid2d_crossect (GRID, SCELLS, IERR)
 Calculate cross section area of the cells. More...
 
subroutine gridman_grid2d_center (GRID, XCN, IERR)
 Calculate coordinates of the cell centers. More...
 
subroutine gridman_grid2d_norm (GRID, VN, IERR)
 Calculate unit normal vectors to grid edges. More...
 
subroutine gridman_grid2d_isconvex (GRID, ISCONVEX, IERR)
 Find if cells are convex polygons or not. More...
 
subroutine gridman_grid2d_cylareas (GRID, SEDGES, IERR, ANGLE)
 Calculate cylindrical areas of the cell edges. More...
 
subroutine gridman_grid2d_cylvolumes (GRID, VCELLS, IERR, ANGLE)
 Calculate cylindrical cell volumes. More...
 

Detailed Description

Basic subroutines, calculation of geometrical properties.

Definition in file grid2d.f.

Function/Subroutine Documentation

subroutine gridman_grid2d_check ( type(gridman_grid)  GRID,
integer, intent(out)  RES,
integer, intent(out)  IERR 
)

Check correctness of the 2D grid object.

  • RES<100: see GRIDMAN_GRID_CHECK in grid.f
  • RES=100: the grid is not of 2D-type
  • RES=102: the chain of edges belonging to one cell is brocken or no single chain
  • RES=103: edges with zero length
  • RES=111: intersecting edges (only edges withing one cell are checked) (edges which do not belong to any cell are not checked)
Parameters
gridGrid object to be checked
[out]resCode of the result
[out]ierrError code

Definition at line 37 of file grid2d.f.

References gridman::gridman_dp, gridman_grid_cells(), gridman_grid_check(), gridman_grid_points(), gridman_indlist_deallocate(), gridman_intersect2d(), gridman::gridman_sp, and gridman::gridman_unit.

Referenced by gridman_2dgrid2vtk(), gridman_2dgrid2vtk_index(), gridman_addsurf2grid_2d(), gridman_carre2grid(), gridman_grid2d_center(), gridman_grid2d_crossect(), gridman_grid2d_cut(), gridman_grid2d_cylareas(), gridman_grid2d_cylvolumes(), gridman_grid2d_isconvex(), gridman_grid2d_lengths(), gridman_grid2d_merge(), gridman_grid2d_norm(), gridman_grid2d_triang(), gridman_grid2template(), gridman_grid2tria(), gridman_template2grid(), and gridman_tria2grid().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine gridman_grid2d_chains ( type(gridman_grid)  GRID,
type(gridman_indlist)  CHAINS,
integer, intent(out)  IERR 
)

Find closed chain of points which form each cell.

In each element of the list first and last index points to the same point. IERR=450 is returned of no closed chain is found. WARNING: if the object CHAINS already exist it will be overwritten!

Parameters
gridGrid object for which the list of chains is generated
chainsResulting list of chains
[out]ierrError code

Definition at line 266 of file grid2d.f.

References gridman_grid_cells(), gridman_grid_points(), gridman_indlist_allocate(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Referenced by gridman_2dgrid2vtk(), gridman_grid2d_center(), gridman_grid2d_crossect(), gridman_grid2d_cylvolumes(), gridman_grid2d_isconvex(), gridman_grid2d_norm(), gridman_grid2d_polygon_trajectory(), gridman_grid2d_triang(), and gridman_grid2tria().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine gridman_grid2d_lengths ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(grid%nedges)  LEDGES,
integer, intent(out)  IERR 
)

Calculate lengths of the cell edges.

Parameters
gridGrid object for which the areas are calculated
ledgesResulting array of lengths (has to be allocated)
[out]ierrError code

Definition at line 425 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_check(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_crossect ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(grid%ncells)  SCELLS,
integer, intent(out)  IERR 
)

Calculate cross section area of the cells.

Parameters
gridGrid for which the areas are calculated
scellsResulting arrray with cell areas (has to be allocated)
[out]ierrError code

Definition at line 483 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid2d_check(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_center ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(2,grid%ncells)  XCN,
integer, intent(out)  IERR 
)

Calculate coordinates of the cell centers.

Coordinates of the center of mass of planar polygons

Parameters
gridGrid object for which the coordinates are calculated
xcnResulting X (1st index=1) and Y (1st index=2) coordinates of the centers. The array must be allocated
[out]ierrError code

Definition at line 559 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid2d_check(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_norm ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(2,grid%nedges)  VN,
integer, intent(out)  IERR 
)

Calculate unit normal vectors to grid edges.

Parameters
gridGrid for which the normals are calculated
vnResulting array with X (1st index=1) and Y (1st index=2) coordinates of the normals (array has to be allocated)
[out]ierrError code

Convention about the direction of normal vectors

  1. the normal must point out of the cell CELLS(1,IEDGE)
  2. If CELLS(1,IEDGE)<0 then the normal must point out of the cell CELLS(2,IEDGE)
  3. IF both CELLS(:,IEDGE)==0 then the normal must point to the left from the direction POINT(1,1,IEDGE) to POINT(1,2,IEDGE)

The normal vectors, thus, always point outwards from the grid

Definition at line 692 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid2d_check(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_isconvex ( type(gridman_grid)  GRID,
logical, dimension(grid%ncells)  ISCONVEX,
integer, intent(out)  IERR 
)

Find if cells are convex polygons or not.

Parameters
gridGrid which will be processed
isconvexResulting array where .TRUE. stand for convex polygons and .FALS. otherwise (has to be allocated)
[out]ierrErorr code

The algorithm assumes closed polygons without self intersections. Such polygon is convex if all angles between two neighbour edges < 180 degrees

Definition at line 830 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid2d_check(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_cylareas ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(grid%nedges)  SEDGES,
integer, intent(out)  IERR,
real(gridman_dp), optional  ANGLE 
)

Calculate cylindrical areas of the cell edges.

Calculate areas of the cell edges asumming that the grid defines cylindrical coordinates, with X(1) being the radius -

  • distance from the axis of rotation. If the optional argument ANGLE is not defined then the azimuthal angle occupied by the edges is assumed to be 2*pi.
Parameters
gridGrid object for which the areas are calculated
sedgesResulting array of surface areas (has to be allocated)
[out]ierrError code
angleAzimuthal angle occupied by the edges, in radian, default 2*pi

Definition at line 944 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_check(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function:

subroutine gridman_grid2d_cylvolumes ( type(gridman_grid)  GRID,
real(gridman_dp), dimension(grid%ncells)  VCELLS,
integer, intent(out)  IERR,
real(gridman_dp), optional  ANGLE 
)

Calculate cylindrical cell volumes.

Calculate volumes of the cells asumming that the grid defines cylindrical coordinates, with X(1) being the radius -

  • distance from the axis of rotation. If the optional argument ANGLE is not defined then the azimuthal angle occupied by the cells is assumed to be 2*pi.
Parameters
gridGrid object for which the volumes are calculated
vcellsResulting array of cell volumes (has to be allocated)
[out]ierrError code
angleAzimuthal angle occupied by the cells, in radian, default 2*pi

Definition at line 1018 of file grid2d.f.

References gridman::gridman_dp, gridman_grid2d_chains(), gridman_grid2d_check(), gridman_indlist_deallocate(), gridman::gridman_sp, and gridman::gridman_unit.

Here is the call graph for this function: