/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
myProjectionTemTransFoam
Description
Transient solver for incompressible, laminar flow of Newtonian fluids.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "fvOptions.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
pisoControl piso(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "CourantNo.H"
// Momentum predictor
// First step of myProjection
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
solve(UEqn == -fvc::grad(p));
//if (piso.momentumPredictor())
//{
// solve(UEqn == -fvc::grad(p));
//}
//Second step of myProjection
U +=mesh.time().deltaT()*fvc::grad(p);
U.correctBoundaryConditions();
//Third step of myProjection
phi = fvc::flux(U);
//phi = fvc::interpolate(U)& mesh.Sf();
fvScalarMatrix pEqn
(
fvm::laplacian(mesh.time().deltaT(),p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
//Forth step of myProjection
phi -= pEqn.flux();
#include "continuityErrs.H"
U -= mesh.time().deltaT()*fvc::grad(p);
U.correctBoundaryConditions();
//Temperature Transport Equation
fvScalarMatrix TEqn
(
fvm::ddt(T)
+ fvm::div(phi, T)
- fvm::laplacian(DT, T)
);
TEqn.solve();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
实践作业之OpenFOAM实现cavity算例温度场计算.rar (35个子文件)
实践作业2OpenFOAMv7算例及结果
cavity2
1
U 242KB
p 110KB
phi 243KB
uniform
time 820B
T 75KB
cavityTem.foam 0B
constant
polyMesh
boundary 1KB
faces 975KB
neighbour 96KB
points 343KB
owner 193KB
transportProperties 787B
p.jpeg 19KB
0
U 1KB
p 1KB
T 1KB
nohup.out 0B
grid.jpeg 168KB
T.jpeg 33KB
U.jpeg 38KB
system
controlDict 1KB
fvSchemes 1KB
fvSolution 1KB
blockMeshDict 1KB
myProjectionTemTransFoam
createFvOptions.H 144B
Make
linux64GccDPInt32Opt
sourceFiles 39B
myProjectionTemTransFoam.C.dep 89KB
myProjectionTemTransFoam.o 1.19MB
variables 51B
options 416B
options 214B
files 79B
myProjectionTemTransFoam.C 3KB
createPhi.H 2KB
createFields.H 1KB
共 35 条
- 1
Green_tree_space
- 粉丝: 1
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0