INTEGRALS: Slightly optimize calculation of reconnection rate.
Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
ffb1a2b6c8
commit
015ef41111
@ -853,37 +853,33 @@ module integrals
|
||||
! mean Bx at boundary
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(12) = inarr(12) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nb,nb:ne))) * dxz
|
||||
inarr(12) = inarr(12) + sum(abs(pdata%q(ibx,nb:ne,nb,nb:ne))) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(12) = inarr(12) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nb, : ))) * dxz
|
||||
inarr(12) = inarr(12) + sum(abs(pdata%q(ibx,nb:ne,nb, : ))) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! advection of Bx along Y
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(13) = inarr(13) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nbl:nb,nb:ne)) &
|
||||
* pdata%q(ivy,nb:ne,nbl:nb,nb:ne)) * dxz
|
||||
inarr(13) = inarr(13) + sum(abs(pdata%q(ibx,nb:ne,nbl:nb,nb:ne)) &
|
||||
* pdata%q(ivy,nb:ne,nbl:nb,nb:ne)) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(13) = inarr(13) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nbl:nb, : )) &
|
||||
* pdata%q(ivy,nb:ne,nbl:nb, : )) * dxz
|
||||
inarr(13) = inarr(13) + sum(abs(pdata%q(ibx,nb:ne,nbl:nb, : )) &
|
||||
* pdata%q(ivy,nb:ne,nbl:nb, : )) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! shear of By along X
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(14) = inarr(14) &
|
||||
- 0.5d+00 * sum(sign(pdata%q(iby,nb:ne,nbl:nb,nb:ne) &
|
||||
* pdata%q(ivx,nb:ne,nbl:nb,nb:ne), &
|
||||
pdata%q(ibx,nb:ne,nbl:nb,nb:ne))) * dxz
|
||||
- sum(sign(pdata%q(iby,nb:ne,nbl:nb,nb:ne) &
|
||||
* pdata%q(ivx,nb:ne,nbl:nb,nb:ne), &
|
||||
pdata%q(ibx,nb:ne,nbl:nb,nb:ne))) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(14) = inarr(14) &
|
||||
- 0.5d+00 * sum(sign(pdata%q(iby,nb:ne,nbl:nb, : ) &
|
||||
* pdata%q(ivx,nb:ne,nbl:nb, : ), &
|
||||
pdata%q(ibx,nb:ne,nbl:nb, : ))) * dxz
|
||||
- sum(sign(pdata%q(iby,nb:ne,nbl:nb, : ) &
|
||||
* pdata%q(ivx,nb:ne,nbl:nb, : ), &
|
||||
pdata%q(ibx,nb:ne,nbl:nb, : ))) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! mean magnetic energy at the lower Y boundary
|
||||
@ -933,8 +929,8 @@ module integrals
|
||||
- 0.5d+00 * (pdata%q(iby,nb:ne,nb ,nbu:neu) &
|
||||
- pdata%q(iby,nb:ne,nb ,nbl:nel)) / dh(3)
|
||||
|
||||
inarr(15) = inarr(15) - resistivity * sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,nb,nb:ne))) * dxz
|
||||
inarr(15) = inarr(15) - sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,nb,nb:ne))) * dxz
|
||||
|
||||
! diffusion of magnetic energy through the lower Y boundary
|
||||
!
|
||||
@ -954,8 +950,8 @@ module integrals
|
||||
tmp(:,2,:) = (pdata%q(ibz,nb:ne,nb , : ) &
|
||||
- pdata%q(ibz,nb:ne,nbl, : )) / dh(2)
|
||||
|
||||
inarr(15) = inarr(15) - resistivity * sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,nb , : ))) * dxz
|
||||
inarr(15) = inarr(15) - sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,nb , : ))) * dxz
|
||||
|
||||
! diffusion of magnetic energy through the lower Y boundary
|
||||
!
|
||||
@ -975,37 +971,33 @@ module integrals
|
||||
! mean Bx at boundary
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(12) = inarr(12) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,ne,nb:ne))) * dxz
|
||||
inarr(12) = inarr(12) + sum(abs(pdata%q(ibx,nb:ne,ne,nb:ne))) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(12) = inarr(12) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,ne, : ))) * dxz
|
||||
inarr(12) = inarr(12) + sum(abs(pdata%q(ibx,nb:ne,ne, : ))) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! advection of Bx along Y
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(13) = inarr(13) &
|
||||
- 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,ne:neu,nb:ne)) &
|
||||
* pdata%q(ivy,nb:ne,ne:neu,nb:ne)) * dxz
|
||||
inarr(13) = inarr(13) - sum(abs(pdata%q(ibx,nb:ne,ne:neu,nb:ne)) &
|
||||
* pdata%q(ivy,nb:ne,ne:neu,nb:ne)) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(13) = inarr(13) &
|
||||
- 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,ne:neu, : )) &
|
||||
* pdata%q(ivy,nb:ne,ne:neu, : )) * dxz
|
||||
inarr(13) = inarr(13) - sum(abs(pdata%q(ibx,nb:ne,ne:neu, : )) &
|
||||
* pdata%q(ivy,nb:ne,ne:neu, : )) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! shear of By along X
|
||||
!
|
||||
#if NDIMS == 3
|
||||
inarr(14) = inarr(14) &
|
||||
+ 0.5d+00 * sum(sign(pdata%q(iby,nb:ne,ne:neu,nb:ne) &
|
||||
* pdata%q(ivx,nb:ne,ne:neu,nb:ne), &
|
||||
pdata%q(ibx,nb:ne,ne:neu,nb:ne))) * dxz
|
||||
+ sum(sign(pdata%q(iby,nb:ne,ne:neu,nb:ne) &
|
||||
* pdata%q(ivx,nb:ne,ne:neu,nb:ne), &
|
||||
pdata%q(ibx,nb:ne,ne:neu,nb:ne))) * dxz
|
||||
#else /* NDIMS == 3 */
|
||||
inarr(14) = inarr(14) &
|
||||
+ 0.5d+00 * sum(sign(pdata%q(iby,nb:ne,ne:neu, : ) &
|
||||
* pdata%q(ivx,nb:ne,ne:neu, : ), &
|
||||
pdata%q(ibx,nb:ne,ne:neu, : ))) * dxz
|
||||
+ sum(sign(pdata%q(iby,nb:ne,ne:neu, : ) &
|
||||
* pdata%q(ivx,nb:ne,ne:neu, : ), &
|
||||
pdata%q(ibx,nb:ne,ne:neu, : ))) * dxz
|
||||
#endif /* NDIMS == 3 */
|
||||
|
||||
! mean magnetic energy at the upper Y boundary
|
||||
@ -1055,8 +1047,8 @@ module integrals
|
||||
- 0.5d+00 * (pdata%q(ibz,nbu:neu,ne,nb :ne ) &
|
||||
- pdata%q(ibz,nbl:nel,ne,nb :ne )) / dh(1)
|
||||
|
||||
inarr(15) = inarr(15) + resistivity * sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,ne,nb:ne))) * dxz
|
||||
inarr(15) = inarr(15) + sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,ne,nb:ne))) * dxz
|
||||
|
||||
! diffusion of magnetic energy through the upper Y boundary
|
||||
!
|
||||
@ -1076,8 +1068,8 @@ module integrals
|
||||
tmp(:,2,:) = 0.5d+00 * (pdata%q(ibz,nbl:nel,ne, : ) &
|
||||
- pdata%q(ibz,nbu:neu,ne, : )) / dh(1)
|
||||
|
||||
inarr(15) = inarr(15) + resistivity * sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,ne, : ))) * dxz
|
||||
inarr(15) = inarr(15) + sum(sign(tmp(:,1,:), &
|
||||
pdata%q(ibx,nb:ne,ne, : ))) * dxz
|
||||
|
||||
! diffusion of magnetic energy through the upper Y boundary
|
||||
!
|
||||
@ -1101,16 +1093,14 @@ module integrals
|
||||
|
||||
! advection of Bx along Z
|
||||
!
|
||||
inarr(16) = inarr(16) &
|
||||
+ 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nb:ne,nbl:nb)) &
|
||||
inarr(16) = inarr(16) + sum(abs(pdata%q(ibx,nb:ne,nb:ne,nbl:nb)) &
|
||||
* pdata%q(ivz,nb:ne,nb:ne,nbl:nb)) * dxy
|
||||
|
||||
! shear of Bz along X
|
||||
!
|
||||
inarr(17) = inarr(17) &
|
||||
- 0.5d+00 * sum(sign(pdata%q(ibz,nb:ne,nb:ne,nbl:nb) &
|
||||
* pdata%q(ivx,nb:ne,nb:ne,nbl:nb), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,nbl:nb))) * dxy
|
||||
inarr(17) = inarr(17) - sum(sign(pdata%q(ibz,nb:ne,nb:ne,nbl:nb) &
|
||||
* pdata%q(ivx,nb:ne,nb:ne,nbl:nb), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,nbl:nb))) * dxy
|
||||
|
||||
! advection of magnetic energy through the lower Z boundary
|
||||
!
|
||||
@ -1139,8 +1129,8 @@ module integrals
|
||||
- 0.5d+00 * (pdata%q(ibz,nbu:neu,nb:ne,nb ) &
|
||||
- pdata%q(ibz,nbl:nel,nb:ne,nb )) / dh(1)
|
||||
|
||||
inarr(18) = inarr(18) - resistivity * sum(sign(tmp(:,:,2), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,nb))) * dxy
|
||||
inarr(18) = inarr(18) - sum(sign(tmp(:,:,2), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,nb))) * dxy
|
||||
|
||||
! diffusion of magnetic energy through the lower Z boundary
|
||||
!
|
||||
@ -1158,16 +1148,14 @@ module integrals
|
||||
|
||||
! advection of Bx along Z
|
||||
!
|
||||
inarr(16) = inarr(16) &
|
||||
- 0.5d+00 * sum(abs(pdata%q(ibx,nb:ne,nb:ne,ne:neu)) &
|
||||
inarr(16) = inarr(16) - sum(abs(pdata%q(ibx,nb:ne,nb:ne,ne:neu)) &
|
||||
* pdata%q(ivz,nb:ne,nb:ne,ne:neu)) * dxy
|
||||
|
||||
! shear of Bz along X
|
||||
!
|
||||
inarr(17) = inarr(17) &
|
||||
+ 0.5d+00 * sum(sign(pdata%q(ibz,nb:ne,nb:ne,ne:neu) &
|
||||
* pdata%q(ivx,nb:ne,nb:ne,ne:neu), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,ne:neu))) * dxy
|
||||
inarr(17) = inarr(17) + sum(sign(pdata%q(ibz,nb:ne,nb:ne,ne:neu) &
|
||||
* pdata%q(ivx,nb:ne,nb:ne,ne:neu), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,ne:neu))) * dxy
|
||||
|
||||
! advection of magnetic energy through the upper Z boundary
|
||||
!
|
||||
@ -1196,8 +1184,8 @@ module integrals
|
||||
- 0.5d+00 * (pdata%q(ibz,nbu:neu,nb:ne,ne ) &
|
||||
- pdata%q(ibz,nbl:nel,nb:ne,ne )) / dh(1)
|
||||
|
||||
inarr(18) = inarr(18) + resistivity * sum(sign(tmp(:,:,1), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,ne))) * dxy
|
||||
inarr(18) = inarr(18) + sum(sign(tmp(:,:,1), &
|
||||
pdata%q(ibx,nb:ne,nb:ne,ne))) * dxy
|
||||
|
||||
! diffusion of magnetic energy through the upper Z boundary
|
||||
!
|
||||
@ -1259,7 +1247,11 @@ module integrals
|
||||
|
||||
! apply factors to the reconnection rate terms
|
||||
!
|
||||
inarr(12) = inarr(12) / yarea
|
||||
inarr(12) = 5.0d-01 * inarr(12) / yarea
|
||||
inarr(13:14) = 5.0d-01 * inarr(13:14)
|
||||
inarr(15) = resistivity * inarr(15)
|
||||
inarr(16:17) = 5.0d-01 * inarr(16:17)
|
||||
inarr(18) = resistivity * inarr(18)
|
||||
inarr(22) = 2.5d-01 * inarr(22) / yarea
|
||||
inarr(23:25) = 5.0d-01 * inarr(23:25)
|
||||
inarr(26:28) = resistivity * inarr(26:28)
|
||||
|
Loading…
x
Reference in New Issue
Block a user