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,15 +832,27 @@ 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)
associate(bound => boundary(i)%bTypes(s)%obj)
SELECT CASE(bType) SELECT CASE(bType)
CASE('reflection') CASE('reflection')
ALLOCATE(boundaryReflection:: boundary(i)%bTypes(s)%obj) 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('axis')
ALLOCATE(boundaryAxis:: bound)
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(bound, Tw, cw)
CASE('ionization') CASE('ionization')
!Neutral parameters !Neutral parameters
@ -870,30 +882,24 @@ MODULE moduleInput
CALL config%get(object // '.electronSecondary', electronSecondary, found) CALL config%get(object // '.electronSecondary', electronSecondary, found)
electronSecondaryID = speciesName2Index(electronSecondary) electronSecondaryID = speciesName2Index(electronSecondary)
IF (found) THEN IF (found) THEN
CALL initIonization(boundary(i)%bTypes(s)%obj, species(s)%obj%m, m0, n0, v0, T0, & CALL initIonization(bound, species(s)%obj%m, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold,electronSecondaryID) speciesID, effTime, crossSection, eThreshold,electronSecondaryID)
ELSE ELSE
CALL initIonization(boundary(i)%bTypes(s)%obj, species(s)%obj%m, m0, n0, v0, T0, & CALL initIonization(bound, species(s)%obj%m, m0, n0, v0, T0, &
speciesID, effTime, crossSection, eThreshold) speciesID, effTime, crossSection, eThreshold)
END IF END IF
CASE('wallTemperature') case('quasiNeutrality')
CALL config%get(object // '.temperature', Tw, found) call initQuasiNeutrality(bound)
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(boundary(i)%bTypes(s)%obj, Tw, cw)
CASE('axis')
ALLOCATE(boundaryAxis:: boundary(i)%bTypes(s)%obj)
CASE DEFAULT CASE DEFAULT
CALL criticalError('Boundary type ' // bType // ' undefined', 'readBoundary') CALL criticalError('Boundary type ' // bType // ' undefined', 'readBoundary')
END SELECT 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