OpenFoamのサンプル確認(パラメータやキーワードの覚書)です。
スロッシングの例です。
こちらはwsl2の環境で行っています。
環境:wsl2 ubuntu 22.04.2 LTS
バージョン : OpenFOAM-11
ベース
チュートリアルフォルダ:wsl2
引用元
<チュートリアルフォルダ>/incompressibleVoF/sloshingTank2D
結果図
作業
作業としては、Allrunを実行するだけです。
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank2D
runApplication setFields
runApplication $(getApplication)
#------------------------------------------------------------------------------
全体構造
//初期フォルダ・ファイル構成
.sloshingTank2D
├── 0
│ ├── U
│ ├── alpha.water.orig
│ └── p_rgh
├── Allrun
├── constant
│ ├── dynamicMeshDict
│ ├── g
│ ├── momentumTransport
│ ├── phaseProperties
│ ├── physicalProperties.air
│ └── physicalProperties.water
└── system
├── controlDict
├── decomposeParDict
├── fvSchemes
├── fvSolution
└── setFieldsDict
3 directories, 15 files
アルファベット順
0
U
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
alpha.water
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type zeroGradient;
}
}
p_rgh
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type fixedFluxPressure;
}
}
constant
dynamicMeshDict
mover
{
type motionSolver;
libs ("libfvMeshMovers.so" "libfvMotionSolvers.so");
motionSolver solidBody;
select all;
solidBodyMotionFunction SDA;
CofG (0 0 0);
lambda 50;
rollAmax 0.22654;
rollAmin 0.10472;
heaveA 3.79;
swayA 2.34;
Q 2;
Tp 13.93;
Tpn 11.93;
dTi 0.059;
dTp -0.001;
}
| Coefficient | Description | Dimension |
|---|---|---|
| CofG | Center of Gravity | [m] |
| lamda | Model scale ratio | [-] |
| rollAmax | Max roll amplitude | [rad] |
| rollAmin | Min roll amplitude | [rad] |
| heaveA | Heave amplitude | [m] |
| swayA | Sway amplitude | [m] |
| Q | Damping Coefficient | [-] |
| Tp | Time Period for liquid | [sec] |
| Tpn | Natural Period of Ship | [sec] |
| Tpi | Current roll period | [sec] |
| dTi | Reference time step | [sec] |
| dTp | Increase in Tp per unit dTi | [-] |
g
dimensions [0 1 -2 0 0 0 0]; value (0 0 -9.81);
momentumTransport
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // simulationType laminar;
phaseProperties
phases (water air); sigma 0;
physicalProperties.air
viscosityModel constant; nu 1.48e-05; rho 1;
physicalProperties.water
viscosityModel constant; nu 1e-06; rho 998.2;
system
メッシュはコマンドで別処理
blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank2D
controlDict
application foamRun;
solver incompressibleVoF;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxAlphaCo 0.5;
maxDeltaT 1;
functions
{
probes
{
type probes;
libs ("libsampling.so");
writeControl writeTime;
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);
fixedLocations false;
fields
(
p
);
}
wallPressure
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
surfaceFormat raw;
fields
(
p
);
interpolationScheme cellPoint;
surfaces
(
walls
{
type patch;
patches (walls);
triangulate false;
}
);
}
}
decomposeParDict
numberOfSubdomains 16;
method hierarchical;
simpleCoeffs
{
n (2 2 1);
}
hierarchicalCoeffs
{
n (4 2 2);
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
fvSchemes
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss vanLeerV;
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fvSolution
solvers
{
alpha.water
{
nAlphaCorr 1;
nAlphaSubCycles 3;
}
"pcorr.*"
{
solver PCG;
preconditioner
{
preconditioner GAMG;
tolerance 1e-05;
relTol 0;
smoother DICGaussSeidel;
cacheAgglomeration no;
}
tolerance 1e-05;
relTol 0;
maxIter 100;
}
p_rgh
{
solver GAMG;
tolerance 1e-08;
relTol 0.01;
smoother DIC;
}
p_rghFinal
{
solver PCG;
preconditioner
{
preconditioner GAMG;
tolerance 2e-09;
relTol 0;
nVcycles 2;
smoother DICGaussSeidel;
nPreSweeps 2;
}
tolerance 2e-09;
relTol 0;
maxIter 20;
}
U
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-06;
relTol 0;
nSweeps 1;
}
}
PIMPLE
{
momentumPredictor no;
nCorrectors 2;
nNonOrthogonalCorrectors 0;
correctPhi no;
pRefPoint (0 0 0.15);
pRefValue 1e5;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
setFieldsDict
defaultFieldValues
(
volScalarFieldValue alpha.water 0
);
regions
(
boxToCell
{
box (-100 -100 -100) (100 100 0);
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);
コメント