CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Read from a CGNS File

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 6, 2013, 07:51
Default Read from a CGNS File
  #1
New Member
 
Join Date: May 2013
Posts: 3
Rep Power: 4
boertecine is on a distinguished road
Hello Dear Community

I want to know, why I can't get read with this code a cgns file.
It's written in Fortran and compiled with gfortran 90

Quote:
program cavity
implicit none
! Included CGNS setup file.
include "cgnslib_f.h"
!---------------Declaration----------------------
!---------------------------------------------------
integer :: ier! error status
integer :: index_base !Base index number
integer :: index_zone !Zone index number
integer :: index_file !File number
integer, dimension(3):: irmin !lower range
integer, dimension(3):: irmax ! upper range
integer :: x,y,z !coordinates
integer,dimension(3,3):: isize!vertex size
CHARACTER(LEN=15) :: zone !zonename
CHARACTER(LEN=15) :: CoordinateX
CHARACTER(LEN=15) :: CoordinateY
CHARACTER(LEN=15) :: CoordinateZ
!---------------initilisation----------------------
!---------------------------------------------------
!lower range index
irmin(1)=1
irmin(2)=1
irmin(3)=1
!upper range index of vertices
irmax(1)=isize(1,1)
irmax(2)=isize(2,1)
irmax(3)=isize(3,1)

index_base=1
index_zone=1

!------------------programm---------------------------
!-----------------------------------------------------

if (ier .ne. CG_OK) then
call cg_error_exit_f

!read grid coordinates
else
call cg_open_f("cavity.cgns",CG_MODE_READ,index_file,ie r)
call cg_zone_read_f(index_file,index_base,index_zone,zo ne,isize,ier)
call cg_coord_read_f(index_file,index_base,index_zone, "CoordinateX",RealSingle,irmin,irmax,x,ier)
call cg_coord_read_f(index_file,index_base,index_zone," CoordinateY",RealSingle,irmin,irmax,y,ier)
call cg_coord_read_f(index_file,index_base,index_zone," CoordinateZ",RealSingle,irmin,irmax,z,ier)
end if
!close CGNS file
call cg_close_f(index_file,ier)
end program cavity
after compiling I get this:
Quote:
gfortran -I ~/$path/include/ -c cavityshort.f90
gfortran -o test cavityshort.o -L ~/$path/src/ -lcgns
$~/Desktop/CGNS> ./test
$~/Desktop/CGNS>
I want read only the coordinates from the CGNS file.But there is nothing to see.
Where is my mistake?
boertecine is offline   Reply With Quote

Old   May 6, 2013, 10:34
Default
  #2
New Member
 
Join Date: May 2013
Posts: 3
Rep Power: 4
boertecine is on a distinguished road
I made meanwhile a compacter code. Maybe it's now easier to find the mistake:
Quote:
program cavity
implicit none
! Included CGNS setup file.
include "cgnslib_f.h"
!---------------Declaration----------------------
!---------------------------------------------------
integer :: ier ! error status
integer :: B !Base index number
integer :: Zn !Zone index number
integer :: fn !File number
integer, dimension(3):: irmin !lower range
integer, dimension(3):: irmax ! upper range
real,dimension(3):: x !coordinate arrays
real,dimension(3):: y
real,dimension(3):: z
integer,dimension(3,3):: isize !vertex size
CHARACTER(LEN=15) :: zone !zonename
CHARACTER(LEN=15) :: CoordinateX
CHARACTER(LEN=15) :: CoordinateY
CHARACTER(LEN=15) :: CoordinateZ
!---------------installation-----------------------
!---------------------------------------------------
!lower range index
irmin(1)=1
irmin(2)=1
irmin(3)=1
!upper range index of vertices
irmax(1)=isize(1,1)
irmax(2)=isize(2,1)
irmax(3)=isize(3,1)

fn=1 !one file
B=1 !one base
Zn=1 !one zone

!------------------programm---------------------------
!-----------------------------------------------------
call cg_open_f("cavity.cgns",CG_MODE_READ,fn,ier)
if (ier .ne. CG_OK) then
call cg_error_exit_f()

!read grid coordinates
else
call cg_coord_read_f(fn,B,Zn,"CoordinateX",RealSingle,i rmin,irmax,x,ier)
call cg_coord_read_f(fn,B,Zn,"CoordinateY",RealSingle,i rmin,irmax,y,ier)
call cg_coord_read_f(fn,B,Zn,"CoordinateZ",RealSingle,i rmin,irmax,z,ier)
end if

!close CGNS file
call cg_close_f(fn,ier)
end program cavity
boertecine is offline   Reply With Quote

Old   May 6, 2013, 11:03
Default
  #3
New Member
 
Join Date: May 2013
Posts: 3
Rep Power: 4
boertecine is on a distinguished road
I've used the cgnscheck prog and get this message:

Quote:
./cgnscheck ~/$/cavity.cgns
reading CGNS file $/cavity.cgns

reading base "BASE#1"
reading zone "hex.uns"
reading element set "SOLID"
reading element set "WALL"
reading element set "MOVING"
building volume faces hash table...
finding exterior nodes...

checking base "BASE#1"

checking zone "hex.uns"
checking coordinates "GridCoordinates"
checking coordinate "CoordinateX"
WARNING:dataclass not given
checking coordinate "CoordinateY"
WARNING:dataclass not given
checking coordinate "CoordinateZ"
WARNING:dataclass not given
checking elements
checking element set "SOLID"
checking element set "WALL"
checking element set "MOVING"
checking boundary conditions
checking BC "BC1_on_WALL"
WARNING:family name "WALL" not found
checking BC interface
checking BC "BC1_on_MOVING"
WARNING:family name "MOVING" not found
checking BC interface
checking discrete data "PID"
checking discrete data array "PID"
WARNING:dataclass is not given

checking complete
6 warnings (6 shown)
What does this mean?
Do I have no coordinate elements?
boertecine is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 May 2, 2013 10:52
funkySetFields compilation error tayo OpenFOAM 39 December 3, 2012 06:18
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
error while compiling the USER Sub routine CFD user CFX 3 November 25, 2002 16:16
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00


All times are GMT -4. The time now is 06:54.