Preparing to change the input

This commit is contained in:
Jorge Gonzalez 2026-02-10 18:46:37 +01:00
commit defcf02466
3 changed files with 43 additions and 10 deletions

View file

@ -800,19 +800,18 @@ MODULE moduleInput
IMPLICIT NONE IMPLICIT NONE
TYPE(json_file), INTENT(inout):: config TYPE(json_file), INTENT(inout):: config
INTEGER:: i, s INTEGER:: b
CHARACTER(2):: iString, sString CHARACTER(2):: iString
CHARACTER(:), ALLOCATABLE:: object CHARACTER(:), ALLOCATABLE:: object
LOGICAL:: found LOGICAL:: found
INTEGER:: nTypes
CALL config%info('boundary', found, n_children = nBoundary) CALL config%info('boundary', found, n_children = nBoundary)
ALLOCATE(boundaries(1:nBoundary)) ALLOCATE(boundaries(1:nBoundary))
DO i = 1, nBoundary DO b = 1, nBoundary
WRITE(iString, '(i2)') i WRITE(iString, '(i2)') b
object = 'boundary(' // TRIM(iString) // ')' object = 'boundary(' // TRIM(iString) // ')'
call boundaries(i)%init(config, object, i) call boundaries(i)%init(config, object, b)
END DO END DO

View file

@ -587,6 +587,7 @@ MODULE moduleMesh
! Boundary Particle Definitions ! Boundary Particle Definitions
!Generic type for boundaries !Generic type for boundaries
TYPE, abstract, PUBLIC:: boundaryGeneric TYPE, abstract, PUBLIC:: boundaryGeneric
integer:: n
character(:), allocatable:: name character(:), allocatable:: name
contains contains
procedure, pass:: init => initBoundary procedure, pass:: init => initBoundary
@ -595,12 +596,13 @@ MODULE moduleMesh
END TYPE boundaryGeneric END TYPE boundaryGeneric
interface interface
module subroutine initBoundary(self, config, object) module subroutine initBoundary(self, config, object, b)
use json_module use json_module
class(boundaryGeneric), intent(out):: self class(boundaryGeneric), intent(out):: self
type(json_file), intent(inout):: config type(json_file), intent(inout):: config
character(:), allocatable, intent(in):: object character(:), allocatable, intent(in):: object
integer, intent(in):: b
end subroutine initBoundary end subroutine initBoundary
@ -778,7 +780,7 @@ MODULE moduleMesh
END TYPE boundaryCont END TYPE boundaryCont
!Number of boundaries !Number of boundaries
INTEGER:: nBoundary = 0 INTEGER:: nBoundaries = 0
!Array for boundaries !Array for boundaries
TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundariesParticle(:) TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundariesParticle(:)

View file

@ -1,7 +1,31 @@
!moduleMeshBoundary: Boundary functions for the mesh edges !moduleMeshBoundary: Boundary functions for the mesh edges
submodule(moduleMesh) boundary submodule(moduleMesh) boundary
contains 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 json_module
use moduleRefParam, only: m_ref use moduleRefParam, only: m_ref
use moduleConstParam, only: me use moduleConstParam, only: me
@ -10,6 +34,7 @@ submodule(moduleMesh) boundary
class(boundaryGeneric), allocatable, intent(out):: self class(boundaryGeneric), allocatable, intent(out):: self
type(json_file), intent(inout):: config type(json_file), intent(inout):: config
character(:), allocatable, intent(in):: object character(:), allocatable, intent(in):: object
integer, intent(in):: b
character(:), allocatable:: bType character(:), allocatable:: bType
logical:: found logical:: found
real(8):: Tw, cw !Wall temperature and specific heat real(8):: Tw, cw !Wall temperature and specific heat
@ -21,6 +46,7 @@ submodule(moduleMesh) boundary
integer:: speciesID, electronSecondaryID integer:: speciesID, electronSecondaryID
character(:), allocatable:: speciesName, crossSection, electronSecondary character(:), allocatable:: speciesName, crossSection, electronSecondary
self%n = b
CALL config%get(object // '.name', self%name, found) CALL config%get(object // '.name', self%name, found)
CALL config%get(object // '.type', bType, found) CALL config%get(object // '.type', bType, found)
SELECT CASE(bType) SELECT CASE(bType)
@ -99,7 +125,13 @@ submodule(moduleMesh) boundary
REAL(8):: vTh REAL(8):: vTh
vTh = DSQRT(c * T) / v_ref 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 END SUBROUTINE initWallTemperature