fields Module

Module for advancing and intitialising all fields-related arrays

Global Routines

Routines for advancing fields in main routine

TODO-GA: move to separate routine Calculations Global



Variables

Type Visibility Attributes Name Initial
logical, public :: fields_updated = .false.

Logicals

logical, private :: fields_initialized = .false.
integer, public :: nfields

EM - to calculate the number of fields that are in the simulation (1 for electrostatic)

logical, private :: fields_initialised = .false.

For the initialisation


Interfaces

public interface get_dchidy

TODO-GA: MOVE

  • private subroutine get_dchidy_4d(phi, apar, bpar, dchidy)

    Compute d/dy and d/dx in (ky,kx) space where <.> is a gyroaverage d/dy = i * ky * J0 * chi d/dx = i * kx * J0 * chi chi = phi - Z/T * vpa * apar There are different routines depending on the size of the input array TODO-GA: maybe separate for EM and electrostatic Compute d/dy in (ky,kx,z,tube) space

    Layouts Parameters Grids Calculations include bpar contribution

    Arguments

    Type IntentOptional Attributes Name
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: phi
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: apar
    complex, intent(in), dimension(:, :, -nzgrid:, :) :: bpar
    complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: dchidy
  • private subroutine get_dchidy_2d(iz, ivmu, phi, apar, bpar, dchidy)

    Compute d/dy in (ky,kx) space

    Layouts Parameters Grids Calculations include bpar contribution

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: iz
    integer, intent(in) :: ivmu
    complex, intent(in), dimension(:, :) :: phi
    complex, intent(in), dimension(:, :) :: apar
    complex, intent(in), dimension(:, :) :: bpar
    complex, intent(out), dimension(:, :) :: dchidy

Subroutines

public subroutine advance_fields(g, phi, apar, bpar, dist, implicit_solve)

This calls the appropriate routines needed to all fields in the main code. This routine calls the appropriate update depending on the effects included in the simulation (e.g. Electrostatic, Full Flux surface effects or Radiatl Variation effects).

Read more…

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: g
complex, intent(out), dimension(:, :, -nzgrid:, :) :: phi
complex, intent(out), dimension(:, :, -nzgrid:, :) :: apar
complex, intent(out), dimension(:, :, -nzgrid:, :) :: bpar
character(len=*), intent(in) :: dist
logical, intent(in), optional :: implicit_solve

public subroutine rescale_fields(target_amplitude)

Rescale fields, including the distribution function

Read more…

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: target_amplitude

private subroutine get_dchidy_4d(phi, apar, bpar, dchidy)

Compute d/dy and d/dx in (ky,kx) space where <.> is a gyroaverage d/dy = i * ky * J0 * chi d/dx = i * kx * J0 * chi chi = phi - Z/T * vpa * apar There are different routines depending on the size of the input array TODO-GA: maybe separate for EM and electrostatic Compute d/dy in (ky,kx,z,tube) space

Read more…

Arguments

Type IntentOptional Attributes Name
complex, intent(in), dimension(:, :, -nzgrid:, :) :: phi
complex, intent(in), dimension(:, :, -nzgrid:, :) :: apar
complex, intent(in), dimension(:, :, -nzgrid:, :) :: bpar
complex, intent(out), dimension(:, :, -nzgrid:, :, vmu_lo%llim_proc:) :: dchidy

private subroutine get_dchidy_2d(iz, ivmu, phi, apar, bpar, dchidy)

Compute d/dy in (ky,kx) space

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(in), dimension(:, :) :: phi
complex, intent(in), dimension(:, :) :: apar
complex, intent(in), dimension(:, :) :: bpar
complex, intent(out), dimension(:, :) :: dchidy

public subroutine get_dchidx(iz, ivmu, phi, apar, bpar, dchidx)

Compute d/dx in (ky,kx) space

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iz
integer, intent(in) :: ivmu
complex, intent(in), dimension(:, :) :: phi
complex, intent(in), dimension(:, :) :: apar
complex, intent(in), dimension(:, :) :: bpar
complex, intent(out), dimension(:, :) :: dchidx

public subroutine init_fields()

Parameters Routined needed to initialise the different field arrays depending on the physics being simulated Allocate arrays such as phi that are needed throughout the simulation

Arguments

None

private subroutine allocate_arrays()

Allocate arrays needed for solving fields for all versions of stella

Read more…

Arguments

None

public subroutine finish_fields()

Parameters Arrays TODO-GA: move apar stuff to EM fields Routines for deallocating arrays fields depending on the physics being simulated TODO-GA: REMOVE TODO-GA: move the above deallocations into 'finish_fields_electromagnetic' when EM is decoupled

Arguments

None