... | @@ -51,22 +51,16 @@ As the error ratio is calculated for each quantity of interest (e.g. one q per D |
... | @@ -51,22 +51,16 @@ As the error ratio is calculated for each quantity of interest (e.g. one q per D |
|
\|q\|_\infty = \max \left( |q_i| \right)
|
|
\|q\|_\infty = \max \left( |q_i| \right)
|
|
```
|
|
```
|
|
|
|
|
|
```
|
|
If $`\|q\| \le 1`$ then the actual time step is valid. In the other case the calculated time step is rejected and must be calculated again with a reduced step size.
|
|
|
|
For the next step the step size is adjusted to aim for $`\|q\| = 0.8`$.
|
|
If [[latex($\|q\| \le 1$)]] then the actual time step is valid. In the other case the calculated time step is rejected and must be calculated again with a reduced step size.
|
|
|
|
For the next step the step size is adjusted to aim for [[latex($\|q\| = 0.8$)]].
|
|
|
|
|
|
|
|
|
|
|
|
For the mathematical background, please have a look at: [http://qucs.sourceforge.net/tech/node23.html]
|
|
For the mathematical background, please have a look at: [http://qucs.sourceforge.net/tech/node23.html]
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
A typical usage of `TimeLoopAdaptive` is shown in the following piece of code:
|
|
|
|
|
|
== Usage ==
|
|
```
|
|
|
|
|
|
A typical usage of TimeLoopAdaptive is shown in the following piece of code:
|
|
|
|
|
|
|
|
|
|
|
|
{{{
|
|
|
|
Resolution {
|
|
Resolution {
|
|
{ Name SimTimeLoopAdaptive;
|
|
{ Name SimTimeLoopAdaptive;
|
|
System {
|
|
System {
|
... | @@ -91,65 +85,62 @@ Resolution { |
... | @@ -91,65 +85,62 @@ Resolution { |
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}}}
|
|
```
|
|
|
|
|
|
|
|
|
|
The parameters are:
|
|
The parameters are:
|
|
|
|
|
|
tStart::
|
|
* `tStart`:
|
|
Start time
|
|
Start time
|
|
|
|
|
|
tStop::
|
|
* `tStop`:
|
|
Stop time
|
|
Stop time
|
|
|
|
|
|
dtInit::
|
|
* `dtInit`:
|
|
Initial time step size
|
|
Initial time step size
|
|
|
|
|
|
dtMin::
|
|
* `dtMin`:
|
|
Minimum time step size
|
|
Minimum time step size
|
|
|
|
|
|
dtMax::
|
|
* `dtMax`:
|
|
Maximum time step size
|
|
Maximum time step size
|
|
|
|
|
|
Method::
|
|
* `Method`:
|
|
Integration method: Euler, Trapezoidal, Gear_2, Gear_3 .. Gear_6;
|
|
Integration method: `Euler`, `Trapezoidal`, `Gear_2`, `Gear_3`, ..., `Gear_6`;
|
|
|
|
|
|
Gear's method correspond to the backward differentiation formulas of order 2 .. 6. If you like you can use the synonyms BDF_2 .. BDF_6 instead.
|
|
Gear's method correspond to the backward differentiation formulas (BDF) of order 2, ..., 6. If you like you can use the synonyms `BDF_2`, ..., `BDF_6` instead.
|
|
|
|
|
|
'''''IMPORTANT NOTE:'''''
|
|
__Important note__: For `Trapezoidal` there are the same restrictions as for `TimeLoopTheta`! See the warning in the reference manual for `TimeLoopTheta`. I.e. it's not a valid method when there are time varying parts in the Galerkin statements using the standard equations (e.g. when we have a time dependent source term there or for non-linear problems). For a workaround have a look in the reference manual part of `TimeLoopTheta`. All other methods (`Euler`, `Gear_2`, ..., `Gear_6`) do not have this restriction.
|
|
For Trapezoidal there are the same restrictions as for TimeLoopTheta! -> See the warning in the reference manual for TimeLoopTheta. I.e. it's not a valid method when there are time varying parts in the Galerkin statements using the standard equations (e.g. when we have a time dependent source term there or for non-linear problems). For a workaround have a look in the reference manual part of TimeLoopTheta. All other methods (Euler, Gear_2 .. Gear_6) do not have this restriction.
|
|
|
|
|
|
|
|
Breakpoints::
|
|
* `Breakpoints`:
|
|
Here you can specify time points to be met during time stepping, e.g. when you expect an abrupt change of the solution due to a piece wise linear source definition.
|
|
Here you can specify time points to be met during time stepping, e.g. when you expect an abrupt change of the solution due to a piece wise linear source definition.
|
|
|
|
|
|
System::
|
|
* `System`:
|
|
Keyword System indicates that the quantity of interest are all DOFs of the given system. In addition or as an alternative you can specify post-operation results as quantities of interest by the keyword PostOperation (→ see example below).
|
|
Keyword `System` indicates that the quantity of interest are all DOFs of the given system. In addition or as an alternative you can specify post-operation results as quantities of interest by the keyword PostOperation (see example below).
|
|
|
|
|
|
System name::
|
|
* `System name`:
|
|
Here the name of the system of interest is declared. In case of a post-operation you specify here the name of the post-operation.
|
|
Here the name of the system of interest is declared. In case of a post-operation you specify here the name of the post-operation.
|
|
|
|
|
|
Relative tolerance::
|
|
* `Relative tolerance`:
|
|
Relative tolerance for the quantity of interest.
|
|
Relative tolerance for the quantity of interest.
|
|
|
|
|
|
Absolute tolerance::
|
|
* `Absolute tolerance`:
|
|
Absolute tolerance for the quantity of interest.
|
|
Absolute tolerance for the quantity of interest.
|
|
|
|
|
|
Error norm::
|
|
* `Error norm`:
|
|
Type of the error norm. Possible choices are: L1Norm, MeanL1Norm, L2Norm, MeanL2Norm, LinfNorm (→ see definitions above).
|
|
Type of the error norm. Possible choices are: L1Norm, MeanL1Norm, L2Norm, MeanL2Norm, LinfNorm (→ see definitions above).
|
|
|
|
|
|
1^st^ set of operations::
|
|
* `1st set of operations`:
|
|
This set of operations are executed for each time step. Usually the solution is calculated here.
|
|
This set of operations are executed for each time step. Usually the solution is calculated here.
|
|
|
|
|
|
2^nd^ set of operations::
|
|
* `2nd set of operations`:
|
|
This operations are executed only when the time step is valid, i.e. LTE is in the specified tolerance.
|
|
This operations are executed only when the time step is valid, i.e. LTE is in the specified tolerance.
|
|
|
|
|
|
|
|
## Quantities of Interest
|
|
== Quantities of Interest ==
|
|
|
|
|
|
|
|
Quantities of interest can be all degrees of freedom of one or several systems. Additionally or alternatively the quantities of interest can be the results of one or several post-operation(s). Each of them can have their own tolerances.
|
|
Quantities of interest can be all degrees of freedom of one or several systems. Additionally or alternatively the quantities of interest can be the results of one or several post-operation(s). Each of them can have their own tolerances.
|
|
Here is an example:
|
|
Here is an example:
|
|
|
|
|
|
{{{
|
|
```
|
|
TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints],
|
|
TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints],
|
|
System { { MySystemA, Areltol, Aabstol, LinfNorm }
|
|
System { { MySystemA, Areltol, Aabstol, LinfNorm }
|
|
{ MySystemB, Breltol, Babstol, L1Norm } }
|
|
{ MySystemB, Breltol, Babstol, L1Norm } }
|
... | @@ -161,9 +152,9 @@ TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints] |
... | @@ -161,9 +152,9 @@ TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints] |
|
{
|
|
{
|
|
...
|
|
...
|
|
}
|
|
}
|
|
}}}
|
|
```
|
|
|
|
|
|
=== Comparison of system versus post-operation ===
|
|
### Comparison of system versus post-operation
|
|
|
|
|
|
* For non-linear or coupled problems it's recommended to specify the system(s) because then for each new time step the solution is predicted (predictor-corrector method) before the actual calculation is done. This yield in better convergence.
|
|
* For non-linear or coupled problems it's recommended to specify the system(s) because then for each new time step the solution is predicted (predictor-corrector method) before the actual calculation is done. This yield in better convergence.
|
|
* When a system is specified then all DOFs of this system are assessed, but they do not necessarily correspond to the values of the quantities of the formulation directly (e.g. in case of higher order basis functions).
|
|
* When a system is specified then all DOFs of this system are assessed, but they do not necessarily correspond to the values of the quantities of the formulation directly (e.g. in case of higher order basis functions).
|
... | @@ -173,13 +164,13 @@ TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints] |
... | @@ -173,13 +164,13 @@ TimeLoopAdaptive[ tStart, tStop, dtInit, dtMin, dtMax, Method, List[Breakpoints] |
|
* Performing a post-operation each time step can be time consuming for large problems.
|
|
* Performing a post-operation each time step can be time consuming for large problems.
|
|
|
|
|
|
|
|
|
|
== Obtaining Results with Equidistant Time Steps ==
|
|
## Obtaining Results with Equidistant Time Steps
|
|
|
|
|
|
Sometimes it might be advantageous to have a result with equidistant time steps, e.g. for creating a movie with constant speed. There are two ways to do this:
|
|
Sometimes it might be advantageous to have a result with equidistant time steps, e.g. for creating a movie with constant speed. There are two ways to do this:
|
|
|
|
|
|
=== 1) During simulation with breakpoints ===
|
|
### 1) During simulation with breakpoints
|
|
|
|
|
|
{{{
|
|
```
|
|
Function {
|
|
Function {
|
|
...
|
|
...
|
|
dt = 125e-9; // Time step size for breakpoints [s]
|
|
dt = 125e-9; // Time step size for breakpoints [s]
|
... | @@ -203,13 +194,13 @@ Resolution { |
... | @@ -203,13 +194,13 @@ Resolution { |
|
}
|
|
}
|
|
...
|
|
...
|
|
}
|
|
}
|
|
}}}
|
|
```
|
|
|
|
|
|
|
|
|
|
=== 2) After simulation in the post-operation ===
|
|
### 2) After simulation in the post-operation
|
|
|
|
|
|
There is a new feature, called ResampleTime. It interpolates the result at specified time points via a cubic spline interpolation. This feature is independent of the time loop type.
|
|
There is a new feature, called ResampleTime. It interpolates the result at specified time points via a cubic spline interpolation. This feature is independent of the time loop type.
|
|
{{{
|
|
```
|
|
PostOperation {
|
|
PostOperation {
|
|
{ Name T_resampled; NameOfPostProcessing The; ResampleTime[tStart, tStop, dtResample];
|
|
{ Name T_resampled; NameOfPostProcessing The; ResampleTime[tStart, tStop, dtResample];
|
|
Operation {
|
|
Operation {
|
... | @@ -217,16 +208,16 @@ PostOperation { |
... | @@ -217,16 +208,16 @@ PostOperation { |
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}}}
|
|
```
|
|
|
|
|
|
|
|
|
|
== General Hints ==
|
|
## General Hints
|
|
|
|
|
|
* If you specify several systems and/or post-operations then usually only the largest [[latex($\|q\|$)]] is printed. If the verbosity level is set higher than 5 then [[latex($\|q\|$)]] is printed for each system or post-operation.
|
|
* If you specify several systems and/or post-operations then usually only the largest $`\|q\|`$ is printed. If the verbosity level is set higher than 5 then $`\|q\|`$ is printed for each system or post-operation.
|
|
* If you start GetDP within Gmsh then time, time step size and the largest [[latex($\|q\|$)]] (LTEmaxErrorRatio) can be plotted nicely.
|
|
* If you start GetDP within Gmsh then time, time step size and the largest $`\|q\|`$ (`LTEmaxErrorRatio`) can be plotted nicely.
|
|
* When TimeLoopAdaptive aborts the first time step because the minimum step size is reached and LTEmaxErrorRatio is still quite high then there is usually a jump in a quantity of interest. E.g. this is usually the case when the initial solution is not really a solution of the system or if it is not completely initialized (This can easily happen e.g. when lumped element circuits are used). You can overcome this problem by using TimeLoopTheta for just the first time step(s) and applying TimeLoopAdaptive afterwards, as shown in this example:
|
|
* When `TimeLoopAdaptive` aborts the first time step because the minimum step size is reached and `LTEmaxErrorRatio` is still quite high then there is usually a jump in a quantity of interest. E.g. this is usually the case when the initial solution is not really a solution of the system or if it is not completely initialized (This can easily happen e.g. when lumped element circuits are used). You can overcome this problem by using `TimeLoopTheta` for just the first time step(s) and applying `TimeLoopAdaptive` afterwards, as shown in this example:
|
|
|
|
|
|
{{{
|
|
```
|
|
Resolution {
|
|
Resolution {
|
|
{ Name SimTimeLoopAdaptive;
|
|
{ Name SimTimeLoopAdaptive;
|
|
System {
|
|
System {
|
... | @@ -257,16 +248,15 @@ Resolution { |
... | @@ -257,16 +248,15 @@ Resolution { |
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}}}
|
|
```
|
|
|
|
|
|
|
|
|
|
== Complete Example ==
|
|
## Complete Example
|
|
|
|
|
|
Here a complete example is given for a thermal problem. We have an object consisting of two materials. On top a uniform heat source is applied.
|
|
Here a complete example is given for a thermal problem. We have an object consisting of two materials. On top a uniform heat source is applied.
|
|
|
|
|
|
Geometry: [https://onelab.info/trac/getdp/attachment/wiki/TimeLoopAdaptive/Thermal_Sim.geo] [[BR]]
|
|
Geometry: [Thermal_Sim.geo](uploads/ee38ec1678343361776645148de2ee7a/Thermal_Sim.geo)
|
|
Problem: [https://onelab.info/trac/getdp/attachment/wiki/TimeLoopAdaptive/Thermal_Sim.pro]
|
|
|
|
|
|
|
|
[[Image(Gmsh_Simulation.JPG)]]
|
|
Problem: [Thermal_Sim.pro](uploads/5d860feb06c83655a487a5feaf76c69a/Thermal_Sim.pro)
|
|
|
|
|
|
|
|

|
|
|
|
|
|
``` |
|
|