Evaluate the MHD3D functional and its derivative
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private, | ALLOCATABLE | :: | pres_GP(:) |
mass profile |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | chiPrime_GP(:) |
s derivative of poloidal flux |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | phiPrime_GP(:) |
s derivative of toroidal flux |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | phiPrime2_GP(:) |
s derivative of toroidal flux : |Phi'(s)|^2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | X1_IP_GP(:,:) |
evaluation of X1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | X2_IP_GP(:,:) |
evaluation of X2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | J_h(:,:) |
Jacobian of the mapping h (X1,X2,zeta) -->(x,y,z) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | J_p(:,:) |
Jacobian of poloidal mapping: dX1_dsdX2_dtheta - dX2_dsdX1_theta |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | sJ_h(:,:) |
1/J_h |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | sJ_p(:,:) |
1/J_p |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | detJ(:,:) |
global Jacobian: detJ=sqrt(det g)=J_h*J_p ) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | sdetJ(:,:) |
1/detJ |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX1_ds(:,:) |
radial derivative of X1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX2_ds(:,:) |
radial derivative of X2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX1_dthet(:,:) |
theta derivative of X1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX2_dthet(:,:) |
theta derivative of X2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dLA_dthet(:,:) |
theta derivative of lambda |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX1_dzeta(:,:) |
zeta derivative of X1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dX2_dzeta(:,:) |
zeta derivative of X2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | dLA_dzeta(:,:) |
zeta derivative of lambda |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | b_thet(:,:) |
b_thet=(iota-dlamba_dzeta,1+dlambda_dtheta), normalized contravariant magnetic field |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | b_zeta(:,:) |
b_zeta=1+dlambda_dtheta, normalized contravariant magnetic field |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | sJ_bcov_thet(:,:) |
covariant normalized magnetic field, scaled with 1/J: |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | sJ_bcov_zeta(:,:) |
sJ_bcov_alpha=1/detJ (g_{alpha,theta} b_theta + g_{alpha,zeta) b_zeta) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | bbcov_sJ(:,:) |
(b^alphag_{alpha,beta}b^beta)/(detJ) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_tt(:,:) |
metric tensor g_(theta,theta) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_tz(:,:) |
metric tensor g_(theta,zeta )=g_(zeta,theta) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_zz(:,:) |
metric tensor g_(zeta ,zeta ) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_t1(:,:) |
metric tensor dq^i_dthet G^i1 (sum over i=1,2,3) |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_t2(:,:) |
metric tensor dq^i_dthet G^i2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_z1(:,:) |
metric tensor dq^i_dzeta G^i1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | g_z2(:,:) |
metric tensor dq^i_dzeta G^i2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | Jh_dq1(:,:) |
hmap dJh/dq1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | Jh_dq2(:,:) |
hmap dJh/dq2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gtt_dq1(:,:) |
hmap dg_{thet,theta}/dq1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gtz_dq1(:,:) |
hmap dg_{theta,zeta}/dq1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gzz_dq1(:,:) |
hmap dg_{zeta,zeta}/dq1 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gtt_dq2(:,:) |
hmap dg_{thet,theta}/dq2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gtz_dq2(:,:) |
hmap dg_{theta,zeta}/dq2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | gzz_dq2(:,:) |
hmap dg_{zeta,zeta}/dq2 |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | Gh11(:,:) |
hmap G_{11} |
||
| real(kind=wp), | private, | ALLOCATABLE | :: | Gh22(:,:) |
hmap G_{22} |
||
| integer, | private | :: | nGP | ||||
| integer, | private | :: | nGP_str | ||||
| integer, | private | :: | nGP_end | ||||
| integer, | private | :: | mn_IP | ||||
| real(kind=wp), | private | :: | dthet_dzeta | ||||
| real(kind=wp), | private, | ALLOCATABLE | :: | w_GP(:) | |||
| integer, | private | :: | nElems | ||||
| integer, | private | :: | nElems_str | ||||
| integer, | private | :: | nElems_end | ||||
| integer, | private | :: | degGP | ||||
| real(kind=wp), | private, | ALLOCATABLE | :: | s_GP(:) | |||
| real(kind=wp), | private, | ALLOCATABLE | :: | zeta_IP(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX1_tt(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX1_tz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX1_zz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX1(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX1_ss(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX2_tt(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX2_tz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX2_zz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX2(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DX2_ss(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DLA_tt(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DLA_tz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | DLA_zz(:) | |||
| real(kind=wp), | private, | CONTIGUOUS, POINTER | :: | D_buf(:,:) |
2d array container for all 1d array abpove (is the one allocated) |
||
| class(sll_c_spline_matrix), | private, | ALLOCATABLE | :: | precond_X1(:) |
container for preconditioner matrices |
||
| class(sll_c_spline_matrix), | private, | ALLOCATABLE | :: | precond_X2(:) |
container for preconditioner matrices |
||
| class(sll_c_spline_matrix), | private, | ALLOCATABLE | :: | precond_LA(:) |
container for preconditioner matrices |
Evaluate 3D MHD energy NOTE: set callEvalaux >0 if not called before for the same Uin !!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_sol_var_MHD3D), | intent(in) | :: | Uin |
input solution |
||
| logical, | intent(in) | :: | callEvalAux |
set True if evalAux was not called on Uin |
||
| integer, | intent(inout) | :: | JacCheck |
if 1 on input: abort if detJ<0. if 2 on input, no abort, unchanged if detJ>0 ,return -1 if detJ<=0 |
total integral of MHD3D energy W_MHD3D= int ( p/(gamma-1) + 1/(2mu_0) |B|^2) detJ ds dtheta dzeta
Initialize Module
Initialise Profiles at GP!!!
Evaluate auxiliary variables at input state, writes onto module variables!!!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_sol_var_MHD3D), | intent(in) | :: | Uin |
input solution |
||
| integer, | intent(inout) | :: | JacCheck |
if 1 on input: abort if detJ<0. if 2 on input, no abort, unchanged if detJ>0 ,return -1 if detJ<=0 |
Evaluate total volume and average surface
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_sol_var_MHD3D), | intent(in) | :: | Uin |
input solution |
||
| real(kind=wp), | intent(out) | :: | vol |
total integral of the volume |
||
| real(kind=wp), | intent(out) | :: | surfAvg |
average polodial surface |
Evaluate the variation of the Energy = Force... F_j=-(D_U W(U))_j = -DW(u_h)*testfunc_j NOTE: set callEvalaux TRUE if not called before for the same Uin !!
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_sol_var_MHD3D), | intent(in) | :: | Uin |
input solution |
||
| logical, | intent(in) | :: | callEvalAux |
set True if evalAux was not called on Uin |
||
| integer, | intent(inout) | :: | JacCheck |
if 1 on input: abort if detJ<0. if 2 on input, no abort, unchanged if detJ>0 ,return -1 if detJ<=0 |
||
| class(t_sol_var_MHD3D), | intent(inout) | :: | F_MHD3D |
variation of the energy projected onto the basis functions of Uin |
||
| logical, | intent(in), | optional | :: | noBC |
Applies strong boundary condition to force DOF
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | whichVar |
=1: X1, =2: X2, =3: LA |
||
| class(t_sol_var_MHD3D), | intent(inout) | :: | F_MHD3D |
variation of the energy projected onto the basis functions of Uin |
Build preconditioner matrices for X1,X2,LA and factorize, for all modes
the matrix is only radially dependent, and has the form
K_ij = int(s,0,1) d/ds sbase_i(s) (s) + |Phi'(s)|^2 (-m^2
Apply preconditioner matrix for single mode of one variable
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nBase |
length of inout vector |
||
| type(sll_t_spline_matrix_banded), | intent(in) | :: | precond |
preconditioner matrix (factorized!) |
||
| real(kind=wp), | intent(inout) | :: | F_inout(1:nBase) |
apply preconditioner on this force vector |
Finalize Module