conv_cgns.F

Go to the documentation of this file.
00001 C:\opentelemac\v7p0\sources\stbtel\conv_cgns.F
00002 !
00041       MODULE CONV_CGNS
00042       CONTAINS
00043 !                       *****************
00044                         SUBROUTINE READ_CGNS
00045 !                       *****************
00046      &(CGNSFILE)
00047 !
00048 !***********************************************************************
00049 ! STBTEL   V6P1                                   11/07/2011
00050 !***********************************************************************
00051 !
00052 !BRIEF    READS A FILE OF CGNS FORMAT AND FILL THE MESH OBJECT
00053 !
00054 !HISTORY  Y.AUDOUIN (EDF)
00055 !+        11/07/2011
00056 !+        V6P1
00057 !+   CREATION OF THE FILE
00058 !
00059 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00060 !| CGNSFILE        |-->| NAME OF THE CGNS FILE IN THE TEMPORARY FOLDER
00061 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00062 !
00063       USE DECLARATIONS_STBTEL
00064 !
00065       IMPLICIT NONE
00066       ! LANGAE AND OUTPUT VALUE
00067       INTEGER LNG,LU
00068       COMMON/INFO/LNG,LU
00069 !
00070 #if defined(HAVE_CGNS)
00071       INCLUDE 'cgnslib_f.h'
00072 #endif
00073 !
00074 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00075 !
00076       CHARACTER(LEN=MAXLENHARD), INTENT(IN) :: CGNSFILE
00077 
00078 !
00079 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00080 !
00081 #if defined(HAVE_CGNS)
00082       INTEGER :: IERR
00083       INTEGER :: I, J, I1
00084       INTEGER :: ITIME, IVAR
00085       CHARACTER*32 :: CGNSNAME, SOLNAME, VARNAME
00086       INTEGER :: ICELLDIM, IPHYSDIM
00087       INTEGER :: INDEX_BASE, INDEX_ZONE, INDEX_COORD, INDEX_SECTION
00088       INTEGER :: INDEX_FLOW, INDEX_FIELD
00089       INTEGER :: ISIZE(3,3), IDATA(2)
00090       INTEGER, ALLOCATABLE :: IELEM(:,:), PARENT(:)
00091       INTEGER :: NBDYELEM
00092       INTEGER :: TYPGEO
00093       INTEGER :: PARENT_FLAG
00094       INTEGER :: ISTART, IEND
00095       INTEGER :: DATATYPE, GRIDLOCATION
00096       DOUBLE PRECISION, ALLOCATABLE :: TMP(:)
00097 !
00098       WRITE(LU,*) '----------------------------------------------------'
00099       IF(LNG.EQ.2) WRITE(LU,*) '------BEGINNING READING OF CGNS FILE'
00100       IF(LNG.EQ.1) WRITE(LU,*) '------DEBUT LECTURE DU FICHIER CGNS'
00101       WRITE(LU,*) '----------------------------------------------------'
00102 !
00103 !-----------------------------------------------------------------------
00104 !
00105       CALL CG_OPEN_F(CGNSFILE,CG_MODE_READ,NINP,IERR)
00106       CALL FNCT_CHECK(IERR,'CG_OPEN_F')
00107       !READ BASE
00108       INDEX_BASE = 1
00109       CALL CG_BASE_READ_F(NINP,INDEX_BASE,CGNSNAME,MESH2%NDIM,IPHYSDIM,
00110      &                     IERR)
00111       CALL FNCT_CHECK(IERR,'CG_BASE_READ_F')
00112       IF(LNG.EQ.1) THEN
00113       IF(DEBUG) WRITE(LU,*) 'NOM DE LA BASE :', CGNSNAME
00114       IF(DEBUG) WRITE(LU,*) 'MESH2%NDIM :', MESH2%NDIM
00115       ENDIF
00116       IF(LNG.EQ.2) THEN
00117       IF(DEBUG) WRITE(LU,*) 'BASENAME:', CGNSNAME
00118       IF(DEBUG) WRITE(LU,*) 'MESH2%NDIM:', MESH2%NDIM
00119       ENDIF
00120       ! READ ZONE INFORMATION
00121       INDEX_ZONE = 1
00122       CALL CG_ZONE_READ_F(NINP,INDEX_BASE,INDEX_ZONE,CGNSNAME,
00123      &                     ISIZE(1,:),IERR)
00124       CALL FNCT_CHECK(IERR,'CG_ZONE_READ_F')
00125       MESH2%NPOIN = ISIZE(1,1)
00126       MESH2%TITLE = CGNSNAME
00127       IF(LNG.EQ.1) THEN
00128       IF(DEBUG) WRITE(LU,*) 'NOM DE LA ZONE : ',CGNSNAME
00129       IF(DEBUG) WRITE(LU,*) 'NOMBRE DE POINTS : ',MESH2%NPOIN
00130       ENDIF
00131       IF(LNG.EQ.2) THEN
00132       IF(DEBUG) WRITE(LU,*) 'ZONENAME: ',CGNSNAME
00133       IF(DEBUG) WRITE(LU,*) 'NUMBER OF POINTS: ',MESH2%NPOIN
00134       ENDIF
00135       ! READ COORDINATES
00136       ALLOCATE(MESH2%X(MESH2%NPOIN),STAT=IERR)
00137       CALL FNCT_CHECK(IERR,'ALLOCATION MESH2%X')
00138       CALL CG_COORD_READ_F(NINP,INDEX_BASE,INDEX_ZONE,'CoordinateX',
00139      &                      REALDOUBLE,1,MESH2%NPOIN,MESH2%X,IERR)
00140       CALL FNCT_CHECK(IERR,'CG_COORD_READ_F X')
00141       ALLOCATE(MESH2%Y(MESH2%NPOIN),STAT=IERR)
00142       CALL FNCT_CHECK(IERR,'ALLOCATION MESH2%X')
00143       CALL CG_COORD_READ_F(NINP,INDEX_BASE,INDEX_ZONE,'CoordinateY',
00144      &                      REALDOUBLE,1,MESH2%NPOIN,MESH2%Y,IERR)
00145       CALL FNCT_CHECK(IERR,'CG_COORD_READ_F Y')
00146       IF(MESH2%NDIM.EQ.3) THEN
00147         ALLOCATE(MESH2%Z(MESH2%NPOIN),STAT=IERR)
00148         CALL FNCT_CHECK(IERR,'ALLOCATION MESH2%X')
00149       CALL CG_COORD_READ_F(NINP,INDEX_BASE,INDEX_ZONE,'CoordinateZ',
00150      &                      REALDOUBLE,1,MESH2%NPOIN,MESH2%Z,IERR)
00151       CALL FNCT_CHECK(IERR,'CG_COORD_READ_F Z')
00152       ENDIF
00153       ! IDENTIFY THE ELEMENT TYPE
00154       INDEX_SECTION = 1
00155       CALL CG_SECTION_READ_F(NINP,INDEX_BASE,INDEX_ZONE,
00156      &   INDEX_SECTION,CGNSNAME,TYPGEO,ISTART,IEND,NBDYELEM,
00157      &   PARENT_FLAG,IERR)
00158       CALL FNCT_CHECK(IERR,'CG_SECTION_READ_F')
00159       ! COUNTING THE NUMBER OF ELEMENTS
00160       MESH2%NELEM = IEND
00161       SELECT CASE (TYPGEO)
00162       CASE(TRI_3)
00163         MESH2%TYPE_ELEM = TYPE_TRIA3
00164         MESH2%NDP = 3
00165       CASE(QUAD_4)
00166         MESH2%TYPE_ELEM = TYPE_QUAD4
00167         MESH2%NDP = 4
00168       CASE(TETRA_4)
00169         MESH2%TYPE_ELEM = TYPE_TETRA4
00170         MESH2%NDP = 4
00171       CASE(PENTA_6)
00172         MESH2%TYPE_ELEM = TYPE_PRISM6
00173         MESH2%NDP = 6
00174       END SELECT
00175       ! SET ELEMENT CONNECTIVITY:
00176       ALLOCATE(IELEM(MESH2%NDP,MESH2%NELEM),STAT=IERR)
00177       CALL FNCT_CHECK(IERR,'ALLOCATE IELEM')
00178       ! READING THE CONNECTIVITY TABLE
00179       CALL CG_ELEMENTS_READ_F(NINP,INDEX_BASE,INDEX_ZONE,INDEX_SECTION,
00180      &          IELEM,PARENT,IERR)
00181       CALL FNCT_CHECK(IERR,'CG_ELEMENTS_READ_F')
00182       ! BUILDING THE CONNECTIVITY TABLE
00183       ALLOCATE(MESH2%IKLES(MESH2%NELEM*MESH2%NDP),STAT=IERR)
00184       CALL FNCT_CHECK(IERR,'ALLOCATION MESH2%IKLES')
00185       DO I=1,MESH2%NELEM
00186         DO J=1,MESH2%NDP
00187           MESH2%IKLES((I-1)*MESH2%NDP+J) = IELEM(J,I)
00188         ENDDO
00189       ENDDO
00190       DEALLOCATE(IELEM)
00191       ! SETTING MESH_OBJECT VALUES
00192       ALLOCATE(MESH2%IPOBO(MESH2%NPOIN),STAT=IERR)
00193       CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%IPOBO')
00194       MESH2%IPOBO(:) = 0
00195       ALLOCATE(MESH2%NAMECOO(MESH2%NDIM),STAT=IERR)
00196       CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%NAMECOO')
00197       ALLOCATE(MESH2%UNITCOO(MESH2%NDIM),STAT=IERR)
00198       CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%UNITCOO')
00199       MESH2%NAMECOO(1) = 'X'
00200       MESH2%UNITCOO(1) = 'M'
00201       MESH2%NAMECOO(2) = 'Y'
00202       MESH2%UNITCOO(2) = 'M'
00203       IF(MESH2%NDIM.EQ.3) THEN
00204         MESH2%NAMECOO(3) = 'Z'
00205         MESH2%UNITCOO(3) = 'M'
00206       ENDIF
00207       DO I=1,MESH2%NDIM
00208         CALL BLANC2USCORE(MESH2%NAMECOO(I),16)
00209         CALL BLANC2USCORE(MESH2%UNITCOO(I),16)
00210         ! CHANGING IB IF IN 3D
00211         MESH2%IB(7) = 1
00212       ENDDO
00213 
00214       ! RESULTS INFORMATIONS
00215       ! READING THE NUMBER OF TIMSTEP
00216       CALL CG_BITER_READ_F(NINP,INDEX_BASE,CGNSNAME,MESH2%TIMESTEP,IERR)
00217       CALL FNCT_CHECK(IERR,'CG_BITER_READ_F')
00218       IF (DEBUG.AND.(LNG.EQ.1)) WRITE(LU,*) 'NOMBRE DE PAS DE TEMPS :',
00219      &           MESH2%TIMESTEP
00220       IF (DEBUG.AND.(LNG.EQ.2)) WRITE(LU,*) 'NUMBER OF TIMESTEP:',
00221      &           MESH2%TIMESTEP
00222       ! IF WE HAVE RESULTS
00223       IF(MESH2%TIMESTEP.NE.0) THEN
00224         ! LOOPING FOR EACH TIME STEP
00225         DO ITIME=1,MESH2%TIMESTEP
00226           ! READ FLOW SOLUTION NODE
00227           CALL CG_SOL_INFO_F(NINP,INDEX_BASE,INDEX_ZONE,ITIME,SOLNAME,
00228      &                       GRIDLOCATION,IERR)
00229           CALL FNCT_CHECK(IERR,'CG_SOL_INFO_F '//I2CHAR(ITIME))
00230           IF (DEBUG) WRITE(LU,*) 'SOLUTION NAME : ',SOLNAME
00231           ! IF THE FIRST LOOP IDENTIFY THE NUMBER OF VARIABLES
00232           ! AND ALLOCATION RESULTS
00233           IF(ITIME.EQ.1) THEN
00234             CALL CG_NFIELDS_F(NINP,INDEX_BASE,INDEX_ZONE,ITIME,
00235      &                        MESH2%NVAR,IERR)
00236             CALL FNCT_CHECK(IERR,'CG_NFIELDS_F')
00237             IF(DEBUG.AND.(LNG.EQ.1)) WRITE(LU,*)
00238      &             'NOMBRE DE VARIABLES :',MESH2%NVAR
00239             IF(DEBUG.AND.(LNG.EQ.2)) WRITE(LU,*)
00240      &             'NUMBER OF VARIABLES:',MESH2%NVAR
00241             ALLOCATE(MESH2%RESULTS(MESH2%TIMESTEP,MESH2%NVAR,
00242      &                             MESH2%NPOIN),STAT=IERR)
00243             CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%RESULTS')
00244             ALLOCATE(MESH2%NAMEVAR(MESH2%NVAR),STAT=IERR)
00245             CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%NAMEVAR')
00246             ALLOCATE(MESH2%UNITVAR(MESH2%NVAR),STAT=IERR)
00247             CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%UNITVAR')
00248           ENDIF
00249           !   READ FLOW SOLUTION (USER MUST USE SIDS-STANDARD NAMES HERE)
00250           ! TEMPORARY FOLDER FOR THE RESULTS
00251           ALLOCATE(TMP(MESH2%NPOIN),STAT=IERR)
00252           CALL FNCT_CHECK(IERR,'ALLOCATE TMP')
00253           DO IVAR=1,MESH2%NVAR
00254             CALL CG_FIELD_INFO_F(NINP,INDEX_BASE,INDEX_ZONE,ITIME,
00255      &                           IVAR,DATATYPE,VARNAME,IERR)
00256             CALL FNCT_CHECK(IERR,'CG_FIELD_INFO_F '//I2CHAR(IVAR))
00257             IF(DEBUG.AND.(LNG.EQ.1)) WRITE(LU,*)
00258      &              'NOM DE LA VARIABLE :',VARNAME
00259             IF(DEBUG.AND.(LNG.EQ.2)) WRITE(LU,*)
00260      &              'NAME OF THE VARIABLE:',VARNAME
00261             ! IF FIRST TIME STEP SAVING VAR NAMES
00262             IF (ITIME.EQ.1) THEN
00263               MESH2%NAMEVAR(IVAR) = VARNAME(1:16)
00264               MESH2%UNITVAR(IVAR) = VARNAME(16:32)
00265               CALL BLANC2USCORE(MESH2%NAMEVAR(IVAR),16)
00266               CALL BLANC2USCORE(MESH2%UNITVAR(IVAR),16)
00267             ENDIF
00268             ! READING RESULTS
00269             CALL CG_FIELD_READ_F(NINP,INDEX_BASE,INDEX_ZONE,ITIME,
00270      &                           VARNAME,REALDOUBLE,1,MESH2%NPOIN,
00271      &                           TMP,IERR)
00272             CALL FNCT_CHECK(IERR,'CG_FIELD_READ_F '//I2CHAR(IVAR))
00273             DO I1=1,MESH2%NPOIN
00274               MESH2%RESULTS(ITIME,IVAR,I1) = TMP(I1)
00275             ENDDO
00276           ENDDO
00277           DEALLOCATE(TMP)
00278         ENDDO
00279         ! READING THE TIME TABLE
00280         ! GO TO BASEITERATIVEDATA LEVEL
00281         CALL CG_GOTO_F(NINP,INDEX_BASE,IERR,'BaseIterativeData_t',
00282      &                 1,'end')
00283         CALL FNCT_CHECK(IERR,'CG_GOTO_F')
00284         ALLOCATE(MESH2%TIMES(MESH2%TIMESTEP),STAT=IERR)
00285         CALL FNCT_CHECK(IERR,'ALLOCATE MESH2%TIMES')
00286         ! THERE IS NORAMLY ONLY ONE TABLE UNDER THE BASE ITERATIVE NODE
00287         CALL CG_ARRAY_READ_F(1,MESH2%TIMES,IERR)
00288         CALL FNCT_CHECK(IERR,'CG_ARRAY_READ_F')
00289       ENDIF
00290       ! CLOSE CGNS CFILE
00291       CALL CG_CLOSE_F(NINP,IERR)
00292       CALL FNCT_CHECK(IERR,'CG_CLOSE_F')
00293 !
00294 !-----------------------------------------------------------------------
00295 !
00296       WRITE(LU,*) '----------------------------------------------------'
00297       IF(LNG.EQ.1) WRITE(LU,*) '------FIN LECTURE DU FICHIER CGNS'
00298       IF(LNG.EQ.2) WRITE(LU,*) '------ENDING READING OF CGNS FILE'
00299       WRITE(LU,*) '----------------------------------------------------'
00300 #else
00301       IF(LNG.EQ.1) WRITE(LU,*)
00302      &       'ERREUR : TENTATIVE DE LECTURE DE FICHIER ',
00303      &       'CGNS SANS LA BILOTHEQUE CGNS'
00304       IF(LNG.EQ.2) WRITE(LU,*)
00305      &       'ERROR : TRYING TO READ CGNS FILE WITHOUT CGNS LIBRARY'
00306       CALL PLANTE(1)
00307 #endif
00308 ! ENDIF HAVE_CGNS
00309       END SUBROUTINE
00310 !                       *****************
00311                         SUBROUTINE WRITE_CGNS
00312 !                       *****************
00313      &(CGNSFILE)
00314 !
00315 !***********************************************************************
00316 ! STBTEL   V6P1                                   11/07/2011
00317 !***********************************************************************
00318 !
00319 !BRIEF    WRITE A FILE OF CGNS FORMAT WITH THE MESH OBJECT
00320 !+        INFORMATIONS
00321 !
00322 !HISTORY  Y.AUDOUIN (EDF)
00323 !+        11/07/2011
00324 !+        V6P1
00325 !+   CREATION OF THE FILE
00326 !
00327 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00328 !| CGNSFILE        |-->| NAME OF THE CGNS FILE
00329 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00330 !
00331       USE DECLARATIONS_STBTEL
00332       IMPLICIT NONE
00333       ! LANGAE AND OUTPUT VALUE
00334       INTEGER LNG,LU
00335       COMMON/INFO/LNG,LU
00336 #if defined(HAVE_CGNS)
00337       INCLUDE 'cgnslib_f.h'
00338 #endif
00339 !
00340 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00341 !
00342       CHARACTER(LEN=MAXLENHARD)  CGNSFILE
00343 !
00344 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
00345 !
00346 #if defined (HAVE_CGNS)
00347       INTEGER :: IERR
00348       INTEGER :: I, J
00349       INTEGER :: ITIME, IVAR
00350       CHARACTER*32 :: BASENAME, ZONENAME
00351       CHARACTER*32 :: VARNAME
00352       INTEGER :: ICELLDIM, IPHYSDIM
00353       INTEGER :: INDEX_BASE, INDEX_ZONE, INDEX_COORD, INDEX_SECTION
00354       INTEGER :: INDEX_FLOW, INDEX_FIELD
00355       INTEGER :: ISIZE(3,3), IDATA(2)
00356       INTEGER, ALLOCATABLE :: IELEM(:,:)
00357       INTEGER :: NBDYELEM
00358       INTEGER :: TYPGEO
00359       CHARACTER*32, ALLOCATABLE :: SOLNAME(:)
00360       DOUBLE PRECISION, ALLOCATABLE :: TMP(:)
00361 !
00362       WRITE(LU,*) '----------------------------------------------------'
00363       IF(LNG.EQ.1) WRITE(LU,*) '------DEBUT ECRITURE DU FICHIER CGNS'
00364       IF(LNG.EQ.2) WRITE(LU,*) '------BEGINNING WRITTING OF CGNS FILE'
00365       WRITE(LU,*) '----------------------------------------------------'
00366 !
00367 !-----------------------------------------------------------------------
00368 !
00369 
00370       CALL CG_OPEN_F(CGNSFILE,CG_MODE_WRITE,NOUT,IERR)
00371       CALL FNCT_CHECK(IERR,'CG_OPEN_F')
00372       !CREATE BASE (USER CAN GIVE ANY NAME)
00373       BASENAME='BASE'
00374       ICELLDIM=MESH2%NDIM
00375       IPHYSDIM=MESH2%NDIM
00376       CALL CG_BASE_WRITE_F(NOUT,BASENAME,ICELLDIM,IPHYSDIM,
00377      &                     INDEX_BASE,IERR)
00378       CALL FNCT_CHECK(IERR,'CG_BASE_WRITE_F')
00379       !  DEFINE ZONE NAME (USER CAN GIVE ANY NAME)
00380       ZONENAME = MESH2%TITLE(1:32)
00381       ISIZE=0
00382       ! NUMBER OF POINTS
00383       ISIZE(1,1)=MESH2%NPOIN
00384       ! NUMBER OF ELEMENTS
00385       ISIZE(1,2)=MESH2%NELEM
00386       ! CREATE ZONE
00387       CALL CG_ZONE_WRITE_F(NOUT,INDEX_BASE,ZONENAME,ISIZE,
00388      &                     UNSTRUCTURED,INDEX_ZONE,IERR)
00389       CALL FNCT_CHECK(IERR,'CG_ZONE_WRITE_F')
00390       ! WRITE GRID COORDINATES (USER MUST USE SIDS-STANDARD NAMES HERE)
00391       CALL CG_COORD_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,REALDOUBLE,
00392      &                      'CoordinateX',MESH2%X,INDEX_COORD,IERR)
00393       CALL FNCT_CHECK(IERR,'CG_COORD_WRITE_F X')
00394       CALL CG_COORD_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,REALDOUBLE,
00395      &                      'CoordinateY',MESH2%Y,INDEX_COORD,IERR)
00396       CALL FNCT_CHECK(IERR,'CG_COORD_WRITE_F Y')
00397       IF(MESH2%NDIM.EQ.3) THEN
00398         CALL CG_COORD_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,REALDOUBLE,
00399      &                        'CoordinateZ',MESH2%Z,INDEX_COORD,IERR)
00400       CALL FNCT_CHECK(IERR,'CG_COORD_WRITE_F Z')
00401       ENDIF
00402       ! SET ELEMENT CONNECTIVITY:
00403       ALLOCATE(IELEM(MESH2%NDP,MESH2%NELEM),STAT=IERR)
00404       CALL FNCT_CHECK(IERR,'ALLOCATE IELEM')
00405       ! BUILDING THE CONNECTIVITY TABLE
00406       DO I=1,MESH2%NELEM
00407         DO J=1,MESH2%NDP
00408           IELEM(J,I)=MESH2%IKLES((I-1)*MESH2%NDP+J)
00409         ENDDO
00410       ENDDO
00411       ! UNSORTED BOUNDARY ELEMENTS
00412       NBDYELEM=0
00413       ! DEFINES THE CGNS TYPE
00414       ! WRITE ELEMENT CONNECTIVITY
00415       SELECT CASE (MESH2%TYPE_ELEM)
00416       CASE(TYPE_TRIA3)
00417         CALL CG_SECTION_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00418      &   'Elem',TRI_3,1,MESH2%NELEM,NBDYELEM,IELEM,
00419      &   INDEX_SECTION,IERR)
00420       CASE(TYPE_QUAD4)
00421         CALL CG_SECTION_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00422      &   'Elem',QUAD_4,1,MESH2%NELEM,NBDYELEM,IELEM,
00423      &   INDEX_SECTION,IERR)
00424       CASE(TYPE_TETRA4)
00425         CALL CG_SECTION_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00426      &   'Elem',TETRA_4,1,MESH2%NELEM,NBDYELEM,IELEM,
00427      &   INDEX_SECTION,IERR)
00428       CASE(TYPE_PRISM6)
00429         CALL CG_SECTION_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00430      &   'Elem',PENTA_6,1,MESH2%NELEM,NBDYELEM,IELEM,
00431      &   INDEX_SECTION,IERR)
00432       END SELECT
00433       CALL FNCT_CHECK(IERR,'CG_SECTION_WRITE_F')
00434       DEALLOCATE(IELEM)
00435 
00436       ! RESULTS INFORMATIONS
00437       ! IF WE HAVE RESULTS
00438       IF(MESH2%TIMESTEP.NE.0) THEN
00439         !   DEFINE SOLUTION NAMES (USER CAN GIVE ANY NAMES)
00440         ALLOCATE(SOLNAME(MESH2%TIMESTEP),STAT=IERR)
00441         CALL FNCT_CHECK(IERR,'ALLOCATION SOLNAME')
00442         DO I=1,MESH2%TIMESTEP
00443           SOLNAME(I) = 'Test'//I2CHAR(I)
00444         ENDDO
00445         ! LOOPING FOR EACH TIME STEP
00446         DO ITIME=1,MESH2%TIMESTEP
00447           !   CREATE FLOW SOLUTION NODE
00448           CALL CG_SOL_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00449      &                        SOLNAME(ITIME),VERTEX,INDEX_FLOW,IERR)
00450           CALL FNCT_CHECK(IERR,'CG_SOL_WRITE_F '//I2CHAR(ITIME))
00451           !   WRITE FLOW SOLUTION (USER MUST USE SIDS-STANDARD NAMES HERE)
00452           ! TEMPORARY ARRAY FOR RESULTS
00453           ALLOCATE(TMP(MESH2%NPOIN),STAT=IERR)
00454           CALL FNCT_CHECK(IERR,'ALLOCATE TMP')
00455           DO IVAR=1,MESH2%NVAR
00456             ! DECLARING A NEW VARIABLE
00457             VARNAME = MESH2%NAMEVAR(IVAR)
00458             DO K=1,MESH2%NPOIN
00459               TMP(K) = MESH2%RESULTS(ITIME,IVAR,K)
00460             ENDDO
00461             CALL CG_FIELD_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00462      &               INDEX_FLOW,REALDOUBLE,VARNAME,
00463      &               TMP,INDEX_FIELD,IERR)
00464             CALL FNCT_CHECK(IERR,'CG_FIELD_WRITE_F '//I2CHAR(IVAR))
00465           ENDDO
00466           DEALLOCATE(TMP)
00467         ENDDO
00468         ! CREATE BASEITERATIVEDATA
00469         CALL CG_BITER_WRITE_F(NOUT,INDEX_BASE,'TimeIterValues',
00470      &       MESH2%TIMESTEP,IERR)
00471         CALL FNCT_CHECK(IERR,'CG_BITER_WRITE_F')
00472         ! GO TO BASEITERATIVEDATA LEVEL AND WRITE TIME VALUES
00473         CALL CG_GOTO_F(NOUT,INDEX_BASE,IERR,'BaseIterativeData_t',
00474      &                 1,'end')
00475         CALL FNCT_CHECK(IERR,'CG_GOTO_F')
00476         CALL CG_ARRAY_WRITE_F('TimeValues',REALDOUBLE,1,MESH2%TIMESTEP
00477      &                        ,MESH2%TIMES,IERR)
00478         CALL FNCT_CHECK(IERR,'CG_ARRAY_WRITE_F')
00479         ! CREATE ZONEITERATIVEDATA
00480         CALL CG_ZITER_WRITE_F(NOUT,INDEX_BASE,INDEX_ZONE,
00481      &                        'ZoneIterativeData',IERR)
00482         CALL FNCT_CHECK(IERR,'CG_ZITER_WRITE_F')
00483         ! GO TO ZONEITERATIVEDATA LEVEL AND GIVE INFO TELLING WHICH
00484         ! FLOW SOLUTION CORRESPONDS WITH WHICH TIME (SOLNAME(1) CORRESPONDS
00485         ! WITH TIME(1), SOLNAME(2) WITH TIME(2), AND SOLNAME(3) WITH TIME(3))
00486         CALL CG_GOTO_F(NOUT,INDEX_BASE,IERR,'Zone_t',
00487      &           INDEX_ZONE,'ZoneIterativeData_t',1,'end')
00488         CALL FNCT_CHECK(IERR,'CG_GOTO_F BIS')
00489         IDATA(1)=32
00490         IDATA(2)=MESH2%TIMESTEP
00491         CALL CG_ARRAY_WRITE_F('FlowSolutionPointers',CHARACTER,2,IDATA,
00492      &                     SOLNAME,IERR)
00493         CALL FNCT_CHECK(IERR,'CG_ARRAY_WRITE_F BIS')
00494         ! ADD SIMULATIONTYPE
00495         CALL CG_SIMULATION_TYPE_WRITE_F(NOUT,INDEX_BASE,
00496      &               TIMEACCURATE,IERR)
00497         CALL FNCT_CHECK(IERR,'CG_SIMULATION_TYPE_WRITE_F')
00498       ENDIF
00499       ! CLOSE CGNS CFILE
00500       CALL CG_CLOSE_F(NOUT,IERR)
00501       CALL FNCT_CHECK(IERR,'CG_CLOSE_F')
00502 !
00503 !-----------------------------------------------------------------------
00504 !
00505       WRITE(LU,*) '----------------------------------------------------'
00506       IF(LNG.EQ.1) WRITE(LU,*) '------FIN ECRITURE DU FICHIER CGNS'
00507       IF(LNG.EQ.2) WRITE(LU,*) '------ENDING WRITTING OF CGNS FILE'
00508       WRITE(LU,*) '----------------------------------------------------'
00509 #else
00510       IF(LNG.EQ.1) WRITE(LU,*)'ERREUR : TENTATIVE D ECRITURE D UN ',
00511      &            'FICHIER CGNS SANS LA BIBLIOTHEQUE'
00512       IF(LNG.EQ.2) WRITE(LU,*)'ERROR : TRYING TO WRITE CGNS FILE ',
00513      &            'WITHOUT CGNS LIBRARY'
00514       CALL PLANTE(1)
00515 #endif
00516 ! ENDIF HAVE_CGNS
00517       END SUBROUTINE
00518       END MODULE

Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using doxygen 1.7.0