Skip to content

Commit 38f9772

Browse files
Compressbile VOF
0 parents  commit 38f9772

30 files changed

+5356
-0
lines changed

mybuoyantPimpleFoam/EEqn.H

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
volScalarField& he = thermo.he();
3+
4+
// Info << "divq is" << thermophysicalTransport->divq(he) << endl;
5+
6+
fvScalarMatrix EEqn
7+
(
8+
fvm::ddt(rho, he) + fvm::div(phi, he)
9+
+ fvc::ddt(rho, K) + fvc::div(phi, K)
10+
+ (
11+
he.name() == "e"
12+
? fvc::div
13+
(
14+
fvc::absolute(phi/fvc::interpolate(rho), U),
15+
p,
16+
"div(phiv,p)"
17+
)
18+
: -dpdt
19+
)
20+
+ thermophysicalTransport->divq(he)
21+
==
22+
rho*(U&g)
23+
+ radiation->Sh(thermo, he)
24+
+ fvOptions(rho, he)
25+
);
26+
27+
EEqn.relax();
28+
29+
fvOptions.constrain(EEqn);
30+
31+
EEqn.solve();
32+
33+
fvOptions.correct(he);
34+
35+
thermo.correct();
36+
radiation->correct();
37+
}

mybuoyantPimpleFoam/Make/files

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mybuoyantPimpleFoam.C
2+
3+
EXE = $(FOAM_USER_APPBIN)/mybuoyantPimpleFoam

mybuoyantPimpleFoam/Make/options

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
EXE_INC = \
2+
-I. \
3+
-I./mybuoyantPimpleFoam \
4+
-I./myPhaseCompressibleMomentumTransportModel/ \
5+
-I$(WM_PROJECT_DIR)/applications/solvers/compressible/rhoPimpleFoam \
6+
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
7+
-I$(LIB_SRC)/radiationModels/lnInclude \
8+
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
9+
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
10+
-I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \
11+
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \
12+
-I$(LIB_SRC)/finiteVolume/cfdTools \
13+
-I$(LIB_SRC)/finiteVolume/lnInclude \
14+
-I$(LIB_SRC)/meshTools/lnInclude \
15+
-I$(LIB_SRC)/sampling/lnInclude \
16+
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
17+
18+
EXE_LIBS = \
19+
-L$(FOAM_USER_LIBBIN) \
20+
-lmyVoFphaseCompressibleMomentumTransportModels \
21+
-lmymultiphaseThermophysicalTransportModels \
22+
-lfluidThermophysicalModels \
23+
-lradiationModels \
24+
-lspecie \
25+
-lmomentumTransportModels \
26+
-lfluidThermoMomentumTransportModels \
27+
-lthermophysicalTransportModels \
28+
-lfiniteVolume \
29+
-ldynamicFvMesh \
30+
-ltopoChangerFvMesh \
31+
-lmeshTools \
32+
-lsampling \
33+
-lfvOptions

mybuoyantPimpleFoam/UEqn.H

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Solve the Momentum equation
2+
3+
MRF.correctBoundaryVelocity(U);
4+
5+
tmp<fvVectorMatrix> tUEqn
6+
(
7+
fvm::ddt(rho, U) + fvm::div(phi, U)
8+
+ MRF.DDt(rho, U)
9+
+ turbulence->divDevTau(U)
10+
==
11+
fvOptions(rho, U)
12+
);
13+
fvVectorMatrix& UEqn = tUEqn.ref();
14+
15+
UEqn.relax();
16+
17+
fvOptions.constrain(UEqn);
18+
19+
if (pimple.momentumPredictor())
20+
{
21+
solve
22+
(
23+
UEqn
24+
==
25+
fvc::reconstruct
26+
(
27+
(
28+
- ghf*fvc::snGrad(rho)
29+
- fvc::snGrad(p_rgh)
30+
)*mesh.magSf()
31+
)
32+
);
33+
34+
fvOptions.correct(U);
35+
K = 0.5*magSqr(U);
36+
}

mybuoyantPimpleFoam/correctPhi.H

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CorrectPhi
2+
(
3+
U,
4+
phi,
5+
p_rgh,
6+
rho,
7+
psi,
8+
dimensionedScalar("rAUf", dimTime, 1),
9+
divrhoU(),
10+
pimple,
11+
true
12+
);

mybuoyantPimpleFoam/createFieldRefs.H

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const volScalarField& psi = thermo.psi();

mybuoyantPimpleFoam/createFields.H

+208
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
#include "createRDeltaT.H"
2+
3+
word continuousPhaseName
4+
(
5+
IOdictionary
6+
(
7+
IOobject
8+
(
9+
"continousPhase",
10+
runTime.constant(),
11+
mesh,
12+
IOobject::MUST_READ
13+
)
14+
).lookup("continuousPhaseName")
15+
);
16+
// 在constant文件夹中添加一个continousPhase文件,其中信息就是continuousPhaseName的值,也就是流体名称
17+
// 注意:还是只有一个thermophysicalProperties文件,只是给他加了个名字
18+
Info<< "Reading thermophysical properties\n" << endl;
19+
20+
autoPtr<fluidThermo> pThermo
21+
(
22+
fluidThermo::New(mesh)
23+
);
24+
fluidThermo& thermo = pThermo();
25+
thermo.validate(args.executable(), "h", "e");
26+
27+
volScalarField& p = thermo.p();
28+
29+
volScalarField rho
30+
(
31+
IOobject
32+
(
33+
"rho",
34+
runTime.timeName(),
35+
mesh,
36+
IOobject::NO_READ,
37+
IOobject::NO_WRITE
38+
),
39+
thermo.rho()
40+
);
41+
42+
Info << "Creating field alphac\n" << endl;
43+
// 在time文件夹中存在alphac文件,不需要特意创建
44+
volScalarField alphac
45+
(
46+
IOobject
47+
(
48+
IOobject::groupName("alpha", continuousPhaseName),
49+
runTime.timeName(),
50+
mesh,
51+
IOobject::READ_IF_PRESENT,
52+
IOobject::AUTO_WRITE
53+
),
54+
mesh,
55+
dimensionedScalar(dimless, 1)
56+
);
57+
58+
Info<< alphac << endl;
59+
60+
Info<< "Reading field U\n" << endl;
61+
// U文件改名叫做 U.water(或者其他流体名称) 记得修改
62+
volVectorField U
63+
(
64+
IOobject
65+
(
66+
IOobject::groupName("U", continuousPhaseName),
67+
runTime.timeName(),
68+
mesh,
69+
IOobject::MUST_READ,
70+
IOobject::AUTO_WRITE
71+
),
72+
mesh
73+
);
74+
75+
#include "compressibleCreatePhi.H"
76+
// 没办法还是使用了可压缩的Phi 只是同时定义了一个不可压缩的phi_u配合别的使用
77+
Info<< "Reading/calculating face flux field phi(U only)\n" << endl;
78+
// surfaceScalarField phi_u
79+
// (
80+
// IOobject
81+
// (
82+
// "phi_u",
83+
// runTime.timeName(),
84+
// mesh,
85+
// IOobject::READ_IF_PRESENT,
86+
// IOobject::AUTO_WRITE
87+
// ),
88+
// fvc::flux(U)
89+
// );
90+
// 这里的phi是基于U,直接显示标出来了方便后面的直接使用
91+
Info<< "Creating field alphaRhoPhi\n" << endl;
92+
surfaceScalarField alphaRhoPhi
93+
(
94+
IOobject
95+
(
96+
"alphaRhoPhi",
97+
runTime.timeName(),
98+
mesh,
99+
IOobject::NO_READ,
100+
IOobject::NO_WRITE
101+
),
102+
linearInterpolate(alphac*rho*U) & mesh.Sf()
103+
);
104+
// 这里是基于alphac,rho和U 模仿compressible phi的创建方式
105+
106+
Info<< "Creating Multiphase turbulence model\n" << endl;
107+
autoPtr<PhaseCompressibleMomentumTransportModel<fluidThermo>> turbulence
108+
(
109+
PhaseCompressibleMomentumTransportModel<fluidThermo>::New
110+
(
111+
alphac,
112+
rho,
113+
U,
114+
alphaRhoPhi,
115+
phi,
116+
thermo
117+
)
118+
);
119+
// Info<< "Creating turbulence model\n" << endl; 这部分代码是原始的 单相流体的模型
120+
// autoPtr<compressible::momentumTransportModel> turbulence 经过测试发现,并不是因为这个原因导致的结果发散
121+
// (
122+
// compressible::momentumTransportModel::New
123+
// (
124+
// rho,
125+
// U,
126+
// phi,
127+
// thermo
128+
// )
129+
// );
130+
131+
typedef PhaseThermophysicalTransportModel
132+
<
133+
PhaseCompressibleMomentumTransportModel<fluidThermo>,
134+
fluidThermo
135+
> multiphaseThermophysicalTransportModel;
136+
// 重名一个类,用于创造热扩散模型
137+
138+
Info<< "Creating Multiphase Thermophysical TransportModel Model with VOF\n" << endl;
139+
140+
autoPtr<multiphaseThermophysicalTransportModel> thermophysicalTransport
141+
(
142+
multiphaseThermophysicalTransportModel::New(turbulence(), thermo)
143+
);
144+
145+
// Info<< "Creating thermophysical transport model\n" << endl; 问题同上
146+
// autoPtr<fluidThermophysicalTransportModel> thermophysicalTransport 经过测试其实不是模型的问题
147+
// (
148+
// fluidThermophysicalTransportModel::New(turbulence().transportModel, thermo)
149+
// );
150+
151+
Info<< "nu for thermophysicalTransport\n" << thermophysicalTransport->thermo() << endl;
152+
153+
154+
#include "readGravitationalAcceleration.H"
155+
#include "readhRef.H"
156+
#include "gh.H"
157+
#include "readpRef.H"
158+
159+
160+
Info<< "Reading field p_rgh\n" << endl;
161+
volScalarField p_rgh
162+
(
163+
IOobject
164+
(
165+
"p_rgh",
166+
runTime.timeName(),
167+
mesh,
168+
IOobject::MUST_READ,
169+
IOobject::AUTO_WRITE
170+
),
171+
mesh
172+
);
173+
174+
// Force p_rgh to be consistent with p
175+
p_rgh = p - rho*gh - pRef;
176+
177+
pressureControl pressureControl
178+
(
179+
p,
180+
p_rgh,
181+
rho,
182+
pimple.dict(),
183+
thermo.incompressible()
184+
);
185+
186+
mesh.setFluxRequired(p_rgh.name());
187+
188+
Info<< "Creating field dpdt\n" << endl;
189+
volScalarField dpdt
190+
(
191+
IOobject
192+
(
193+
"dpdt",
194+
runTime.timeName(),
195+
mesh
196+
),
197+
mesh,
198+
dimensionedScalar(p.dimensions()/dimTime, 0)
199+
);
200+
201+
Info<< "Creating field kinetic energy K\n" << endl;
202+
volScalarField K("K", 0.5*magSqr(U));
203+
204+
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
205+
206+
#include "createMRF.H"
207+
#include "createRadiationModel.H"
208+
#include "createFvOptions.H"

mybuoyantPimpleFoam/log.wmake

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Making dependency list for source file mybuoyantPimpleFoam.C
2+
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I. -I/home/yuchen/OpenFOAM/OpenFOAM-8/applications/solvers/compressible/rhoPimpleFoam -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/thermophysicalModels/basic/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/radiationModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/compressible/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/phaseCompressible/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/ThermophysicalTransportModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/finiteVolume/cfdTools -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/meshTools/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/sampling/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/dynamicFvMesh/lnInclude -IlnInclude -I. -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/OSspecific/POSIX/lnInclude -fPIC -c mybuoyantPimpleFoam.C -o Make/linux64GccDPInt32Debug/mybuoyantPimpleFoam.o
3+
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I. -I/home/yuchen/OpenFOAM/OpenFOAM-8/applications/solvers/compressible/rhoPimpleFoam -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/thermophysicalModels/basic/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/radiationModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/compressible/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/phaseCompressible/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/ThermophysicalTransportModels/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/finiteVolume/cfdTools -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/finiteVolume/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/meshTools/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/sampling/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/dynamicFvMesh/lnInclude -IlnInclude -I. -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude -I/home/yuchen/OpenFOAM/OpenFOAM-8/src/OSspecific/POSIX/lnInclude -fPIC -fuse-ld=bfd -Xlinker --add-needed -Xlinker --no-as-needed Make/linux64GccDPInt32Debug/mybuoyantPimpleFoam.o -L/home/yuchen/OpenFOAM/OpenFOAM-8/platforms/linux64GccDPInt32Debug/lib \
4+
-lfluidThermophysicalModels -lradiationModels -lspecie -lmomentumTransportModels -lfluidThermoMomentumTransportModels -lthermophysicalTransportModels -lfiniteVolume -ldynamicFvMesh -ltopoChangerFvMesh -lmeshTools -lsampling -lfvOptions -lOpenFOAM -ldl \
5+
-ggdb3 -DFULLDEBUG -lm -o /home/yuchen/OpenFOAM/yuchen-8/platforms/linux64GccDPInt32Debug/bin/mybuoyantPimpleFoam
6+
/usr/bin/ld.bfd: Make/linux64GccDPInt32Debug/mybuoyantPimpleFoam.o: in function `Foam::MomentumTransportModel<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleMomentumTransportModel, Foam::fluidThermo>::New(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::fluidThermo const&)':
7+
/home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude/MomentumTransportModel.C:113: undefined reference to `Foam::MomentumTransportModel<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleMomentumTransportModel, Foam::fluidThermo>::dictionaryConstructorTablePtr_'
8+
/usr/bin/ld.bfd: /home/yuchen/OpenFOAM/OpenFOAM-8/src/MomentumTransportModels/momentumTransportModels/lnInclude/MomentumTransportModel.C:123: undefined reference to `Foam::MomentumTransportModel<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::compressibleMomentumTransportModel, Foam::fluidThermo>::dictionaryConstructorTablePtr_'
9+
collect2: error: ld returned 1 exit status
10+
make: *** [/home/yuchen/OpenFOAM/OpenFOAM-8/wmake/makefiles/general:142: /home/yuchen/OpenFOAM/yuchen-8/platforms/linux64GccDPInt32Debug/bin/mybuoyantPimpleFoam] Error 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VoFphaseCompressibleMomentumTransportModels.C
2+
3+
LIB = $(FOAM_USER_LIBBIN)/libmyVoFphaseCompressibleMomentumTransportModels

0 commit comments

Comments
 (0)