粒子計算2014年2月2日 | |
はじめにOpenFOAM で粒子計算を行う。 使用バージョンOpenFOAM 2.2.2 ファイルソルバーの改造粒子計算ができるように simpleFoam を改造する。 simpleFoam.C の最初の include 文のグループの最後に以下を追加。 #include "basicKinematicCloud.H" simpleFoam.C の main 関数の中の最初の include 文のグループの最後に以下を追加。
#include "readGravitationalAcceleration.H"
#include "createClouds.H"
createClouds.H は以下の内容。
Info<< "\nConstructing kinematic cloud" << endl;
basicKinematicCloud parcels
(
"kinematicCloud",
rhoInf,
U,
mu,
g
);
simpleFoam.C の SIMPLE ループの最初の Info 文の下 (UEqn.H インクルードの前) に以下を追加。
parcels.evolve();
createFields.H の最後に以下を追加。
dimensionedScalar rhoInfValue
(
laminarTransport.lookup("rhoInf")
);
volScalarField rhoInf
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
rhoInfValue
);
volScalarField mu
(
IOobject
(
"mu",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
laminarTransport.nu()*rhoInfValue
);
UEqn.H の U の方程式に以下のようにソース項を追加。
tmp<fvVectorMatrix> UEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
+ 1./rhoInf*parcels.SU(U)
);
Make/options に以下を追加。 EXE_INC
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
EXE_LIBS
-llagrangian \
-llagrangianIntermediate \
-lregionModels \
-lsurfaceFilmModels \
設定simpleFoam のチュートリアルケース pitzDaily で粒子計算を行うには、以下のように設定する。 constant/transportProperties に以下を追加。 rhoInf rhoInf [ 1 -3 0 0 0 0 0 ] 1; constant/kinematicCloudProperties
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object reactingCloud1Properties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solution
{
active true;
transient no;
calcFrequency 10;
maxTrackTime 5.0;
maxCo 0.3;
coupled true;
cellValueSourceCorrection off;
sourceTerms
{
resetOnStartup false;
schemes
{
U semiImplicit 1;
}
}
interpolationSchemes
{
rho cell;
U cellPoint;
mu cell;
}
integrationSchemes
{
U Euler;
}
}
constantProperties
{
rho0 1;
youngsModulus 1e9;
poissonsRatio 0.35;
constantVolume false;
}
subModels
{
particleForces
{
sphereDrag;
gravity;
}
injectionModels
{
model1
{
type patchInjection;
massFlowRate 5.24e-15;
parcelBasisType mass;
patchName inlet;
parcelsPerSecond 100;
duration 1;
U0 (10 0 0);
flowRateProfile constant 1;
sizeDistribution
{
type fixedValue;
fixedValueDistribution
{
value 1e-5;
}
}
}
}
dispersionModel stochasticDispersionRAS;
patchInteractionModel standardWallInteraction;
heatTransferModel none;
phaseChangeModel none;
devolatilisationModel none;
surfaceReactionModel none;
surfaceFilmModel none;
collisionModel none;
radiation off;
standardWallInteractionCoeffs
{
type rebound;
}
}
cloudFunctions
{
patchPostProcessing
{
maxStoredParcels 100;
patches ( outlet );
}
particleTracks
{
trackInterval 5;
maxSamples 1000000;
resetOnWrite yes;
}
}
// ************************************************************************* //
constant/particleTrackDict
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object particleTrackDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
cloudName kinematicCloudTracks;
fields
(
d
U
age
);
// ************************************************************************* //
constant/g
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value ( 0 -9.81 0 );
// ************************************************************************* //
詳細は省くが、kinematicCloudProperties で定常計算 (10 step ごとに計算)、inlet から粒子を放出、outlet において粒子データ出力、粒子追跡データを出力するように設定している。 ポスト処理steadyParticleTracks により粒子軌跡データを VTK 形式で出力できる。 $ steadyParticleTracks | |
| PENGUINITIS | |