V3FIT
|
This file contains subroutines for allocating and initializing curvilinear magnetic covariant and pressure Fourier harmonics on the half-radial mesh. More...
Functions/Subroutines | |
subroutine | init_quantities |
Intialize quantities. | |
subroutine | init_bfield (jbsupsmnh, jbsupumnh, jbsupvmnh, |
Initialized magnetic field. More... | |
subroutine | recompute_lambda (lmns, lmnc, jacobh, orthonorm, |
Recompute lambda on the SIESTA mesh. More... | |
subroutine | alloc_quantities |
Allocates dependant variables. More... | |
subroutine | dealloc_quantities |
Deallocates dependant variables. More... | |
subroutine | toupper_forces |
Routine to compute the contravariant force components. | |
subroutine | gatherfields |
Gather fields from all processors if running in parallel. | |
subroutine | gather_fields (jbsupsmnh, jbsupumnh, jbsupvmnh, jpmnh) |
Gather fields for a partity. More... | |
subroutine | surfaverage (average, q3d, nsmin, nsmax) |
Get the surface average of quantity. More... | |
Variables | |
real(dp) | b_factor |
Magnetic scaling factor to scale internal energy to 1. | |
real(dp) | p_factor |
Pressure scaling factor to scale internal energy to 1. | |
real(dp) | signjac |
Sign of the jacobian. | |
real(dp) | wp |
Energy due to the pressure. | |
real(dp) | wb |
Energy due to the magnetic field. | |
real(dp) | wp0 |
Initial pressure. | |
real(dp), dimension(:,:,:), allocatable | jbsupsmnsh |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | jbsupumnch |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | jbsupvmnch |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), allocatable | jpmnch |
Fouier amplitudes of the pressure and jacobian for stellarator symmetric parity. | |
real(dp), dimension(:,:,:), allocatable | ksupsmnsf |
Fouier amplitudes of the contravariant current for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | ksupumncf |
Fouier amplitudes of the contravariant current for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | ksupvmncf |
Fouier amplitudes of the contravariant current for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), allocatable | djpmnch |
Fouier amplitudes of the pressure perturbation and jacobian for stellarator symmetric parity. | |
real(dp), dimension(:,:,:), allocatable | djbsupsmnsh |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | djbsupumnch |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | djbsupvmnch |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | jvsupsmncf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | jvsupumnsf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | jvsupvmnsf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | fsubsmncf |
Fouier amplitudes of the covariant force for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | fsubumnsf |
Fouier amplitudes of the covariant force for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | fsubvmnsf |
Fouier amplitudes of the covariant force for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | fsupsmncf |
Fouier amplitudes of the contravariant force for stellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | fsupumnsf |
Fouier amplitudes of the contravariant force for stellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | fsupvmnsf |
Fouier amplitudes of the contravariant force for stellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), allocatable | jbsupsmnch |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator asymmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | jbsupumnsh |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator asymmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | jbsupvmnsh |
Fouier amplitudes of the contravariant magnetic field and jacobian for stellarator asymmetric parity in the v direction. | |
real(dp), dimension(:,:,:), allocatable | jpmnsh |
Fouier amplitudes of the pressure and jacobian for stellarator asymmetric parity. | |
real(dp), dimension(:,:,:), allocatable | ksupsmncf |
Fouier amplitudes of the contravariant current for stellarator asymmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | ksupumnsf |
Fouier amplitudes of the contravariant current for stellarator asymmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | ksupvmnsf |
Fouier amplitudes of the contravariant current for stellarator asymmetric parity in the v direction. | |
real(dp), dimension(:,:,:), allocatable | djpmnsh |
Fouier amplitudes of the pressure perturbation and jacobian for stellarator asymmetric parity. | |
real(dp), dimension(:,:,:), allocatable | djbsupsmnch |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for astellarator symmetric parity in the s direction. | |
real(dp), dimension(:,:,:), allocatable | djbsupumnsh |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for astellarator symmetric parity in the u direction. | |
real(dp), dimension(:,:,:), allocatable | djbsupvmnsh |
Fouier amplitudes of the contravariant magnetic field perturbation and jacobian for astellarator symmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | jvsupsmnsf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator asymmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | jvsupumncf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator asymmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | jvsupvmncf |
Fouier amplitudes of the contravariant displacement vector and jacobian for stellarator asymmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | fsubsmnsf |
Fouier amplitudes of the covariant force for stellarator asymmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | fsubumncf |
Fouier amplitudes of the covariant force for stellarator asymmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | fsubvmncf |
Fouier amplitudes of the covariant force for stellarator asymmetric parity in the v direction. | |
real(dp), dimension(:,:,:), pointer | fsupsmnsf |
Fouier amplitudes of the contravariant force for stellarator asymmetric parity in the s direction. | |
real(dp), dimension(:,:,:), pointer | fsupumncf |
Fouier amplitudes of the contravariant force for stellarator asymmetric parity in the u direction. | |
real(dp), dimension(:,:,:), pointer | fsupvmncf |
Fouier amplitudes of the contravariant force for stellarator asymmetric parity in the v direction. | |
real(dp), dimension(:,:,:,:), allocatable | pwr_spec_s |
Initial power spectrum storage for stellarator symmetric parity. | |
real(dp), dimension(:,:,:,:), allocatable | pwr_spec_a |
Initial power spectrum storage for stellarator asymmetric parity. | |
real(dp), dimension(:,:,:), allocatable | jvsupsijf |
Real space contravariant displacement vector in the s direction. | |
real(dp), dimension(:,:,:), allocatable | jvsupuijf |
Real space contravariant displacement vector in the u direction. | |
real(dp), dimension(:,:,:), allocatable | jvsupvijf |
Real space contravariant displacement vector in the v direction. | |
real(dp), dimension(:,:,:), allocatable | jacobh |
Real space jacobian on the half grid. | |
real(dp), dimension(:,:,:), allocatable | jacobf |
Real space jacobian on the full grid. | |
real(dp), dimension(:,:,:), allocatable | wint |
Volumn integration element. | |
real(dp), dimension(:,:,:), allocatable | bsupsijf0 |
Unperturbed realspace contravariant magnetic field in the s direction. | |
real(dp), dimension(:,:,:), allocatable | bsupuijf0 |
Unperturbed realspace contravariant magnetic field in the v direction. | |
real(dp), dimension(:,:,:), allocatable | bsupvijf0 |
Unperturbed realspace contravariant magnetic field in the u direction. | |
real(dp), dimension(:,:,:), allocatable | bsupsijh0 |
Unperturbed half grid realspace contravariant magnetic field in the s direction. | |
real(dp), dimension(:,:,:), allocatable | bsupuijh0 |
Unperturbed half grid realspace contravariant magnetic field in the u direction. | |
real(dp), dimension(:,:,:), allocatable | bsupvijh0 |
Unperturbed half grid realspace contravariant magnetic field in the v direction. | |
real(dp), dimension(:,:,:), allocatable | bsupsijf |
Perturbed full grid realspace contravariant magnetic field in the s direction. | |
real(dp), dimension(:,:,:), allocatable | bsupuijf |
Perturbed full grid realspace contravariant magnetic field in the u direction. | |
real(dp), dimension(:,:,:), allocatable | bsupvijf |
Perturbed full grid realspace contravariant magnetic field in the v direction. | |
real(dp), dimension(:,:,:), allocatable | bsubsijf |
Perturbed full grid realspace covariant magnetic field in the s direction. | |
real(dp), dimension(:,:,:), allocatable | bsubuijf |
Perturbed full grid realspace covariant magnetic field in the u direction. | |
real(dp), dimension(:,:,:), allocatable | bsubvijf |
Perturbed full grid realspace covariant magnetic field in the v direction. | |
real(dp), dimension(:,:,:), allocatable | bsq |
Realspace magnetude of |B|^2. | |
real(dp), dimension(:,:,:), allocatable | ksubsijf |
Perturbed full grid realspace covariant current in the s direction. | |
real(dp), dimension(:,:,:), allocatable | ksubuijf |
Perturbed full grid realspace covariant current in the u direction. | |
real(dp), dimension(:,:,:), allocatable | ksubvijf |
Perturbed full grid realspace covariant current in the v direction. | |
real(dp), dimension(:,:,:), allocatable | ksupsijf0 |
Unperturbed full grid realspace contravariant current in the s direction. | |
real(dp), dimension(:,:,:), allocatable | ksupuijf0 |
Unperturbed full grid realspace contravariant current in the u direction. | |
real(dp), dimension(:,:,:), allocatable | ksupvijf0 |
Unperturbed full grid realspace contravariant current in the v direction. | |
real(dp), dimension(:,:,:), allocatable | ksupsijf |
Perturbed full grid realspace contravariant current in the s direction. | |
real(dp), dimension(:,:,:), allocatable | ksupuijf |
Perturbed full grid realspace contravariant current in the u direction. | |
real(dp), dimension(:,:,:), allocatable | ksupvijf |
Perturbed full grid realspace contravariant current in the v direction. | |
real(dp), dimension(:,:,:), allocatable | pijh0 |
Unperturbed half grid realspace pressure. | |
real(dp), dimension(:,:,:), allocatable | pijh0_du |
Unperturbed half grid realspace u gradient of the pressure. | |
real(dp), dimension(:,:,:), allocatable | pijh0_dv |
Unperturbed half grid realspace v gradient of the pressure. | |
real(dp), dimension(:,:,:), allocatable | pijf0 |
Unperturbed full grid realspace pressure. | |
real(dp), dimension(:,:,:), allocatable | pijf0_ds |
Unperturbed full grid realspace s gradient of the pressure. | |
real(dp), dimension(13) | fbdy |
Saved boundary harmonics. | |
This file contains subroutines for allocating and initializing curvilinear magnetic covariant and pressure Fourier harmonics on the half-radial mesh.
subroutine quantities::alloc_quantities |
Allocates dependant variables.
All variables allocated here are then deallocated in dealloc_quantities, which should be called at the end of the run.
Definition at line 775 of file quantities.f90.
subroutine quantities::dealloc_quantities |
Deallocates dependant variables.
Deallocates all variables in alloc_quantities and some additional variables.
Definition at line 824 of file quantities.f90.
subroutine quantities::gather_fields | ( | real (dp), dimension(:,:,:), intent(inout) | jbsupsmnh, |
real (dp), dimension(:,:,:), intent(inout) | jbsupumnh, | ||
real (dp), dimension(:,:,:), intent(inout) | jbsupvmnh, | ||
real (dp), dimension(:,:,:), intent(inout) | jpmnh | ||
) |
Gather fields for a partity.
[in,out] | jbsupsmnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the s direction. |
[in,out] | jbsupumnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the udirection. |
[in,out] | jbsupvmnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the vdirection. |
[in,out] | jpmnh | Fouier amplitudes of the pressure and jacobian. |
Definition at line 976 of file quantities.f90.
subroutine quantities::init_bfield | ( | jbsupsmnh, | |
jbsupumnh, | |||
jbsupvmnh | |||
) |
Initialized magnetic field.
[in,out] | jbsupsmnh | Contravariant magnetic field in the s direction. |
[in,out] | jbsupumnh | Contravariant magnetic field in the u direction. |
[in,out] | jbsupvmnh | Contravariant magnetic field in the v direction. |
[in] | lmn | Lambda Fourier coeffients. |
[in] | phiph | Radial toroidal flux derivative. |
[in] | chiph | Radial poloidal flux derivative. |
[in] | nsmin | Minimum radial index. |
[in] | nsmax | Maximum radial index. |
[in] | parity | Fourier parity. |
Definition at line 460 of file quantities.f90.
subroutine quantities::recompute_lambda | ( | real (dp), dimension(mnmax,ns), intent(out) | lmns, |
real (dp), dimension(mnmax,ns), intent(out) | lmnc, | ||
real (dp), dimension(nuv,ns), intent(in) | jacobh, | ||
real (dp), dimension(mnmax), intent(in) | orthonorm | ||
) |
Recompute lambda on the SIESTA mesh.
Solves J^s = 0 to find a new lambda consistent on the SIESTA mesh. The J^s component is equal to zero when assuming a nested flux surface solution.
sqrt(g)J^s = Curl(B) = dB_v/du - dB_u/dv = 0 (1)
From the fouier representation, equation 1 becomes.
0 = m*B^mn_v - n*nfp*B^mn_u (2)
The magnetic field can be defined in terms of lambda by
B_ij^u = (chi' - phi'*dlambda_ij/dv)/sqrt(g) (3)
B_ij^v = (phi' + phi'*dlambda_ij/du)/sqrt(g) (4)
Using the Fourier definition equations 3 and 4 become
B_ij^u = (chi' - phi'*SUM(n*nfp*lambda_mn*cos(m*u + n*nfp*v)))/sqrt(g) (5)
B_ij^v = (phi' + phi'*SUM(m*lambda_mn*cos(m*u + n*nfp*v))/sqrt(g) (6)
Where chi' is the radial derivative of the poloidal flux and phi' is the radial derivative of the toroidal flux. The covariant components are then
B^ij_u = g_uu*B_ij^u + g_uv*B_ij^v (7)
B^ij_v = g_uv*B_ij^u + g_vv*B_ij^v (8)
B_u and B_v need to be transformed into Fourier space for use in equation 2.
[out] | lmns | Lambda for stellarator symmetric parity. |
[out] | lmnc | Lambda for stellarator asymmetric parity. |
[in] | jacobh | Jacobian on the half mesh. |
[in] | orthonorm | Fouier normalization factors. |
[in] | phiph | Radial dervative of the toroidal flux. |
[in] | chiph | Radial dervative of the poloidal flux. |
[in] | nsmin | Minimum radial index. |
[in] | nsmax | Maximum radial index. |
Definition at line 580 of file quantities.f90.
subroutine quantities::surfaverage | ( | average, | |
real(dp), dimension(ntheta,nzeta,nsmin:nsmax), intent(in) | q3d, | ||
integer, intent(in) | nsmin, | ||
integer, intent(in) | nsmax | ||
) |
Get the surface average of quantity.
[in,out] | jbsupsmnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the s direction. |
[in,out] | jbsupumnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the udirection. |
[in,out] | jbsupvmnh | Fouier amplitudes of the contravariant magnetic field and jacobian in the vdirection. |
[in,out] | jpmnh | Fouier amplitudes of the pressure and jacobian. |
Definition at line 1009 of file quantities.f90.