In this simple program, when I compile the program it will give me an error in regard to "the allocated BoundaryConditionLTU is already allocated". I know the problem but I don't know how to fix it. Please let me know how to fix this. Thank you This code is part of CFD code that I'm trying to use for Boundary conditions. Three general boundary conditions are defined (i.e Dirichelet, Neumann, And mixed BC). Each of flow variables such as velocity, pressure, and temperature will be assigned one of the mentioned boundary conditions at the beginning of the code. ClassBoundaryCond is an abstract class. Note: ClassDirichlet_BC, ClassNeumann_BC, and ClassMix_B are the inheirtance of the ClassBoundaryCond (Extended type of the ClassBoundaryCond).
module BoundaryCondition
! Date : 08/1/2019
use Varibales_Nst_NoImm_2D_MPH_DEM
!use SubroutineModule
implicit none
!=====================================================================
! Classes
type,abstract :: ClassBoundaryCond
contains
procedure(InterfaceBound) ,deferred :: evaluateBound
procedure(InterfaceBound_N),deferred :: evaluateBound_Neu
end type ClassBoundaryCond
!............................................
type,extends(ClassBoundaryCond) :: ClassDirichlet_BC
contains
procedure :: evaluateBound=>evaluateDir
procedure :: evaluateBound_Neu=>evaluateNeu_Dir
end type ClassDirichlet_BC
!==============
type,extends(ClassBoundaryCond) :: ClassNeumann_BC
contains
procedure :: evaluateBound=>evaluateNeu
procedure :: evaluateBound_Neu=>evaluateNeu_Neu
end type ClassNeumann_BC
!==============
type,extends(ClassBoundaryCond) :: ClassMix_BC
contains
procedure :: evaluateBound=>evaluateMix
procedure :: evaluateBound_Neu=>evaluateNeu_Mix
end type ClassMix_BC
!==============
!=====================================================================
! Interfaces
!---------------------------------------
abstract interface
!---------------------------------------
subroutine InterfaceBound(this)
import :: ClassBoundaryCond
class(ClassBoundaryCond) :: this
end subroutine InterfaceBound
!---------------------------------------
end interface
!=====================================================================
! ClassBoundaryCond is an abstract class
!=====================================================================
! Decelerations
class(ClassBoundaryCond),allocatable,Dimension(:) :: BoundaryConditionLTU
!=====================================================================
contains
!=====================================================================
subroutine initiateBoundaryCondition()
implicit none
integer :: i
! Date : 06/24/2019
! Arguments
! Body
do i=1,6
if (leftBC(i) == 0) then
allocate(ClassDirichlet_BC::BoundaryConditionLTU(i))
else if (leftBC(i) == 1) then
allocate(ClassNeumann_BC::BoundaryConditionLTU(i))
else if (leftBC(i) == 2) then
allocate(ClassMix_BC::BoundaryConditionLTU(i))
end if
end do
end subroutine initiateBoundaryCondition
SUBROUTINE evaluateDir(this)
Implicit None
! Start of Variable Definition
! ----------------------------
Class(ClassDirichlet_BC) :: this
END SUBROUTINE
SUBROUTINE evaluateNeu(this)
Implicit None
! Start of Variable Definition
! ----------------------------
Class(ClassNeumann_BC) :: this
END SUBROUTINE
SUBROUTINE evaluateMix(this)
Implicit None
! Start of Variable Definition
! ----------------------------
Class(ClassMix_BC) :: this
END SUBROUTINE
end module BoundaryCondition