粒子計算2019年1月26日 | |
はじめにOpenFOAM で粒子計算を行う。 使用バージョンOpenFOAM 6 ファイルソルバーの改造粒子計算ができるように simpleFoam を改造する。 simpleFoam.C の最初の include 文のグループの最後に以下を追加。 #include "basicKinematicCloud.H" createFields.C の最後に以下を追加。
#include "readGravitationalAcceleration.H"
dimensionedScalar rhoInfValue
(
laminarTransport.lookup("rhoInf")
);
volScalarField rhoInf
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
rhoInfValue
);
volScalarField mu
(
IOobject
(
"mu",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
laminarTransport.nu()*rhoInfValue
);
Info<< "Constructing kinematicCloud" << endl;
basicKinematicCloud parcels
(
"kinematicCloud",
rhoInf,
U,
mu,
g
);
simpleFoam.C の SIMPLE ループの最初の Info 文の下 (UEqn.H インクルードの前) に以下を追加。
parcels.evolve();
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 \
-llagrangianTurbulence \
-lregionModels \
-lsurfaceFilmModels
設定simpleFoam のチュートリアルケース pitzDaily で粒子計算を行うには、以下のように設定する。 constant/transportProperties に以下を追加。 rhoInf rhoInf [ 1 -3 0 0 0 0 0 ] 1; constant/kinematicCloudProperties
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;
stochasticCollisionModel none;
radiation off;
standardWallInteractionCoeffs
{
type rebound;
}
}
cloudFunctions
{
patchPostProcessing1
{
type patchPostProcessing;
maxStoredParcels 100;
patches ( outlet );
}
particleTracks1
{
type particleTracks;
trackInterval 5;
maxSamples 1000000;
resetOnWrite yes;
}
}
constant/g
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 形式で出力できる。 出力設定は const/particleTrackDict で行う。 constant/particleTrackDict
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object particleTrackDict;
}
cloudName kinematicCloudTracks;
fields
(
d
U
age
);
実行。 $ steadyParticleTracks ![]() 古い | |
| PENGUINITIS | |