Adaptive Timestepping
Adaptive Timestepping
Hi,
I try to use adaptive timestepping on a problem with coupled Statcurrent and Heat Equation solvers involving phase change. I have run the problem before without adaptive timestepping. It worked OK, but I found that I need to take very small timesteps in order to achieve resonable results. Then I have just added
Adaptive Timestepping = Logical True
Adaptive Time Error = Real 1e5
in the Simulation section. My problem is that now the solver seems to run forever.
I have read in the Models Manual that adaptive timestepping is possible when the BDF timestepping method of order 1 is used, which is the case.
What could I have done wrong? Is there an example where adaptive timestepping is used?
I have found nothing the tutorials and just one example under "tests" where a "RungeKutta" timestepping method (?) is used.
Maybe someone could shed some light on this and give me a hint what I could do to get more information and get my simulation to work...
Thank you,
Matthias
I try to use adaptive timestepping on a problem with coupled Statcurrent and Heat Equation solvers involving phase change. I have run the problem before without adaptive timestepping. It worked OK, but I found that I need to take very small timesteps in order to achieve resonable results. Then I have just added
Adaptive Timestepping = Logical True
Adaptive Time Error = Real 1e5
in the Simulation section. My problem is that now the solver seems to run forever.
I have read in the Models Manual that adaptive timestepping is possible when the BDF timestepping method of order 1 is used, which is the case.
What could I have done wrong? Is there an example where adaptive timestepping is used?
I have found nothing the tutorials and just one example under "tests" where a "RungeKutta" timestepping method (?) is used.
Maybe someone could shed some light on this and give me a hint what I could do to get more information and get my simulation to work...
Thank you,
Matthias
Re: Adaptive Timestepping
Hi,
still trying to get the adaptive timestepping to work, I have experienced a solver crash. After some iterations, I get the error message:
Fortran runtime error: Attempting to allocate already allocated array
I use the latest binary for Windoze (svn484420101125).
In the attachment there is a test case which reproduces the crash. To load the project with ElmerGUI, all solver xml files fro bin/edfextra have to be copied to bin/edf.
I would be very grateful if someone from the Elmer team could have a look on my case, and try to find out why the solver crashed, and what I can do to get the adaptive timestepping to work...
Thank you,
Matthias
still trying to get the adaptive timestepping to work, I have experienced a solver crash. After some iterations, I get the error message:
Fortran runtime error: Attempting to allocate already allocated array
I use the latest binary for Windoze (svn484420101125).
In the attachment there is a test case which reproduces the crash. To load the project with ElmerGUI, all solver xml files fro bin/edfextra have to be copied to bin/edf.
I would be very grateful if someone from the Elmer team could have a look on my case, and try to find out why the solver crashed, and what I can do to get the adaptive timestepping to work...
Thank you,
Matthias
 Attachments

 Adaptive_crash.zip
 (96.07 KiB) Downloaded 118 times
Re: Adaptive Timestepping
Hi,
thanks for the bug report, the memory (de)allocation trouble has been resolved in the current SVN.
Looking at the adaptive timestepping (after the fix), it seems to work much as expected.
Just your simulation needs pretty small timesteps at the beginning to get to the desider accuracy.
Anyway the sif file below seems to work reasonably (for me):
1) added material table values to both ends (Temp=0 & 250) to account for
iteration overshoots
2) Let the timestepping resolve (most) the nonliearities (Relaxation Factor=1, Steady Max Iter=2)
3) Use Explicit Euler timestepping for speed
4) Use somewhat stricter criteria for adaptive timestepping convergence (1e4)
Note that the first few steps take most of the time...
Regards, Juha
thanks for the bug report, the memory (de)allocation trouble has been resolved in the current SVN.
Looking at the adaptive timestepping (after the fix), it seems to work much as expected.
Just your simulation needs pretty small timesteps at the beginning to get to the desider accuracy.
Anyway the sif file below seems to work reasonably (for me):
1) added material table values to both ends (Temp=0 & 250) to account for
iteration overshoots
2) Let the timestepping resolve (most) the nonliearities (Relaxation Factor=1, Steady Max Iter=2)
3) Use Explicit Euler timestepping for speed
4) Use somewhat stricter criteria for adaptive timestepping convergence (1e4)
Note that the first few steps take most of the time...
Regards, Juha
Code: Select all
Header
CHECK KEYWORDS Warn
Mesh DB "." "."
Include Path ""
Results Directory ""
End
Simulation
Max Output Level = 3
Coordinate System = Cartesian
Coordinate Mapping(3) = 1 2 3
Simulation Type = Transient
Steady State Max Iterations = 2
Output Intervals = 1
Timestepping Method = explicit euler
BDF Order = 1
RungeKutta Order = 2
Timestep intervals = 100
Timestep Sizes = 0.05
Solver Input File = case.sif
Post File = case_ee_t.ep
Adaptive Timestepping = Logical True
Adaptive Min Timestep = 1e6
Adaptive Time Error = 1e4
Adaptive Keep Smallest = 3
Coordinate Scaling = Real 0.001
End
Constants
Gravity(4) = 0 1 0 9.82
Stefan Boltzmann = 5.67e08
Permittivity of Vacuum = 8.8542e12
Boltzmann Constant = 1.3807e23
Unit Charge = 1.602e19
End
Body 1
Target Bodies(1) = 11
Name = "Test Material"
Equation = 1
Material = 1
Body Force = 1
Initial condition = 1
End
Solver 1
Equation = Static Current Conduction
Calculate Volume Current = True
Procedure = "StatCurrentSolve" "StatCurrentSolver"
Variable = dofs 1 Potential
Calculate Joule Heating = True
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e5
Nonlinear System Convergence Tolerance = 1.0e8
Nonlinear System Max Iterations = 1
Nonlinear System Newton After Iterations = 1
Nonlinear System Newton After Tolerance = 1.0e3
Nonlinear System Relaxation Factor = 1
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStabL
Linear System Max Iterations = 10
Linear System Convergence Tolerance = 1.0e8
Linear System Preconditioning = ILU2
Linear System ILUT Tolerance = 1.0e3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End
Solver 2
Equation = Heat Equation
Variable = dofs 1 Temperature
Procedure = "HeatSolve" "HeatSolver"
Exec Solver = Always
Stabilize = True
Bubbles = False
Lumped Mass Matrix = False
Optimize Bandwidth = True
Steady State Convergence Tolerance = 1.0e5
Nonlinear System Convergence Tolerance = 1.0e8
Nonlinear System Max Iterations = 1
Nonlinear System Newton After Iterations = 1
Nonlinear System Newton After Tolerance = 1.0e3
Nonlinear System Relaxation Factor = 1
Linear System Solver = Iterative
Linear System Iterative Method = BiCGStabL
Linear System Max Iterations = 10
Linear System Convergence Tolerance = 1.0e8
Linear System Preconditioning = ILU2
Linear System ILUT Tolerance = 1.0e3
Linear System Abort Not Converged = False
Linear System Residual Output = 1
Linear System Precondition Recompute = 1
End
Equation 1
Name = "Equation 1"
Phase Change Model = Spatial 2
Active Solvers(2) = 1 2
End
Material 1
Name = "TestMaterial (phase and conductivity change)"
Enthalpy = Variable Temperature;Real;0 60; 10 42117000; 20 84012000; 50 209410000; 70 293070000; 99 417000000; 101 2675800000; 150 2776600000; 250 4.62767e+09; End;
Electric Conductivity = Variable Temperature
Real
0 0.2
20 0.2
90 0.2
98 0.15
99 0.1
100 0.05
101 0.005
110 0.005
250 0.005
End
Heat Conductivity = 0.5
Heat Capacity = 3600
Density = 1000
End
Body Force 1
Name = "BodyForce 1"
Joule Heat = True
End
Initial Condition 1
Name = "InitialCondition 1"
Temperature = 20
End
Boundary Condition 1
Target Boundaries(1) = 12
Name = "Electrode"
Potential = 100
End
Boundary Condition 2
Target Boundaries(1) = 13
Name = "Ground"
Potential = 0
End
Boundary Condition 3
Target Boundaries(1) = 14
Name = "Temperature limit"
Temperature = 20
End
Boundary Condition 4
Target Boundaries(1) = 15
Name = "Temperature limit"
Temperature = 20
End
Re: Adaptive Timestepping
Hi,
seems better (timewise at least) taking Steady Max Iterations=1, when Explicit Euler is used.
Juha
seems better (timewise at least) taking Steady Max Iterations=1, when Explicit Euler is used.
Juha
Re: Adaptive Timestepping
Hi Juha,
thank you for your reply and the helpful hints. I will try them out when a new Windows binary is available.
In the meantime, I would like to expand my knowledge on FEM methods. I would never have found out by myself what you have suggested (timestepping method = explicit Euler  what is that, and why is it better here? etc. etc.). Unfortunately I have not found much information in the Elmer manuals, which is maybe normal since they are not textbooks on FEM. I think I should look for a good textbook on FEM. Do you have a recommendation?
Thank you,
Matthias
thank you for your reply and the helpful hints. I will try them out when a new Windows binary is available.
In the meantime, I would like to expand my knowledge on FEM methods. I would never have found out by myself what you have suggested (timestepping method = explicit Euler  what is that, and why is it better here? etc. etc.). Unfortunately I have not found much information in the Elmer manuals, which is maybe normal since they are not textbooks on FEM. I think I should look for a good textbook on FEM. Do you have a recommendation?
Thank you,
Matthias

 Site Admin
 Posts: 3416
 Joined: 22 Aug 2009, 11:57
 Antispam: Yes
 Location: Espoo, Finland
 Contact:
Re: Adaptive Timestepping
Hi
Generally implicit time integration methods are superior with FEM since they are unconditionally stable (of course there could be nonlinearities that spoil this stability). The explicit methods aren't and therefore you often need to severily limit the timestep. However, in this case the evaluation of the effective heat capacity is done using the previous temperature field so it is by construction explicit and goes well together the explicit time integration method as well.
Peter
Time integration methods such as the explicit Euler are not limited to just to FEM. In fact in FEM the time discretization is the only one that is done with the Finite Difference method. There are also Finite Element discretizations for time but that's another story.mzenker wrote:
I would never have found out by myself what you have suggested (timestepping method = explicit Euler  what is that, and why is it better here? etc. etc.).
Generally implicit time integration methods are superior with FEM since they are unconditionally stable (of course there could be nonlinearities that spoil this stability). The explicit methods aren't and therefore you often need to severily limit the timestep. However, in this case the evaluation of the effective heat capacity is done using the previous temperature field so it is by construction explicit and goes well together the explicit time integration method as well.
Peter
Re: Adaptive Timestepping
Hi Peter,
thank you for this explanation. I see that I still have much to learn in this field.
Can you recommend some literature for further reading? What is your "FEM bible", if any?
Thanks again,
Matthias
thank you for this explanation. I see that I still have much to learn in this field.
Can you recommend some literature for further reading? What is your "FEM bible", if any?
Thanks again,
Matthias
Re: Adaptive Timestepping
Hello,
While it's not a "Bible" by any stretch, I worked on some reading material for an introductory course in modeling a few years back, including FEM. You can find the reading at: http://hdl.handle.net/1721.1/50265 , scroll down and click on "View/Open", then "Selected lecture notes" > "Continuum Methods (CM) (PDF)".
Or you can just download the .zip archive with all of the files.
Either way, the timestepping algorithm stuff is in chapter 3. Unfortunately it is limited to implicit, explicit and semiimplicit algorithms, with no BDF.
Adam
While it's not a "Bible" by any stretch, I worked on some reading material for an introductory course in modeling a few years back, including FEM. You can find the reading at: http://hdl.handle.net/1721.1/50265 , scroll down and click on "View/Open", then "Selected lecture notes" > "Continuum Methods (CM) (PDF)".
Or you can just download the .zip archive with all of the files.
Either way, the timestepping algorithm stuff is in chapter 3. Unfortunately it is limited to implicit, explicit and semiimplicit algorithms, with no BDF.
Adam
Re: Adaptive Timestepping
Hi all,
thanks to Adam's lecture notes, I know more about time discretisation now, and I will go on filling my knowledge gaps...
Now I am eager to try the fixed adaptive timestepping on my problem. When can we expect the next Windows binary... ?
Thank you,
Matthias
thanks to Adam's lecture notes, I know more about time discretisation now, and I will go on filling my knowledge gaps...
Now I am eager to try the fixed adaptive timestepping on my problem. When can we expect the next Windows binary... ?
Thank you,
Matthias
Re: Adaptive Timestepping
Thanks to the new binary, I just have made the first successful run using adaptive timestepping.
Now I am going to explore the new possibilities...
Thank you again,
Matthias
Now I am going to explore the new possibilities...
Thank you again,
Matthias