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 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 #include <finiteVolume/fvCFD.H>
00055 
00056 
00057 
00058 
00059 int main(int argc, char *argv[])
00060 {
00061 
00062     argList::validOptions.insert("writep", "");
00063 
00064 #   include <OpenFOAM/setRootCase.H>
00065 
00066 #   include <OpenFOAM/createTime.H>
00067 #   include <OpenFOAM/createMesh.H>
00068 #   include "createFields.H"
00069 #   include <finiteVolume/readSIMPLEControls.H>
00070 
00071 
00072 
00073     Info<< nl << "Calculating potential flow" << endl;
00074 
00075     adjustPhi(phi, U, p);
00076 
00077     for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
00078     {
00079         fvScalarMatrix pEqn
00080         (
00081             fvm::laplacian
00082             (
00083                 dimensionedScalar
00084                 (
00085                     "1",
00086                     dimTime/p.dimensions()*dimensionSet(0, 2, -2, 0, 0),
00087                     1
00088                 ),
00089                 p
00090             )
00091          ==
00092             fvc::div(phi)
00093         );
00094 
00095         pEqn.setReference(pRefCell, pRefValue);
00096         pEqn.solve();
00097 
00098         if (nonOrth == nNonOrthCorr)
00099         {
00100             phi -= pEqn.flux();
00101         }
00102     }
00103 
00104     Info<< "continuity error = "
00105         << mag(fvc::div(phi))().weightedAverage(mesh.V()).value()
00106         << endl;
00107 
00108     U = fvc::reconstruct(phi);
00109     U.correctBoundaryConditions();
00110 
00111     Info<< "Interpolated U error = "
00112         << (sqrt(sum(sqr((fvc::interpolate(U) & mesh.Sf()) - phi)))
00113           /sum(mesh.magSf())).value()
00114         << endl;
00115 
00116     
00117     U.write();
00118     phi.write();
00119 
00120     if (args.optionFound("writep"))
00121     {
00122         p.write();
00123     }
00124 
00125     Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
00126         << "  ClockTime = " << runTime.elapsedClockTime() << " s"
00127         << nl << endl;
00128 
00129     Info<< "End\n" << endl;
00130 
00131     return 0;
00132 }
00133 
00134 
00135