RFP Workshop Oct 2008 – J Scheffel 1 A generalized weighted residual method for RFP plasma...

29
RFP Workshop Oct 2008 – J Scheffel 1 A generalized weighted residual method for RFP plasma simulation Jan Scheffel Fusion Plasma Physics Alfvén Laboratory, KTH Stockholm, Sweden

Transcript of RFP Workshop Oct 2008 – J Scheffel 1 A generalized weighted residual method for RFP plasma...

RFP Workshop Oct 2008 – J Scheffel 1

A generalized weighted residual method for RFP plasma simulation

Jan Scheffel

Fusion Plasma PhysicsAlfvén Laboratory, KTH

Stockholm, Sweden

RFP Workshop Oct 2008 – J Scheffel 2

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 3

Basic idea

Time differencing numerical initial value schemes (even implicit)require extremely many time steps for problems of physicalinterest, where there are several separated time scales.

Causality is already embedded in the governing PDE’s –

- there is no need to mimic causality by time stepping.

Spectral methods (solution expanded in basis functions) aresuccessful in the spatial domain – why not employ them also inthe time domain?

By expanding in time + physical space + physical parameters, thecomputational result will be semi-analytical. (Analytic basisfunctions with numerical coefficients). Ideal for scaling studies, for example.

RFP Workshop Oct 2008 – J Scheffel 4

Fully spectral weighted residual method for semi-analytical solution of initial value partial differential equations.

All time, spatial and physical parameter domains are represented by Chebyshev series, enabling closed and approximate analytical solutions. The method generalises earlier spatially spectral, finite time difference methods.

The method is acausal and thus avoids time step limitations.

The spectral coefficients are determined by iterative solution of a nonlinear system of algebraic eqs, for which a globally convergent semi-implicit root solver (SIR) has been developed.

Accuracy is controlled by the number of included Chebyshev modes.

Efficiency is controlled also by the use of temporal and spatial subdomains.

Intended for efficient solution of nonlinear initial value problems in fluid mechanics and magnetohydrodynamics, including simulation of multi-time-scale RFP confinement and transport.

What is the Generalized Weighted Spectral Method (GWRM) ?

RFP Workshop Oct 2008 – J Scheffel 5

Consider a system of parabolic or hyperbolic initial-value PDE’s, symbolically written as

D is a nonlinear matrix operator, f is a forcing term.

D and f contains both physical variables and physical free parameters (denoted p).

Initial u(0,x;p) + (Dirichlet, Neumann or Robin) boundary u(t,xB;p) conditions.

Integrate in time:

Solution u(t,x;p) is approximated by finite, first kind Chebyshev polynomial series.

Definition: Chebyshev polynomial Tn(x) = cos(n arccosx).

For simplicity – here single equation, one spatial dimension x, one physical parameter p.

The Generalized Weighted Spectral Method (GWRM)

u

tDu f

u(t,x;p)u(t0 ,x;p) {Du( t ,x;p) f (t´,x;p)}d tt0

t

u(t, x; p) ´

k0

K

´

l0

L

´

m0

M

aklmTk ( )Tl ()Tm (P)

RFP Workshop Oct 2008 – J Scheffel 6

The Generalized Weighted Spectral Method (GWRM)

u(t, x; p) u(t0 , x; p) {Du f }d tt0

t

p0

p1

x0

x1

t0

t1

Tq ( )Tr ()Ts (P)wtwxwpdtdxdp 0

wt (1 2 ) 1/2 , wx (1 2 ) 1/2 , wp (1 P2 ) 1/2

Dt0

t

u( t , x; p)d t ´

k0

K 1

´

l0

L

´

m0

M

AklmTk ( )Tl ()Tm (P)

ft0

t

( t , x; p)d t ´

k0

K 1

´

l0

L

´

m0

M

FklmTk ( )Tl ()Tm (P)

aqrs 2q0brs Aqrs Fqrs

u(t0 , x; p) ´

l0

L

´

m0

M

blmTl ()Tm (P)

t At

Bt

, x Ax

Bx

, P p Ap

Bp

At (t1 t0 ) / 2, Ax (x1 x0 ) / 2, Ap (p1 p0 ) / 2

Bt (t1 t0 ) / 2, Bx (x1 x0 ) / 2, Bp (p1 p0 ) / 2

The Weighted Residual of the GWRM is given by

with

The TP-WRM coefficients are now obtained from the nonlinear system of algebraic equations

The initial state is expanded as

where

RFP Workshop Oct 2008 – J Scheffel 7

The Generalized Weighted Spectral Method (GWRM)COMMENTS

• Boundary conditions are transformed into Chebyshev space (using Chebyshev interpolation); they enter at the highest modal numbers of the spatial Chebyshev coefficients.

• All computations are in Chebyshev space.

• Efficient procedures for integration, differentiation and nonlinear products in Chebyshev space have been developed.

• Chebyshev polynomial expansions have several desirable qualities:

- converge rapidly to the approximated function- are real and can be converted to ordinary polynomials and

vice versa- minimax property - they are the most economical polynomial

representation- can be used for non-periodic boundary conditions

RFP Workshop Oct 2008 – J Scheffel 8

Simple GWRM example - the linear diffusion equation

Boundary conditions enter here

u

t

2u

x2

a0rs 2(brs Aqrsq1

K 1

( 1)q )

aqrs Aqrs

Aqrs (2 s0A s1B )2Bt

qk(k2 r2 )[aq 1,k ,s aq1,k ,s ]

kr2k r even

L

S ´ aqls

l0

L 2

( 1)l , S ´ aqls

l0

L 2

b0s 1 / 4, b2s 1 / 8

u(t,0)u(t,1)0

u(0, x)x(1 x)

for 1≤ q ≤ K + 1

aq,L ,s (S S ) / 2

aq,L 1,s (S S ) / 2

The coefficients aqrs are determinedby iterations, using a root solver.

u(t, x; p) ´

k0

K

´

l0

L

´

m0

M

aklmTk ( )Tl ()Tm (P)

Solution to be determined:

with

RFP Workshop Oct 2008 – J Scheffel 9

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 10

ODE example

Light a match – a model of flame propagation:

dy

dty 2 y 3

y(0), 0t 2 /

y – flame radius

= 0.05; # Chebyshev modes K = 20, # time domains Nt = 1, error = 0.01

green - exact solution

RFP Workshop Oct 2008 – J Scheffel 11

ODE example, cont’d

= 0.01 # Chebyshev modes K = 8 # time domains Nt = 10 error = 0.01

= 0.0001 – Stiff problem! # Chebyshev modes K = 5 # time domains Nt = 100 error = 0.1Adaptive grid should be usedfor improved accuracy.

RFP Workshop Oct 2008 – J Scheffel 12

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 13

SIR - a globally convergent root solver

The GWRM - well adapted for iterative methods for two reasons:1) Basic Chebyshev coefficient equations are of the standard iterative form

2) Initial estimate of solution vector can be chosen sufficiently close to the solution by reducing the solution time interval

x (x)

Instead of using direct iteration, the Semi-Implicit Root solver (SIR) finds the roots to the equations

xm mnn1

N

(xn n (x))m (x)m (x;A)

or, in matrix form

x A(x (x))(x)(x;A)

RFP Workshop Oct 2008 – J Scheffel 14

SIR - a globally convergent root solver

are finite and is controlled; it produces limited step lengths, quasi-monotonous convergence; and approaches zero after some initial iterations.Newton’s method is a special case of the present method, when all

The system

m / xn

m / xn 0 m n m / xm

x A(x (x))(x)(x;A)

has the same solutions as the original system, but contains free parameters in the formof the components of the matrix A. The parameters can be chosen to control

the gradients of the hypersurfaces . Adjusting these parameters, global, quasi-monotonous and superlinear convergence is attained. In SIR,

• Rapid second order convergence is generally approached after some iteration steps.• Relationship to Newton’s method - approximately similar numerical work; inversion of a Jacobian matrix at each iteration step.

whereas

m / xn 0

RFP Workshop Oct 2008 – J Scheffel 15

Newton’s method2D example

f (x i

i

i(x))2

solution

RFP Workshop Oct 2008 – J Scheffel 16

Newton’s method with linesearch2D example

local minimumf ≠ 0

RFP Workshop Oct 2008 – J Scheffel 17

SIR2D

example

finds solution

RFP Workshop Oct 2008 – J Scheffel 18

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 19

Accuracy - the Burger equation

u

t u

u

x

2u

x2

u(0, x)x(1 x)

u(t,0)u(t,1)0

0.01, tmax 10

Burger’s nonlinear equation (parabolic)

Solution compared to Lax-Wendroff (explicit time differencing):GWRM parameters - (S,M,N) = (2,7,6), 13 iterations.L-W marginally stable parameters -

Parameters:

t 0.01,x 0.014

TP-WRM solution, usingtwo spatial subdomains

TP-WRM solution error, ascompared to exact solution

Result: GWRM 50 % faster than L-W for same accuracy.

10-3

RFP Workshop Oct 2008 – J Scheffel 20

Initial condition(x) = x(1 - x) and boundary condition u(t,0;v) = u(t,1;v) = 0. Solution shown versus x and v at time t = 2.5. Here K = 8, L = 10, and M = 2.

GWRM Burger equation solution, including viscosity dependence u = u(t,x;v)

RFP Workshop Oct 2008 – J Scheffel 21

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 22

Efficiency

2u

t 2

2u

x2 f (t, x) f (t, x)A( 2 2 )sin(t)sin(x)

Parameters: 1, A 10, 2 / tmax , 3 , tmax 30

Wave equation, forced (hyperbolic)

Exact solution

GWRM solution(averages out

fast time scale)

u(t, x)cos(3 0.5t)sin(3 x) Asin(t)sin(x)

(slow + rapid time scale)

RFP Workshop Oct 2008 – J Scheffel 23

Forced wave equation solutions u(t,x0) for fixed x = x0

GWRM(K,L) = (6,8)

Crank-Nicholson, implicit∆x = 1/30, 100 time steps

Lax-Wendroff, explicit∆x = 1/30, 900 time steps

Efficiency

RFP Workshop Oct 2008 – J Scheffel 24

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 25

Discussion

GWRM work so far:

• The time- and parameter-generalized weighted residual method, J. Scheffel, 2008. (GWRM method outlined)

• Semi-analytical solution of initial-value problems, D. Lundin, 2006. (Resistive MHD stability of RFP and z-pinch)

• Application of the time- and parameter generalized weighted reidual method to systems of nonlinear equations, D. Jackson, 2007. (Navier-Stokes equations, Rayleigh-Taylor instability)

• Further development and implementation of the GWRM A. Mirza, ongoing Ph D studies (Application of GWRM to nonlinear

resistive MHD)

SIR:

• Solution of systems of nonlinear equations, a semi-implicit approach,

J. Scheffel, 2006. (SIR outlined)

• Studies of a semi-implicit root solver, C. Håkansson, M Sc Thesis. (Efficient SIR compared to other

methods)

RFP Workshop Oct 2008 – J Scheffel 26

Discussion (cont’d)

• The GWRM is shown to be accurate for spatially smooth solutions - convergence including sharp gradients should be further studied.

• Efficiency is central; SIR involves Jacobian matrix inversion of Chebyshev coefficient eqs - N eqs takes O[N3] operations.

• Methods to improve efficiency have been developed - temporal subdomains and spatial subdomain techniques using overlapping domains.

• Further benchmarking of efficiency for MHD relevant test problems should be carried out as well as corresponding comparisons with implicit methods.

• SIR efficiency and linking to GWRM is presently being optimized.

RFP Workshop Oct 2008 – J Scheffel 27

OUTLINE

• What is the GWRM?• ODE example

• SIR - a globally convergent root solver• Accuracy

• Efficiency• Discussion

• Conclusion and prospects

RFP Workshop Oct 2008 – J Scheffel 28

Conclusion and prospects A fully spectral method, the generalized weighted residual method (GWRM),

for solution of initial value partial differential equations, has been outlined.

By representing all time, spatial and physical parameter domains by Chebyshev series, semi-analytical solutions can be obtained as ordinary polynomials. (“Semi-analytical”: expansion in basis functions with numerical coefficients.)

Computed solutions thus contain r- t- and parameter dependence explicitly.

The method is global and avoids time step limitations.

Spectral coefficients are found by iterative solution of a linear or nonlinear system of algebraic equations, for which an efficient semi-implicit root solver

(SIR) has been developed.

Accuracy is explicitly controlled by the number of modes and subdomains used.

To improve efficiency, a spatial subdomain approach has been developed.

Problems in fluid mechanics and MHD will be addressed.

Future applications involve studies of nonlinear plasma instabilities at finite plasma pressure in stochastic magnetic field geometries, in particular operational limits in reversed-field pinches.

RFP Workshop Oct 2008 – J Scheffel 29

Thank you for your attention!