PROGRAMMING

PROGRAMMING

皆さん、どんなプログラミング言語を使っていますか?

最新の調査によると、首位がPython、二番手はC、俺が見栄で使うC++は3番手、Javaは4番手に後退して、併せて全体の6割弱を占めている。初めて齧った高級言語FORTRANに至っては27位と過去の遺物でしかない。

俺がプログラミングを始めたのは業務で必要に迫られた事によるが、それまでプログラミングに関する全うな教育を受けたことはない。科学技術計算に特化したFORTRANを見様見真似で業務に使っていたが、90年代後半からは当時の流行りのC++言語を使ってカッコつけていた。21世紀に入ってからはプログラミングには縁がなくなったが、Arduinoの電子工作をきっかけにプログラミング熱が再発、Androidアプリ製作にのめり込んだ時期もあった。Android言語のJavaはObjective指向がより発展していて初めは取っ付き難かったが、実態はC++と変わりませんね。

C++言語は入出力、文字を扱うのが容易な反面、FORTRANに比べてメモリマネジメントが難しいきらいがあるが、最も気に入らないのはC++の配列がゼロから始まるの点だ。これは行列計算では納得できない、行・列は1から始まるという固定観念を持ているからだ。また、C++はコーディングに気を使う度合いが格段に大きい事も難点。それに比べてFORTRANはアルゴリズムに専念できるし出来上がったコードは数式そのもので美しい。従って、主体はC++だが、技術計算にはFORTRAN一筋で使っている。要は使い分けと思っている。

世間では忘れ去られた存在のFORTRAN言語だが、実は大いな進化を遂げ、オブジェクト指向対応を果たした2003年規格はFORTRAN77に比べ全く別の言語と云っても過言ではない。

An ultimate purpose is here to provide with an opportunity so as to enable get familiarized with the scientific programming, introducing the coding work for the large sparse matrix solution which plays a core role of the Reservoir Simulation Model widely utilized in the upstream oil and gas business. The modelling code with Modern Fortran is an actual model produced through my company career. Its code name is SmartMarix.

Further to the following NF and ILU, the CPR (Constrained Pressure Residual) preconditioner which is a two-stage preconditioner is well noted to be effective especially in the compositional model. The pressure equation is extracted from the implicit coefficient matrix in the CPR method. It is iteratively solved by means of an inexpensive preconditioner like the line Gauss-Seidel etc, ending up to solve the full coefficient matrix.

For the large sparse matrix solution, the preconditioning methods comprise of

  • Nested Factorization (NF)
  • Incomplete LU Factorization (ILU)

The iterative methods represent

  • ORTHOMIN
  • Flexible GMRES

While those methods are common at present, the special treatment related to the Adaptive Implicit Method is internally adopted.

時代錯誤とお思いになられる事でしょうが、「Front-end Computing with the Modern Fortran」を合言葉に長丁場のお付き合いの程、宜しくお願いします。

昨年夏よりスタート致しました。今後の展開をご期待ください。

2023年1月

参考:Reservoir simulation linear equation solver – PetroWiki