From 3cd24e3b0f26fce53b5e775916f0e96cb23ad767 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Wed, 29 Mar 2017 10:40:31 -0300 Subject: [PATCH] =?UTF-8?q?SOURCES:=20Fix=20calculation=20of=20=CE=B7=20J?= =?UTF-8?q?=C2=B2=20term.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/sources.F90 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sources.F90 b/src/sources.F90 index 88d198f..1c13354 100644 --- a/src/sources.F90 +++ b/src/sources.F90 @@ -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