SOURCES: Fix calculation of η J² term.

In the sum of the J² we used Fortran subroutine sum() and the sum was
done along the 2nd index. However, the interpretation of this index is
uncertain when the first array rank is 1.

Therefore, instead of using subroutine sum(), the calculation is done
directly.

After this change there are no strange effects appearing on the
boundaries of the blocks.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2017-03-29 10:40:31 -03:00
parent aad62c9c51
commit 3cd24e3b0f

View File

@ -582,11 +582,17 @@ module sources
call curl(dh(:), pdata%q(ibx:ibz,1:im,1:jm,1:km) &
, tmp(inz,inx:inz,1:im,1:jm,1:km))
! calculate J²
!
db(1:im,1:jm,1:km) = tmp(inz,inx,1:im,1:jm,1:km)**2 &
+ tmp(inz,iny,1:im,1:jm,1:km)**2 &
+ tmp(inz,inz,1:im,1:jm,1:km)**2
! add the second resistive source term to the energy equation, i.e.
! d/dt E + .F = η J²
!
du(ien,1:im,1:jm,1:km) = du(ien,1:im,1:jm,1:km) &
+ resistivity * sum(tmp(inz,inx:inz,1:im,1:jm,1:km)**2, 2)
+ resistivity * db(1:im,1:jm,1:km)
end if ! energy equation present