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
a31d7666
Commit
a31d7666
authored
2 years ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
Ampere and Poisson equations
parent
6b4a82ec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/solve_EM_fields.F90
+20
-38
20 additions, 38 deletions
src/solve_EM_fields.F90
with
20 additions
and
38 deletions
src/solve_EM_fields.F90
+
20
−
38
View file @
a31d7666
...
@@ -20,7 +20,7 @@ CONTAINS
...
@@ -20,7 +20,7 @@ CONTAINS
USE
grid
USE
grid
USE
calculus
,
ONLY
:
simpson_rule_z
USE
calculus
,
ONLY
:
simpson_rule_z
USE
parallel
,
ONLY
:
manual_3D_bcast
USE
parallel
,
ONLY
:
manual_3D_bcast
use
model
,
ONLY
:
qe2_taue
,
qi2_taui
,
q_e
,
q_i
,
lambdaD
,
KIN_E
use
model
,
ONLY
:
qe2_taue
,
qi2_taui
,
q_e
,
q_i
,
lambdaD
,
KIN_E
,
sigma_e
,
sigma_i
USE
processing
,
ONLY
:
compute_density
USE
processing
,
ONLY
:
compute_density
USE
geometry
,
ONLY
:
iInt_Jacobian
,
Jacobian
USE
geometry
,
ONLY
:
iInt_Jacobian
,
Jacobian
IMPLICIT
NONE
IMPLICIT
NONE
...
@@ -33,9 +33,7 @@ CONTAINS
...
@@ -33,9 +33,7 @@ CONTAINS
! Execution time start
! Execution time start
CALL
cpu_time
(
t0_poisson
)
CALL
cpu_time
(
t0_poisson
)
!! Poisson can be solved only for process containing p=0
!! Poisson can be solved only for process containing p=0
! IF ( SOLVE_POISSON ) THEN
IF
(
SOLVE_POISSON
)
THEN
IF
(
(
ips_e
.EQ.
ip0_e
)
.AND.
(
ips_i
.EQ.
ip0_i
)
)
THEN
kxloop
:
DO
ikx
=
ikxs
,
ikxe
kxloop
:
DO
ikx
=
ikxs
,
ikxe
kyloop
:
DO
iky
=
ikys
,
ikye
kyloop
:
DO
iky
=
ikys
,
ikye
phi
(
iky
,
ikx
,
izs
:
ize
)
=
0._dp
phi
(
iky
,
ikx
,
izs
:
ize
)
=
0._dp
...
@@ -45,14 +43,13 @@ CONTAINS
...
@@ -45,14 +43,13 @@ CONTAINS
rho_i
(
izs
:
ize
)
=
rho_i
(
izs
:
ize
)
&
rho_i
(
izs
:
ize
)
=
rho_i
(
izs
:
ize
)
&
+
q_i
*
kernel_i
(
ini
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_i
(
ip0_i
,
ini
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
+
q_i
*
kernel_i
(
ini
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_i
(
ip0_i
,
ini
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
END
DO
END
DO
!!!! Compute electron particle charge density q_e n_e
!!!! Compute electron particle charge density q_e n_e
rho_e
=
0._dp
rho_e
=
0._dp
IF
(
KIN_E
)
THEN
! Kinetic electrons
IF
(
KIN_E
)
THEN
! Kinetic electrons
DO
ine
=
1
,
jmaxe
+1
DO
ine
=
1
,
jmaxe
+1
rho_e
(
izs
:
ize
)
=
rho_e
(
izs
:
ize
)
&
rho_e
(
izs
:
ize
)
=
rho_e
(
izs
:
ize
)
&
+
q_e
*
kernel_e
(
ine
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_e
(
ip0_e
,
ine
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
+
q_e
*
kernel_e
(
ine
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_e
(
ip0_e
,
ine
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
END
DO
END
DO
ELSE
! Adiabatic electrons
ELSE
! Adiabatic electrons
! Adiabatic charge density (linked to flux surface averaged phi)
! Adiabatic charge density (linked to flux surface averaged phi)
! We compute the flux surface average solving a flux surface averaged
! We compute the flux surface average solving a flux surface averaged
...
@@ -70,13 +67,10 @@ CONTAINS
...
@@ -70,13 +67,10 @@ CONTAINS
ENDIF
ENDIF
!!!!!!!!!!!!!!! Inverting the poisson equation !!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!! Inverting the poisson equation !!!!!!!!!!!!!!!!!!!!!!!!!!
phi
(
iky
,
ikx
,
izs
:
ize
)
=
(
rho_e
(
izs
:
ize
)
+
rho_i
(
izs
:
ize
))
*
inv_poisson_op
(
iky
,
ikx
,
izs
:
ize
)
phi
(
iky
,
ikx
,
izs
:
ize
)
=
(
rho_e
(
izs
:
ize
)
+
rho_i
(
izs
:
ize
))
*
inv_poisson_op
(
iky
,
ikx
,
izs
:
ize
)
END
DO
kyloop
END
DO
kyloop
END
DO
kxloop
END
DO
kxloop
! Cancel origin singularity
! Cancel origin singularity
IF
(
contains_kx0
.AND.
contains_ky0
)
phi
(
iky_0
,
ikx_0
,:)
=
0._dp
IF
(
contains_kx0
.AND.
contains_ky0
)
phi
(
iky_0
,
ikx_0
,:)
=
0._dp
ENDIF
ENDIF
! Transfer phi to all the others process along p
! Transfer phi to all the others process along p
...
@@ -85,7 +79,6 @@ CONTAINS
...
@@ -85,7 +79,6 @@ CONTAINS
! Execution time end
! Execution time end
CALL
cpu_time
(
t1_poisson
)
CALL
cpu_time
(
t1_poisson
)
tc_poisson
=
tc_poisson
+
(
t1_poisson
-
t0_poisson
)
tc_poisson
=
tc_poisson
+
(
t1_poisson
-
t0_poisson
)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END
SUBROUTINE
poisson
END
SUBROUTINE
poisson
SUBROUTINE
ampere
SUBROUTINE
ampere
...
@@ -104,34 +97,24 @@ CONTAINS
...
@@ -104,34 +97,24 @@ CONTAINS
! Execution time start
! Execution time start
CALL
cpu_time
(
t0_poisson
)
CALL
cpu_time
(
t0_poisson
)
!! Ampere can be solved only with beta > 0 and for process containing p=1
!! Ampere can be solved only with beta > 0 and for process containing p=1
moments
IF
(
SOLVE_AMPERE
)
THEN
IF
(
SOLVE_AMPERE
)
THEN
kxloop
:
DO
ikx
=
ikxs
,
ikxe
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
=
0._dp
kyloop
:
DO
iky
=
ikys
,
ikye
!!!! ion particle current density contribution "q_i u_i"
psi
(
iky
,
ikx
,
izs
:
ize
)
=
0._dp
DO
ini
=
1
,
jmaxi
+1
!!!! Compute ion particle current density q_i u_i
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
=
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
&
I_i
=
0._dp
+
q_i
*
sqrt_tau_o_sigma_i
*
kernel_i
(
ini
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
,
0
)
*
moments_i
(
ip1_i
,
ini
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
,
updatetlevel
)
DO
ini
=
1
,
jmaxi
+1
END
DO
I_i
(
izs
:
ize
)
=
I_i
(
izs
:
ize
)
&
!!!! electron particle current density contribution "q_e u_e"
+
kernel_i
(
ini
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_i
(
ip1_i
,
ini
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
DO
ine
=
1
,
jmaxe
+1
END
DO
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
=
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
&
I_i
=
q_i
*
sqrt_tau_o_sigma_i
*
I_i
+
q_e
*
sqrt_tau_o_sigma_e
*
kernel_e
(
ine
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
,
0
)
*
moments_e
(
ip1_e
,
ine
,
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
,
updatetlevel
)
!!!! Compute electron particle charge density q_e n_e
END
DO
I_e
=
0._dp
!!!!!!!!!!!!!!! Inverting the poisson equation !!!!!!!!!!!!!!!!!!!!!!!!!!
DO
ine
=
1
,
jmaxe
+1
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
=
beta
*
psi
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
*
inv_ampere_op
(
ikys
:
ikye
,
ikxs
:
ikxe
,
izs
:
ize
)
I_e
(
izs
:
ize
)
=
I_e
(
izs
:
ize
)
&
+
q_e
*
kernel_e
(
ine
,
iky
,
ikx
,
izs
:
ize
,
0
)
*
moments_e
(
ip1_e
,
ine
,
iky
,
ikx
,
izs
:
ize
,
updatetlevel
)
END
DO
I_e
=
q_e
*
sqrt_tau_o_sigma_e
*
I_e
!!!!!!!!!!!!!!! Inverting the poisson equation !!!!!!!!!!!!!!!!!!!!!!!!!!
psi
(
iky
,
ikx
,
izs
:
ize
)
=
beta
*
(
I_e
(
izs
:
ize
)
+
I_i
(
izs
:
ize
))
*
inv_ampere_op
(
iky
,
ikx
,
izs
:
ize
)
END
DO
kyloop
END
DO
kxloop
! Cancel origin singularity
! Cancel origin singularity
IF
(
contains_kx0
.AND.
contains_ky0
)
psi
(
iky_0
,
ikx_0
,:)
=
0._dp
IF
(
contains_kx0
.AND.
contains_ky0
)
psi
(
iky_0
,
ikx_0
,:)
=
0._dp
ENDIF
ENDIF
! Transfer phi to all the others process along p
! Transfer phi to all the others process along p
...
@@ -140,7 +123,6 @@ CONTAINS
...
@@ -140,7 +123,6 @@ CONTAINS
! Execution time end
! Execution time end
CALL
cpu_time
(
t1_poisson
)
CALL
cpu_time
(
t1_poisson
)
tc_poisson
=
tc_poisson
+
(
t1_poisson
-
t0_poisson
)
tc_poisson
=
tc_poisson
+
(
t1_poisson
-
t0_poisson
)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
END
SUBROUTINE
ampere
END
SUBROUTINE
ampere
END
SUBROUTINE
solve_EM_fields
END
SUBROUTINE
solve_EM_fields
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