Module containing subroutines to initialize externally generated fields, and to calculate the electric and magnetic fields when using an analytical model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=rp), | intent(in), | DIMENSION(3) | :: | a | Vector . |
|
| real(kind=rp), | intent(in), | DIMENSION(3) | :: | b | Vector . |
Cross product
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Y | Toroidal coordinates of each particle in the simulation; Y(1,:) = , Y(2,:) = , Y(3,:) = . |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | E | Electric field components in Cartesian coordinates; E(1,:) = , E(2,:) = , E(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | B | Magnetic field components in Cartesian coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
|
| integer(kind=is), | intent(in), | DIMENSION(:), ALLOCATABLE | :: | flag | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| integer, | intent(in) | :: | pchunk | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | X_X | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | X_Y | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | X_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_X | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_Y | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_X | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_Y | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_Z | ||
| integer(kind=is), | intent(inout), | DIMENSION(pchunk) | :: | flag_cache |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Y | Cylindrical coordinates of each particle in the simulation; Y(1,:) = , Y(2,:) = , Y(3,:) = . |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | E | Electric field components in cylindricalcoordinates; E(1,:) = , E(2,:) = , E(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | B | Magnetic field components in cylindrical coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | gradB | Gradient of magnitude of magnetic field in cylindrical coordinates; gradB(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | curlB | Curl of magnetic field unit vector in cylindrical coordinates |
|
| integer(kind=is), | intent(in), | DIMENSION(:), ALLOCATABLE | :: | flag | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
|
| real(kind=rp), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | PSIp |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Y | Cylindrical coordinates of each particle in the simulation; Y(1,:) = , Y(2,:) = , Y(3,:) = . |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | E | Electric field components in cylindricalcoordinates; E(1,:) = , E(2,:) = , E(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | B | Magnetic field components in cylindrical coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | gradB | Gradient of magnitude of magnetic field in cylindrical coordinates; gradB(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | curlB | Curl of magnetic field unit vector in cylindrical coordinates |
|
| integer(kind=is), | intent(in), | DIMENSION(:), ALLOCATABLE | :: | flag | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
|
| real(kind=rp), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | PSIp |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | pchunk | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_R | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_PHI | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | Bmag | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_PHI |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(inout) | :: | params | |||
| integer(kind=ip), | intent(in) | :: | tt | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(inout), | DIMENSION(params%pchunk) | :: | E_PHI | ||
| real(kind=rp), | intent(in), | DIMENSION(params%pchunk) | :: | Y_R | ||
| real(kind=rp), | intent(in), | DIMENSION(params%pchunk) | :: | Y_Z |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | pchunk | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_R | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_PHI | ||
| real(kind=rp), | intent(in), | DIMENSION(pchunk) | :: | Y_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_R | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_PHI | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_R | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_PHI | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | curlB_R | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | curlB_PHI | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | curlB_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | gradB_R | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | gradB_PHI | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | gradB_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | PSIp |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | B | Magnetic field components in Cartesian coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | pchunk | |||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_X | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_Y | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | B_Z | ||
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_X | Magnetic field components in Cartesian coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_Y | Magnetic field components in Cartesian coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
|
| real(kind=rp), | intent(out), | DIMENSION(pchunk) | :: | E_Z | Magnetic field components in Cartesian coordinates; B(1,:) = , B(2,:) = , B(3,:) = |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | E | Electric field components in Cartesian coordinates; E(1,:) = , E(2,:) = , E(3,:) = |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Y | Cylindrical coordinates of each particle in the simulation; Y(1,:) = , Y(2,:) = , Y(3,:) = . |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | E | Electric field components in Cartesian coordinates; E(1,:) = , E(2,:) = , E(3,:) = |
|
| integer(kind=is), | intent(in), | DIMENSION(:), ALLOCATABLE | :: | flag | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(out) | :: | Fo | Mean electric or magnetic field. |
||
| type(KORC_STRING), | intent(in) | :: | op_field | String that specifies what mean field will be calculated. Its value can be 'B' or 'E'. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(PARTICLES), | intent(inout) | :: | vars | An instance of the KORC derived type PARTICLES. |
||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(PARTICLES), | intent(inout) | :: | vars | An instance of the KORC derived type PARTICLES. |
||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| real(kind=rp), | intent(in), | DIMENSION(:,:), ALLOCATABLE | :: | Xo | Array with the position of the simulated particles. |
|
| type(FIELDS), | intent(in) | :: | F | F An instance of the KORC derived type FIELDS. |
||
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | b1 | Basis vector pointing along the local magnetic field, that is, along . |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | b2 | Basis vector perpendicular to b1 |
|
| real(kind=rp), | intent(inout), | DIMENSION(:,:), ALLOCATABLE | :: | b3 | Basis vector perpendicular to b1 and b2. |
|
| integer(kind=is), | intent(inout), | optional | DIMENSION(:), ALLOCATABLE | :: | flag | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
| logical | :: | cart | ||||
| type(C_PTR), | intent(inout), | DIMENSION(:), ALLOCATABLE | :: | hint | Flag for each particle to decide whether it is being followed (flag=T) or not (flag=F). |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(PARTICLES), | intent(inout) | :: | vars | An instance of the KORC derived type PARTICLES. |
||
| type(FIELDS), | intent(in) | :: | F | An instance of the KORC derived type FIELDS. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F | |||
| real(kind=rp), | intent(in), | dimension(F%dim_1D) | :: | Vden |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F | |||
| real(kind=rp), | intent(in), | dimension(F%dim_1D) | :: | dintJphidPSIP |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_R | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_PHI | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_Z | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | Y_R | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | Y_Z | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | V_PLL | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | V_MU | ||
| real(kind=rp), | intent(in) | :: | m_cache | |||
| integer(kind=is), | intent(in), | dimension(params%pchunk) | :: | flagCon | ||
| integer(kind=is), | intent(in), | dimension(params%pchunk) | :: | flagCol | ||
| real(kind=rp), | intent(out), | dimension(F%dim_1D) | :: | Vden |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(in) | :: | F | |||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_R | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_PHI | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | B_Z | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | PSIp | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | V_PLL | ||
| real(kind=rp), | intent(in), | dimension(params%pchunk) | :: | V_MU | ||
| real(kind=rp), | intent(in) | :: | m_cache | |||
| integer(kind=is), | intent(in), | dimension(params%pchunk) | :: | flagCon | ||
| integer(kind=is), | intent(in), | dimension(params%pchunk) | :: | flagCol | ||
| real(kind=rp), | intent(out), | dimension(F%dim_1D) | :: | dintJphidPSIP |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F | |||
| type(SPECIES), | intent(in) | :: | spp |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F | |||
| type(SPECIES), | intent(in) | :: | spp |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(inout) | :: | params | Core KORC simulation parameters. |
||
| type(FIELDS), | intent(out) | :: | F | An instance of the KORC derived type FIELDS. |
Computes the auxiliary fields and that are used in the RHS of the evolution equations for the GC orbit model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(inout) | :: | F | An instance of the KORC derived type FIELDS. |
Computes the auxiliary fields and that are used in the RHS of the evolution equations for the GC orbit model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(inout) | :: | F | An instance of the KORC derived type FIELDS. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(inout) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
@brief Subroutine that loads the size of the arrays having the electric and magnetic field data. @details All the information of externally calculated fields must be given in a rectangular, equally spaced mesh in the space of cylindrical coordinates. If the fields are axisymmetric, then the fields must be in a rectangular mesh on the -plane.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
@brief Subroutine that queries the HDF5 file what data are present in the HDF5 input file (sanity check).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| logical, | intent(out) | :: | Bfield | |||
| logical, | intent(out) | :: | Efield | |||
| logical, | intent(out) | :: | Bflux | |||
| logical, | intent(out) | :: | dBfield | |||
| logical, | intent(out) | :: | B1field | |||
| logical, | intent(out) | :: | E1field |
@brief Subroutine that loads the fields data from the HDF5 input file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(FIELDS), | intent(inout) | :: | F | An instance of the KORC derived type FIELDS. In this variable we keep the loaded data. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | Core KORC simulation parameters. |
||
| type(FIELDS), | intent(inout) | :: | F | An instance of the KORC derived type FIELDS. In this variable we keep the loaded data. |
||
| logical, | intent(in) | :: | bfield | |||
| logical, | intent(in) | :: | bflux | Logical variable that specifies if the variables that keep the poloidal magnetic flux data is allocated (bflux=T) or not (bflux=F). |
||
| logical, | intent(in) | :: | dbfield | Logical variable that specifies if the variables that keep the magnetic field data is allocated (bfield=T) or not (bfield=F). |
||
| logical, | intent(in) | :: | efield | Logical variable that specifies if the variables that keep the electric field data is allocated (efield=T) or not (efield=F). |
||
| logical, | intent(in) | :: | b1field | |||
| logical, | intent(in) | :: | e1field |
@brief Subroutine that allocates the variables keeping the 3-D fields data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(KORC_PARAMS), | intent(in) | :: | params | |||
| type(FIELDS), | intent(inout) | :: | F | |||
| logical, | intent(in) | :: | bfield | |||
| logical, | intent(in) | :: | efield | |||
| logical, | intent(in) | :: | dbfield |
@brief Subroutine that allocates the cylindrical components of an axisymmetric field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(V_FIELD_2D), | intent(inout) | :: | F | |||
| integer, | intent(in), | DIMENSION(3) | :: | dims |
@brief Subroutine that allocates the cartesian components of an axisymmetric field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(V_FIELD_2DX), | intent(inout) | :: | F | |||
| integer, | intent(in), | DIMENSION(3) | :: | dims |
@brief Subroutine that allocates the cylindrical components of a 3-D field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(V_FIELD_3D), | intent(inout) | :: | F | |||
| integer, | intent(in), | DIMENSION(3) | :: | dims |
@brief Subroutine that deallocates all the variables of the electric and magnetic fields.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(FIELDS), | intent(inout) | :: | F |