@brief Subroutine that allocates the variables keeping the 3-D fields data.
@param[in,out] F An instance of the KORC derived type FIELDS. In this variable we keep the loaded data. @param[in] bfield Logical variable that specifies if the variables that keep the magnetic field data is allocated (bfield=T) or not (bfield=F). @param[in] efield Logical variable that specifies if the variables that keep the electric field data is allocated (efield=T) or not (efield=F).
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 |
subroutine ALLOCATE_3D_FIELDS_ARRAYS(params,F,bfield,efield,dbfield)
TYPE (KORC_PARAMS), INTENT(IN) :: params
TYPE(FIELDS), INTENT(INOUT) :: F
LOGICAL, INTENT(IN) :: bfield
LOGICAL, INTENT(IN) :: dbfield
LOGICAL, INTENT(IN) :: efield
if (bfield) then
call ALLOCATE_V_FIELD_3D(F%B_3D,F%dims)
if(params%orbit_model(3:5).EQ.'pre') then
call ALLOCATE_V_FIELD_3D(F%curlb_3D,F%dims)
call ALLOCATE_V_FIELD_3D(F%gradB_3D,F%dims)
end if
end if
if (F%Bflux3D.and.(.not.ALLOCATED(F%PSIp3D))) then
ALLOCATE(F%PSIp3D(F%dims(1),F%dims(2),F%dims(3)))
end if
if (dbfield.and.(.not.ALLOCATED(F%dBdR_3D%R))) then
call ALLOCATE_V_FIELD_3D(F%dBdR_3D,F%dims)
call ALLOCATE_V_FIELD_3D(F%dBdPHI_3D,F%dims)
call ALLOCATE_V_FIELD_3D(F%dBdZ_3D,F%dims)
end if
if (efield) then
call ALLOCATE_V_FIELD_3D(F%E_3D,F%dims)
end if
if (.NOT.ALLOCATED(F%FLAG3D)) ALLOCATE(F%FLAG3D(F%dims(1),F%dims(2),F%dims(3)))
if (.NOT.ALLOCATED(F%LCFS3D)) ALLOCATE(F%LCFS3D(F%dims(1),F%dims(2),F%dims(3)))
if (.NOT.ALLOCATED(F%X%R)) ALLOCATE(F%X%R(F%dims(1)))
if (.NOT.ALLOCATED(F%X%PHI)) ALLOCATE(F%X%PHI(F%dims(2)))
if (.NOT.ALLOCATED(F%X%Z)) ALLOCATE(F%X%Z(F%dims(3)))
end subroutine ALLOCATE_3D_FIELDS_ARRAYS