Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.85 KB

03_02_gridgenerator_openclose.rst

File metadata and controls

52 lines (38 loc) · 1.85 KB

格子生成データファイルを開く処理、閉じる処理の記述

格子生成データファイルを開く処理、閉じる処理を記述します。

格子計算プログラムは、処理開始時に 格子生成データファイルを開き、終了時に閉じる必要があります。iRIC は引数として格子生成データファイルのファイル名を渡すため、 そのファイル名を開きます。

Intel Fortran Compiler での引数の取得方法を handling_arguments で説明していますので、参考にしてください。

処理を追記したソースコードを gridgenerator_with_open_close に示します。追記した部分を強調して示します。

program SampleProgram
  use iric
  implicit none

  integer:: fin, ier
  integer:: icount, istatus

  character(200)::condFile

  icount = nargs()
  if ( icount.eq.2 ) then
    call getarg(1, condFile, istatus)
  else
    stop "Input File not specified."
  endif

  ! 格子生成データファイルを開く
  call cg_iric_open(condFile, IRIC_MODE_MODIFY, fin, ier)
  if (ier /=0) stop "*** Open error of CGNS file ***"

  ! 格子生成データファイルを閉じる
  call cg_iric_close(fin, ier)
end program SampleProgram

gridgenerator_dev_skeleton と同様に、ファイルのコンパイルを行います。 問題なくコンパイルが成功することを確認してください。

この節で追加した関数の詳細については、iriclib_open_cgns, iriclib_close_cgns を参照してください。