The program reads the case but stops while doind the simulation

This commit is contained in:
Jorge Gonzalez 2026-02-26 14:25:47 +01:00
commit 31f0b510bc
5 changed files with 224 additions and 215 deletions

View file

@ -287,9 +287,6 @@ MODULE moduleInput
END DO
CASE DEFAULT
CALL criticalError('EM Solver ' // EMType // ' not found', 'readSolver')
END SELECT
END IF
@ -794,26 +791,117 @@ MODULE moduleInput
SUBROUTINE readBoundaryParticle(config)
use moduleMesh
USE moduleErrors
use moduleSpecies, only: nSpecies
USE moduleList, ONLY: partSurfaces
use moduleRefParam, only: m_ref
use moduleConstParam, only: me
USE json_module
IMPLICIT NONE
TYPE(json_file), INTENT(inout):: config
integer:: b
character(2):: iString
character(2):: bString
character(:), allocatable:: object
character(len=100), allocatable:: speciesNames(:)
LOGICAL:: found
character(:), allocatable:: bType
real(8):: Tw, cw !Wall temperature and specific heat
!neutral Properties
real(8):: m0, n0, T0
real(8), dimension(:), allocatable:: v0
real(8):: effTime
real(8):: eThreshold !Energy threshold
integer:: speciesID, electronSecondaryID
character(:), allocatable:: speciesName, crossSection, electronSecondary
! Read models of particles
CALL config%info('boundaries.particles.models', found, n_children = nBoundariesParticle)
ALLOCATE(boundariesParticle(1:nBoundariesParticle))
object = 'boundaries.particles'
CALL config%info(object, found, n_children = nBoundariesParticle)
allocate(boundariesParticle(1:nBoundariesParticle))
DO b = 1, nBoundariesParticle
WRITE(iString, '(i2)') b
object = 'boundary.particles.models(' // TRIM(iString) // ')'
WRITE(bString, '(i2)') b
object = 'boundaries.particles(' // trim(bString) // ')'
call boundariesParticle(b)%obj%init(config, object, b)
CALL config%get(object // '.type', bType, found)
if (.not. found) then
call criticalError('Required parameter "type" for particle boundary condition not found', &
'initBoundaryParticle')
end if
associate(self => boundariesParticle(b)%obj)
SELECT CASE(bType)
CASE('reflection')
ALLOCATE(boundaryReflection:: self)
CASE('absorption')
ALLOCATE(boundaryAbsorption:: self)
CASE('transparent')
ALLOCATE(boundaryTransparent:: self)
CASE('axis')
ALLOCATE(boundaryAxis:: self)
CASE('wallTemperature')
CALL config%get(object // '.temperature', Tw, found)
IF (.NOT. found) CALL criticalError("temperature not found for wallTemperature boundary type", 'readBoundary')
CALL config%get(object // '.specificHeat', cw, found)
IF (.NOT. found) CALL criticalError("specificHeat not found for wallTemperature boundary type", 'readBoundary')
CALL initWallTemperature(self, Tw, cw)
CASE('ionization')
!Neutral parameters
CALL config%get(object // '.neutral.ion', speciesName, found)
IF (.NOT. found) CALL criticalError("missing parameter 'ion' for neutrals in ionization", 'readBoundary')
speciesID = speciesName2Index(speciesName)
CALL config%get(object // '.neutral.mass', m0, found)
IF (.NOT. found) CALL criticalError("missing parameter 'mass' for neutrals in ionization", 'readBoundary')
CALL config%get(object // '.neutral.density', n0, found)
IF (.NOT. found) CALL criticalError("missing parameter 'density' for neutrals in ionization", 'readBoundary')
CALL config%get(object // '.neutral.velocity', v0, found)
IF (.NOT. found) CALL criticalError("missing parameter 'velocity' for neutrals in ionization", 'readBoundary')
CALL config%get(object // '.neutral.temperature', T0, found)
IF (.NOT. found) CALL criticalError("missing parameter 'temperature' for neutrals in ionization", 'readBoundary')
CALL config%get(object // '.effectiveTime', effTime, found)
IF (.NOT. found) CALL criticalError("missing parameter 'effectiveTime' for ionization", 'readBoundary')
CALL config%get(object // '.energyThreshold', eThreshold, found)
IF (.NOT. found) CALL criticalError("missing parameter 'eThreshold' in ionization", 'readBoundary')
CALL config%get(object // '.crossSection', crossSection, found)
IF (.NOT. found) CALL criticalError("missing parameter 'crossSection' for neutrals in ionization", 'readBoundary')
CALL config%get(object // '.electronSecondary', electronSecondary, found)
electronSecondaryID = speciesName2Index(electronSecondary)
IF (found) THEN
CALL initIonization(self, me/m_ref, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold,electronSecondaryID)
ELSE
CALL initIonization(self, me/m_ref, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold)
END IF
case('quasiNeutrality')
call initQuasiNeutrality(self)
CASE DEFAULT
CALL criticalError('Boundary type ' // bType // ' undefined', 'readBoundary')
END SELECT
self%n = b
CALL config%get(object // '.name', self%name, found)
if (.not. found) then
call criticalError('Required parameter "name" for particle boundary condition not found', &
'initBoundaryParticle')
end if
end associate
END DO
@ -827,7 +915,6 @@ MODULE moduleInput
USE moduleOutput
USE moduleErrors
USE moduleEM
USE moduleSpecies, only: nSpecies
USE json_module
IMPLICIT NONE
@ -836,9 +923,9 @@ MODULE moduleInput
LOGICAL:: found
INTEGER:: b, s
CHARACTER(2):: bString
character(len=100), allocatable:: modelName(:)
character(:), allocatable:: bType
CALL config%info('boundaries.EM.models', found, n_children = nBoundariesEM)
CALL config%info('boundaries.EM', found, n_children = nBoundariesEM)
IF (found) THEN
ALLOCATE(boundariesEM(1:nBoundariesEM))
@ -847,9 +934,45 @@ MODULE moduleInput
do b = 1, nBoundariesEM
write(bString, '(I2)') b
object = 'boundaries.EM.models(' // TRIM(bString) // ')'
object = 'boundaries.EM(' // TRIM(bString) // ')'
call boundariesEM(b)%obj%init(config, object, b)
associate(self => boundariesEM(b)%obj)
call config%get(object // '.type', bType, found)
if (.not. found) then
call criticalError('Required parameter "type" for EM boundary condition not found', &
'initBoundaryEM')
end if
select case(bType)
case ("dirichlet")
! Allocate boundary edge
allocate(boundaryEMDirichlet:: self)
CALL initDirichlet(self, config, object)
case ("dirichlettime")
! Allocate boundary edge
allocate(boundaryEMDirichletTime:: self)
call initDirichletTime(self, config, object)
case default
call criticalError('Boundary type ' // bType // ' not supported', 'readBoundaryEM')
end select
self%n = b
allocate(self%nodes(0))
call config%get(object // '.name', self%name, found)
if (.not. found) then
call criticalError('Required parameter "name" for EM boundary condition not found', &
'initBoundaryEM')
end if
end associate
end do
@ -1130,9 +1253,6 @@ MODULE moduleInput
END SELECT
!Builds the K matrix for the Particles mesh
CALL mesh%constructGlobalK()
!Assign the procedure to find a cell for meshColl
IF (doubleMesh) THEN
findCellColl => findCellCollMesh
@ -1189,21 +1309,39 @@ MODULE moduleInput
! EM Boundaries
do b = 1, nBoundariesEM
select type(bound => boundariesEM(b)%obj)
type is(boundaryEMDirichlet)
! Loop over all physical surfaces
do ps = 1, nPhysicalSurfaces
! If the boundary for the species is linked to the one analysing, add the edges
if (associated(physicalSurfaces(ps)%EM, bound)) then
bound%nodes = [bound%nodes, physicalSurfaces(ps)%nodes]
end if
associate(bound => boundariesEM(b)%obj)
select type(bound)
type is(boundaryEMDirichlet)
! Loop over all physical surfaces
do ps = 1, nPhysicalSurfaces
! If the boundary for the species is linked to the one analysing, add the edges
if (associated(physicalSurfaces(ps)%EM, bound)) then
bound%nodes = [bound%nodes, physicalSurfaces(ps)%nodes]
end if
end do
end do
end select
type is(boundaryEMDirichletTime)
! Loop over all physical surfaces
do ps = 1, nPhysicalSurfaces
! If the boundary for the species is linked to the one analysing, add the edges
if (associated(physicalSurfaces(ps)%EM, bound)) then
bound%nodes = [bound%nodes, physicalSurfaces(ps)%nodes]
end if
end do
end select
bound%nNodes = size(bound%nodes)
end associate
end do
! Builds the K matrix for the Particles mesh
call mesh%constructGlobalK()
END SUBROUTINE readGeometry
SUBROUTINE readProbes(config)