MODULE moduleBoundary USE moduleTable !Generic type for boundaries TYPE, PUBLIC:: boundaryGeneric CONTAINS END TYPE boundaryGeneric !Reflecting boundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryReflection CONTAINS END TYPE boundaryReflection !Absorption boundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryAbsorption CONTAINS END TYPE boundaryAbsorption !Transparent boundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryTransparent CONTAINS END TYPE boundaryTransparent !Wall Temperature boundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryWallTemperature !Thermal velocity of the wall: square root(Wall temperature X specific heat) REAL(8):: vTh CONTAINS END TYPE boundaryWallTemperature !Ionization boundary TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryIonization REAL(8):: m0, n0, v0(1:3), T0 !Properties of background neutrals. INTEGER:: sp !Ion species TYPE(table1D):: crossSection REAL(8):: eThreshold REAL(8):: deltaV CONTAINS END TYPE boundaryIonization !Symmetry axis TYPE, PUBLIC, EXTENDS(boundaryGeneric):: boundaryAxis CONTAINS END TYPE boundaryAxis TYPE:: bTypesCont CLASS(boundaryGeneric), ALLOCATABLE:: obj END TYPE bTypesCont TYPE:: boundaryCont INTEGER:: id = 0 CHARACTER(:), ALLOCATABLE:: name INTEGER:: physicalSurface = 0 CLASS(bTypesCont), ALLOCATABLE:: bTypes(:) CONTAINS END TYPE boundaryCont !Number of boundaries INTEGER:: nBoundary = 0 !Array for boundary information TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundary(:) CONTAINS FUNCTION getBoundaryId(physicalSurface) RESULT(id) IMPLICIT NONE INTEGER:: physicalSurface INTEGER:: id INTEGER:: i id = 0 DO i = 1, nBoundary IF (physicalSurface == boundary(i)%physicalSurface) id = boundary(i)%id END DO END FUNCTION getBoundaryId SUBROUTINE initWallTemperature(boundary, T, c) USE moduleRefParam IMPLICIT NONE CLASS(boundaryGeneric), ALLOCATABLE, INTENT(out):: boundary REAL(8), INTENT(in):: T, c !Wall temperature and specific heat REAL(8):: vTh vTh = DSQRT(c * T) / v_ref boundary = boundaryWallTemperature(vTh = vTh) END SUBROUTINE initWallTemperature SUBROUTINE initIonization(boundary, m0, n0, v0, T0, speciesID, crossSection, eThreshold) USE moduleRefParam USE moduleSpecies USE moduleCaseParam USE moduleConstParam IMPLICIT NONE CLASS(boundaryGeneric), ALLOCATABLE, INTENT(out):: boundary REAL(8), INTENT(in):: m0, n0, v0(1:3), T0 INTEGER:: speciesID CHARACTER(:), ALLOCATABLE, INTENT(in):: crossSection REAL(8), INTENT(in):: eThreshold ALLOCATE(boundaryIonization:: boundary) SELECT TYPE(boundary) TYPE IS(boundaryIonization) boundary%m0 = m0 / m_ref boundary%n0 = n0 boundary%v0 = v0 / v_ref boundary%T0 = T0 / T_ref boundary%sp = speciesID CALL boundary%crossSection%init(crossSection) CALL boundary%crossSection%convert(eV2J/(m_ref*v_ref**2), 1.D0/L_ref**2) boundary%eThreshold = eThreshold*eV2J/(m_ref*v_ref**2) END SELECT END SUBROUTINE initIonization END MODULE moduleBoundary