dynamicsoar's log

主に研究関係のメモ

Fluent: journal file を複数に分割して include するには→ file/read-journal を使う

まえがき

これ、できないと思いこんでたけど、よく見たら User's Guide に書いてあった。.set ファイルに頼らずに、なるべく journal file でやろうとすると、ファイルがどんどん長くなっていて、困っていたので、これができると非常に嬉しい。

方法

要は以下のコマンドで他の journal file(s) を read するというだけ:

file/read-journal "<path_to_another_jorunal_file>" ""

最後に2つのダブルクォーテーションを置くことを忘れないように(忘れると、なぜか次のコマンドがファイル名として認識されてエラーになる)。

ファイルパスは、同一ディレクトリで良ければ、ふつうに、

file/read-journal "./sub.jou" ""

って感じでOK.

もし複数の journal files を連続して読み込みたいなら、

file/read-journal "<path_to_1st_jorunal_file>" "<path_to_2nd_jorunal_file>" ""

みたいにいける。まぁ行数節約しなくていいなら複数行に分けて書いたほうが見やすい気もするが。

具体例

こんなのやろうって人は自分でいくらでも思いつくとは思うけど、たとえば、smoothing の方法を切り替えやすくなる。

つまり、以下のように、smoothing_common.jou, smoothing_spring.jou, smoothing_diffusion.jou, smoothing_linelast.jou というファイルを作っておいて、

smoothing_common.jou

;; ****************************************
;; COMMON settings for SPRING, DIFFUSION, or LIN-ELASTIC method (see below for method-specific settings)
;;; Hidden settings (not accessible from GUI)
;;;; Skewness smoothing on all deforming boundaries [yes]
;;;;   ? Enable/disable skewness smoothing for all deforming dynamic boundary zones. If disabled, only the deforming dynamic boundary zones are smoothed which have smoothing explicitly enabled or use local face remeshing.
define/dynamic-mesh/controls/smoothing-parameters/skew-smooth-all-deforming-boundaries?
yes
;;;; Skewness threshold for cell [0.9]
;;;;   ? Set the cell skewness threshold above which cells will be smoothed using the skewness method.
define/dynamic-mesh/controls/smoothing-parameters/skew-smooth-cell-skew-max
0.7
;;;; Skewness threshold for face [0.7]
;;;;   ? Set the face skewness threshold above which deforming boundary faces will be smoothed using the skewness method.
define/dynamic-mesh/controls/smoothing-parameters/skew-smooth-face-skew-max
0.5
;;;; Skewness-based smoothing number of iterations [4]
define/dynamic-mesh/controls/smoothing-parameters/skew-smooth-niter
4

smoothing_spring.jou

;; ****************************************
;; SPRING method
;;    As boundary layer deformation smoothing can only be used with SPRING, this might be the one we should use.
;;; Smoothing method [spring] (spring, diffusion, linelast)
define/dynamic-mesh/controls/smoothing-parameters/smoothing-method
spring
;;; Normal settings (accessible from GUI)
;;;; <SPRING> Max iterations [20]
define/dynamic-mesh/controls/smoothing-parameters/max-iter
100
;;;; <SPRING> Spring constant factor [1]
define/dynamic-mesh/controls/smoothing-parameters/constant-factor
1
;;;; <SPRING> Convergence Tolorance [0.001]
define/dynamic-mesh/controls/smoothing-parameters/convergence-tolerance
0.0001
;;;; <SPRING> Laplace Node Relaxation factor [1]
define/dynamic-mesh/controls/smoothing-parameters/laplace-node-relaxation
1
;;;; <SPRING> Enable/disable spring-based smoothing for all cell shapes [no]
define/dynamic-mesh/controls/smoothing-parameters/spring-on-all-elements?
no
;;;; <SPRING> Enable/disable spring-based smoothing for tri/tet elements in mixed element zones [no]
define/dynamic-mesh/controls/smoothing-parameters/spring-on-simplex-elements?
no
;;; Hidden settings (not accessible from GUI)
;;;; <SPRING> Set the spring boundary node relaxation factor [1]
;;;;   ? The boundary node relaxation is used by spring smoothing. The boundary node relaxation allows you to relax the update of the node positions at deforming boundaries. A value of 0 prevents deforming boundary nodes from moving and a value of 1 indicates no under-relaxation.
define/dynamic-mesh/controls/smoothing-parameters/bnd-node-relaxation
1
;;;; <SPRING> Set the stiffness factor for springs connected to boundary nodes [1]
define/dynamic-mesh/controls/smoothing-parameters/bnd-stiffness-factor
1

smoothing_spring.jou

;; ****************************************
;; DIFFUSION method
define/dynamic-mesh/controls/smoothing-parameters/smoothing-method
diffusion
;;; Normal settings (accessible from GUI)
;;;; <DIFFUSION> Specify whether the diffusion coefficient is based on the boundary distance or the cell volume [boundary-distance] (boundary-distance, cell-volume)
define/dynamic-mesh/controls/smoothing-parameters/diffusion-coeff-function
boundary-distance
;;;; <DIFFUSION> Set the diffusion coefficient parameter used for diffusion-based smoothing [0] (0.0 -- 3.0)
define/dynamic-mesh/controls/smoothing-parameters/diffusion-coeff-parameter
1.5
;;; Hidden settings (not accessible from GUI)
;;;; <DIFFUSION> Set the numerical method used for diffusion-based smoothing [no] (no=FEM; yes=FVM)
;;;;   ? Answering yes at the prompt changes the diffusion-based smoothing method to the cell based finite volume approach that was the default in releases prior to Fluent 15.0. Answering no at the prompt changes the diffusion-based smoothing method to the default node-based finite element method.
define/dynamic-mesh/controls/smoothing-parameters/diffusion-fvm?
no
;;;; <DIFFUSION> Set the method used to evaluate the boundary distance for the diffusion coefficient calculation [no] (no=standard wall distance; yes=generalized boundary distance)
define/dynamic-mesh/controls/smoothing-parameters/boundary-distance-method
no
;;;; <DIFFUSION/LIN-ELAST> maximum number of iterations for mesh smoothing (FEM) [30]
define/dynamic-mesh/controls/smoothing-parameters/max-iter
30
;;;; <DIFFUSION/LIN-ELAST> Set the relative convergence tolerance for mesh smoothing (FEM) [1e-10]
define/dynamic-mesh/controls/smoothing-parameters/relative-convergence-tolerance
1e-15
;;;; <DIFFUSION/LIN-ELAST> Enable smoothing from reference position [no]
;;;;   ? Enables/disables smoothing from a reference position. Such smoothing may produce greater mesh quality consistency for cases with periodic or quasi-periodic motion, and is only available when the smoothing method is based on diffusion or the linearly elastic solid model.
define/dynamic-mesh/controls/smoothing-parameters/smooth-from-reference-position?
no
;;;; <DIFFUSION/LIN-ELAST> Set the verbosity for mesh smoothing (FEM) [0] (0 -- 1)
;;;;   ? Setting this to 1 will cause smoothing residuals to be printed to the text console. The default value of 0 suppresses this output.
define/dynamic-mesh/controls/smoothing-parameters/verbosity
1

smoothing_linelast.jou

;; ****************************************
;; LIN-ELAST method (linearly elastic solid based)
define/dynamic-mesh/controls/smoothing-parameters/smoothing-method
linelast
;;; Normal setting (accessible from GUI)
;;;; Poission ratio [0.45] (-1.0 -- 0.5)
define/dynamic-mesh/controls/smoothing-parameters/poisson-ratio
0.45
;;; Hidden settings (not accessible from GUI)
;;;; <DIFFUSION/LIN-ELAST> maximum number of iterations for mesh smoothing (FEM) [30]
define/dynamic-mesh/controls/smoothing-parameters/max-iter
30
;;;; <DIFFUSION/LIN-ELAST> Set the relative convergence tolerance for mesh smoothing (FEM) [1e-10]
define/dynamic-mesh/controls/smoothing-parameters/relative-convergence-tolerance
1e-4
;;;; <DIFFUSION/LIN-ELAST> Enable smoothing from reference position [no]
;;;;   ? Enables/disables smoothing from a reference position. Such smoothing may produce greater mesh quality consistency for cases with periodic or quasi-periodic motion, and is only available when the smoothing method is based on diffusion or the linearly elastic solid model.
define/dynamic-mesh/controls/smoothing-parameters/smooth-from-reference-position?
no
;;;; <DIFFUSION/LIN-ELAST> Set the verbosity for mesh smoothing (FEM) [0] (0 -- 1)
;;;;   ? Setting this to 1 will cause smoothing residuals to be printed to the text console. The default value of 0 suppresses this output.
define/dynamic-mesh/controls/smoothing-parameters/verbosity
1

main.jou

メインとなる journal では以下のように、必要ないものをコメントアウトすればよい:

<略>
;; Enable smoothing
define/dynamic-mesh/controls/smoothing?
yes
;
file/read-journal "./smoothing_common.jou" ""
file/read-journal "./smoothing_spring.jou" ""
; file/read-journal "./smoothing_diffusion.jou" ""
; file/read-journal "./smoothing_linelast.jou" ""
;
<略>

他にも、たとえば display/views/camera の設定をいろいろと保存しておいて、見たい角度などに応じて呼び出しを切り替える、といったこともできるだろう。