Post on 18-Oct-2020
transcript
ASTER meeting 12-14/11/2006
AAAAdaptive mhd Simulation
of Tokamak Elms for iteR
Projet ANR-CIS 2006
Meeting Bordeaux
12-14/11/2007
ASTER meeting 12-14/11/2006
WP 2.2 Bezier Grid
• Development of the JOREK MHD simulation code
– Implementation of Bezier finite elements in new JOREK(2) code:
•Polar flux surface aligned grid
•X-point/separatrix aligned grid, open/closed field lines
•Report available on ASTER website
ASTER meeting 12-14/11/2006
WP 2.2 Bezier Grid
• Bezier grid aligned on open/closed flux surfaces:
– Continuity of values enforced at axis and X-point
– Partial continuity enforced of gradients at X-point
ASTER meeting 12-14/11/2006
• Verification on two resistive MHD instabilities:
– Linear growth rate n=1 resistive internal kink mode :
•Correct scaling (after correction of an error in grid generation)
WP 2.2 : Test Cases
10-3
10-2
10-1
10-6
10-5
10-4
10-3
10-2
10-1
h
error
h5
710η −= 8
10ν −=
ASTER meeting 12-14/11/2006
WP 2.2 : Test Cases
• Linear growth rate n=1 tearing mode test case:
10-3
10-2
10-1
10-6
10-5
10-4
10-3
10-2
10-1
error5
h
h
710η −= 8
10ν −=
ASTER meeting 12-14/11/2006
WP 2.2 : time evolution
• Implementation of new time evolution scheme in JOREK:
– Fully implicit but using iterative solution (GMRES)
•Matrix for each toroidal harmonic used as preconditioner
– Solved using PastiX or MUMPS
(using N MPI groups, new option in PastiX)
– Preconditioning only recalculated when GMRES requires too many
iterations
– Reduce time step when number of iterations still too large
•Much improved scaling parallelisation/memory use
– First tests on CCRT platine (up to 512 cores)
– Good scaling when (n_tor / n_cpu) constant
•To be compared with PastiX iterative/direct solution
– Partly explicit scheme:
•Each toroidal harmonic implicit (ignoring coupling between harmonics)
•Coupling terms explicit
•Scheme as in SFELES code
ASTER meeting 12-14/11/2006
Parallelisation
Matrix: 49
Distr: 5.2
Fact: 46
GMRES:3.3/it
Matrix: 89
Distr: 6.9
Fact: 110
GMRES::-
51x64x16
Matrix: 34
Distr: 3.4
Fact: 17
GMRES: 1.8/it
Matrix: 43
Distr: 3.9
Fact: 24
GMRES: 2.6/it
Matrix: 88
Distr: 5.2
Fact: 46
GMRES:-
N(radial) 51
N(poloidal) 32
N(Fourier) 16
256128N_cpu=64
Largest matrix size : ndof = 2.4x106 (on 256 cpu’s)
ASTER meeting 12-14/11/2006
GMRES
• GMRES number of iterations for two values of time step
– Larger time step not always the best choice
160
140
120
100
80
60
40
20
GM
RE
S i
tera
tio
ns
5004003002001000 no. timestep
t_step =10
t_step=20
residu 10-8
η = υ=10-5
ASTER meeting 12-14/11/2006
GMRES
• Reduce time step when number of GMRES iterations too big.
250
200
150
100
50
0
ite
ratio
ns
8006004002000
no. steps
50
40
30
20
10
0
time
ste
p
η = υ = 10-6
ASTER meeting 12-14/11/2006
WP 4
• Application of the methods developed in the project to
advance the simulation of ELMs in ITER plasmas
– Stanislas Pamela started thesis 1-10-2007
– First application using new jorek version:
• equilibrium flow in x-point plasmas
600
400
200
0
x1
0-6
4.03.53.02.52.0
R [m]
flow profile
ASTER meeting 12-14/11/2006
Planning 2008
• JOREK2 developments (WP2):
– Include PastiX with distributed matrix, test direct/indirect version
– Change MHD model to full MHD, diamagnetic effects
– Include refinement in new JOREK version
– Post-doc Emiel van der Plas starts 1-2-2008
• JOREK applications (WP4)
– Equilibrium flow patterns due to X-point configuration
– Extend ELM simulations to higher toroidal resolution
•Saturation mechanism
•Crash amplitude
ASTER meeting 12-14/11/2006
JOREK2
• New version of JOREK uses (isoparametric) Bezier finite
elements in the poloidal plane and Fourier harmonics in the toroidal (periodic direction)
– Leads to ‘sparse’ matrix with very large full blocks
•Blocksize (4 x N_tor(=16-64) x (n_var=6-8))
( )4
1 1 1
( , , ) Re( , )Ntor Nelm
in
ijn j
n i j
U s t u H s t eφφ
= = =
= ∑∑∑�
( )
( )
4
1
4
1
( , ) ,
( , ) ,
i ij j
j
i ij j
j
R s t R H s t
Z s t Z H s t
=
=
=
=
∑
∑
ASTER meeting 12-14/11/2006
JOREK2
• Initialisation (serial):
Construct finite
element grid
Solve equilibrium equation
(~poisson equation, MUMPS)
Construct finite element
grid aligned on magnetic
field structure
Determine matrix structure
(CSR matrix setup)
Distribute ndof’s over all
available cpu’s
grid_bezier_square_polargrid_bezier_squaregrid_polar_bezier
equilibrium
grid_xpointgrid_flux_surface
distribute_nodes_elements (parallel)
global_matrix_structure (parallel)
ASTER meeting 12-14/11/2006
JOREK2• Implicit time stepping (parallel):
Construct matrix
(distributed nodes/elements)
Redistribute reduced matrices
over N_tor masters
(distributed harmonics)
Analysis/Factorisation
Reduced matrices
GMRES
precond. (reduced matrix solve)
full matrix-vector product
Add solution
it_gmres<20it_gmres>20
it_gmres>200
tstep=tstep/2
Residue>10-8
construct_matrixelement_matrixelement_matrix_fft
distribute_harmonicssolve_matrix_n
gmres_drivergmres_preconditiongmres_matrix_vector
update_valuesupdate_deltas
ASTER meeting 12-14/11/2006
JOREK2
• Direct with MUMPS or PastiX (not yet completed in JOREK2)
Construct matrix
(distributed nodes/elements)
Gather/scather full matrix
Add solution
PastiX:Analysis
PastiX:Factorisation
PastiX:Solve
It>1 It=1 or grid changed
construct_matrix
solve_mumps_allsolve_pastix_all
Update_valuesupdate_deltas
ASTER meeting 12-14/11/2006
JOREK2type type_node ! type definition of a node
real*8 :: x(n_order+1,n_dim) ! x,y,z coordinates of points and
real*8 :: values(n_tor,n_order+1,n_var) ! variables
real*8 :: deltas(n_tor,n_order+1,n_var)
integer :: index(n_order+1) ! the index in the main matrix
integer :: boundary ! = 1, 2 or 3 for boundary nodes
endtype type_node ! x(:,1) : position, x(:,2) : vector u, ! x(:,3) : vector v, x(4) : vector w
type type_node_list ! type definition of a list of nodes
integer :: n_nodes ! the number of nodes in the list
integer :: n_dof ! the total number of degrees of freedom
type (type_node) :: node(n_nodes_max) ! an allocatable list of nodes
endtype type_node_list
type type_element ! type definition for one elements
integer :: vertex(n_vertex_max) ! the nodes of the corners
integer :: neighbours(n_vertex_max) ! the neighbouring elements
real*8 :: size(n_vertex_max,n_order+1) ! the size of the vectors at each vertex
endtype type_element
type type_element_list ! type definition for a list of elements
integer :: n_elements ! the number of elements in the list
type (type_element) :: element(n_elements_max) ! the list of elements
endtype type_element_list
ASTER meeting 12-14/11/2006
JOREK2module parameters
parameter (n_var = 6) ! the number of variables
parameter (n_dim = 2) ! the number of dimensions
parameter (n_order = 3) ! order of the polynomial basis
parameter (n_tor = 3) ! the number of toroidal harmonics
parameter (n_period = 1) ! periodicity in toroidal direction
parameter (n_plane = 4) ! the number of toroidal angles
parameter (n_vertex_max = 4) ! the maximum number of corners of an element
parameter (n_nodes_max = 10001) ! the maximum number of nodes
parameter (n_elements_max = 10001) ! the maximum number of elements
parameter (n_pieces_max = 10001) ! max. no. of line pieces describing a flux surface
parameter (n_degrees = n_order+1) ! degrees of freedom per variable per node
endmodule
ASTER meeting 12-14/11/2006
JOREK2 input&in1
restart = .f. ! start t=0 (.f.) or continue old run (.t.) using file .rst
tstep = 1000.d0 ! Time step (in Alfven times
nstep = 1 ! Number of timesteps
ellip = 1.d0 ! Shape of plasma boundary
tria_u = 0.d0
tria_l = 0.d0
quad_u = -0.d0
quad_l = -0.d0
xampl = +0.d0 ! Parameters to create x-point plasma (xampl=0 no x-point)
xsig = 0.5d0
xwidth = 1.d0
xtheta = 4.7d0
xshift = 0.0d0
xpoint = .f.
R_geo = 3.0d0 ! Major radius of plasma [m]
F0 = 3.0d0 ! Major radius times magnetic field (R_geo * B_vac)
amin = 1.d0 ! Minor radius of plasma
n_R = 0 ! Number of horizontal points in square grid
n_Z = 0 ! vertical
n_radial = 51 ! Number of radial points in polar grid
n_pol = 32 ! polar
ASTER meeting 12-14/11/2006
JOREK2 inputn_flux = 0 ! Number radial points in flux surface grid
n_tht = 16 ! Number of angular points
n_open = 0 ! Number of radial points on open field lines
n_leg = 0 ! Number of points on the legs of the x-point
n_private = 0 ! Number of points in the private region (below x-point)
eta = 1.d-6 ! resistivity
visco = 1.d-6 ! viscosity
D_perp = 1.d-6 ! density diffusion
ZK_par = 1.d0 ! Temperature parallel diffusion
ZK_perp = 1.d-6 ! Perpendicular diffusion coefficient
FF_0 = 1.12d0 ! Parameters for current profile
FF_1 = 0.d0
aF = -1.d0
heatsource = 0.d-4 ! Heating power
particlesource = 0.d-6 ! Particle source
T_0 = 1.d-3 ! Temperature on axis
T_1 = 1.d-4 ! Temperature at the boundary
aT = -2.0d0 ! Profile coefficients
bT = +1.0d0
cT = 0.d0
dT = 9999.
eT = 9999.
r_0 = 1.d0 ! Density on axis
r_1 = 1.d0 ! Density at the boundary
&end
ASTER meeting 12-14/11/2006
Equilibrium
• Static equilibrium:
• Force balance between pressure gradient and the Lorentz force:
• Poloidal flux ψ:
• Grad-Shafranov equation describes axisymmetric equilibrium:
0
1p
µ∇ = ×J B
0t
∂=
∂0=v
0∇ • =B
( )F 1= +
R Rϕ ϕ
ψψ∇ ×B e e
( ) ( ) ( )2 2
02
1' 'R RJ R p F F
Rϕψ µ ψ ψ ψ
∇ ∇ = − = − −
0ϕ
∂=
∂
JET equilibrium
ASTER meeting 12-14/11/2006
Reduced MHD model
•Reduced MHD model in toroidal geometry
– fixed large toroidal magnetic field
– removes fast waves, easier on the numerics
– similar to reduction Navier-Stokes to potential flow
– Good for physics studies, not for detailed comparison with experiment
[ ]
[ ] [ ]
[ ] ( )
[ ] ( )
*
2
2
*
(1 ) ,
12 (1 ) , ,
(1 ) (1 )
(1 ) , 2
(1 ) , 2
;
T
ux u
t
w u Jw x w u J w
t y x x
ux u D S
t y
T ux T u T T T S
t y
J w u
ρ
ψε ψ η ψ ε
ϕ
εε ε ψ ν
ε ε ϕ
ρε ρ ερ ρ
ρ ε ρ ερ
ψ
⊥
⊥ ⊥
⊥ ⊥
⊥
∂ ∂= + + ∆ −
∂ ∂
∂ ∂ ∂= + + + − + ∇
∂ ∂ + + ∂
∂ ∂= + + + ∇ ⋅ ∇ +
∂ ∂
∂ ∂= + + + ∇ ⋅ Κ ∇ + Κ ∇ +
∂ ∂
= ∆ = ∇ ⋅∇
� �
0 0
0
R RB B e e
R Rϕ ϕψ= + ∇ ×
� �� �
0 0
Rv u e
R Bϕ
−= ∇ ×
�� �
Magnetic flux:
Vorticity:
Density:
Temperature:
dimensionless form : ( )0 0( ) / ; / ; /x R R a y Z a a Rε= − = =