|
[Sponsors] |
programming a subroutine inside the time loop |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 14, 2020, 12:20 |
programming a subroutine inside the time loop
|
#1 |
New Member
Felix Benz
Join Date: Jan 2020
Posts: 3
Rep Power: 6 |
Dear OpenFoam Users,
I am trying to implement a subroutine inside the main time loop which looks something like: while(runTime.loop()) { solve first equation while (some convergence criteria) { solve second equation } } The solver compiles and the case is working, but it seems to be that openfoam does not like it if I call solve over and over again in the same time step. If I run the two pieces of code: 1: while (runTime.loop()) { dU *= (0.0,0.0,0.0); solve ( fvm::laplacian(mu,dU) + fvc::div(sigma) //mu, dU and sigma are just dummy fields ); prevTime = time; time = runTime.elapsedCpuTime(); Info << "Time needed : " << time - prevTime << nl; } and 2: while(true) { dU *= (0.0,0.0,0.0); solve ( fvm::laplacian(mu,dU) + fvc::div(sigma) ); prevTime = time; time = runTime.elapsedCpuTime() ; Info << "Time needed : " << time - prevTime << nl; } the first code will give me a constant "Time needed" as expected, while the second will increase with every iteration. I guess runTime.loop() will kind of reset the field or the objectRegistry? Is there a way to circumvent this problem or to access the registry manually? Thanks in advance Felix |
|
Tags |
run time, subroutine |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
LES, Courant Number, Crash, Sudden | Alhasan | OpenFOAM Running, Solving & CFD | 5 | November 22, 2019 03:05 |
Inconsistencies in reading .dat file during run time in new injection model | Scram_1 | OpenFOAM | 0 | March 23, 2018 23:29 |
How to export time series of variables for one point? | mary mor | OpenFOAM Post-Processing | 8 | July 19, 2017 11:54 |
Stuck in a Rut- interDyMFoam! | xoitx | OpenFOAM Running, Solving & CFD | 14 | March 25, 2016 08:09 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |