sonicDyMFoam.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "fvCFD.H"
00035 #include "basicPsiThermo.H"
00036 #include "turbulenceModel.H"
00037 #include "motionSolver.H"
00038
00039
00040
00041 int main(int argc, char *argv[])
00042 {
00043 #include "setRootCase.H"
00044 #include "createTime.H"
00045 #include "createMesh.H"
00046 #include "createFields.H"
00047 #include "initContinuityErrs.H"
00048
00049
00050
00051 Info<< "\nStarting time loop\n" << endl;
00052
00053 autoPtr<Foam::motionSolver> motionPtr = motionSolver::New(mesh);
00054
00055 while (runTime.loop())
00056 {
00057 Info<< "Time = " << runTime.timeName() << nl << endl;
00058
00059 #include "readPISOControls.H"
00060 #include "compressibleCourantNo.H"
00061
00062 mesh.movePoints(motionPtr->newPoints());
00063
00064 #include "rhoEqn.H"
00065
00066 fvVectorMatrix UEqn
00067 (
00068 fvm::ddt(rho, U)
00069 + fvm::div(phi, U)
00070 + turbulence->divDevRhoReff(U)
00071 );
00072
00073 solve(UEqn == -fvc::grad(p));
00074
00075 #include "eEqn.H"
00076
00077
00078
00079
00080 for (int corr=0; corr<nCorr; corr++)
00081 {
00082 U = UEqn.H()/UEqn.A();
00083
00084 surfaceScalarField phid
00085 (
00086 "phid",
00087 fvc::interpolate(psi)
00088 *(
00089 (fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U)
00090 )
00091 );
00092
00093 for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00094 {
00095 fvScalarMatrix pEqn
00096 (
00097 fvm::ddt(psi, p)
00098 + fvm::div(phid, p)
00099 - fvm::laplacian(rho/UEqn.A(), p)
00100 );
00101
00102 pEqn.solve();
00103
00104 phi = pEqn.flux();
00105 }
00106
00107 #include "compressibleContinuityErrs.H"
00108
00109 U -= fvc::grad(p)/UEqn.A();
00110 U.correctBoundaryConditions();
00111 }
00112
00113 DpDt = fvc::DDt
00114 (
00115 surfaceScalarField
00116 (
00117 "phiU",
00118 phi/fvc::interpolate(rho) + fvc::meshPhi(rho, U)
00119 ),
00120 p
00121 );
00122
00123 turbulence->correct();
00124
00125 rho = psi*p;
00126
00127 runTime.write();
00128
00129 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
00130 << " ClockTime = " << runTime.elapsedClockTime() << " s"
00131 << nl << endl;
00132 }
00133
00134 Info<< "End\n" << endl;
00135
00136 return 0;
00137 }
00138
00139
00140
Copyright © 2000-2009 OpenCFD Ltd