next up previous contents index
Next: Moving format Up: Data formats Previous: HFEP format   Contents   Index


HDB format

HDB2.3 uses standard IEEE 32 bits binary and is defined for 2D and 3D meshes. The problem is in 2D or 3D. The mesh is made of one or several blocks, defined by surface or volume elements. Each block is structured or unstructured. Solutions are defined on mesh nodes, and also on the boundary.

Note: For the definition of several blocks, solutions defined on mesh nodes, must be identical in each block.

A structured block is defined by a matrix of points:

An unstructured block is defined by: HDB: example for a 3D structured mesh:
      parameter (ndimax=3, idimax=2, jdimax=2, kdimax=2)
      integer unit1
      real coor1(ndimax,idimax,jdimax,kdimax)
      real q(idimax, jdimax, kdimax, 1)
c
      unit1 = 20
      nblock = 1
      rewind(unit1)
      write (unit1) nblock
      
      itype = 1
      nnu = 1
      nnufr = 0
      npatch = 0
      idim = 2
      jdim = 2
      kdim = 2
      ndim = 3
c
      dx = 2./(idim-1)
      dy = 2./(jdim-1)
      dz = 2./(kdim-1)
      do 100 i=1,idim
      x = (i-1)*dx
      do 100 j=1,jdim
      y = (j-1)*dy
      do 100 k=1,kdim
      z = (k-1)*dz
      coor1(1,i,j,k) = x
      coor1(2,i,j,k) = y
      coor1(3,i,j,k) = z
c  evaluation of q(i,j,k,1)
100   continue
      write (unit1) itype, nnu, nnufr, npatch
      write (unit1) idim, jdim, kdim, ndim
      write (unit1) ((((coor1(l,i,j,k),l=1,ndim),
     *                  i=1,idim),j=1,jdim),k=1,kdim)
      write (unit1) ((((q(i,j,k,nu),i=1,idim),j=1,jdim),
     *                  k=1,kdim), nu=1,nnu)
c
      stop
      end

HDB: The complete HDB format defined by R. Abgrall:
c 
c 
c NOTE In this example, there are only two variables (named q 
c      and qfr hereafter). q contains the set of variable in 
c      the whole field, it has nnu unknown for each grid point.
c      The variable qfr contains other variable on specific 
c      surface S of the mesh (inflow, outflow, wall,etc~...). 
c      It contains nnufr variables to be stored at the grid 
c      points of the surface S.
c       The unit number(s) below (unit1 and unit2) are arbitrary
c      and to be selected by the participant.
c
c  **************************************************************
c
      real coor1(ndimax,idimax,jdimmax,kdimax),coor2(ndimax,nnodesmax)
      real q1(idimax,jdimax,kdimax,nnumax),q2(nnodesmax,nnumax)
      real q1fr(idifrmax,jdifrmax,kdifrmax,nnufrmax),q2fr(6,
     &nnufrmax,nfacmax)
      integer nnperlement(6),ietyp(nelemax),iconnec(6*nelemax)
      integer iconnecp(nelemax) ,ibegfr(npatchmax),iendfr(npatchmax)
     & ,jbegfr(npatchmax),jendfr(npatchmax),
     & kbegfr(npatchmax),kendfr(npatchmax)
      character*30 name(100) 
      integer npoint(npointmax)
      real curv(npointmax,ncurvmax)
c
c parameters
c ----------
c
c ndimax               : space dimension (1,2 or 3)
c idimax,jdimax,kdimax : maximum of indices in the i,j,k direction,
c                        structured meshes
c idifrmax,jdifrmax,
c kdifrmax             : maximum of indices in the ifr,jfr,kfr direction,
c                      : structured mesh for S
c nnodesmax            : maximum number of nodes, unstructured meshes
c nnodesfrmax          : maximum number of nodes on S, unstructured
c                        meshes
c nelemax              : maximum number of element, ustructured meshes
c nnumax,
c nnufrmax             : maximum number of variables
c nfacmax              : maximum number of elements on S
c npatchmax            : maximum number of patches (structured meshes)
c 
c arrays
c ------
c coor1,coor2          : x,y,z coordinates 
c q1,q2,q1fr,q2fr      : array of variables
c nnperlement          : number of nodes per element
c ietyp                : define for a given element its type
c iconnec              : connectivity table
c iconnecp(nelemax)    : connectivity table pointer
c iconnecpfac(nfacmax) : connectivity table pointer for the frontier
c nufac(6,nfacmax)     : connectivity table for the frontier
c logfac(nfacmax)      : logic type of the frontier elements
c name                 : name of the variables in file unit2
c curv                 : values of variables in file unit2
c npoint               : number of value on the curves curv(*,*)
c ibegfr,...kendfr     : extreme indices of surfaces where surface
c                        values are asked for.
c
c note : the dimension 6*nelemax for iconnec has to be related to the
c size of nnperlement.
c
c   ***************************************************************
c
      open (unit1,file='soldata',form='unformatted')
c
c     Number of blocks. Note that blocks should be either structured
c     or unstructured, but one database file can contain both
c     structured and unstructured blocks
c 
c
      read (unit1) nblock
c
      do 103 nb=1,nblock
c
c     Read type of block, and number of unknowns stored for this block 
c
c     itype = 0: Unstructured mesh
c             1: Structured mesh
c     nnu   = number of unknowns stored
c     nnufr = number of unknown stored on the frontier
c
         read (unit1) itype,nnu,nnufr,npatch
c
c     ******************************************************************
c     Structured mesh
c     ******************************************************************
c
c idim,jdim,kdim : indexes for the nodes
c ndim           : dimension of the problem
c ibegfr,jbegfr, kbegfr : first indexes of the nodes of the frontier
c iendfr,jendfr,kendfr  : last indexes of the nodes of the frontier
c
c Assumed : npatch number of  frontier per block
c********
c         may be done ibegfr(ntypefr),jbegfr(ntypefr), kbegfr(ntypfr)
c                     iendfr(ntypefr),jendfr(ntypefr), kendfr(ntypfr)
c        where ntypefr : nbre of frontier of interest
c
         if (itype .eq. 1) then
            read (unit1) idim,jdim,kdim,ndim
            read (unit1) ((((coor1(l,i,j,k),l=1,ndim)
     *                        i=1,idim),j=1,jdim),k=1,kdim)
            read (unit1) ((((q(i,j,k,nu),i=1,idim),j=1,jdim),
     *                                    k=1,kdim),nu=1,nnu)
          do 2 np=1,npatch
            read (unit1) ibegfr(np),iendfr(np), jbegfr(np),
     *                    jendfr(np),kbegfr(np),kendfr(np)
            read (unit1) ((((q1fr(i,j,k,nu),i=ibegfr(np),iendfr(np)),
     *                                     j=jbegfr(np),jendfr(np)),
     *                                    k=kbegfr(np),kendfr(np)),nu=1,nnufr)
2         continue
c
c
c     ******************************************************************
c     Unstructured mesh
c     ******************************************************************
c
         else
c
c     nelemtypes = number of element types
c     nelem      = number of elements
c     nnodes     = number of nodes
c     nfac       = number of facets on the frontier
c     nnodesfr   = number of nodes on the frontier where data is stored
c                  they correspond to type of frontiers that are given
c                  by the next paragraph, problem per problem
c  remark : only on frontier is assumed to be of interest
c           same remarks as for structured
c
            read (unit1) nnodes,nelem,nelemtypes,nfac,nnodesfr,ndim
c
            read (unit1) ((coor(l,i),l=1,ndim),i=1,nnodes)
            read (unit1) ((q(i,nu),i=1,nnodes),nu=1,nnu)
C    MODIFICATION
C            read(unit1) ((q2fr(i,nu),i=1,nnodesfr),nu=1,nnufr)
c
c     Element names implicitly define the element characteristics:
c
c     HE8    8-noded (linear) 3D hex-cube cell      
c     TE4    4-noded (linear) 3D tetrahedral cell
c     T3     3-noded triangular 2D cell
c     Q4     4-noded quadrilateral 2D cell
c     P5     5-noded pyramid element
c     P6     6-noded prismatic element
c
c    itypel      = element type number in table 
c                 (order is  1=HE8, 2=TE4, 3=T3, 4=Q4, 5=P5, 6=P6)
c The ordering of the nodes are defined implicitely, so that
c the faces of the element itypel are known at priory (see figure)
c
           nnperelement(1)=8
           nnperelement(2)=4
           nnperelement(3)=3
           nnperelement(4)=4
           nnperelement(5)=5
           nnperelement(6)=6
c
c  read the connectivity table
c

            iptr=0
            do 203 iel=1,nelem
               read (unit1) itypel 
               ietype(iel)      =itypel
               iconnecp(iel)    =iptr+1
               read (unit1) (iconnec(iptr+i),i=1,nnperelement(itypel)
               iptr = iptr + nnperelement(itypel)
  203       continue
c
c  logic of facet
c  
c   logfac= 1 : entrance facet
c   logfac=-1 : symmetry facet
c   logfac= 2 : outflow facet
c   logfac= 3 : freestream facet
c   logfac= 4 : wall nodes (no slip condition)
c   logfac= 5 : wall nodes (velocity=0)
c 
           iptr=0
           do 204 ifac=1,nfac
            read(unit1) itypel
            ietypfac(ifac)=itypel
            iconnecpfac(ifac)=iptr+1
            read(unit1) logfac(ifac)
            read(unit1)((nufac(l,ifac),l=1,nnperelement(itypel))
204        continue
c
c values on frontiers MODIFICATIONS
c
         do 205 ifac=1,nfac
          itypel=ietypfac(ifac)
          read(unit1)((q2fr(l,nn,ifac),l=1,nnperelement(itypel)),nn=1,nnufr)
205       continue

         end if
c
  103 continue
           close(unit1)
c
c     Quality control data sets (residu curves, lift, drag, etc, as
c     function of the time step), for the whole simulation on the 
c     ASCII file unit2
c
c     ncurves : number of different variables
c
c
      open (unit2,file='history',form='formatted')
c
      read (unit2,'(i4)') ncurves
      do 303 ncurv=1,ncurves
      read (unit2,'(i6,a30)') npoint(ncurv),name(ncurv)
      read (unit2,'(5e15.8)') (curv(i,ncurv),i=1,npoint)
  303 continue
c
     close(unit2)
c


next up previous contents index
Next: Moving format Up: Data formats Previous: HFEP format   Contents   Index
Robert Fournier 2002-09-13