Adding calculation data file opening and closing codes

Adds codes for opening and closing calculation data file.

The solver has to open calculation data file in the first step, and close it in the last step.

iRIC will handle the file name of calculation data file as a the first argument, so open that file.

The way to handle the number of arguments is described in Handling command line arguments in Fortran programs.

Table List 7 shows the source code with the lines to open and close calculation data file. The added lines are shown with highlight.

List 7 The source code with lines to open and close file
 1program SampleProgram
 2  use iric
 3  implicit none
 4  integer:: fin, ier
 5  integer:: icount, istatus
 6  character(200)::condFile
 7
 8  write(*,*) "Sample Program"
 9
10  icount = nargs()
11  if ( icount.eq.2 ) then
12    call getarg(1, condFile, istatus)
13  else
14    write(*,*) "Input File not specified."
15    stop
16  endif
17
18  ! Opens calculation data file.
19  call cg_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
20  if (ier /=0) stop "*** Open error of CGNS file ***"
21
22  ! Closes calculation data file.
23  call cg_iric_close(fin, ier)
24  stop
25end program SampleProgram

Compile and deploy the executable file, just like in Creating a skelton.

Check whether it can be launched from iRIC successfully, just like in Creating a skelton.

Refer to Opening a CGNS file and Closing a CGNS file for the details of the subroutines added in this section.