Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gyacomo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Cyril David Hoffmann
Gyacomo
Commits
5636a3ee
Commit
5636a3ee
authored
2 years ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
explicit modules requirement writing and bug in checkfield
parent
c082a7a6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/stepon.F90
+35
-19
35 additions, 19 deletions
src/stepon.F90
src/utility_mod.F90
+13
-18
13 additions, 18 deletions
src/utility_mod.F90
with
48 additions
and
37 deletions
src/stepon.F90
+
35
−
19
View file @
5636a3ee
SUBROUTINE
stepon
SUBROUTINE
stepon
! Advance one time step, (num_step=4 for Runge Kutta 4 scheme)
! Advance one time step, (num_step=4 for Runge Kutta 4 scheme)
USE
advance_field_routine
,
ONLY
:
advance_time_level
,
advance_field
,
advance_moments
USE
advance_field_routine
,
ONLY
:
advance_time_level
,
advance_moments
USE
basic
USE
basic
,
ONLY
:
nlend
,
ierr
USE
closure
USE
closure
,
ONLY
:
apply_closure_model
USE
ghosts
,
ONLY
:
update_ghosts_moments
,
update_ghosts_EM
USE
ghosts
,
ONLY
:
update_ghosts_moments
,
update_ghosts_EM
USE
grid
use
mpi
,
ONLY
:
MPI_COMM_WORLD
USE
model
,
ONLY
:
LINEARITY
,
KIN_E
USE
time_integration
,
ONLY
:
ntimelevel
use
prec_const
USE
time_integration
USE
utility
,
ONLY
:
checkfield
IMPLICIT
NONE
IMPLICIT
NONE
INTEGER
::
num_step
INTEGER
::
num_step
...
@@ -64,8 +61,16 @@ SUBROUTINE stepon
...
@@ -64,8 +61,16 @@ SUBROUTINE stepon
END
SUBROUTINE
assemble_RHS
END
SUBROUTINE
assemble_RHS
SUBROUTINE
checkfield_all
! Check all the fields for inf or nan
SUBROUTINE
checkfield_all
! Check all the fields for inf or nan
USE
utility
,
ONLY
:
checkfield
USE
basic
,
ONLY
:
t0_checkfield
,
t1_checkfield
,
tc_checkfield
USE
fields
,
ONLY
:
phi
,
moments_e
,
moments_i
USE
fields
,
ONLY
:
phi
,
moments_e
,
moments_i
USE
grid
,
ONLY
:
ipgs_e
,
ipge_e
,
ijgs_e
,
ijge_e
,
ipgs_i
,
ipge_i
,
ijgs_i
,
ijge_i
,&
ikys
,
ikye
,
ikxs
,
ikxe
,
izgs
,
izge
,
ij
,
ip
USE
MPI
USE
time_integration
,
ONLY
:
updatetlevel
USE
model
,
ONLY
:
LINEARITY
,
KIN_E
IMPLICIT
NONE
IMPLICIT
NONE
LOGICAL
::
checkf_
! Execution time start
! Execution time start
CALL
cpu_time
(
t0_checkfield
)
CALL
cpu_time
(
t0_checkfield
)
...
@@ -74,17 +79,22 @@ SUBROUTINE stepon
...
@@ -74,17 +79,22 @@ SUBROUTINE stepon
mlend
=
.FALSE.
mlend
=
.FALSE.
IF
(
.NOT.
nlend
)
THEN
IF
(
.NOT.
nlend
)
THEN
mlend
=
mlend
.or.
checkfield
(
phi
,
' phi'
)
checkf_
=
checkfield
(
phi
,
' phi'
)
mlend
=
(
mlend
.or.
checkf_
)
IF
(
KIN_E
)
THEN
IF
(
KIN_E
)
THEN
DO
ij
=
ijgs_e
,
ijge_e
DO
ij
=
ijgs_e
,
ijge_e
DO
ip
=
ipgs_e
,
ipge_e
DO
ip
=
ipgs_e
,
ipge_e
mlend
=
mlend
.or.
checkfield
(
moments_e
(
ip
,
ij
,:,:,:,
updatetlevel
),
' moments_e'
)
checkf_
=
checkfield
(
moments_e
(
ip
,
ij
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izgs
:
izge
,
updatetlevel
),
' moments_e'
)
mlend
=
(
mlend
.or.
checkf_
)
ENDDO
ENDDO
ENDDO
ENDDO
ENDIF
ENDIF
DO
ij
=
ijgs_i
,
ijge_i
DO
ij
=
ijgs_i
,
ijge_i
DO
ip
=
ipgs_i
,
ipge_i
DO
ip
=
ipgs_i
,
ipge_i
mlend
=
mlend
.or.
checkfield
(
moments_i
(
ip
,
ij
,:,:,:,
updatetlevel
),
' moments_i'
)
checkf_
=
checkfield
(
moments_i
(
ip
,
ij
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izgs
:
izge
,
updatetlevel
),
' moments_i'
)
mlend
=
(
mlend
.or.
checkf_
)
! print*, 'should be an error'
! stop
ENDDO
ENDDO
ENDDO
ENDDO
CALL
MPI_ALLREDUCE
(
mlend
,
nlend
,
1
,
MPI_LOGICAL
,
MPI_LOR
,
MPI_COMM_WORLD
,
ierr
)
CALL
MPI_ALLREDUCE
(
mlend
,
nlend
,
1
,
MPI_LOGICAL
,
MPI_LOR
,
MPI_COMM_WORLD
,
ierr
)
...
@@ -97,6 +107,9 @@ SUBROUTINE stepon
...
@@ -97,6 +107,9 @@ SUBROUTINE stepon
SUBROUTINE
anti_aliasing
SUBROUTINE
anti_aliasing
USE
fields
,
ONLY
:
moments_e
,
moments_i
USE
fields
,
ONLY
:
moments_e
,
moments_i
USE
grid
,
ONLY
:
ipgs_i
,
ipge_i
,
ijgs_i
,
ijge_i
,
ipgs_e
,
ipge_e
,
ijgs_e
,
ijge_e
,&
ikys
,
ikye
,
ikxs
,
ikxe
,
izgs
,
izge
,
AA_x
,
AA_y
,
iz
,
ikx
,
iky
,
ij
,
ip
USE
model
,
ONLY
:
KIN_E
IMPLICIT
NONE
IMPLICIT
NONE
IF
(
KIN_E
)
THEN
IF
(
KIN_E
)
THEN
DO
iz
=
izgs
,
izge
DO
iz
=
izgs
,
izge
...
@@ -114,7 +127,7 @@ SUBROUTINE stepon
...
@@ -114,7 +127,7 @@ SUBROUTINE stepon
DO
iz
=
izgs
,
izge
DO
iz
=
izgs
,
izge
DO
ikx
=
ikxs
,
ikxe
DO
ikx
=
ikxs
,
ikxe
DO
iky
=
ikys
,
ikye
DO
iky
=
ikys
,
ikye
DO
ij
=
ijs_i
,
ije_i
DO
ij
=
ij
g
s_i
,
ij
g
e_i
DO
ip
=
ipgs_i
,
ipge_i
DO
ip
=
ipgs_i
,
ipge_i
moments_i
(
ip
,
ij
,
iky
,
ikx
,
iz
,:)
=
AA_x
(
ikx
)
*
AA_y
(
iky
)
*
moments_i
(
ip
,
ij
,
iky
,
ikx
,
iz
,:)
moments_i
(
ip
,
ij
,
iky
,
ikx
,
iz
,:)
=
AA_x
(
ikx
)
*
AA_y
(
iky
)
*
moments_i
(
ip
,
ij
,
iky
,
ikx
,
iz
,:)
END
DO
END
DO
...
@@ -126,11 +139,14 @@ SUBROUTINE stepon
...
@@ -126,11 +139,14 @@ SUBROUTINE stepon
SUBROUTINE
enforce_symmetry
! Force X(k) = X(N-k)* complex conjugate symmetry
SUBROUTINE
enforce_symmetry
! Force X(k) = X(N-k)* complex conjugate symmetry
USE
fields
,
ONLY
:
phi
,
psi
,
moments_e
,
moments_i
USE
fields
,
ONLY
:
phi
,
psi
,
moments_e
,
moments_i
USE
grid
,
ONLY
:
ipgs_i
,
ipge_i
,
ijgs_i
,
ijge_i
,
ipgs_e
,
ipge_e
,
ijgs_e
,
ijge_e
,&
izgs
,
izge
,
iz
,
ikx
,
ij
,
ip
,
Nkx
,
iky_0
,
ikx_0
,
contains_ky0
USE
model
,
ONLY
:
KIN_E
IMPLICIT
NONE
IMPLICIT
NONE
IF
(
contains_ky0
)
THEN
IF
(
contains_ky0
)
THEN
! Electron moments
! Electron moments
IF
(
KIN_E
)
THEN
IF
(
KIN_E
)
THEN
DO
iz
=
izs
,
ize
DO
iz
=
iz
g
s
,
iz
g
e
DO
ij
=
ijgs_e
,
ijge_e
DO
ij
=
ijgs_e
,
ijge_e
DO
ip
=
ipgs_e
,
ipge_e
DO
ip
=
ipgs_e
,
ipge_e
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
...
@@ -143,7 +159,7 @@ SUBROUTINE stepon
...
@@ -143,7 +159,7 @@ SUBROUTINE stepon
END
DO
END
DO
ENDIF
ENDIF
! Ion moments
! Ion moments
DO
iz
=
izs
,
ize
DO
iz
=
iz
g
s
,
iz
g
e
DO
ij
=
ijgs_i
,
ijge_i
DO
ij
=
ijgs_i
,
ijge_i
DO
ip
=
ipgs_i
,
ipge_i
DO
ip
=
ipgs_i
,
ipge_i
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
...
@@ -156,16 +172,16 @@ SUBROUTINE stepon
...
@@ -156,16 +172,16 @@ SUBROUTINE stepon
END
DO
END
DO
! Phi
! Phi
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
phi
(
iky_0
,
ikx
,
izs
:
ize
)
=
phi
(
iky_0
,
Nkx
+2
-
ikx
,
izs
:
ize
)
phi
(
iky_0
,
ikx
,
iz
g
s
:
iz
g
e
)
=
phi
(
iky_0
,
Nkx
+2
-
ikx
,
iz
g
s
:
iz
g
e
)
END
DO
END
DO
! must be real at origin
! must be real at origin
phi
(
iky_0
,
ikx_0
,
izs
:
ize
)
=
REAL
(
phi
(
iky_0
,
ikx_0
,
izs
:
ize
))
phi
(
iky_0
,
ikx_0
,
iz
g
s
:
iz
g
e
)
=
REAL
(
phi
(
iky_0
,
ikx_0
,
iz
g
s
:
iz
g
e
))
! Psi
! Psi
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
DO
ikx
=
2
,
Nkx
/
2
!symmetry at ky = 0
psi
(
iky_0
,
ikx
,
izs
:
ize
)
=
psi
(
iky_0
,
Nkx
+2
-
ikx
,
izs
:
ize
)
psi
(
iky_0
,
ikx
,
iz
g
s
:
iz
g
e
)
=
psi
(
iky_0
,
Nkx
+2
-
ikx
,
iz
g
s
:
iz
g
e
)
END
DO
END
DO
! must be real at origin
! must be real at origin
psi
(
iky_0
,
ikx_0
,
izs
:
ize
)
=
REAL
(
psi
(
iky_0
,
ikx_0
,
izs
:
ize
))
psi
(
iky_0
,
ikx_0
,
iz
g
s
:
iz
g
e
)
=
REAL
(
psi
(
iky_0
,
ikx_0
,
iz
g
s
:
iz
g
e
))
ENDIF
ENDIF
END
SUBROUTINE
enforce_symmetry
END
SUBROUTINE
enforce_symmetry
...
...
This diff is collapsed.
Click to expand it.
src/utility_mod.F90
+
13
−
18
View file @
5636a3ee
MODULE
utility
MODULE
utility
USE
basic
USE
grid
,
ONLY
:
Nkx
,
Nky
,
Nz
,
ikys
,
ikye
,
izs
,
ize
,
local_nky
,
local_nz
use
prec_const
IMPLICIT
NONE
IMPLICIT
NONE
PUBLIC
::
checkfield
CONTAINS
CONTAINS
FUNCTION
is_nan
(
x
,
str
)
RESULT
(
isn
)
FUNCTION
is_nan
(
x
,
str
)
RESULT
(
isn
)
USE
basic
,
ONLY
:
cstep
,
stdout
USE
time_integration
USE
time_integration
,
ONLY
:
updatetlevel
USE
prec_const
,
ONLY
:
dp
use
prec_const
IMPLICIT
NONE
IMPLICIT
NONE
real
(
dp
),
INTENT
(
IN
)
::
x
real
(
dp
),
INTENT
(
IN
)
::
x
...
@@ -29,10 +25,8 @@ CONTAINS
...
@@ -29,10 +25,8 @@ CONTAINS
FUNCTION
is_inf
(
x
,
str
)
RESULT
(
isi
)
FUNCTION
is_inf
(
x
,
str
)
RESULT
(
isi
)
USE
basic
,
ONLY
:
stdout
USE
time_integration
USE
prec_const
,
ONLY
:
dp
use
prec_const
IMPLICIT
NONE
IMPLICIT
NONE
real
(
dp
),
INTENT
(
IN
)
::
x
real
(
dp
),
INTENT
(
IN
)
::
x
...
@@ -51,13 +45,14 @@ CONTAINS
...
@@ -51,13 +45,14 @@ CONTAINS
END
FUNCTION
is_inf
END
FUNCTION
is_inf
FUNCTION
checkfield
(
field
,
str
)
RESULT
(
mlend
)
FUNCTION
checkfield
(
field
,
str
)
RESULT
(
mlend
)
USE
grid
,
ONLY
:
ikys
,
ikye
,
ikxs
,
ikxe
,
izgs
,
izge
USE
grid
use
prec_const
,
ONLY
:
dp
use
prec_const
IMPLICIT
NONE
IMPLICIT
NONE
!! BUG found (or feature?)
COMPLEX
(
dp
),
DIMENSION
(
ikys
:
ikye
,
ikxs
:
ikxe
),
INTENT
(
IN
)
::
field
! if one put the commented first line (commented) instead of the second one,
! no error will be risen by the compiler even if the rank of the array is not matching (should be 3D!)
! COMPLEX(dp), DIMENSION(ikys:ikye,ikxs:ikxe), INTENT(IN) :: field
COMPLEX
(
dp
),
DIMENSION
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izgs
:
izge
),
INTENT
(
IN
)
::
field
CHARACTER
(
LEN
=*
),
INTENT
(
IN
)
::
str
CHARACTER
(
LEN
=*
),
INTENT
(
IN
)
::
str
LOGICAL
::
mlend
LOGICAL
::
mlend
COMPLEX
(
dp
)
::
sumfield
COMPLEX
(
dp
)
::
sumfield
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment