Subroutine that allocates the variables keeping the axisymmetric fields 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 |
subroutine ALLOCATE_2D_FIELDS_ARRAYS(params,F,bfield,bflux,dbfield, &
efield,b1field,e1field)
!! @note Subroutine that allocates the variables keeping the axisymmetric
!! fields data. @endnote
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) :: b1field
LOGICAL, INTENT(IN) :: e1field
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) :: 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) :: efield
!! Logical variable that specifies if the variables that keep the electric
!! field data is allocated (efield=T) or not (efield=F).
if (bfield.and.(.not.ALLOCATED(F%B_2D%R))) then
call ALLOCATE_V_FIELD_2D(F%B_2D,F%dims)
if(params%orbit_model(3:5).EQ.'pre') then
call ALLOCATE_V_FIELD_2D(F%curlb_2D,F%dims)
call ALLOCATE_V_FIELD_2D(F%gradB_2D,F%dims)
end if
end if
if (bflux.and.(.not.ALLOCATED(F%PSIp))) then
ALLOCATE(F%PSIp(F%dims(1),F%dims(3)))
F%PSIp=0._rp
end if
if (dbfield.and.(.not.ALLOCATED(F%dBdR_2D%R))) then
call ALLOCATE_V_FIELD_2D(F%dBdR_2D,F%dims)
call ALLOCATE_V_FIELD_2D(F%dBdPHI_2D,F%dims)
call ALLOCATE_V_FIELD_2D(F%dBdZ_2D,F%dims)
end if
if (params%field_model(10:13).eq.'MARS') then
if (B1field.and.(.not.ALLOCATED(F%B1Re_2D%R))) then
call ALLOCATE_V_FIELD_2D(F%B1Re_2D,F%dims)
call ALLOCATE_V_FIELD_2D(F%B1Im_2D,F%dims)
end if
else if (params%field_model(10:14).eq.'AORSA') then
if (B1field.and.(.not.ALLOCATED(F%B1Re_2DX%X))) then
call ALLOCATE_V_FIELD_2DX(F%B1Re_2DX,F%dims)
call ALLOCATE_V_FIELD_2DX(F%B1Im_2DX,F%dims)
end if
if (E1field.and.(.not.ALLOCATED(F%E1Re_2DX%X))) then
call ALLOCATE_V_FIELD_2DX(F%E1Re_2DX,F%dims)
call ALLOCATE_V_FIELD_2DX(F%E1Im_2DX,F%dims)
end if
endif
if (efield.and.(.not.ALLOCATED(F%E_2D%R))) then
call ALLOCATE_V_FIELD_2D(F%E_2D,F%dims)
end if
if (.NOT.ALLOCATED(F%FLAG2D)) ALLOCATE(F%FLAG2D(F%dims(1),F%dims(3)))
if (.NOT.ALLOCATED(F%LCFS2D)) ALLOCATE(F%LCFS2D(F%dims(1),F%dims(3)))
if (.NOT.ALLOCATED(F%X%R)) ALLOCATE(F%X%R(F%dims(1)))
if (.NOT.ALLOCATED(F%X%Z)) ALLOCATE(F%X%Z(F%dims(3)))
end subroutine ALLOCATE_2D_FIELDS_ARRAYS