New BC for quasi-neutrality

Still, the adjustment it is not iterative.
I need to build new subroutines to gather values of edges.
This commit is contained in:
Jorge Gonzalez 2026-02-05 11:01:15 +01:00
commit e7e6e1bece
3 changed files with 80 additions and 59 deletions

View file

@ -832,68 +832,74 @@ MODULE moduleInput
WRITE(sString,'(i2)') s WRITE(sString,'(i2)') s
object = 'boundary(' // TRIM(iString) // ').bTypes(' // TRIM(sString) // ')' object = 'boundary(' // TRIM(iString) // ').bTypes(' // TRIM(sString) // ')'
CALL config%get(object // '.type', bType, found) CALL config%get(object // '.type', bType, found)
SELECT CASE(bType) associate(bound => boundary(i)%bTypes(s)%obj)
CASE('reflection') SELECT CASE(bType)
ALLOCATE(boundaryReflection:: boundary(i)%bTypes(s)%obj) CASE('reflection')
ALLOCATE(boundaryReflection:: bound)
CASE('absorption') CASE('absorption')
ALLOCATE(boundaryAbsorption:: boundary(i)%bTypes(s)%obj) ALLOCATE(boundaryAbsorption:: bound)
CASE('transparent') CASE('transparent')
ALLOCATE(boundaryTransparent:: boundary(i)%bTypes(s)%obj) ALLOCATE(boundaryTransparent:: bound)
CASE('ionization') CASE('axis')
!Neutral parameters ALLOCATE(boundaryAxis:: bound)
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) THEN
m0 = species(s)%obj%m*m_ref
END IF
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) CASE('wallTemperature')
IF (.NOT. found) CALL criticalError("missing parameter 'effectiveTime' for ionization", 'readBoundary') 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 config%get(object // '.energyThreshold', eThreshold, found) CALL initWallTemperature(bound, Tw, cw)
IF (.NOT. found) CALL criticalError("missing parameter 'eThreshold' in ionization", 'readBoundary')
CALL config%get(object // '.crossSection', crossSection, found) CASE('ionization')
IF (.NOT. found) CALL criticalError("missing parameter 'crossSection' for neutrals in ionization", 'readBoundary') !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) THEN
m0 = species(s)%obj%m*m_ref
END IF
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 // '.electronSecondary', electronSecondary, found) CALL config%get(object // '.effectiveTime', effTime, found)
electronSecondaryID = speciesName2Index(electronSecondary) IF (.NOT. found) CALL criticalError("missing parameter 'effectiveTime' for ionization", 'readBoundary')
IF (found) THEN
CALL initIonization(boundary(i)%bTypes(s)%obj, species(s)%obj%m, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold,electronSecondaryID)
ELSE CALL config%get(object // '.energyThreshold', eThreshold, found)
CALL initIonization(boundary(i)%bTypes(s)%obj, species(s)%obj%m, m0, n0, v0, T0, & IF (.NOT. found) CALL criticalError("missing parameter 'eThreshold' in ionization", 'readBoundary')
speciesID, effTime, crossSection, eThreshold)
END IF CALL config%get(object // '.crossSection', crossSection, found)
IF (.NOT. found) CALL criticalError("missing parameter 'crossSection' for neutrals in ionization", 'readBoundary')
CASE('wallTemperature') CALL config%get(object // '.electronSecondary', electronSecondary, found)
CALL config%get(object // '.temperature', Tw, found) electronSecondaryID = speciesName2Index(electronSecondary)
IF (.NOT. found) CALL criticalError("temperature not found for wallTemperature boundary type", 'readBoundary') IF (found) THEN
CALL config%get(object // '.specificHeat', cw, found) CALL initIonization(bound, species(s)%obj%m, m0, n0, v0, T0, &
IF (.NOT. found) CALL criticalError("specificHeat not found for wallTemperature boundary type", 'readBoundary') speciesID, effTime, crossSection, eThreshold,electronSecondaryID)
CALL initWallTemperature(boundary(i)%bTypes(s)%obj, Tw, cw)
CASE('axis') ELSE
ALLOCATE(boundaryAxis:: boundary(i)%bTypes(s)%obj) CALL initIonization(bound, species(s)%obj%m, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold)
CASE DEFAULT END IF
CALL criticalError('Boundary type ' // bType // ' undefined', 'readBoundary')
END SELECT case('quasiNeutrality')
call initQuasiNeutrality(bound)
CASE DEFAULT
CALL criticalError('Boundary type ' // bType // ' undefined', 'readBoundary')
END SELECT
end associate
END DO END DO

View file

@ -206,11 +206,11 @@ MODULE moduleMesh
!Subroutine to find in which cell a particle is located !Subroutine to find in which cell a particle is located
PROCEDURE, PASS:: findCell PROCEDURE, PASS:: findCell
!Gather value and spatial derivative on the nodes at position Xi !Gather value and spatial derivative on the nodes at position Xi
PROCEDURE, PASS, PRIVATE:: gatherF_scalar PROCEDURE, PASS, PRIVATE:: gatherF_cell_scalar
PROCEDURE, PASS, PRIVATE:: gatherF_array PROCEDURE, PASS, PRIVATE:: gatherF_cell_array
PROCEDURE, PASS, PRIVATE:: gatherDF_scalar PROCEDURE, PASS, PRIVATE:: gatherDF_cell_scalar
GENERIC:: gatherF => gatherF_scalar, gatherF_array GENERIC:: gatherF => gatherF_cell_scalar, gatherF_cell_array
GENERIC:: gatherDF => gatherDF_scalar GENERIC:: gatherDF => gatherDF_cell_scalar
END TYPE meshCell END TYPE meshCell
@ -546,7 +546,7 @@ MODULE moduleMesh
END SUBROUTINE resetOutput END SUBROUTINE resetOutput
!Gather the value of valNodes (scalar) at position Xi !Gather the value of valNodes (scalar) at position Xi
PURE FUNCTION gatherF_scalar(self, Xi, nNodes, valNodes) RESULT(f) PURE FUNCTION gatherF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(f)
IMPLICIT NONE IMPLICIT NONE
CLASS(meshCell), INTENT(in):: self CLASS(meshCell), INTENT(in):: self
@ -559,10 +559,10 @@ MODULE moduleMesh
fPsi = self%fPsi(Xi, nNodes) fPsi = self%fPsi(Xi, nNodes)
f = DOT_PRODUCT(fPsi, valNodes) f = DOT_PRODUCT(fPsi, valNodes)
END FUNCTION gatherF_scalar END FUNCTION gatherF_cell_scalar
!Gather the value of valNodes (array) at position Xi !Gather the value of valNodes (array) at position Xi
PURE FUNCTION gatherF_array(self, Xi, nNodes, valNodes) RESULT(f) PURE FUNCTION gatherF_cell_array(self, Xi, nNodes, valNodes) RESULT(f)
IMPLICIT NONE IMPLICIT NONE
CLASS(meshCell), INTENT(in):: self CLASS(meshCell), INTENT(in):: self
@ -575,10 +575,10 @@ MODULE moduleMesh
fPsi = self%fPsi(Xi, nNodes) fPsi = self%fPsi(Xi, nNodes)
f = MATMUL(fPsi, valNodes) f = MATMUL(fPsi, valNodes)
END FUNCTION gatherF_array END FUNCTION gatherF_cell_array
!Gather the spatial derivative of valNodes (scalar) at position Xi !Gather the spatial derivative of valNodes (scalar) at position Xi
PURE FUNCTION gatherDF_scalar(self, Xi, nNodes, valNodes) RESULT(df) PURE FUNCTION gatherDF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(df)
IMPLICIT NONE IMPLICIT NONE
CLASS(meshCell), INTENT(in):: self CLASS(meshCell), INTENT(in):: self
@ -600,7 +600,7 @@ MODULE moduleMesh
DOT_PRODUCT(dPsiR(2,:), valNodes), & DOT_PRODUCT(dPsiR(2,:), valNodes), &
DOT_PRODUCT(dPsiR(3,:), valNodes) /) DOT_PRODUCT(dPsiR(3,:), valNodes) /)
END FUNCTION gatherDF_scalar END FUNCTION gatherDF_cell_scalar
!Scatters particle properties into cell nodes !Scatters particle properties into cell nodes
SUBROUTINE scatter(self, nNodes, part) SUBROUTINE scatter(self, nNodes, part)

View file

@ -160,4 +160,19 @@ MODULE moduleBoundary
END SUBROUTINE initIonization END SUBROUTINE initIonization
subroutine initQuasiNeutrality(boundary)
implicit none
class(boundaryGeneric), allocatable, intent(out):: boundary
allocate(boundaryQuasiNeutrality:: boundary)
select type(boundary)
type is(boundaryQuasiNeutrality)
boundary%alpha = 0.d0
end select
end subroutine initQuasiNeutrality
END MODULE moduleBoundary END MODULE moduleBoundary