Adding codes to load grid generating condition

Adds codes to load grid generating conditions.

iRIC will output grid generating conditions according to the grid generating program definition file. So, the grid generating program have to load them to coincide with the description in the grid generating program definition file.

List 21 shows the source code with lines to load grid generating condition. The added lines are shown with highlight. Note that the arguments passed to load grid generating conditions are the same to the [name] attributes of Items defined in Defining grid generating conditions.

When it is compiled successfully, create a grid from iRIC in the procedure same to Adding codes to output a grid, and the grid will be created with the condition you specified on [Grid Creation] dialog.

Refer to Examples of calculation conditions, boundary conditions, and grid generating condition for the relation between definitions of grid generating condition and the iRIClib subroutines to load them. Refer to Reading calculation conditions for the detail of subroutines to load grid generating conditions.

List 21 Source codewith lines to load grid generating conditions
 1program SampleProgram
 2  use iric
 3  implicit none
 4
 5  integer:: fin, ier
 6  integer:: icount, istatus
 7  integer:: imax, jmax
 8  integer:: elev_on
 9  double precision:: elev_value
10  double precision, dimension(:,:), allocatable::grid_x, grid_y
11  double precision, dimension(:,:), elevation
12
13  character(200)::condFile
14
15  icount = nargs()
16  if ( icount.eq.2 ) then
17    call getarg(1, condFile, istatus)
18  else
19    stop "Input File not specified."
20  endif
21
22  ! Opens grid generating data file.
23  call cg_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
24  if (ier /=0) stop "*** Open error of CGNS file ***"
25
26  ! Loads grid generating condition
27  ! To make it simple, no error handling codes are written.
28  call cg_iric_read_integer(fin, "imax", imax, ier)
29  call cg_iric_read_integer(fin, "jmax", jmax, ier)
30  call cg_iric_read_integer(fin, "elev_on", elev_on, ier)
31  call cg_iric_read_real(fin, "elev_value", elev_value, ier)
32
33  ! Allocate memory for creating grid
34  allocate(grid_x(imax,jmax), grid_y(imax,jmax)
35  allocate(elevation(imax,jmax))
36
37  ! Generate grid
38  do i = 1, isize
39    do j = 1, jsize
40      grid_x(i, j) = i
41      grid_y(i, j) = j
42      elevation(i, j) = elev_value
43    end do
44  end do
45
46  ! Outputs grid
47  cg_iric_write_grid2d_coords(fin, imax, jmax, grid_x, grid_y, ier)
48  if (elev_on == 1) then
49    cg_iric_write_grid_real_node(fin, "Elevation", elevation, ier);
50  end if
51
52  ! Closes grid generating data file.
53  call cg_iric_close(fin, ier)
54end program SampleProgram