ITM Grid Service Library: Fortran 90

src/examples/itm_grid_example7_tetrahedra.f90

Go to the documentation of this file.
00001 program itm_grid_example7_tetrahedra
00002 
00003   !> Triangle grid example, where for the node positions and for every triangles
00004   !> the node indices of the corners are given
00005   !> 
00006   !> The used grid is described in detail here on the ITM Documentation Website (https://www.efda-itm.eu/ITM/html/)
00007   !> Then go to IMP3 -> IMP3 general grid description & service library -> Example grids -> Example grid #2
00008   !> Direct link (might be broken): https://www.efda-itm.eu/ITM/html/imp3_gridexamples.html#imp3_gridexamples_5
00009 
00010   use itm_types         ! ITM standard Fortran data types, e.g. real(R8)
00011   use euITM_schemas     ! ITM data structure/CPO definitions
00012   use euITM_routines    ! ITM UAL routines
00013   use itm_grid_common   ! ITM grid service library: constant definitions like COORDTYPE_R, COORDTYPE_Z
00014   use itm_grid_simplex
00015 
00016   implicit none
00017 
00018   ! parameters
00019   integer, parameter :: SHOTNUM = 9007
00020   integer, parameter :: RUNNUM = 0
00021 
00022   integer, parameter :: NDIM = 3      ! We discretize the 3d x,y,z space
00023   integer, parameter :: NSPACE = 1    ! We use one space to do so
00024 
00025   integer, parameter :: NTETRA = 2    ! Number of tetrahedra
00026   integer, parameter :: NNODES = 5    ! Number of nodes/points
00027 
00028 
00029   ! variables
00030 
00031   ! The node positions as (R,Z) vectors
00032   real(R8) :: nodes(NNODES, NDIM) 
00033   ! The tetrahedra, defined by the indices of their three corners
00034   integer :: tetrahedra(NTETRA, NDIM+1)
00035 
00036   type (type_edge),pointer :: edgecpo(:) => null()
00037   type (type_complexgrid) :: grid
00038   integer :: idx, i
00039   real(R8) :: cellData(NTETRA)
00040 
00041 
00042   ! === 1. Set up CPO ===
00043 
00044   allocate( edgecpo(1) )    
00045   allocate( edgecpo(1)%datainfo%dataprovider(1) )
00046   edgecpo(1)%datainfo%dataprovider="IMP3"
00047   allocate( edgecpo(1)%codeparam%codename(1) )
00048   edgecpo(1)%codeparam%codename(1)="itm_grid_example2_tetrahedra_servicelibrary"
00049   edgecpo(1)%time = 0.0_R8
00050 
00051   ! === 2. Set up grid ===
00052 
00053   ! Node positions in the R,Z plane
00054   nodes( 1, : ) = (/ 0.0, 0.0, 0.0 /)  
00055   nodes( 2, : ) = (/ 1.0, 0.0, 0.0 /)
00056   nodes( 3, : ) = (/ 0.5, 1.0, 0.0 /)
00057   nodes( 4, : ) = (/ 0.5, 0.5, 1.0 /)
00058   nodes( 5, : ) = (/ 0.5, 0.5,-1.0 /)
00059   
00060   ! Tetrahedra defined by their corner nodes
00061   tetrahedra( 1, : ) = (/ 1, 2, 3, 4 /)
00062   tetrahedra( 2, : ) = (/ 1, 2, 3, 5 /)
00063   
00064   ! TODO: write grid to CPO
00065   call gridSetupSimplex( edgecpo(1)%grid, (/ COORDTYPE_X, COORDTYPE_Y, COORDTYPE_Z /), &
00066       & nodes, tetrahedra )
00067 
00068   ! === 4. Write some fake scalar data to the edge cpo ===
00069 
00070   ! Make up some data
00071   cellData = (/ (i,i=1,NTETRA) /)
00072 
00073   ! TODO: write data to CPO
00074 
00075 
00076   ! === 5. Write the edge CPO to the UAL ===
00077 
00078   write (*,*) "Example 7: writing to shot ", SHOTNUM, ", run ", RUNNUM
00079   call euitm_create( 'euitm', SHOTNUM, RUNNUM, 0, 0, idx)
00080   call euitm_put(idx, "edge", edgecpo)
00081   call euitm_deallocate(edgecpo)
00082   call euitm_close(idx)
00083   
00084 end program itm_grid_example7_tetrahedra
 All Classes Namespaces Files Functions Variables