mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
Let rCFD solvers update fields with integer counter instead of scalar elapsed time.
This commit is contained in:
@ -70,8 +70,8 @@ int main(int argc, char *argv[])
|
||||
Info << "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||
|
||||
label recTimeIndex = 0;
|
||||
scalar recTimeStep = recurrenceBase.recM().recTimeStep();
|
||||
scalar startTime = runTime.startTime().value();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
@ -88,13 +88,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
particleCloud.clockM().stop("Coupling");
|
||||
|
||||
stepCounter++;
|
||||
|
||||
if ( runTime.timeOutputValue() - startTime - (recTimeIndex+1)*recTimeStep + 1.0e-5 > 0.0 )
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
Info << "updating recurrence fields at time " << runTime.timeName() << "with recTimeIndex = " << recTimeIndex << nl << endl;
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "updateFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
|
||||
particleCloud.clockM().start(27,"Output");
|
||||
@ -106,7 +109,6 @@ int main(int argc, char *argv[])
|
||||
Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
|
||||
}
|
||||
|
||||
Info << "End\n" << endl;
|
||||
|
||||
@ -67,8 +67,8 @@ int main(int argc, char *argv[])
|
||||
Info << "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||
|
||||
label recTimeIndex = 0;
|
||||
scalar recTimeStep = recurrenceBase.recM().recTimeStep();
|
||||
scalar startTime = runTime.startTime().value();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
// control coupling behavior in case of substepping
|
||||
// assumes constant timestep size
|
||||
@ -101,12 +101,16 @@ int main(int argc, char *argv[])
|
||||
#include "TEqImp.H"
|
||||
particleCloud.clockM().stop("Flow");
|
||||
|
||||
stepCounter++;
|
||||
|
||||
particleCloud.clockM().start(32,"ReadFields");
|
||||
if ( runTime.timeOutputValue() - startTime - (recTimeIndex+1)*recTimeStep + 1.0e-5 > 0.0 )
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "updateFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
particleCloud.clockM().stop("ReadFields");
|
||||
|
||||
|
||||
@ -65,8 +65,8 @@ int main(int argc, char *argv[])
|
||||
Info << "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||
|
||||
label recTimeIndex = 0;
|
||||
scalar recTimeStep = recurrenceBase.recM().recTimeStep();
|
||||
scalar startTime = runTime.startTime().value();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
@ -83,12 +83,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
particleCloud.clockM().stop("Coupling");
|
||||
|
||||
stepCounter++;
|
||||
|
||||
if ( runTime.timeOutputValue() - startTime - (recTimeIndex+1)*recTimeStep + 1.0e-5 > 0.0 )
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "updateFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
|
||||
particleCloud.clockM().start(27,"Output");
|
||||
|
||||
@ -82,13 +82,13 @@ int main(int argc, char *argv[])
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
label recTimeIndex = 0;
|
||||
scalar recTimeStep = recurrenceBase.recM().recTimeStep();
|
||||
scalar startTime = runTime.startTime().value();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
const IOdictionary& couplingProps = particleCloud.couplingProperties();
|
||||
label nEveryFlow(couplingProps.lookupOrDefault<label>("nEveryFlow",1));
|
||||
Info << "Solving flow equations every " << nEveryFlow << " steps.\n" << endl;
|
||||
label stepcounter = 0;
|
||||
label totalStepCounter = 0;
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
particleCloud.clockM().start(26,"Flow");
|
||||
volScalarField rhoeps("rhoeps",rho*voidfractionRec);
|
||||
if (stepcounter%nEveryFlow==0)
|
||||
if (totalStepCounter%nEveryFlow==0)
|
||||
{
|
||||
while (pimple.loop())
|
||||
{
|
||||
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
stepcounter++;
|
||||
totalStepCounter++;
|
||||
particleCloud.clockM().stop("Flow");
|
||||
|
||||
particleCloud.clockM().start(31,"postFlow");
|
||||
@ -173,11 +173,16 @@ int main(int argc, char *argv[])
|
||||
particleCloud.clockM().stop("postFlow");
|
||||
|
||||
particleCloud.clockM().start(32,"ReadFields");
|
||||
if ( runTime.timeOutputValue() - startTime - (recTimeIndex+1)*recTimeStep + 1.0e-5 > 0.0 )
|
||||
|
||||
stepCounter++;
|
||||
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "updateFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
particleCloud.clockM().stop("ReadFields");
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ fvVectorMatrix UEqn
|
||||
fvOptions(rho, U)
|
||||
);
|
||||
|
||||
if (stepcounter%nEveryFlow==0)
|
||||
if (totalStepCounter%nEveryFlow==0)
|
||||
{
|
||||
UEqn.relax();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
if (stepcounter%nEveryFlow==0)
|
||||
if (totalStepCounter%nEveryFlow==0)
|
||||
{
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
@ -90,13 +90,13 @@ int main(int argc, char *argv[])
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
label recTimeIndex = 0;
|
||||
scalar recTimeStep = recurrenceBase.recM().recTimeStep();
|
||||
scalar startTime = runTime.startTime().value();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
const IOdictionary& couplingProps = particleCloud.couplingProperties();
|
||||
label nEveryFlow(couplingProps.lookupOrDefault<label>("nEveryFlow",1));
|
||||
Info << "Solving flow equations for U and p every " << nEveryFlow << " steps.\n" << endl;
|
||||
label stepcounter = 0;
|
||||
label totalStepCounter = 0;
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "monitorMass.H"
|
||||
|
||||
stepcounter++;
|
||||
totalStepCounter++;
|
||||
particleCloud.clockM().stop("Flow");
|
||||
|
||||
particleCloud.clockM().start(31,"postFlow");
|
||||
@ -190,11 +190,15 @@ int main(int argc, char *argv[])
|
||||
particleCloud.clockM().stop("postFlow");
|
||||
|
||||
particleCloud.clockM().start(32,"ReadFields");
|
||||
if ( runTime.timeOutputValue() - startTime - (recTimeIndex+1)*recTimeStep + 1.0e-5 > 0.0 )
|
||||
stepCounter++;
|
||||
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "updateFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
particleCloud.clockM().stop("ReadFields");
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ Description
|
||||
for a solver based on recurrence statistics
|
||||
|
||||
Rules
|
||||
Solution data to compute the recurrence statistics from, needs to
|
||||
Solution data to compute the recurrence statistics from, needs to
|
||||
reside in $CASE_ROOT/dataBase
|
||||
Time step data in dataBase needs to be evenly spaced in time
|
||||
|
||||
@ -55,34 +55,39 @@ int main(int argc, char *argv[])
|
||||
#include "createControl.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
|
||||
|
||||
recBase recurrenceBase(mesh);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||
|
||||
|
||||
label recTimeIndex(0);
|
||||
scalar recTimeStep_=recurrenceBase.recM().recTimeStep();
|
||||
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
|
||||
myClock().start(1,"Global");
|
||||
|
||||
runTime++;
|
||||
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
myClock().start(2,"fieldUpdate");
|
||||
|
||||
if ( runTime.timeOutputValue() - (recTimeIndex+1)*recTimeStep_ + 1.0e-5 > 0.0 )
|
||||
|
||||
stepCounter++;
|
||||
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
Info << "Updating fields at run time " << runTime.timeOutputValue()
|
||||
<< " corresponding to recurrence time " << (recTimeIndex+1)*recTimeStep_ << ".\n" << endl;
|
||||
<< " with recTimeIndex " << recTimeIndex << ".\n" << endl;
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "readFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
|
||||
myClock().stop("fieldUpdate");
|
||||
|
||||
@ -67,7 +67,8 @@ int main(int argc, char *argv[])
|
||||
Info << "\nCalculating particle trajectories based on recurrence statistics\n" << endl;
|
||||
|
||||
label recTimeIndex(0);
|
||||
scalar recTimeStep_=recurrenceBase.recM().recTimeStep();
|
||||
label stepCounter = 0;
|
||||
label recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
@ -82,14 +83,17 @@ int main(int argc, char *argv[])
|
||||
#include "TEq.H"
|
||||
particleCloud.clockM().stop("Flow");
|
||||
|
||||
stepCounter++;
|
||||
|
||||
if ( runTime.timeOutputValue() - (recTimeIndex+1)*recTimeStep_ + 1.0e-5 > 0.0 )
|
||||
if (stepCounter == recTimeStep2CFDTimeStep)
|
||||
{
|
||||
Info << "Updating fields at run time " << runTime.timeOutputValue()
|
||||
<< " corresponding to recurrence time " << (recTimeIndex+1)*recTimeStep_ << ".\n" << endl;
|
||||
<< " corresponding to recTimeIndex " << recTimeIndex << ".\n" << endl;
|
||||
recurrenceBase.updateRecFields();
|
||||
#include "readFields.H"
|
||||
recTimeIndex++;
|
||||
stepCounter = 0;
|
||||
recTimeStep2CFDTimeStep = recurrenceBase.recM().recTimeStep2CFDTimeStep();
|
||||
}
|
||||
|
||||
particleCloud.clockM().start(27,"Output");
|
||||
|
||||
Reference in New Issue
Block a user