FACUtility is an OpenFOAM-based post-processing utility for predicting flow-accelerated corrosion (FAC) wall-thinning rates from a converged CFD solution. The utility combines hydrodynamic quantities derived from the wall region with temperature-dependent chemistry to compute local thinning-related outputs on selected wall patches.
This repository is written for OpenFOAM V2212 and contains:
FACUtilitysource code- required header/source files and build configuration
- four validation / example cases
- 2D benchmark case (validationCases/2DCase)
- 3D benchmark case (validationCases/3DCase)
- 3D elbow pipe case (plant-representative) (validationCases/DN150)
- Utanohara & Murase compound elbow (validationCases/case4)
The default case settings are configured to reproduce the validation conditions reported in the associated publication.
A typical repository layout is shown below. Adjust the paths if your local folder names differ.
├── FACUtility
│ ├── FACUtility.C
│ ├── Make
│ │ ├── files
│ │ └── options
│ ├── createFields.H
│ ├── models
│ │ ├── FACChemistryConstants.C
│ │ ├── FACChemistryConstants.H
│ │ ├── FACChemistryModel.C
│ │ ├── FACChemistryModel.H
│ │ ├── FACErosionModel.C
│ │ ├── FACErosionModel.H
│ │ ├── FACNewtonRaphson.H
│ │ ├── FACThinningModel.C
│ │ └── FACThinningModel.H
│ ├── readFACProperties.H
│ ├── utils
│ │ ├── FACCSV.H
│ │ ├── FACChemistryTable.C
│ │ ├── FACChemistryTable.H
│ │ ├── FACDatWriter.H
│ │ ├── FACInterpolation.C
│ │ ├── FACInterpolation.H
│ │ ├── FACMapping.H
│ │ ├── FACProperties.H
│ │ ├── FACSelection.C
│ │ └── FACSelection.H
│ └── writeOutputs.H
├── LICENSE
├── README.md
└── validationCases
├── 2DCase
│ ├── 0.orig
│ ├── constant
│ ├── plots
│ └── system
├── 3DCase
│ ├── 0.orig
│ ├── constant
│ ├── plots
│ └── system
├── case4
│ ├── 0.orig
│ ├── constant
│ ├── plots
│ └── system
└── DN150
├── 0.orig
├── constant
└── system
- OpenFOAM V2212
- Linux environment or WSL/Linux-compatible shell with OpenFOAM sourced
- C++ compiler supported by the OpenFOAM installation
wmakeavailable in the environment
Before compiling or running any case, load OpenFOAM V2212:
source /path/to/OpenFOAM-v2212/etc/bashrcReplace the path above with the correct installation path on your system.
FACUtility is a standalone custom OpenFOAM utility and is compiled using wmake.
Copy or link the utility source into your user application area, for example:
mkdir -p $WM_PROJECT_USER_DIR/applications/utilities
cp -r FACUtility $WM_PROJECT_USER_DIR/applications/utilities/Move into the utility source directory and run wmake:
cd $WM_PROJECT_USER_DIR/applications/utilities/FACUtility
wmakeIf compilation is successful, the executable will be created in:
$FOAM_USER_APPBIN/FACUtilityYou can verify that the utility is available using:
which FACUtilityor
ls $FOAM_USER_APPBIN/FACUtilityFACUtility is released under the GNU General Public License v3.0 (GPL-3.0).
FACUtility directly includes OpenFOAM headers and links against OpenFOAM's core libraries (fvMesh, volScalarField, surfaceScalarField, fvc:: operators, etc.). Since OpenFOAM itself is licensed under GPL-3.0, FACUtility is a combined/derivative work under the GPL and inherits the same license. See the LICENSE file for the full text.
FACUtility is a decoupled post-processing utility.
The workflow is:
- Set up and run the CFD case using a suitable OpenFOAM solver.
- Ensure that the flow and temperature fields are converged.
- Configure
FACPropertiesand select the target patch. - Run
FACUtilityfor the selected time directory. - Review the generated post-processing files and ParaView-compatible patch fields.
In summary:
Create mesh -> Run CFD solver -> Run FACUtility -> Post-process outputs
Before running FACUtility, the CFD case must already contain the required solution fields. Depending on the selected physical model and case setup, these typically include:
- velocity field
U - pressure field
porp_rgh - temperature field
T - turbulence quantities required by the parent CFD solver
- mesh and boundary conditions
FACPropertiesdictionary
The utility reads the converged OpenFOAM case and computes FAC-related quantities only on the specified wall patch.
# move to the case director
cd validationCases/2DCase
# copy the original zero folder as "0"
cp -r 0.orig/ 0
# create mesh
blockMesh
# run solver
buoyantSimpleFoam # run solver in single core
# Run in parallel
decomposePar # split mesh, adjust the number of cores in "decomposeParDict"
mpirun -np 4 buoyantSimpleFoam -parallel # run solver in parallel
mpirun -np 4 buoyantSimpleFoam -parallel > log.solver # to log the solver in a file
mv $(foamListTimes -latestTime)/turbulence*muEff $(foamListTimes -latestTime)/muEff # remove the prefix text from muEff under the latest time directory
FACUtility -latestTime # run FACUtility
gnuplot plots/*.xy # run gnuplots to check the resultsThis case reproduces the 2D validation setup and is intended to demonstrate the local flow acceleration, separation behavior, and resulting FAC-related post-processing.
# move to the case director
cd validationCases/3DCase
# copy the original zero folder as "0"
cp -r 0.orig/ 0
# create mesh
blockMesh
# run solver
buoyantSimpleFoam # run solver in single core
# Run in parallel
decomposePar # split mesh, adjust the number of cores in "decomposeParDict"
mpirun -np 4 buoyantSimpleFoam -parallel # run solver in parallel
mpirun -np 4 buoyantSimpleFoam -parallel > log.solver # to log the solver in a file
mv $(foamListTimes -latestTime)/turbulence*muEff $(foamListTimes -latestTime)/muEff # remove the prefix text from muEff under the latest time directory
FACUtility -latestTime # run FACUtility
gnuplot plots/*.xy # run gnuplots to check the resultsThis case extends the benchmark workflow to a three-dimensional geometry.
# move to the case director
cd validationCases/DN150
# copy the original zero folder as "0"
cp -r 0.orig/ 0
# create back ground mesh
blockMesh
# generate *.eMsh for edges
surfaceFeatureExtract
# create mesh
snappyHexMesh -overwrite
# run solver
buoyantSimpleFoam # run solver in single core
# Run in parallel
decomposePar # split mesh, adjust the number of cores in "decomposeParDict"
mpirun -np 4 buoyantSimpleFoam -parallel # run solver in parallel
mpirun -np 4 buoyantSimpleFoam -parallel > log.solver # to log the solver in a file
mv $(foamListTimes -latestTime)/turbulence*muEff $(foamListTimes -latestTime)/muEff # remove the prefix text from muEff under the latest time directory
FACUtility -latestTime # run FACUtility
Note: The plots are visualized and generated using ParaViewThis case reproduces the elbow-pipe validation configuration and is useful for studying circumferential variation in thinning around the bend.
# move to the case director
cd validationCases/case4
# copy the original zero folder as "0"
cp -r 0.orig/ 0
# create back ground mesh
blockMesh
# generate *.eMsh for edges
surfaceFeatureExtract
# create mesh
snappyHexMesh -overwrite
# run solver
buoyantSimpleFoam # run solver in single core
# Run in parallel
decomposePar # split mesh, adjust the number of cores in "decomposeParDict"
mpirun -np 4 buoyantSimpleFoam -parallel # run solver in parallel
mpirun -np 4 buoyantSimpleFoam -parallel > log.solver # to log the solver in a file
mv $(foamListTimes -latestTime)/turbulence*muEff $(foamListTimes -latestTime)/muEff # remove the prefix text from muEff under the latest time directory
FACUtility -latestTime # run FACUtility
Note: The plots are visualized and generated using ParaView