diff --git a/src/modules/init/moduleInput.f90 b/src/modules/init/moduleInput.f90 index 5c1f266..3f52f82 100644 --- a/src/modules/init/moduleInput.f90 +++ b/src/modules/init/moduleInput.f90 @@ -800,19 +800,18 @@ MODULE moduleInput IMPLICIT NONE TYPE(json_file), INTENT(inout):: config - INTEGER:: i, s - CHARACTER(2):: iString, sString + INTEGER:: b + CHARACTER(2):: iString CHARACTER(:), ALLOCATABLE:: object LOGICAL:: found - INTEGER:: nTypes CALL config%info('boundary', found, n_children = nBoundary) ALLOCATE(boundaries(1:nBoundary)) - DO i = 1, nBoundary - WRITE(iString, '(i2)') i + DO b = 1, nBoundary + WRITE(iString, '(i2)') b object = 'boundary(' // TRIM(iString) // ')' - call boundaries(i)%init(config, object, i) + call boundaries(i)%init(config, object, b) END DO diff --git a/src/modules/mesh/moduleMesh.f90 b/src/modules/mesh/moduleMesh.f90 index a951eda..144305c 100644 --- a/src/modules/mesh/moduleMesh.f90 +++ b/src/modules/mesh/moduleMesh.f90 @@ -587,6 +587,7 @@ MODULE moduleMesh ! Boundary Particle Definitions !Generic type for boundaries TYPE, abstract, PUBLIC:: boundaryGeneric + integer:: n character(:), allocatable:: name contains procedure, pass:: init => initBoundary @@ -595,12 +596,13 @@ MODULE moduleMesh END TYPE boundaryGeneric interface - module subroutine initBoundary(self, config, object) + module subroutine initBoundary(self, config, object, b) use json_module class(boundaryGeneric), intent(out):: self type(json_file), intent(inout):: config character(:), allocatable, intent(in):: object + integer, intent(in):: b end subroutine initBoundary @@ -778,7 +780,7 @@ MODULE moduleMesh END TYPE boundaryCont !Number of boundaries - INTEGER:: nBoundary = 0 + INTEGER:: nBoundaries = 0 !Array for boundaries TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundariesParticle(:) diff --git a/src/modules/mesh/moduleMesh@boundary.f90 b/src/modules/mesh/moduleMesh@boundary.f90 index e3805a5..5b30513 100644 --- a/src/modules/mesh/moduleMesh@boundary.f90 +++ b/src/modules/mesh/moduleMesh@boundary.f90 @@ -1,7 +1,31 @@ !moduleMeshBoundary: Boundary functions for the mesh edges submodule(moduleMesh) boundary contains - module subroutine initBoundary(self, config, object) + module function boundaryParticleName2Index(boundaryName) result(bp) + use moduleErrors + implicit none + + character(:), allocatable:: boundaryName + integer:: bp + integer:: b + + bp = 0 + do b = 1, nBoundaries + if (boundaryName == boundariesParticle(b)%obj%name) then + bp = boundariesParticle(b)%obj%n + + end if + + end do + + if (bp == 0) then + call criticalError('Boundary ' // boundaryName // ' not found', 'boundaryName2Index') + + end if + + end function boundaryParticleName2Index + + module subroutine initBoundary(self, config, object, b) use json_module use moduleRefParam, only: m_ref use moduleConstParam, only: me @@ -10,6 +34,7 @@ submodule(moduleMesh) boundary class(boundaryGeneric), allocatable, intent(out):: self type(json_file), intent(inout):: config character(:), allocatable, intent(in):: object + integer, intent(in):: b character(:), allocatable:: bType logical:: found real(8):: Tw, cw !Wall temperature and specific heat @@ -21,6 +46,7 @@ submodule(moduleMesh) boundary integer:: speciesID, electronSecondaryID character(:), allocatable:: speciesName, crossSection, electronSecondary + self%n = b CALL config%get(object // '.name', self%name, found) CALL config%get(object // '.type', bType, found) SELECT CASE(bType) @@ -99,7 +125,13 @@ submodule(moduleMesh) boundary REAL(8):: vTh vTh = DSQRT(c * T) / v_ref - boundary = boundaryWallTemperature(vTh = vTh) + allocate(boundaryWallTemperature:: boundary) + + select type(boundary) + type is(boundaryWallTemperature) + boundary%vTh = vTh + + end select END SUBROUTINE initWallTemperature