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
87cbdec0
Commit
87cbdec0
authored
1 year ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
update ExB NL factor each RK step?
parent
de9e4f23
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ExB_shear_flow_mod.F90
+17
-13
17 additions, 13 deletions
src/ExB_shear_flow_mod.F90
src/stepon.F90
+10
-0
10 additions, 0 deletions
src/stepon.F90
with
27 additions
and
13 deletions
src/ExB_shear_flow_mod.F90
+
17
−
13
View file @
87cbdec0
...
@@ -92,10 +92,7 @@ CONTAINS
...
@@ -92,10 +92,7 @@ CONTAINS
INTEGER
,
INTENT
(
IN
)
::
step_number
INTEGER
,
INTENT
(
IN
)
::
step_number
! local var
! local var
INTEGER
::
iky
INTEGER
::
iky
REAL
(
xp
)::
tnext
! tnext = time + c_E(step_number)*dt
tnext
=
time
+
0._xp
*
dt
! do nothing if no ExB
! do nothing if no ExB
IF
(
ExB
)
THEN
IF
(
ExB
)
THEN
! Update new shear value
! Update new shear value
...
@@ -125,7 +122,7 @@ CONTAINS
...
@@ -125,7 +122,7 @@ CONTAINS
CALL
evaluate_magn_curv
CALL
evaluate_magn_curv
! update the ExB nonlinear factor...
! update the ExB nonlinear factor...
IF
(
LINEARITY
.EQ.
'nonlinear'
)
&
IF
(
LINEARITY
.EQ.
'nonlinear'
)
&
CALL
update_nonlinear_ExB_factors
CALL
update_nonlinear_ExB_factors
(
step_number
)
ENDIF
ENDIF
END
SUBROUTINE
Update_ExB_shear_flow
END
SUBROUTINE
Update_ExB_shear_flow
...
@@ -201,14 +198,18 @@ CONTAINS
...
@@ -201,14 +198,18 @@ CONTAINS
END
SUBROUTINE
Array_shift_ExB_shear_flow
END
SUBROUTINE
Array_shift_ExB_shear_flow
SUBROUTINE
Update_nonlinear_ExB_factors
SUBROUTINE
Update_nonlinear_ExB_factors
(
step_number
)
USE
grid
,
ONLY
:
local_nky
,
local_nky_offset
,
xarray
,
Nx
,
Ny
,
local_nx
,
deltakx
,&
USE
grid
,
ONLY
:
local_nky
,
local_nky_offset
,
xarray
,
Nx
,
Ny
,
local_nx
,
deltakx
,&
local_nx_offset
,
ikyarray
,
inv_ikyarray
,
deltaky
,
update_grids
local_nx_offset
,
ikyarray
,
inv_ikyarray
,
deltaky
,
update_grids
USE
basic
,
ONLY
:
time
,
dt
USE
basic
,
ONLY
:
time
,
dt
USE
time_integration
,
ONLY
:
c_E
IMPLICIT
NONE
IMPLICIT
NONE
INTEGER
,
INTENT
(
IN
)
::
step_number
INTEGER
::
iky
,
ix
INTEGER
::
iky
,
ix
REAL
(
xp
)::
dt_ExB
,
J_xp
,
inv_J
,
xval
,
tnext
REAL
(
xp
)::
dt_ExB
,
J_xp
,
inv_J
,
xval
,
tnow
tnext
=
time
+
dt
tnow
=
time
+
c_E
(
step_number
)
*
dt
DO
iky
=
1
,
local_nky
! WARNING: Local indices ky loop
DO
iky
=
1
,
local_nky
! WARNING: Local indices ky loop
! for readability
! for readability
! J_xp = ikyarray(iky+local_nky_offset)
! J_xp = ikyarray(iky+local_nky_offset)
...
@@ -220,12 +221,12 @@ CONTAINS
...
@@ -220,12 +221,12 @@ CONTAINS
inv_J
=
0._xp
inv_J
=
0._xp
ENDIF
ENDIF
! compute dt factor
! compute dt factor
dt_ExB
=
(
tn
ext
-
t0
*
inv_J
*
ANINT
(
J_xp
*
tn
ext
*
inv_t0
,
xp
))
dt_ExB
=
(
tn
ow
-
t0
*
inv_J
*
ANINT
(
J_xp
*
tn
ow
*
inv_t0
,
xp
))
DO
ix
=
1
,
Nx
DO
ix
=
1
,
Nx
xval
=
2._xp
*
pi
/
deltakx
*
REAL
(
ix
-1
,
xp
)/
REAL
(
Nx
,
xp
)
!xarray(ix)
xval
=
2._xp
*
pi
/
deltakx
*
REAL
(
ix
-1
,
xp
)/
REAL
(
Nx
,
xp
)
!xarray(ix)
! assemble the ExB nonlin factor
! assemble the ExB nonlin factor
!
ExB_NL_factor(ix,iky) = EXP(-imagu*x*gamma_E*J_xp*deltaky*dt_ExB)
ExB_NL_factor
(
ix
,
iky
)
=
EXP
(
-
imagu
*
x
val
*
gamma_E
*
J_xp
*
deltaky
*
dt_ExB
)
ExB_NL_factor
(
ix
,
iky
)
=
EXP
(
-
imagu
*
sky_ExB
(
iky
)
*
xval
)
!
ExB_NL_factor(ix,iky) = EXP(-imagu*sky_ExB(iky)*xval)
! ExB_NL_factor(ix,iky) = EXP(-imagu*sky_ExB_full(iky+local_nky_offset)*xval)
! ExB_NL_factor(ix,iky) = EXP(-imagu*sky_ExB_full(iky+local_nky_offset)*xval)
ENDDO
ENDDO
ENDDO
ENDDO
...
@@ -239,14 +240,17 @@ CONTAINS
...
@@ -239,14 +240,17 @@ CONTAINS
inv_J
=
0._xp
inv_J
=
0._xp
ENDIF
ENDIF
! compute dt factor
! compute dt factor
dt_ExB
=
(
tn
ext
-
t0
*
inv_J
*
ANINT
(
J_xp
*
tn
ext
*
inv_t0
,
xp
))
dt_ExB
=
(
tn
ow
-
t0
*
inv_J
*
ANINT
(
J_xp
*
tn
ow
*
inv_t0
,
xp
))
DO
ix
=
1
,
local_nx
DO
ix
=
1
,
local_nx
xval
=
2._xp
*
pi
/
deltakx
*
REAL
(
ix
-1
,
xp
)/
REAL
(
Nx
,
xp
)
!xarray(ix+local_nx_offset)
xval
=
2._xp
*
pi
/
deltakx
*
REAL
(
ix
-1
,
xp
)/
REAL
(
Nx
,
xp
)
!xarray(ix+local_nx_offset)
! assemble the inverse ExB nonlin factor
! assemble the inverse ExB nonlin factor
!
inv_ExB_NL_factor(iky,ix) = EXP(imagu*
x*
gamma_E*J_xp*deltaky*dt_ExB)
inv_ExB_NL_factor
(
iky
,
ix
)
=
EXP
(
imagu
*
gamma_E
*
J_xp
*
deltaky
*
dt_ExB
*
xval
)
inv_ExB_NL_factor
(
iky
,
ix
)
=
EXP
(
imagu
*
sky_ExB_full
(
iky
)
*
xval
)
!
inv_ExB_NL_factor(iky,ix) = EXP(imagu*sky_ExB_full(iky)*xval)
ENDDO
ENDDO
ENDDO
ENDDO
! Cancel the additional point
inv_ExB_NL_factor
(
Ny
/
2+1
,:)
=
0._xp
inv_ExB_NL_factor
(
Ny
/
2+2
,:)
=
0._xp
END
SUBROUTINE
Update_nonlinear_ExB_factors
END
SUBROUTINE
Update_nonlinear_ExB_factors
END
MODULE
ExB_shear_flow
END
MODULE
ExB_shear_flow
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/stepon.F90
+
10
−
0
View file @
87cbdec0
...
@@ -12,12 +12,22 @@ SUBROUTINE stepon
...
@@ -12,12 +12,22 @@ SUBROUTINE stepon
#ifdef TEST_SVD
#ifdef TEST_SVD
USE
CLA
,
ONLY
:
test_svd
,
filter_sv_moments_ky_pj
USE
CLA
,
ONLY
:
test_svd
,
filter_sv_moments_ky_pj
#endif
#endif
USE
ExB_shear_flow
,
ONLY
:
Update_ExB_shear_flow
IMPLICIT
NONE
IMPLICIT
NONE
INTEGER
::
num_step
,
ierr
INTEGER
::
num_step
,
ierr
LOGICAL
::
mlend
LOGICAL
::
mlend
SUBSTEPS
:
DO
num_step
=
1
,
ntimelevel
! eg RK4 compute successively k1, k2, k3, k4
SUBSTEPS
:
DO
num_step
=
1
,
ntimelevel
! eg RK4 compute successively k1, k2, k3, k4
!----- TEST !-----
! Update the ExB shear flow for the next step
! This call includes :
! - the ExB shear value (s(ky)) update for the next time step
! - the kx grid update
! - the ExB NL correction factor update (exp(+/- ixkySdts))
! - (optional) the kernel, poisson op. and ampere op update
CALL
Update_ExB_shear_flow
(
num_step
)
!-----END TEST !-----
!----- BEFORE: All fields+ghosts are updated for step = n
!----- BEFORE: All fields+ghosts are updated for step = n
! Compute right hand side from current fields
! Compute right hand side from current fields
! N_rhs(N_n, nadia_n, phi_n, S_n, Tcoll_n)
! N_rhs(N_n, nadia_n, phi_n, S_n, Tcoll_n)
...
...
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