179 Commits

Author SHA1 Message Date
94ecb53bc4 EVOLUTION: Do not increase CFL coefficient in some SSPRK methods.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2024-07-10 20:54:55 -03:00
b37f8997ea EVOLUTION: Introduce limiter for timestep jump.
To prevent solution instability caused by sudden increases in the
timestep, such as when the maximum refinement level decreases, a new
parameter 'dt_jump_factor' has been introduced. This parameter controls
the allowable increase in the timestep.

By default, 'dt_jump_factor' is set to 1.05, permitting a maximum
increase of 5% from the previous timestep.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2024-07-01 20:06:24 -03:00
2496b8f8cc EVOLUTION: Prevent overflow in initial time step estimation
Ensure tolerance calculation uses already normalized variables to avoid
potential overflow.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2024-06-03 22:20:43 -03:00
6d20a66b8b EVOLUTION: Ensure stable initial time step for embedded methods
Restricted initial time steps to values smaller than the CFL time step
to ensure numerical stability. This prevents instability issues that
may arise from excessively large initial steps.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2024-06-01 23:36:28 -03:00
e76e875004 Update the copyright year to 2024.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2024-03-07 09:34:43 -03:00
659449669b EVOLUTION: Fix wrong import in update_errors_lmax().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-12-28 11:52:22 -03:00
60d13dff6c EVOLUTION: Update subroutine to calculate errors using Lmax-norm.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-12-28 11:14:34 -03:00
213879c9c4 EVOLUTION: Update subroutine to calculate errors using L2-norm.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-12-28 10:56:11 -03:00
de49eeedaa EVOLUTION: Add subroutine to calculate errors using the L1-norm.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-12-28 10:49:24 -03:00
7c292e7095 EVOLUTION: Fix possible overflow in update_errors_l2().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-12-26 22:20:24 -03:00
5333ebdf37 EVOLUTION: 3S*+ RK methods do not have extended CFL coefficients.
The methods by Ranocha et al. (2021) are error-controlled embedded RK
methods, therefore the CFL value should be set explicitely for these
methods.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-09-01 16:36:36 -03:00
62017bc5b3 EVOLUTION: Improve the conservation in SSPRK(10,4) method.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-30 17:37:09 -03:00
26022c4ce0 EVOLUTION, FORCING: Add injected flag to update_forcing().
This flag indicates whether the energy injection was performed. If not,
there is no need for the variable update.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-29 17:43:03 -03:00
55b13fb895 EVOLUTION: Add missing variable update after adding turbulence forcing.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-29 17:09:48 -03:00
48f6618121 Revert "EVOLUTION: Update all blocks after the mesh update."
This reverts commit 8b36ce58e18bdc5af35c03571e77c5566efb2ae0.
2023-08-29 17:06:15 -03:00
dfe7310408 EVOLUTION: Improve the conservation in the SSPRK3 and SSPRK(4,3) methods.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-29 10:43:42 -03:00
8b36ce58e1 EVOLUTION: Update all blocks after the mesh update.
It seems that the selective block update, i.e., update of the blocks
which have been (de)refined only, is not perfect. It violates the
numerical conservation somehow, and requires more investigation.

In order to fix this, perform the update of all data blocks, no matter
if they were refined or not. This makes some blocks to be updated twice,
but resolves the problem of variable conservation.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-29 10:15:08 -03:00
39c3cdf7a4 EVOLUTION: Improve the conservation in the SSPRK3(2)4 method.
The 4th step produced errors large enought to give significant
conservation errors.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-08-28 17:53:59 -03:00
7deb0d369d EVOLUTION: Make shape update more consistent.
For of all, update_shape now works with the conservative variables.

It is called in three points:
1) Just after the integration update or when the block were (de)refined.
2) Afted the boundary update.
3) If the unphysical cell correction is on, it is applied to blocks
   which contain unphysical cells after they are corrected.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-05-31 18:16:59 -03:00
31e13b43b8 EVOLUTION: Introduce "dt_safe_factor".
In the case of embedded integration method, the time step resulting from
the error could drop to very small values. In such situation, the next
time step is taken to a maximum value between the time step due to error
and the stability time step multiplied by the safe factor. By default
this factor is set to 0.01.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-05-17 15:32:29 -03:00
99d5196736 FORCING: Allow to specify the period of turbulence injection.
The period is controlled by two parameters:

'injection_time_start' - the beginning of the injection period,
'injection_time_stop'  - the end of the injection period.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-02-27 10:04:06 -03:00
81de98d9e2 Update the copyright year to 2023.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2023-02-01 18:36:37 -03:00
0a20337054 EVOLUTION: Remove debug check for NaNs.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-11-25 18:16:02 -03:00
8e4bd1712d EVOLUTION: Change safety factor to 0.91.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-06-11 00:22:56 -03:00
4af6e99ca8 EVOLUTION: Do not repeat if tolerance reached in embedded methods.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-06-09 18:04:53 -03:00
aa99145260 EQUATIONS: Print the location of unphysical cell.
Also slightly rewrite and simplify the arguments of
correct_unphysical_states().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-05-26 22:21:02 -03:00
2696d5dffb EVOLUTION: Rewrite the handling of unimplemented methods.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-05-24 19:20:57 -03:00
fbc04e4996 EVOLUTION: Mark updated blocks as physical in update_variables().
Otherwise, these blocks are considered as non-physical if the
fix_unphysical_cells is on.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-19 15:40:26 -03:00
95d117cd1a EVOLUTION: Quit update_variables() in case of problems.
The possible failure could take place in the boundary update or
conversion to the conservative variables. In case of a failure, jump
directly to the end part of subroutine in which the %boundary flag is
cleared.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-19 13:39:58 -03:00
a4890bb240 EQUATIONS: Rewrite slightly correct_unphysical_states().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-19 13:34:31 -03:00
571e352e5b EVOLUTION: Remove unused variable from check_variables().
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-19 13:12:30 -03:00
9aa74d2343 EVOLUTION: Rewrite update_variables().
After the boundary update, all respective blocks modified by the mesh or
boundary update are required to update their primitive variables. If a
data block contains a non-physical cell, it is corrected by
correct_unphysical_states(), if fix_unphysical_cells is switched on.
As the last steps, the shapes are updated if they are switched on.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-19 13:07:17 -03:00
a3a140b572 BLOCKS, BOUNDARIES, EVOLUTION: Fix block variable update.
When the block has been (de)refined, its field %update is set in order
to update its primitive variables. However, the block which are
neighbors of the (de)refined blocks, since their boundaries are updated
too, were not selected for the primitive variable update.

Fix this by adding a new meta block field %boundary, which indicates
that a block boundary has been updated, and update the corresponding
data block primitive variables either if the %update or %boundary flags
are set.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-11 22:37:46 -03:00
6ba8d5d34f SOURCES: Reduce the number of arguments to update_sources().
Pointer pdata already has a reference to the increment array dU(), so
remove the redundant argument du.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-09 16:25:07 -03:00
eea8c036b4 EVOLUTION: It is sufficient to update primitive variables once.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-08 18:33:18 -03:00
f510a2ec15 EVOLUTION: Call variable conversion after the boundary update.
The variable conversion is done for the whole blocks, including ghost
zones.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-04 16:40:20 -03:00
9e327d76ca EQUATIONS: Add option ghosts to update_primitive_variables().
This is a logical flag controling if the conversion should be done for
the whole block, including the ghost zones, or just the interior part.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-04 16:36:50 -03:00
4634081ca9 BOUNDARIES: Rewrite boundary_fluxes().
Slighly change the shape of block fluxes. Also add status flag to this
subroutine.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-02 16:39:51 -03:00
9829505650 Update copyright year to 2022.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-02-02 09:51:41 -03:00
124ad01eca EVOLUTION: Fix time step estimation with OpenMP.
The variable um should be also thread private in initialize_time_step()
and new_time_step().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-01-09 17:24:56 -03:00
a634d9bed5 VARIOUS: Make thread number thread private.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-01-08 11:52:16 -03:00
c56daa6991 EVOLUTION: Make variable initialization OpenMP conformant.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-01-08 11:12:15 -03:00
9b5198a5ff EQUATIONS, EVOLUTION: Rework get_maximum_speeds().
There is no need for the maximum characteristic speed. The divergence
correcting speed cglm is calculated using the maximum eigenvalue and
physical velocity.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-01-07 15:38:54 -03:00
c32e4adcde EVOLUTION: Use get_maximum_speeds() in the time step estimation.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2022-01-06 22:48:35 -03:00
27fd2fb6e1 EVOLUTION: Improve the initial time step estimation.
First of all, the estimation is of the third order, so use the cubic
square in the calculation of h1. Secondly, fix the normalization factor
fnorm. Finally, use only the variables corresponding to the fluxes in
the increment norms sc(..) and df(..).

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-16 09:18:32 -03:00
df9b301734 EVOLUTION: Restore the initial state in initialize_time_step().
The estimation of the initial time step requires the advance of the
system by one step. This, however, alters the primitive variables of
data blocks. Restore the primitive variables to the initial state, once
the initial time step has been estimated, in order to solve this
inconsistency.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-15 09:11:49 -03:00
76695febbd EVOLUTION: Reorganize integration method selection.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-15 08:47:23 -03:00
5d8c6d994d EVOLUTION: Produce the same initial time step for OpenMP on and off.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-10 13:16:26 -03:00
c54539a379 EVOLUTION: Parallelize initialize_time_step() using OpenMP.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-10 09:44:02 -03:00
21cbecef26 EVOLUTION: Remove unused variables.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
2021-12-09 22:07:36 -03:00