CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to carry out multiple solving iterations within one time step

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2020, 09:47
Default How to carry out multiple solving iterations within one time step
  #1
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 7
ywem is on a distinguished road
Dear Foamers,
I am trying to solve two coupled equations with OpenFOAM. The solutions converge very slowly and I have to make several iterations within one time step. I have used piso corrections in the runTime loop and solving the two equations sequentially in each correction loop. But it seems that the solution of the current correction iteration does not read solutions of the former iteration.
Does anyone has ideas about this problem or any instructions about the solving of coupled equations using OpenFOAM? Thanks in advance.
ywem is offline   Reply With Quote

Old   June 6, 2020, 20:27
Default
  #2
New Member
 
Sen Wang
Join Date: Jul 2018
Location: Singapore / Notre Dame, U.S.
Posts: 19
Blog Entries: 1
Rep Power: 7
wangsen992 is on a distinguished road
Dear Wenming,

Quote:
the solution of the current correction iteration does not read solutions of the former iteration
This is probably due to your settings on the IOobject set on your variables. Also please note, the objectRegistry only writes those variables marked with AUTO_WRITE if the current time step is over. So if you are doing iteration within the time step, using the time control loop won't work.

Could you upload your solver (including the createFields.H file). For piso corrections (i haven't looked into the internals), but i suspect it explicitly works with p, U and phi (for optimization), most likely a tmp<type> object is used for storing intermediate geometricField data, or use the prevIter() method from the geometricField.

So in summary it looks like a storage/IO issue, so a test case could be helpful. If not solving fluid motion, i don't recommend using pisoControl directly (a personal preference).

Cheers,
Sen
wangsen992 is offline   Reply With Quote

Old   June 7, 2020, 04:54
Default
  #3
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 7
ywem is on a distinguished road
Dear Sen,
Thank you for your reply.
Yes, you are right. The settings for IOobject such as
volVectorField M
(
IOobject
(
"M",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
dose not work for the iteration within time steps.

Following your advice, I tried to store the intermediate field data by adding a sentence like
M.storePrevIter();
but it does not work either.

I also tried to change the piso correction to the PIMPLE outer correction for the iteration within one time loop. The results were not changed. The problem is also that the previous results of the inner iteration was not read by the current interation.
ywem is offline   Reply With Quote

Old   June 7, 2020, 06:09
Default
  #4
Member
 
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6
superkelle is on a distinguished road
won't a simple "for" or "while" loop in your runtime loop work?


Code:


while (runTime.loop())
{    

    runTime++;

    
    for (int i=0; i<nTotalCycles; ++i)
    {
        #include "Eqn1.H"
        #include "Eqn2.H"
    } 
    runTime.write();

}
or

Code:
while (runTime.loop())
{    

    runTime++;

    while ( ! convCrit)
    {
         #include "Eqn1.H"        

        #include "Eqn2.H"
         #include "convergenceCriterium.H"


    }
    runTime.write();

}
superkelle is offline   Reply With Quote

Old   June 7, 2020, 07:35
Default
  #5
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 7
ywem is on a distinguished road
Dear Alexander,
Thank you for your suggestions. I tried that but it dose not work either. The problem is that the solving of Eqn2 does not read the results of Eqn1 in your reply within one time step.
ywem is offline   Reply With Quote

Old   June 7, 2020, 20:08
Default
  #6
New Member
 
Sen Wang
Join Date: Jul 2018
Location: Singapore / Notre Dame, U.S.
Posts: 19
Blog Entries: 1
Rep Power: 7
wangsen992 is on a distinguished road
Hi Wenming,

i am confused about why your Eqn2 is not reading your Eqn1's results. After computation of Eqn1, M should be the updated result which can be directly accessed in Eqn2. Maybe you can check if your scope is set correctly? So for your Eqn1.H, you should not have a set of curly brackets {} surrounding all your code. You can have curly brackets for Eqn2 though.

Sorry since I can't see your code, I can only guess at the possible errors that could happen.

Hope this helps.
Sen
wangsen992 is offline   Reply With Quote

Old   June 9, 2020, 03:13
Default
  #7
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 7
ywem is on a distinguished road
Dear Sen,

Thanks a lot for your suggestions. I checked and found that the curly brackets do not influence the results.

Maybe you are right. Eqn2 should read the results of Eqn1 automatically although its results have not been written out . My problem may come from the fact that

I am solving a steady problem using a transient solver but the convergence of the steady problem is time dependent. So although the Eqn2 and Eqn1 are solved and converged by several innter iterations, the whole problem is not converged because the time dose not evolve.

I have started another thread to talk about this problem.
ywem is offline   Reply With Quote

Old   June 9, 2020, 03:17
Smile
  #8
Member
 
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6
superkelle is on a distinguished road
Quote:
Originally Posted by ywem View Post
I have started another thread to talk about this problem.

maybe you post the link here for anyone who has similar issues
superkelle is offline   Reply With Quote

Old   June 9, 2020, 03:46
Default
  #9
Member
 
Wenming Yang
Join Date: Jun 2018
Posts: 42
Rep Power: 7
ywem is on a distinguished road
Dear Sen,
Please follow the link below

Why the convergence of a steady problem also need several time evolution steps
ywem is offline   Reply With Quote

Reply

Tags
coupled problems, multiple iterations


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 05:49
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 08:35
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 03:34
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 11:22.