V3FIT
Functions/Subroutines
siesta_force Module Reference

Compute the JxB - Grad(p) covariant force components. The plasma is in equilibrium when the force of the magnetic pressure balances the plasma pressure. More...

Functions/Subroutines

subroutine update_force
 Update MHD forces on full radial mesh. More...
 
subroutine incfields (jbsupsmnh, jbsupumnh, jbsupvmnh, jpmnh,
 Compute nonlinear or linearized contravariant magnetic field components and pressure in real space. More...
 
subroutine lorentz (bsupsijf, bsupuijf, bsupvijf,
 Compute covariant (sub) real-space components of the Lorentz K X B force. More...
 
subroutine getmhdforce (fsubsmnf, fsubumnf, fsubvmnf, pijh,
 Compute covariant (sub) components of the MHD force J X B - grad(p). More...
 
subroutine initpardamping (parscale, pardamp)
 Compute scaling factors for parallel flow damping. More...
 
subroutine get_force_harmonics (pardamp, f_smnf, f_umnf, f_vmnf, pa
 Final computation of the MHD covariant Fourier force components. More...
 
subroutine addpardamping (pardamp, f_smnf, f_umnf, f_vmnf,
 Add parallel flow damping terms to forces (for Hessian calculation) to suppress null space at resonances. More...
 

Detailed Description

Compute the JxB - Grad(p) covariant force components. The plasma is in equilibrium when the force of the magnetic pressure balances the plasma pressure.

F = J X B - Grad(p) = 0                                               (1)

where J is the current density. Updates for B (dB) and p (dp) were computed in siesta_bfield and siesta_pressure, respectively.

B_i+1 = B_i + dB (2a)

p_i+1 = p_i + dp (2b)

Note that the magnetic field and pressure terms contain a Jacobian factor. Updated current density can be found from the updated magnetic field.

J = Curl(B)/mu0 (3)

Actual computation of the contravariant current components is implimented in cv_currents. The curvilinear coordinates, the J X B term becomes

(J X B)_s = (K^u*B^v - K^v*B^u) (4a)

(J X B)_u = (K^v*B^s - K^s*B^v) (4b)

(J X B)_v = (K^s*B^u - K^u*B^s) (4c)

where K^i = sqrt(g) J^i.

Function/Subroutine Documentation

◆ addpardamping()

subroutine siesta_force::addpardamping ( real (dp), dimension(:,:), intent(in)  pardamp,
real (dp), dimension(:,:,:), intent(inout)  f_smnf,
real (dp), dimension(:,:,:), intent(inout)  f_umnf,
real (dp), dimension(:,:,:), intent(inout)  f_vmnf 
)

Add parallel flow damping terms to forces (for Hessian calculation) to suppress null space at resonances.

Compute parallel (to B) damping force and add it to (linearized) forces to suppress null space in preconditioner.

Parameters
[in,out]f_smnfCovariant component of the mhd force in the s direction.
[in,out]f_umnfCovariant component of the mhd force in the u direction.
[in,out]f_vmnfCovariant component of the mhd force in the v direction.
[in]jvsupsmnfContravariant displacement in the s direction.
[in]jvsupsmnfContravariant displacement in the u direction.
[in]jvsupsmnfContravariant displacement in the v direction.

Definition at line 784 of file siesta_force.f90.

◆ get_force_harmonics()

subroutine siesta_force::get_force_harmonics ( real (dp), dimension(:,:), intent(inout), allocatable  pardamp,
real (dp), dimension(:,:,:), intent(inout)  f_smnf,
real (dp), dimension(:,:,:), intent(inout)  f_umnf,
real (dp), dimension(:,:,:), intent(inout)  f_vmnf,
  pa 
)

Final computation of the MHD covariant Fourier force components.

Add pressure gradients and parallel damping (to Hessian), and scale and print boundary values.

Parameters
[in,out]pardampParallel damping.
[in,out]f_smnfCovariant component of the mhd force in the s direction.
[in,out]f_umnfCovariant component of the mhd force in the u direction.
[in,out]f_vmnfCovariant component of the mhd force in the v direction.
[in]parityParity of the fourier components.

Definition at line 595 of file siesta_force.f90.

◆ getmhdforce()

subroutine siesta_force::getmhdforce ( real (dp), dimension(:,:,:), intent(inout)  fsubsmnf,
real (dp), dimension(:,:,:), intent(inout)  fsubumnf,
real (dp), dimension(:,:,:), intent(inout)  fsubvmnf,
real (dp), dimension(:,:,:), intent(in), allocatable  pijh 
)

Compute covariant (sub) components of the MHD force J X B - grad(p).

The MHD forces are sum of Lorentz and pressure gradient forces

F = J X B - Grad(p) (1)

where J is the plasma current density. In curvilinear coodinates, the forces components becomes

F_s = (K^u*B^v - K^v*B^u) - dp/ds (2a)

F_u = (K^v*B^s - K^s*B^v) - dp/du (2b)

F_v = (K^s*B^u - K^u*B^s) - dp/dv (2c)

where K^i = sqrt(g)*J^i . Note this routine works on one parity at a time. When l_linearize is true, calculate the perturbed Force only (Ignores F(xc=0) part). When l_linearize is false, calculate full non-linear force(F(xc=0) part only)

Parameters
[in,out]fsubsmnfCovariant force in the s direction.
[in,out]fsubumnfCovariant force in the s direction.
[in,out]fsubvmnfCovariant force in the s direction.
[in]pijhReal space pressure.
[in,out]KxBsijCovariant component of the lorentz force in the s direction.
[in,out]KxBuijCovariant component of the lorentz force in the u direction.
[in,out]KxBvijCovariant component of the lorentz force in the v direction.
[in,out]pardampParallel damping.
[in]parityParity of the fourier components.

Definition at line 429 of file siesta_force.f90.

◆ incfields()

subroutine siesta_force::incfields ( real (dp), dimension(:,:,:), intent(in), allocatable  jbsupsmnh,
real (dp), dimension(:,:,:), intent(in), allocatable  jbsupumnh,
real (dp), dimension(:,:,:), intent(in), allocatable  jbsupvmnh,
real (dp), dimension(:,:,:), intent(in), allocatable  jpmnh 
)

Compute nonlinear or linearized contravariant magnetic field components and pressure in real space.

Parameters
[in]jbsupsmnhContravariant B field in the s direction.
[in]jbsupumnhContravariant B field in the u direction.
[in]jbsupvmnhContravariant B field in the v direction.
[in]jpmnhPressure on the half grid.
[in]djbsupsmnhContravariant B field perturbation in the s direction.
[in]djbsupumnhContravariant B field perturbation in the u direction.
[in]djbsupvmnhContravariant B field perturbation in the v direction.
[in]djpmnhPressure perturbation.
[out]jbsupsijhReal space contravariant B field in the s direction.
[out]jbsupuijhReal space contravariant B field in the u !direction.
[out]jbsupvijhReal space contravariant B field in the v direction.
[in]iparityFourier parity.

Definition at line 231 of file siesta_force.f90.

◆ initpardamping()

subroutine siesta_force::initpardamping (   parscale,
real (dp), dimension(:,:), intent(inout), allocatable  pardamp 
)

Compute scaling factors for parallel flow damping.

Parameters
[in,out]parscaleScratch array.
[in,out]pardampParallel damping.

Definition at line 536 of file siesta_force.f90.

◆ lorentz()

subroutine siesta_force::lorentz (   bsupsijf,
  bsupuijf,
  bsupvijf 
)

Compute covariant (sub) real-space components of the Lorentz K X B force.

Parameters
[in]bsupsijfContravariant component of the B field in the s direction.
[in]bsupuijfContravariant component of the B field in the u direction.
[in]bsupvijfContravariant component of the B field in the v direction.
[in]ksupsijfContravariant component of the current in the s direction.
[in]ksupuijfContravariant component of the current in the u direction.
[in]ksupvijfContravariant component of the current in the v direction.
[in,out]KxBsijCovariant component of the lorentz force in the s direction.
[in,out]KxBuijCovariant component of the lorentz force in the u direction.
[in,out]KxBvijCovariant component of the lorentz force in the v direction.
[in]fcombControl flag to sum the components with previous values.

Definition at line 348 of file siesta_force.f90.

◆ update_force()

subroutine siesta_force::update_force

Update MHD forces on full radial mesh.

Updates force using the advanced values of B and p obtained from calls to siesta_pressure::update_pres and siesta_bfield::update_bfield Update values of fsub*mn*f stored in quantities. Linearized force is

Flin ~ delta_v

has only the linear part. Not DC part and not non-linear.

Definition at line 70 of file siesta_force.f90.