FORCING: Make injected energy update atomic.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
3013d57f9f
commit
bca8681d96
@ -1582,12 +1582,13 @@ module forcing
|
|||||||
real(kind=8), dimension(nn):: zk, kz, snkz, cskz
|
real(kind=8), dimension(nn):: zk, kz, snkz, cskz
|
||||||
#endif /* NDIMS == 3 */
|
#endif /* NDIMS == 3 */
|
||||||
|
|
||||||
|
real(kind=8), save :: deinj
|
||||||
real(kind=8), dimension(:,:,:,:), pointer, save :: acc
|
real(kind=8), dimension(:,:,:,:), pointer, save :: acc
|
||||||
real(kind=8), dimension(:,:,:) , pointer, save :: den
|
real(kind=8), dimension(:,:,:) , pointer, save :: den
|
||||||
|
|
||||||
integer, save :: nt
|
integer, save :: nt
|
||||||
!$ integer :: omp_get_thread_num
|
!$ integer :: omp_get_thread_num
|
||||||
!$omp threadprivate(first, nt, acc, den)
|
!$omp threadprivate(first, nt, acc, den, deinj)
|
||||||
|
|
||||||
character(len=*), parameter :: loc = 'FORCING:inject_fmodes_block()'
|
character(len=*), parameter :: loc = 'FORCING:inject_fmodes_block()'
|
||||||
|
|
||||||
@ -1750,10 +1751,12 @@ module forcing
|
|||||||
! calculate the injected energy
|
! calculate the injected energy
|
||||||
!
|
!
|
||||||
#if NDIMS == 3
|
#if NDIMS == 3
|
||||||
einj = einj + sum(den(nb:ne,nb:ne,nb:ne)) * dvol
|
deinj = sum(den(nb:ne,nb:ne,nb:ne)) * dvol
|
||||||
#else /* NDIMS == 3 */
|
#else /* NDIMS == 3 */
|
||||||
einj = einj + sum(den(nb:ne,nb:ne, 1 )) * dvol
|
deinj = sum(den(nb:ne,nb:ne, 1 )) * dvol
|
||||||
#endif /* NDIMS == 3 */
|
#endif /* NDIMS == 3 */
|
||||||
|
!$omp atomic update
|
||||||
|
einj = einj + deinj
|
||||||
|
|
||||||
! add the energy increment
|
! add the energy increment
|
||||||
!
|
!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user