How to customize solver H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 1 Customization of scalarTransportFoam • Based on “実践ソルバー改良(1)” 柴田貴裕 “practical customization of solver (1)” by Takahiro Shibata • Target: ▫ Add source term to the existing scalarTransportFoam H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 2 Copy solver and case directory • Make directories ▫ Make directory $FORM_RUN/mySolver ▫ Make directory $FORM_RUN/myCase • Copy directories ▫ applications/solvers/basic/scalarTransportFoam to mySolver/scalarTranportFoam ▫ tutorials/basic/scalarTranportFoam to myCase/ H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 3 Rename solver name • In mySolver dir 1. Change the name of directory ▫ $ mv scalarTransportFoam ¥ scalarTransportFoam_S 2. Change the name of source code ▫ In scalarTransportFoam_S dir ▫ $mv scalarTransportFoam.C ¥ scalarTransportFoam_S.C 3. Edit “Make/files” as below scalarTransportFoam_S.C EXE = $(FOAM_APPBIN)/scalarTranportFoam_S H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 4 Edit solver • Add a source term in the transport equation H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 5 Add the definition of source term • Edit “createFields.H” ▫ Copy the entry of “volScalarField T” and create a new entry “volScalarField S” H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 6 Compile and build the new solver • In the solver directory ▫ wmake H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 7 Modify case file for the new solver • Files to be changed H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 8 (1) controlDict H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 9 (2) 0/T H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 10 (3) Prepare the initial distribution S • Create system/setFieldsDict H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 11 Prepare 0/S from 0/T • Copy 0/T to 0/S.org • Edit 0/S.org and then copy to 0/S H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 12 Contenfs 0/S (result of setField) H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 13 Execute solver $ blockMesh $ cp 0/S.org 0/S $ setField $ scalarTransportFoam_S $ paraFoam H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 14 Expected result H. AKIMOTO, Division of Ocean Systems Engineering (OSE), Korea Advanced Institute of Science and Technology 15
© Copyright 2024