@@ -34,179 +34,45 @@ Description
3434//Include CPPPO
3535#include "c3po_OF_interface.H"
3636
37- #include "OFversion.H"
38- #if defined(version30 )
39- #include "turbulentTransportModel.H"
40- #include "pisoControl.H"
41- #else
42- #include "turbulenceModel.H"
43- #endif
44-
45-
4637#include "fvCFD.H"
4738#include "singlePhaseTransportModel.H"
48- #include "turbulenceModel.H"
49-
50- #if defined(versionv1606plus ) || defined(version40 )
51- #include "fvOptions.H"
52- #else
53- #include "fvIOoptionList.H"
54- #endif
55-
56- #include "cellSet.H"
57- #include "mpi.h"
58-
59-
60-
39+ #include "turbulentTransportModel.H"
40+ #include "pisoControl.H"
41+ #include "fvOptions.H"
6142
6243// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
6344
6445int main (int argc , char * argv [])
6546{
66- #include "setRootCase .H"
47+ #include "postProcess .H"
6748
49+ #include "setRootCaseLists.H"
6850 #include "createTime.H"
6951 #include "createMesh.H"
70-
71- #if defined(version30 )
72- pisoControl piso (mesh );
73- #include "createTimeControls.H"
74- #endif
75-
52+ #include "createControl.H"
7653 #include "createFields.H"
7754 #include "initContinuityErrs.H"
78- #include "createFvOptions.H"
79-
80- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81-
82- int flag ;
83- MPI_Initialized (& flag );
84- if (!flag )
85- {
86- int argc = 0 ;
87- char * * argv = NULL ;
88- MPI_Init (& argc ,& argv );
89- }
90- int proc_name ;
91- MPI_Comm_rank (MPI_COMM_WORLD ,& proc_name );
92-
93-
94-
9555
56+ turbulence -> validate ();
9657
97- # include "c3po_modifications_1.H"
9858
59+ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
9960
61+ // Initialise C3PO library
62+ #include "c3po_modifications_1.H"
10063
10164 Info << "\nStarting time loop\n" << endl ;
102-
10365 while (runTime .loop ())
10466 {
105- Info << "Time = " << runTime .timeName () << nl << endl ;
106-
107- #if defined(version30 )
108- #include "readTimeControls.H"
109- #include "CourantNo.H"
110- #include "setDeltaT.H"
111- #else
112- #include "readPISOControls.H"
113- #include "CourantNo.H"
114- #endif
67+
68+ #include "solvePISO.H"
11569
116-
117-
118- // Pressure-velocity PISO corrector
70+ // Call C3PO every time OF writes to disk
71+ if (runTime .write ())
11972 {
120- // Momentum predictor
121-
122- fvVectorMatrix UEqn
123- (
124- fvm ::ddt (U )
125- + fvm ::div (phi , U )
126- + turbulence -> divDevReff (U )
127- - fvOptions (U )
128- );
129-
130- UEqn .relax ();
131-
132- #if defined(version30 )
133- if (piso .momentumPredictor ())
134- #else
135- if (momentumPredictor )
136- #endif
137- {
138- solve (UEqn == - fvc ::grad (p ));
139- }
140-
141- // --- PISO loop
142-
143- #if defined(version30 )
144- while (piso .correct ())
145- #else
146- int nCorrSoph = nCorr + 5 * pow ((1 - particleCloud .dataExchangeM ().timeStepFraction ()),1 );
147- for (int corr = 0 ; corr < nCorrSoph ; corr ++ )
148- #endif
149- {
150- volScalarField rAU (1.0 /UEqn .A ());
151-
152- volVectorField HbyA ("HbyA" , U );
153- HbyA = rAU * UEqn .H ();
154- surfaceScalarField phiHbyA
155- (
156- "phiHbyA" ,
157- (fvc ::interpolate (HbyA ) & mesh .Sf ())
158- + fvc ::interpolate (rAU )* fvc ::ddtCorr (U , phi )
159- );
160-
161- adjustPhi (phiHbyA , U , p );
162-
163- // Non-orthogonal pressure corrector loop
164- #if defined(version30 )
165- while (piso .correctNonOrthogonal ())
166- #else
167- for (int nonOrth = 0 ; nonOrth <=nNonOrthCorr ; nonOrth ++ )
168- #endif
169- {
170- // Pressure corrector
171-
172- fvScalarMatrix pEqn
173- (
174- fvm ::laplacian (rAU , p ) == fvc ::div (phiHbyA )
175- );
176-
177- pEqn .setReference (pRefCell , pRefValue );
178-
179- #if defined(version30 )
180- pEqn .solve (mesh .solver (p .select (piso .finalInnerIter ())));
181-
182- #else
183- if ( corr == nCorr - 1 && nonOrth == nNonOrthCorr )
184- pEqn .solve (mesh .solver ("pFinal" ));
185- else
186- pEqn .solve ();
187-
188-
189- #endif
190-
191- }
192-
193- #include "continuityErrs.H"
194-
195- U = HbyA - rAU * fvc ::grad (p );
196- U .correctBoundaryConditions ();
197- }
73+ # include "c3po_modifications_2.H"
74+ runTime .write ();
19875 }
199-
200- turbulence -> correct ();
201-
202- //In this example CPPPO is called when OF writes data to disk
203-
204- if (runTime .write ())
205- {
206- # include "c3po_modifications_2.H"
207-
208- runTime .write ();
209- }
21076 Info << "ExecutionTime = " << runTime .elapsedCpuTime () << " s"
21177 << " ClockTime = " << runTime .elapsedClockTime () << " s"
21278 << nl << endl ;
0 commit comments