! GEMM does in general Y = fa A^?B^? + fy Y
! with structure: (m x n) = (m x k) (k x n)
! Y=A B : DGEMM('N','N',m,n,k,fa,Amat ,m, Bmat,k, fy,Y,m)
! Y=A^TB : DGEMM('T','N',m,n,k,fa,Amat ,k, Bmat,k, fy,Y,m)
! Y=A B^T : DGEMM('N','T',m,n,k,fa,Amat ,m, Bmat,n, fy,Y,m)
! Y=A^T*B^T : DGEMM('T','T',m,n,k,fa,Amat ,k, Bmat,n, fy,Y,m)
! SIMPLE INTERFACE FOR DGEMM, specifying nrows/ncols of mat A and nrows/ncols of mat B (for any transpose!)
! GEMM does in general Y = fa A^?B^? + fy Y
! with structure: (m x n) = (m x k) (k x n)
! Y=A B : DGEMM('N','N',m,n,k,fa,Amat ,m, Bmat,k, fy,Y,m)
! Y=A^TB : DGEMM('T','N',m,n,k,fa,Amat ,k, Bmat,k, fy,Y,m)
! Y=A B^T : DGEMM('N','T',m,n,k,fa,Amat ,m, Bmat,n, fy,Y,m)
! Y=A^T*B^T : DGEMM('T','T',m,n,k,fa,Amat ,k, Bmat,n, fy,Y,m)
Nodes of different colours represent the following:
Solid arrows point from a file to a file which it depends on. A file
is dependent upon another if the latter must be compiled before the former
can be.
Nodes of different colours represent the following:
Solid arrows point from a file to a file which it depends on. A file
is dependent upon another if the latter must be compiled before the former
can be.
Source Code
!===================================================================================================================================! Copyright (c) 2025 GVEC Contributors, Max Planck Institute for Plasma Physics! License: MIT!===================================================================================================================================#include "defines.FPP"!===================================================================================================================================!>!!# Module ** MHD3D Variables **!!!!!!!===================================================================================================================================MODULE MODgvec_MHD3D_Vars! MODULESUSE MODgvec_Globals,ONLY:PI,wp,Unit_stdOut,abortUSE MODgvec_sgrid,ONLY:t_sgridUSE MODgvec_base,ONLY:t_baseUSE MODgvec_Sol_Var_MHD3D,ONLY:t_sol_var_MHD3DUSE MODgvec_hmapUSE MODgvec_rProfile_base,ONLY:c_rProfileUSE MODgvec_boundaryFromFile,ONLY:t_boundaryFromFileIMPLICIT NONEPUBLIC!-----------------------------------------------------------------------------------------------------------------------------------! derived type variables!-----------------------------------------------------------------------------------------------------------------------------------CLASS(t_base),ALLOCATABLE,TARGET::X1_base!! container for base of variable X1CLASS(t_base),ALLOCATABLE,TARGET::X2_base!! container for base of variable X2CLASS(t_base),ALLOCATABLE,TARGET::LA_base!! container for base of variable lambdaTYPE(t_sgrid)::sgrid!! only one grid up to nowINTEGER::nDOF_X1!! total number of degrees of freedom, sBase%nBase * fbase%mn_modesINTEGER::nDOF_X2!! total number of degrees of freedom, sBase%nBase * fbase%mn_modesINTEGER::nDOF_LA!! total number of degrees of freedom, sBase%nBase * fbase%mn_modesINTEGER,ALLOCATABLE::X1_BC_type(:,:)!! X1 var: BC type for axis and edge for each mode (1:2,1:modes) (1=axis,2=edge)INTEGER,ALLOCATABLE::X2_BC_type(:,:)!! X2 var: BC type for axis and edge for each mode (1:2,1:modes) (1=axis,2=edge)INTEGER,ALLOCATABLE::LA_BC_type(:,:)!! LA var: BC type for axis and edge for each mode (1:2,1:modes) (1=axis,2=edge)#ifdef PP_WHICH_HMAPTYPE(PP_T_HMAP),ALLOCATABLE::hmap!! type containing subroutines for evaluating the map h (Omega_p x S^1) --> OmegaTYPE(PP_T_HMAP_AUXVAR),ALLOCATABLE::hmap_auxvar(:)!! auxiliary variables for hmap#elseCLASS(PP_T_HMAP),ALLOCATABLE::hmap!! type containing subroutines for evaluating the map h (Omega_p x S^1) --> OmegaCLASS(PP_T_HMAP_AUXVAR),ALLOCATABLE::hmap_auxvar(:)!! auxiliary variables for hmap#endif!===================================================================================================================================INTEGER::which_init!! select initialization. 0: only using input parameter, 1: using a VMEC equilibriumINTEGER::which_hmapLOGICAL::init_fromBCOnly!! default=TRUE, for VMEC only, if set false: initial mapping is interpolated for s=0..1LOGICAL::init_with_profile_pressure!! default=FALSE, if True, overwrite profile from VMEC ini using profile from parameterfileLOGICAL::init_with_profile_iota!! default=FALSE, if True, overwrite profile from VMEC ini using profile from parameterfileLOGICAL::init_average_axis!! default=FALSE, if true, use outer boundary to estimate axis position (center of closed line)LOGICAL::boundary_perturb!! default=FALSE, if true, mapping is perturbed with a given modal perturbation of the boundary (X1pert_b,X2pert_b)INTEGER::boundary_perturb_typeINTEGER,PARAMETER::BLEND_LEGACY=0,BLEND_COSM=1!! types of blending functions for boundary_perturb_typeREAL(wp)::boundary_perturb_depth!! depth of boundary perturbationREAL(wp)::average_axis_move(2)!! used if init_average_axis=True to additionally move axis in X1,X2INTEGER::init_BC!! active if init_fromBC_only=T: -1: keep vmec axis and boundary (default), 0: keep vmec boundary, overwrite axis, 1: keep vmec axis, overwrite boundary, 2: overwrite axis and boundaryINTEGER::getBoundaryFromFile!! -1: off, 1: read from specific netcdf fileLOGICAL::init_LA!! false: lambda=0 at initialization, true: lambda is computed from initial mappingINTEGER::PrecondType!! -1: off: 1: ..! input parameters for minimizationINTEGER::MinimizerType!! which mimimizer to use: 0: gradient descent (default) , 10: accelerated gradient descentINTEGER::maxIter!! maximum iteration count for minimizationINTEGER::outputIter!! number of iterations after which output files are writtenINTEGER::logIter!! number of iterations after which a screen log is writtenINTEGER::nlogScreen!! number of log outputs after a screen output is writtenREAL(wp)::minimize_tol!! absolute tolerance for minimization of functionalREAL(wp)::start_dt!! starting time step, is adapted during iterationREAL(wp)::dW_allowed!! for minimizer, accept step if dW<dW_allowed*W_MHD(iter=0) default +10e-10LOGICAL::DoCheckDistance!! TRUE: check distance between solutions of two log output states (default: false)LOGICAL::DoCheckAxis!! TRUE: check axis position (default: true)! input parameters for functionalREAL(wp)::Phi_edge!! toroidal flux at the last flux surface of the domain!constantsREAL(wp)::mu_0!! permeabilityREAL(wp)::gamm!! isentropic exponent, if gamma /= 0 pres ~ mass profileREAL(wp)::sgammM1!! =1/(gamm-1)REAL(wp),ALLOCATABLE::X1_b(:)!! fourier modes of the edge boundary for X1REAL(wp),ALLOCATABLE::X2_b(:)!! fourier modes of the edge boundary for X2REAL(wp),ALLOCATABLE::LA_b(:)!! fourier modes of the edge boundary for LAREAL(wp),ALLOCATABLE::X1_a(:)!! fourier modes of the axis boundary for X1REAL(wp),ALLOCATABLE::X2_a(:)!! fourier modes of the axis boundary for X2REAL(wp),ALLOCATABLE::X1pert_b(:)!! fourier modes of the boundary perturbation for X1 (if boundary_perturb=T)REAL(wp),ALLOCATABLE::X2pert_b(:)!! fourier modes of the boundary perturbation for X2 (if boundary_perturb=T)CLASS(t_boundaryFromFile),ALLOCATABLE::BFF!! class for reading a boundary from fileCLASS(c_rProfile),ALLOCATABLE::iota_profileCLASS(c_rProfile),ALLOCATABLE::pres_profileCLASS(c_rProfile),ALLOCATABLE::Phi_profileCLASS(c_rProfile),ALLOCATABLE::chi_profile!===================================================================================================================================END MODULE MODgvec_MHD3D_Vars