Skip to content

Commit 9ece12b

Browse files
committed
variable renaming, added to outputlist
1 parent 5502bb3 commit 9ece12b

File tree

6 files changed

+23
-31
lines changed

6 files changed

+23
-31
lines changed

src/bnorml.f90

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
8585

8686
use fileunits, only : ounit, lunit
8787

88-
use inputlist, only : Wmacros, Wbnorml, Igeometry, Lcheck, vcasingtol, vcasingper, Lrad, lgridvcasing
88+
use inputlist, only : Wmacros, Wbnorml, Igeometry, Lcheck, vcasingtol, vcasingper, Lrad, Lvcgrid
8989

9090
use cputiming, only : Tbnorml
9191

@@ -99,7 +99,7 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
9999
Nt, Nz, cfmn, sfmn, &
100100
ijreal, ijimag, jireal, jiimag, &
101101
globaljk, virtualcasingfactor, gteta, gzeta, Dxyz, Nxyz, &
102-
Jxyz, Pbxyz, vcNtz
102+
Jxyz, Pbxyz
103103

104104
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
105105

@@ -114,6 +114,7 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
114114
REAL :: accuracyestimate, resulth, resulth2, resulth4, deltah4h2, deltah2h
115115
INTEGER :: vcstep
116116

117+
117118
BEGIN(bnorml)
118119

119120
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
@@ -144,14 +145,14 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
144145
! When comparing results, both methods should always run
145146
if (.true.) then
146147
#else
147-
if ( lgridvcasing.eq.1 ) then
148+
if ( Lvcgrid.eq.1 ) then
148149
#endif
149150
! Precompute Jxyz(1:Ntz,1:3) and the corresponding positions on the high resolution plasma boundary
150151

151-
!$OMP PARALLEL DO SHARED(Pbxyz, Jxyz) PRIVATE(jk, teta, zeta)
152+
!$OMP PARALLEL DO SHARED(Pbxyz, Jxyz) PRIVATE(jk, teta, zeta) COLLAPSE(2)
152153
do kk = 0, vcNz-1 ;
153-
zeta = kk * pi2nfp / vcNz
154154
do jj = 0, vcNt-1 ;
155+
zeta = kk * pi2nfp / vcNz
155156
teta = jj * pi2 / vcNt ;
156157
jk = 1 + jj + kk*vcNt
157158

@@ -164,10 +165,10 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
164165
do vcstep = 3, 0, -1
165166
!$OMP PARALLEL DO SHARED(Dxyz, Pbxyz, Jxyz, ijimag) PRIVATE(jk, gBn)
166167
do jk = 1, Ntz
167-
call casing2( Dxyz(:,jk), Nxyz(:,jk), Pbxyz(1:vcNtz, 1:3), Jxyz(1:vcNtz, 1:3), 2**vcstep, gBn)
168+
call casing2( Dxyz(:,jk), Nxyz(:,jk), Pbxyz, Jxyz, 2**vcstep, gBn)
168169

169-
ijreal(jk) = ijimag(jk)
170-
ijimag(jk) = gBn
170+
ijreal(jk) = ijimag(jk) ! previous solution (lower resolution)
171+
ijimag(jk) = gBn ! current solution (higher resolution)
171172

172173
enddo
173174
deltah4h2 = deltah2h
@@ -188,7 +189,7 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
188189
! When comparing results, both methods should always run
189190
if (.true.) then
190191
#else
191-
else ! if not lgridvcasing
192+
else ! if not Lvcgrid
192193
#endif
193194

194195
do kk = 0, Nz-1 ;
@@ -219,7 +220,7 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
219220

220221
enddo ! end of do jj;
221222
enddo ! end of do kk;
222-
endif ! end of if (lgridvcasing )
223+
endif ! end of if (Lvcgrid )
223224
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
224225

225226
1001 format("bnorml : ", 10x ," : "a1" : (t,z) = ("f8.4","f8.4" ) ; gBn=",f23.15," ; ":" error =",f23.15" ;")
@@ -241,11 +242,6 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
241242
case( 0 ) ! Lparallel = 0 ; 09 Mar 17;
242243

243244
RlBCAST(ijreal(1+kk*Nt:Nt+kk*Nt),Nt,kkmodnp) ! plasma; 03 Apr 13;
244-
!RlBCAST(ijimag(1+kk*Nt:Nt+kk*Nt),Nt,kkmodnp)
245-
246-
!RlBCAST(jireal(1+kk*Nt:Nt+kk*Nt),Nt,kkmodnp)
247-
!RlBCAST(jiimag(1+kk*Nt:Nt+kk*Nt),Nt,kkmodnp)
248-
249245
case( 1 ) ! Lparallel = 1 ; 09 Mar 17;
250246

251247
do jj = 0, Nt-1
@@ -255,10 +251,6 @@ subroutine bnorml( mn, Ntz, efmn, ofmn )
255251
jkmodnp = modulo(jk-1,ncpu)
256252

257253
RlBCAST(ijreal(jk),1,jkmodnp) ! plasma; 03 Apr 13;
258-
!RlBCAST(ijimag(jk),1,jkmodnp)
259-
260-
!RlBCAST(jireal(jk),1,jkmodnp)
261-
!RlBCAST(jiimag(jk),1,jkmodnp)
262254

263255
enddo
264256

src/casing.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,13 @@ subroutine casing2( xyz, nxyz, Pbxyz, Jxyz, vcstep,gBn)
230230

231231
use inputlist, only : vcasingeps, vcNz, vcNt
232232

233-
use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC, vcNtz !, Pbxyz, Jxyz
233+
use allglobal, only : myid, ncpu, cpus, MPI_COMM_SPEC !, Pbxyz, Jxyz
234234

235235
LOCALS
236236

237237
REAL, intent(in) :: xyz(3) ! arbitrary location; Cartesian;
238238
REAL, intent(in) :: nxyz(3) ! surface normal on the computational boundary; Cartesian;
239-
REAL, intent(in) :: Pbxyz(1:vcNtz, 1:3), Jxyz(1:vcNtz, 1:3)
239+
REAL, intent(in) :: Pbxyz(1:vcNz*vcNt, 1:3), Jxyz(1:vcNz*vcNt, 1:3)
240240
INTEGER, intent(in) :: vcstep
241241
REAL, intent(out) :: gBn ! B.n on the computational boundary;
242242

@@ -245,7 +245,7 @@ subroutine casing2( xyz, nxyz, Pbxyz, Jxyz, vcstep,gBn)
245245

246246
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
247247
! plasmaNtz = SIZE(Pbxyz, 1)
248-
plasmaNtz = vcNtz
248+
plasmaNtz = vcNz*vcNt
249249
! loop over the high resolution plasma boundary (inner boundary for virtual casing)
250250
do jk = 1, plasmaNtz, vcstep ;
251251
! position on computational boundary - position on plasma boundary

src/global.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,6 @@ module allglobal
844844
INTEGER :: IBerror !< for computing error in magnetic field
845845

846846
INTEGER :: nfreeboundaryiterations !< number of free-boundary iterations already performed
847-
848-
INTEGER :: vcNtz !< number of grid points in \f$\theta\f$ and \f$\zeta\f$ for the plasma surface current computation
849847
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
850848

851849
INTEGER, parameter :: Node = 2 !< best to make this global for consistency between calling and called routines

src/inputlist.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ module inputlist
315315
!< </ul>
316316
INTEGER :: Ntoraxis = 3 !< the number of \f$n\f$ harmonics used in the Jacobian \f$m=1\f$ harmonic elimination method;
317317
!< only relevant if \c Lrzaxis.ge.1 .
318-
INTEGER :: Lgridvcasing = 0 !< Which method to use for the virtual casing integral. 0 = adaptive integration routine with guaranteed accuracy, 1 = fixed resolution grid
318+
INTEGER :: Lvcgrid = 0 !< Which method to use for the virtual casing integral. 0 = adaptive integration routine with guaranteed accuracy, 1 = fixed resolution grid
319319
!> @}
320320

321321
!> \addtogroup grp_global_local locallist
@@ -679,7 +679,7 @@ module inputlist
679679
Mregular ,&
680680
Lrzaxis ,&
681681
Ntoraxis ,&
682-
Lgridvcasing
682+
Lvcgrid
683683

684684
namelist/locallist/&
685685
LBeltrami ,&
@@ -895,7 +895,7 @@ subroutine initialize_inputs
895895
Mregular = -1
896896
Lrzaxis = 1
897897
Ntoraxis = 3
898-
Lgridvcasing = 0
898+
Lvcgrid = 0
899899

900900
! locallist
901901

src/preset.f90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,17 +1723,16 @@ subroutine preset
17231723

17241724
!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!-!
17251725
if (Lfreebound > 0) then ! Only do for free-boundary; 7 Nov 18;
1726-
if (Lgridvcasing .eq. 1) then
1726+
if (Lvcgrid .eq. 1) then
17271727
if ( vcNt.lt.Nt ) then
17281728
FATAL( bnorml, .true., The plasma boundary resolution for virtual casing vcNt must be greater than or equal to Nt )
17291729
endif
17301730
if ( vcNz.lt.Nz ) then
17311731
FATAL( bnorml, .true., The plasma boundary resolution for virtual casing vcNz must be greater than or equal to Nz )
17321732
endif
17331733

1734-
vcNtz = vcNt*vcNz ! the plasma boundary has to use a higher resolution than the computational boundary
1735-
SALLOCATE( Jxyz, (1:vcNtz,1:3), zero ) ! Cartesian components of virtual casing surface current; needs to be recalculated at each iteration;
1736-
SALLOCATE( Pbxyz, (1:vcNtz,1:3), zero ) ! Cartesian points on the plasma boundary; needs to be recalculated at each iteration;
1734+
SALLOCATE( Jxyz, (1:vcNt*vcNz,1:3), zero ) ! Cartesian components of virtual casing surface current; needs to be recalculated at each iteration;
1735+
SALLOCATE( Pbxyz, (1:vcNt*vcNz,1:3), zero ) ! Cartesian points on the plasma boundary; needs to be recalculated at each iteration;
17371736
endif
17381737

17391738
SALLOCATE( Dxyz, (1:3,1:Ntz), zero ) ! Cartesian components of computational boundary; position; 14 Apr 17;

src/sphdf5.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ subroutine mirror_input_to_outfile
294294
HWRITEIV( grpInputNumerics, 1, Mregular , (/ Mregular /))
295295
HWRITEIV( grpInputNumerics, 1, Lrzaxis , (/ Lrzaxis /))
296296
HWRITEIV( grpInputNumerics, 1, Ntoraxis , (/ Ntoraxis /))
297+
HWRITEIV( grpInputNumerics, 1, Lvcgrid , (/ Lvcgrid /))
297298

298299
HCLOSEGRP( grpInputNumerics, __FILE__, __LINE__)
299300

@@ -344,6 +345,8 @@ subroutine mirror_input_to_outfile
344345
HWRITEIV( grpInputGlobal, 1, vcasingits , (/ vcasingits /))
345346
HWRITEIV( grpInputGlobal, 1, vcasingper , (/ vcasingper /))
346347
HWRITEIV( grpInputGlobal, 1, mcasingcal , (/ mcasingcal /)) ! redundant;
348+
HWRITEIV( grpInputGlobal, 1, vcnt , (/ vcnt /))
349+
HWRITEIV( grpInputGlobal, 1, vcnz , (/ vcnz /))
347350

348351
HCLOSEGRP( grpInputGlobal )
349352

0 commit comments

Comments
 (0)