OpenFoamのサンプル確認(パラメータやキーワードの覚書)です。
チュートリアルフォルダ:チュートリアル場所(windows)
ベース
バージョン : WINDOWS v2206
引用元
<チュートリアルフォルダ>\incompressible\simpleFoam\simpleCar
結果図

作業
基本的な流れはT703 OpenFoam tipsと同じです。(または作業)
//チュートリアルからコピーします。 //0.origを0フォルダにします。 blockMesh topoSet createPatch -overwrite simpleFoam //ParaView用VTK変換// foamToVTK
全体構造
simpleCar ├ 0.orig │ ├ epsilon │ ├ k │ ├ nut │ ├ p │ └ U ├ constant │ ├ transportProperties │ └ turbulenceProperties ├ system │ ├ blockMeshDict │ ├ controlDict │ ├ createPatchDict │ ├ fieldAverage │ ├ forceCoeffs │ ├ fvOptions │ ├ fvSchemes │ ├ fvSolution │ ├ referencePressure │ ├ runTimeControls │ └ topoSetDict ├ Allclean ├ Allrun └ README
0
epsilon
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.125;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
"(body|upperWall|lowerWall)"
{
type epsilonWallFunction;
value $internalField;
Cmu 0.09;
kappa 0.41;
E 9.8;
}
frontAndBack
{
type empty;
}
".*"
{
type zeroGradient;
}
}
k
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.375;
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
"(body|upperWall|lowerWall)"
{
type kqRWallFunction;
value $internalField;
}
frontAndBack
{
type empty;
}
".*"
{
type zeroGradient;
}
}
nut
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
"(body|upperWall|lowerWall)"
{
type nutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value $internalField;
}
frontAndBack
{
type empty;
}
".*"
{
type calculated;
value $internalField;
}
}
p
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
outlet
{
type fixedValue;
value $internalField;
}
frontAndBack
{
type empty;
}
".*"
{
type zeroGradient;
}
}
U
dimensions [0 1 -1 0 0 0 0];
internalField uniform (10 0 0);
// Surface normal with time ramping
intakeType1
{
type surfaceNormalFixedValue;
refValue uniform 1.2;
ramp table ((0 0) (10 1));
}
// Uniform surface normal with Function1 for ramping
intakeType2
{
type uniformNormalFixedValue;
uniformValue table ((0 0) (10 1.2));
}
// Uniform surface normal with time ramping
intakeType3
{
// Or directly with uniform value (ramping also possible)
type uniformNormalFixedValue;
uniformValue constant 1.2;
ramp table ((0 0) (10 1));
}
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
airIntake
{
$intakeType1;
}
outlet
{
type pressureInletOutletVelocity;
value $internalField;
}
"(body|upperWall|lowerWall)"
{
type fixedValue;
value uniform (0 0 0);
}
frontAndBack
{
type empty;
}
}
#remove "intakeType.*"
constant
transportProperties
transportModel Newtonian; nu 1e-05;
turbulenceProperties
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
system
blockMeshDict
scale 1;
vertices
(
( 0.0 0.0 0.1) // 0
( 2.1 0.0 0.1) // 1
( 2.5 0.0 0.1) // 2
( 3.0 0.0 0.1) // 3
( 5.0 0.0 0.1) // 4
(10.0 0.0 0.1) // 5
( 0.0 0.3 0.1) // 6
( 2.1 0.3 0.1) // 7
( 2.5 0.3 0.1) // 8
( 3.0 0.3 0.1) // 9
( 5.0 0.3 0.1) // 10
(10.0 0.3 0.1) // 11
( 0.0 0.4 0.1) // 12
( 2.0 0.4 0.1) // 13
( 2.4 0.4 0.1) // 14
( 0.0 0.8 0.1) // 15
( 2.0 0.8 0.1) // 16
( 2.6 0.8 0.1) // 17
( 0.0 0.9 0.1) // 18
( 2.1 0.9 0.1) // 19
( 3.0 1.0 0.1) // 20
( 3.6 1.5 0.1) // 21
( 4.4 1.5 0.1) // 22
( 5.0 1.0 0.1) // 23
(10.0 1.0 0.1) // 24
( 0.0 3.0 0.1) // 25
( 1.2 3.0 0.1) // 26
( 2.2 3.0 0.1) // 27
( 3.1 3.0 0.1) // 28
( 4.5 3.0 0.1) // 29
( 5.5 3.0 0.1) // 30
(10.0 3.0 0.1) // 31
( 0.0 0.0 0.0) // 32
( 2.1 0.0 0.0) // 33
( 2.5 0.0 0.0) // 34
( 3.0 0.0 0.0) // 35
( 5.0 0.0 0.0) // 36
(10.0 0.0 0.0) // 37
( 0.0 0.3 0.0) // 38
( 2.1 0.3 0.0) // 39
( 2.5 0.3 0.0) // 40
( 3.0 0.3 0.0) // 41
( 5.0 0.3 0.0) // 42
(10.0 0.3 0.0) // 43
( 0.0 0.4 0.0) // 44
( 2.0 0.4 0.0) // 45
( 2.4 0.4 0.0) // 46
( 0.0 0.8 0.0) // 47
( 2.0 0.8 0.0) // 48
( 2.6 0.8 0.0) // 49
( 0.0 0.9 0.0) // 50
( 2.1 0.9 0.0) // 51
( 3.0 1.0 0.0) // 52
( 3.6 1.5 0.0) // 53
( 4.4 1.5 0.0) // 54
( 5.0 1.0 0.0) // 55
(10.0 1.0 0.0) // 56
( 0.0 3.0 0.0) // 57
( 1.2 3.0 0.0) // 58
( 2.2 3.0 0.0) // 59
( 3.1 3.0 0.0) // 60
( 4.5 3.0 0.0) // 61
( 5.5 3.0 0.0) // 62
(10.0 3.0 0.0) // 63
);
blocks
(
hex ( 0 6 7 1 32 38 39 33) ( 8 40 1) simpleGrading (1 1 1) // 0
hex ( 1 7 8 2 33 39 40 34) ( 8 10 1) simpleGrading (1 1 1) // 1
hex ( 2 8 9 3 34 40 41 35) ( 8 10 1) simpleGrading (1 1 1) // 2
hex ( 3 9 10 4 35 41 42 36) ( 8 40 1) simpleGrading (1 1 1) // 3
hex ( 4 10 11 5 36 42 43 37) ( 8 100 1) simpleGrading (1 1 1) // 4
hex (10 23 24 11 42 55 56 43) ( 15 100 1) simpleGrading (1 1 1) // 5
hex (23 30 31 24 55 62 63 56) ( 40 100 1) simpleGrading (1 1 1) // 6
hex (22 29 30 23 54 61 62 55) ( 40 20 1) simpleGrading (1 1 1) // 7
hex (21 28 29 22 53 60 61 54) ( 40 25 1) simpleGrading (1 1 1) // 8
hex (20 27 28 21 52 59 60 53) ( 40 20 1) simpleGrading (1 1 1) // 9
hex (19 26 27 20 51 58 59 52) ( 40 20 1) simpleGrading (1 1 1) // 10
hex (18 25 26 19 50 57 58 51) ( 40 40 1) simpleGrading (1 1 1) // 11
hex (15 18 19 16 47 50 51 48) ( 3 40 1) simpleGrading (1 1 1) // 12
hex (12 15 16 13 44 47 48 45) ( 10 40 1) simpleGrading (1 1 1) // 13
hex ( 6 12 13 7 38 44 45 39) ( 3 40 1) simpleGrading (1 1 1) // 14
hex (13 16 17 14 45 48 49 46) ( 10 10 1) simpleGrading (1 1 1) // 15
hex (14 17 9 8 46 49 41 40) ( 10 10 1) simpleGrading (1 1 1) // 16
);
edges
(
arc 10 23 (5.15 0.7 0.1)
arc 42 55 (5.15 0.7 0.0)
);
defaultPatch
{
name frontAndBack;
type empty;
}
boundary
(
inlet
{
type patch;
faces
(
( 0 6 38 32)
( 6 12 44 38)
(12 15 47 44)
(15 18 50 47)
(18 25 57 50)
);
}
outlet
{
type patch;
faces
(
(5 37 43 11)
(11 43 56 24)
(24 56 63 31)
);
}
upperWall
{
type wall;
faces
(
(25 26 58 57)
(26 27 59 58)
(27 28 60 59)
(28 29 61 60)
(29 30 62 61)
(30 31 63 62)
);
}
lowerWall
{
type wall;
faces
(
(0 32 33 1)
(1 33 34 2)
(2 34 35 3)
(3 35 36 4)
(4 36 37 5)
);
}
body
{
type wall;
faces
(
(7 8 40 39)
(14 46 40 8)
(13 45 46 14)
(7 39 45 13)
(16 17 49 48)
(17 9 41 49)
(9 10 42 41)
(10 42 55 23)
(22 54 55 23)
(21 53 54 22)
(20 52 53 21)
(19 51 52 20)
(16 48 51 19)
);
}
);
mergePatchPairs
(
);
controlDict
application simpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5000;
deltaT 1;
writeControl timeStep;
writeInterval 100;
purgeWrite 10;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#include "forceCoeffs"
#include "fieldAverage"
#include "referencePressure"
#include "runTimeControls"
}
createPatchDict
pointSync false;
// Patches to create
patches
(
{
// Name of new patch
name airIntake;
// Dictionary to construct new patch from
patchInfo
{
type patch;
}
// How to construct: either from 'patches' or 'set'
constructFrom set;
// If constructFrom = patches : names of patches. Wildcards allowed.
patches ();
// If constructFrom = set : name of faceSet
set airIntake;
}
);
fieldAverage
fieldAverage1
{
type fieldAverage;
libs (fieldFunctionObjects);
triggerStart 1;
timeStart 500;
controlMode timeOrTrigger;
writeControl writeTime;
fields
(
U
{
base iteration;
mean on;
prime2Mean off;
}
);
}
forceCoeffs
forceCoeffs1
{
type forceCoeffs;
libs (forces);
writeControl writeTime;
writeFields true;
patches (body);
p p;
U U;
rho rhoInf; // Indicates incompressible
log true;
rhoInf 1; // Required when rho = rhoInf
liftDir (0 1 0);
dragDir (1 0 0);
CofR (3.5 0 0); // Axle midpoint on ground
pitchAxis (0 0 1);
magUInf 10;
lRef 4; // Wheelbase length
Aref 1; // Estimated
porosity on;
binData
{
nBin 20; // output data into 20 bins
direction (1 0 0); // bin direction
cumulative yes;
}
}
fvOptions
porosity1
{
type explicitPorositySource;
active true;
explicitPorositySourceCoeffs
{
type DarcyForchheimer;
selectionMode cellZone;
cellZone porousZone;
DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
f f [0 -1 0 0 0 0 0] (0 0 0);
coordinateSystem
{
origin (0 0 0);
e1 (1 0 0);
e2 (0 1 0);
}
}
}
}
fvSchemes
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss upwind;
turbulence bounded Gauss upwind;
div(phi,k) $turbulence;
div(phi,epsilon) $turbulence;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fvSolution
solvers
{
p
{
solver GAMG;
tolerance 1e-06;
relTol 0.1;
smoother GaussSeidel;
nPreSweeps 0;
nPostSweeps 2;
cacheAgglomeration on;
agglomerator faceAreaPair;
nCellsInCoarsestLevel 10;
mergeLevels 1;
}
"(U|k|epsilon|R|nuTilda)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 0;
residualControl
{
p 1e-2;
U 1e-4;
"(k|epsilon)" 1e-4;
}
}
relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
k 0.7;
epsilon 0.7;
}
}
referencePressure
sample1
{
type sets;
libs (sampling);
interpolationScheme cellPointFace;
setFormat raw;
fields ( p );
sets
(
cloud
{
type cloud;
axis xyz;
points
(
(1 0.2 0.05)
(1 0.4 0.05)
(1 0.6 0.05)
(1 0.8 0.05)
(1 1.0 0.05)
);
}
);
}
average1
{
type valueAverage;
libs (fieldFunctionObjects);
writeControl writeTime;
functionObject sample1;
fields (average(p));
}
reference1
{
type reference;
libs (fieldFunctionObjects);
writeControl writeTime;
field p;
refValue functionObjectValue;
functionObject average1;
functionObjectResult average(p)Mean;
}
reference2
{
type reference;
libs (fieldFunctionObjects);
writeControl writeTime;
field p;
refValue sample;
position (1 0.2 0.05);
}
runTimeControls
runTimeControl1
{
type runTimeControl;
libs (utilityFunctionObjects);
conditions
{
condition1
{
type average;
functionObject forceCoeffs1;
fields (Cd);
tolerance 1e-3;
window 20;
windowType exact;
}
}
satisfiedAction setTrigger;
trigger 1;
}
runTimeControl2
{
type runTimeControl;
libs (utilityFunctionObjects);
controlMode trigger;
triggerStart 1;
conditions
{
condition1
{
type maxDuration;
duration 100;
}
}
satisfiedAction end;
}
/*
runTimeControl3
{
type runTimeControl;
libs (utilityFunctionObjects);
conditions
{
condition1
{
type equationInitialResidual;
fields (U.component(0));
value 1e-02;
mode minimum;
}
}
satisfiedAction end;
}
*/
topoSetDict
actions
(
{
name porousCells;
type cellSet;
action new;
source boxToCell;
box (2.05 0.4 -1) (2.1 0.85 1);
}
{
name porousZone;
type cellZoneSet;
action new;
source setToCellZone;
set porousCells;
}
{
name airIntake;
type faceSet;
action new;
source patchToFace;
patch body;
}
{
name airIntake;
type faceSet;
action subset;
source boxToFace;
box (2.6 0.75 0)(2.64 0.8 0.1);
}
);
コメント