Computational Methods
Computational Methods
We compute each streamline using 4th order Runge Kutta methods. These methods compute the velocity at four nearby points and take a weighted average of them to get the velocity at the current point. The computation at each step is 4th order so
O(k^4)
accurate, where
k
is the (varying) step-size at that point.
Generally, decreasing the step-size increases the accuracy of the results, but also increases the time taken to compute a streamline. To get a balance between these, it is good to use an adaptive step-size. This means a suitable value of
k
is predicted before each step is made.
In simple terms, each step is given by k.v where k is the step-size and v is the velocity vector.
Typically, for 4th order Runge Kutta methods the maximum values of step-size k can be specified. This is useful as it directly corresponds to bounds on the accuracy of the computation O(k^4) .
In D3Plot we give maximum values of step length . This directly corresponds to the length of step k.v seen on the screen.
Example:
A
step-size
of 0.3 will give a step of length 3 where the velocity magnitude is 10, or a step of length 0.15 where the velocity magnitude is 0.5.
A
step length
of 1, will give a step of length 1 for any velocity magnitude.
Note, when the
velocity magnitude is near 0
, it can be difficult to calculate an appropriate step-size as
k = step length / velocity magnitude
.
In D3Plot, for the
and
schemes if the start point is in an area of very low velocity, the first step for the streamline can be larger than desired; for the
scheme if the streamline enters an area of very low velocity this can cause the computation to become unstable (the streamline looks like a hedgehog).
The step length parameters can be given either in units of Length or Cell Length. Where Length is the units of length in the model, and Cell Length is the size of the element the streamline is in - this allows the step length to vary when models have a finer or coarser mesh.
The four different step-size adaptation schemes available in D3Plot are detailed below. Each scheme has parameters that can be changed. See the table in
Advanced options
for a brief overview of the schemes and their parameters.
RK 45 error estimate
Whilst conducting a 4th order Runge Kutta method, the error is also estimated in comparison to a 5th order Runge Kutta method.
This scheme is considered to be computationally efficient, but the error estimate is only
O(k^5)
accurate, which may mean the same
does not give as high a quality streamline as the
scheme.
D3Plot increases the number of steps where the estimated error exceeds the
:
The step-size is
halved
if the
estimated error > Error Tolerance
.
The step-size is
doubled
if the
estimated error < 10 x Error Tolerance
.
Note, accuracy is reduced if the start point is near an area of low velocity. Either reduce the
, or move the start point.
Target stepsize
D3Plot gives steps of a fixed length given by the
.
At each stage
k = Target step length / velocity magnitude
.
Note, this scheme becomes unstable if the streamline enters an area of very low velocity.
To avoid this, either find a suitable
at which to stop the streamline, or use another adaptation scheme.
Angle between steps
D3Plot increases the number of steps where the streamline changes direction, and reduces them where the flow is parallel.
The
cos(step angle)
is given by the dot product of the current step and the previous step.
The step-size is
halved
if the the
step angle > 15 degrees
.
The step-size is
doubled
if the
step angle < 3 degree
s.
The scheme can loose accuracy if the steps are very big and there is a sudden change in velocity, to avoid this reduce
.
RK 4 eigenvalue error
The
growth factor error
for the 4th order Runge Kutta method is estimated.
The
growth factor error
is the error for any
lambda.k
where
lambda
is a real or imaginary eigenvector (i.e. factor of growth) and
k
is a (varying) step-size.
D3Plot computes
LK_max,
the maximum value of
lambda.k
such that
growth factor error < Error Tolerance
.
To compute
LK_max
for each step it estimates the largest eigenvalue. This is done by computing the velocity at 3 infinitesimally nearby points. It is this aspect of the scheme which is time consuming.
A suitable
k
is chosen so at this time step
k.v < k.lambda < LK_max
.
Note:
Generally, it is more efficient to use a bigger
. However, if this is too large (over approximately 5 cell units), it takes longer for a scheme to locate which element the next point is contained in, than the time it saves in using fewer steps.