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

Understanding Log Output / InitialResidual / Adjust timestep

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2020, 12:15
Default Understanding Log Output / InitialResidual / Adjust timestep
  #1
New Member
 
Tobias Hofbaur
Join Date: Oct 2020
Posts: 6
Rep Power: 6
betelgeuze is on a distinguished road
Hello,
first of all a big thank you to the community, the answers in this forum helped me a lot to get my case started. Some remain however

Background:
I am solving a transient heat transfer problem in an axissymmetric, solid body with internal heat source. For now the boundary conditions are isolated, but I want to include radiative and convective cooling on one face later on.
I setup and run my problem using laplacianFoam. The internal source works fine and the results look sensible.

However, I want justification for my result, i.e. I try to get the initial residuals smaller. To get an acceptable initial residual (< 1e-4) I have to choose a very small time in the beginning (~1e-10). Of course then the calculations take forever, so I would like to change to a coarser timestep later on when the initial residuals are much smaller. (1e-8).

I have adapted the laplacianSolver to increase the timestep, however the solver seems to run multiple times for every timestep (as far as I can tell from the output) and the latest initialResidual is small.

Output of my modified laplacianFoam
Code:
Time = 1e-10

Selecting finite volume options model type sourceTime
    Source: sourceTime
    - selecting all cells
    - selected 400000 cell(s) with volume 3.83855999999996e-09
1e-10
DICPBiCGStab:  Solving for T, Initial residual = 0.999993153908313, Final residual = 2.15109639295838e-11, No Iterations 1
DICPBiCGStab:  Solving for T, Initial residual = 1.45887329425369e-07, Final residual = 1.45887329425369e-07, No Iterations 0
1e-10
DICPBiCGStab:  Solving for T, Initial residual = 1.45887329425369e-07, Final residual = 1.45887329425369e-07, No Iterations 0
DICPBiCGStab:  Solving for T, Initial residual = 1.45887329425369e-07, Final residual = 1.45887329425369e-07, No Iterations 0
1e-10
DICPBiCGStab:  Solving for T, Initial residual = 1.45887329425369e-07, Final residual = 1.45887329425369e-07, No Iterations 0
DICPBiCGStab:  Solving for T, Initial residual = 1.45887329425369e-07, Final residual = 1.45887329425369e-07, No Iterations 0
 ExecutionTime = 10.28 s  ClockTime = 10 s
Question:
1. Why does the solver run 6 times for each timestep? According to docu each field solved produces an output, but I have only one. The normal laplacianFoam runs only three times per timestep.
2. Is the way I adjust my timestep correct? In my laplacianFoam I added
Code:
            fvOptions.correct(T);
            initResidual = TEqn.solve().initialResidual();
            if (initResidual <1e-5)
            {
                //runTime.setDeltaT(2*runTime.deltaT());
             }
Thanks in advance.
Tobias

Last edited by betelgeuze; October 29, 2020 at 07:17.
betelgeuze is offline   Reply With Quote

Old   October 29, 2020, 16:31
Default
  #2
New Member
 
Tobias Hofbaur
Join Date: Oct 2020
Posts: 6
Rep Power: 6
betelgeuze is on a distinguished road
I did some more research and found the answer to 1).


My equation is solved three times per timestep as I had nNonOrthogonalCorrectors set to 2. As my mesh is perfectly orthogonal I can set it to zero.
In my modification the solution was doubled again, as I called the solver again, instead of taking the result of the first call. I now changed it to

Code:
         ...
           solverPerf = TEqn.solve();
            fvOptions.correct(T);
            if (solverPerf.initialResidual() <1e-5)
            {
                runTime.setDeltaT(2*runTime.deltaT());
            }
and it runs.
If the result are good - I will see in the morning.
betelgeuze is offline   Reply With Quote

Old   October 30, 2020, 07:05
Default
  #3
New Member
 
Kevin
Join Date: Nov 2019
Location: Bremen, Germany
Posts: 10
Rep Power: 7
DramaDrummer is on a distinguished road
Hi Tobias,
just as a quick thought: Since you simulate a transient case, I won't expect the initial residual to be too low. The solution changes in time, which is why the initial residual will be lower for low deltaT and larger for large deltaT. If you would have a fluid simultaion, I would suggest to perform the simulation based on Courant number (maxCo in controlDict). I guess the solid equivalent is maxDi, right?
Best
Kevin
DramaDrummer is offline   Reply With Quote

Old   October 31, 2020, 09:41
Default
  #4
New Member
 
Tobias Hofbaur
Join Date: Oct 2020
Posts: 6
Rep Power: 6
betelgeuze is on a distinguished road
Hi Kevin,
thanks for the idea. Currently I am using laplacianFoam whic is sufficient in my case and there is no maxCo or maxDi. If I change to chtMult.. I will look into the maxDi idea.
Best
Tobias
betelgeuze is offline   Reply With Quote

Old   November 7, 2020, 14:26
Default
  #5
New Member
 
Tobias Hofbaur
Join Date: Oct 2020
Posts: 6
Rep Power: 6
betelgeuze is on a distinguished road
So I changed to chtMultiRegion Foam.
The simulations runs, and the results are sensible.
Due to the physical background (Lasers shooting on tissue in ms durations) I need a rather fine mesh to get physical results ~ 1e-7.

However if I choose maxDi as given in the tutorials maxDi~10, my simulation runs for ages to reach my target time 5ms (DeltaT ~ 1e-9)


For the Courant number the derivation and the physical interpretation for maxCo < 1 is clear.
However I cannot find a similar detailed explanation for the Diffusion number, neither here nor in the web. The closest I can find is https://www.google.com/url?sa=t&rct=...kUBxOIAIj9K5IH
This would would indicate maxDi <1 as well, I am not sure this discretization scheme is used in OpenFoam though



Do you have a good source for choosing the diffusion number?
betelgeuze is offline   Reply With Quote

Reply

Tags
heattransfer, laplacianfoam, residuals


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
Adjust write interval for function output waynezw0618 OpenFOAM 1 September 27, 2018 02:54
[Gmsh] Understanding output file of Gmsh ihu OpenFOAM Meshing & Mesh Conversion 1 October 24, 2016 06:08
[snappyHexMesh] Calculating Y+ & understanding the Snappyhexmesh log file Doug68 OpenFOAM Meshing & Mesh Conversion 3 April 27, 2016 05:41
how to export every data w.r.t time to txt file jaho CFX 94 August 25, 2015 10:45
[ICEM] Understanding check mesh output kotimari ANSYS Meshing & Geometry 0 July 15, 2012 09:33


All times are GMT -4. The time now is 12:36.