From 135f1f464cfc00406849e56dd35f7e59cae2e9c1 Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Tue, 24 Feb 2026 20:03:36 +0100 Subject: [PATCH] Files compile but there is no linking in mesh module --- src/makefile | 3 +- src/modules/init/moduleInput.f90 | 43 +++++++++++-------- src/modules/mesh/moduleMesh.f90 | 7 ++- src/modules/mesh/moduleMesh@boundaryEM.f90 | 10 ++--- .../mesh/moduleMesh@boundaryParticle.f90 | 17 ++++---- src/modules/mesh/moduleMesh@elements.f90 | 26 +++++------ src/modules/mesh/moduleMesh@surfaces.f90 | 2 +- 7 files changed, 57 insertions(+), 51 deletions(-) diff --git a/src/makefile b/src/makefile index 49c12cb..3f142e3 100644 --- a/src/makefile +++ b/src/makefile @@ -17,7 +17,8 @@ OBJECTS = $(OBJDIR)/moduleMesh.o $(OBJDIR)/moduleMeshCommon.o $(OBJDIR)/moduleCo $(OBJDIR)/moduleMesh1DCart.o \ $(OBJDIR)/moduleMesh0D.o \ $(OBJDIR)/moduleSolver.o \ - $(OBJDIR)/modulePusher.o + $(OBJDIR)/modulePusher.o \ + $(OBJDIR)/velocityDistribution.o all: $(OUTPUT) diff --git a/src/modules/init/moduleInput.f90 b/src/modules/init/moduleInput.f90 index 30bb3aa..7eb3f3b 100644 --- a/src/modules/init/moduleInput.f90 +++ b/src/modules/init/moduleInput.f90 @@ -800,20 +800,20 @@ MODULE moduleInput IMPLICIT NONE TYPE(json_file), INTENT(inout):: config - integer:: b, s + integer:: b character(2):: iString character(:), allocatable:: object character(len=100), allocatable:: speciesNames(:) LOGICAL:: found ! Read models of particles - CALL config%info('boundaries.particles.models', found, n_children = nBoundary) - ALLOCATE(boundaries(1:nBoundary)) - DO b = 1, nBoundary + CALL config%info('boundaries.particles.models', found, n_children = nBoundariesParticle) + ALLOCATE(boundariesParticle(1:nBoundariesParticle)) + DO b = 1, nBoundariesParticle WRITE(iString, '(i2)') b object = 'boundary.particles.models(' // TRIM(iString) // ')' - call boundaries(i)%init(config, object, b) + call boundariesParticle(b)%obj%init(config, object, b) END DO @@ -827,14 +827,14 @@ MODULE moduleInput USE moduleOutput USE moduleErrors USE moduleEM - USE moduleSpecies + USE moduleSpecies, only: nSpecies USE json_module IMPLICIT NONE TYPE(json_file), INTENT(inout):: config CHARACTER(:), ALLOCATABLE:: object LOGICAL:: found - INTEGER:: b + INTEGER:: b, s CHARACTER(2):: bString character(len=100), allocatable:: modelName(:) @@ -845,11 +845,11 @@ MODULE moduleInput END IF - do b = 1, nBoundaryEM + do b = 1, nBoundariesEM write(bString, '(I2)') b object = 'boundaries.EM.models(' // TRIM(bString) // ')' - call boundariesEM(b)%init(config, object, b) + call boundariesEM(b)%obj%init(config, object, b) end do @@ -879,10 +879,10 @@ MODULE moduleInput character(:), allocatable:: object logical:: found integer:: ps - character(2):: psString + character(2):: psString, sSTring integer:: nParticleModels - character(len=100), allocatable:: particleModels(:) - character(len=100):: EMModel + character(:), allocatable:: particleModel + character(:), allocatable:: EMModel integer:: s, boundaryIndex call config%info('physicalSurfaces', found, n_children = nPhysicalSurfaces) @@ -895,8 +895,8 @@ MODULE moduleInput end if do ps = 1, nPhysicalSurfaces - write(ps, '(I2)') ps - object = 'physicalSurfaces(' // TRIM(bString) // ')' + write(psString, '(I2)') ps + object = 'physicalSurfaces(' // trim(psString) // ')' allocate(physicalSurfaces(ps)%nodes(0)) allocate(physicalSurfaces(ps)%edges(0)) @@ -913,18 +913,19 @@ MODULE moduleInput call criticalError('Not enough models for particles provided', 'readPhysicalSurfaces') end if - call config%get(object // '.particles', particleModels, found) allocate(physicalSurfaces(ps)%particles(1:nSpecies)) do s = 1, nSpecies - boundaryIndex = boundaryParticlesName_to_Index(particleModels(s)) - physicalSurfaces(ps)%particles(s)%obj => boundaryParticles(boundaryIndex)%obj + write(sString, '(I2)') s + call config%get(object // '.particles(' // trim(sSTring) // ')', particleModel, found) + boundaryIndex = boundaryParticleName_to_Index(particleModel) + physicalSurfaces(ps)%particles(s)%obj => boundariesParticle(boundaryIndex)%obj end do ! Link electromagnetic boundary condition call config%get(object // '.EM', EMModel, found) if (found) then - bouondaryIndex = boundaryEMName_to_Index(EMModel) + boundaryIndex = boundaryEMName_to_Index(EMModel) physicalSurfaces(ps)%EM => boundariesEM(boundaryIndex)%obj end if @@ -957,6 +958,10 @@ MODULE moduleInput LOGICAL:: found CHARACTER(:), ALLOCATABLE:: meshFormat, meshFile REAL(8):: volume + integer:: b, ps, s + integer:: e + integer:: nVolColl + integer:: boundaryIndex object = 'geometry' @@ -1170,7 +1175,7 @@ MODULE moduleInput ! Loop over all species do s = 1, nSpecies ! If the boundary for the species is linked to the one analysing, add the edges - if (associated(physicalSurfaces(ps)%particles(s), bound)) then + if (associated(physicalSurfaces(ps)%particles(s)%obj, bound)) then bound%edges = [bound%edges, physicalSurfaces(ps)%edges] end if diff --git a/src/modules/mesh/moduleMesh.f90 b/src/modules/mesh/moduleMesh.f90 index ae321f5..2e9afc0 100644 --- a/src/modules/mesh/moduleMesh.f90 +++ b/src/modules/mesh/moduleMesh.f90 @@ -324,8 +324,7 @@ MODULE moduleMesh ABSTRACT INTERFACE SUBROUTINE initCell_interface(self, n, p, nodes) - IMPORT:: meshCell - IMPORT meshNodeCont + IMPORT:: meshCell, meshNodeCont CLASS(meshCell), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) @@ -630,7 +629,7 @@ MODULE moduleMesh END INTERFACE !Logical to indicate if an specific mesh for MC Collisions is used - LOGICAL:: doubleMesh + LOGICAL:: doubleMesh = .false. !Logical to indicate if MCC collisions are performed LOGICAL:: doMCCollisions = .FALSE. !Logical to indicate if Coulomb scattering is performed @@ -737,7 +736,7 @@ MODULE moduleMesh ! Ensures quasi-neutrality by changing the reflection coefficient type, public, extends(boundaryParticleGeneric):: boundaryQuasiNeutrality real(8):: alpha ! Reflection parameter - integer, allocatable:: edges(:) !Array with edges + type(meshEdgePointer), allocatable:: edges(:) !Array with edges contains procedure, pass:: apply => quasiNeutrality diff --git a/src/modules/mesh/moduleMesh@boundaryEM.f90 b/src/modules/mesh/moduleMesh@boundaryEM.f90 index 0629afc..6bd580b 100644 --- a/src/modules/mesh/moduleMesh@boundaryEM.f90 +++ b/src/modules/mesh/moduleMesh@boundaryEM.f90 @@ -1,6 +1,6 @@ submodule(moduleMesh) boundaryEM CONTAINS - function boundaryEMName_to_Index(boundaryName) result(bp) + module function boundaryEMName_to_Index(boundaryName) result(bp) use moduleErrors implicit none @@ -73,7 +73,7 @@ submodule(moduleMesh) boundaryEM end subroutine initBoundaryEM ! Initialize Dirichlet boundary condition - SUBROUTINE initDirichlet(self, config, object) + module SUBROUTINE initDirichlet(self, config, object) use json_module USE moduleRefParam, ONLY: Volt_ref use moduleErrors @@ -100,7 +100,7 @@ submodule(moduleMesh) boundaryEM end subroutine initDirichlet ! Initialize Dirichlet boundary condition - subroutine initDirichletTime(self, config, object) + module subroutine initDirichletTime(self, config, object) use json_module use moduleRefParam, ONLY: Volt_ref, ti_ref use moduleErrors @@ -142,7 +142,7 @@ submodule(moduleMesh) boundaryEM END SUBROUTINE initDirichletTime !Apply Dirichlet boundary condition to the poisson equation - SUBROUTINE applyDirichlet(self, vectorF) + module SUBROUTINE applyDirichlet(self, vectorF) USE moduleMesh IMPLICIT NONE @@ -159,7 +159,7 @@ submodule(moduleMesh) boundaryEM END SUBROUTINE applyDirichlet !Apply Dirichlet boundary condition with time temporal profile - SUBROUTINE applyDirichletTime(self, vectorF) + module SUBROUTINE applyDirichletTime(self, vectorF) USE moduleMesh USE moduleCaseParam, ONLY: timeStep, tauMin IMPLICIT NONE diff --git a/src/modules/mesh/moduleMesh@boundaryParticle.f90 b/src/modules/mesh/moduleMesh@boundaryParticle.f90 index 69f5d17..5715845 100644 --- a/src/modules/mesh/moduleMesh@boundaryParticle.f90 +++ b/src/modules/mesh/moduleMesh@boundaryParticle.f90 @@ -1,7 +1,7 @@ !moduleMeshBoundary: Boundary functions for the mesh edges submodule(moduleMesh) boundaryParticle contains - function boundaryParticleName_to_Index(boundaryName) result(bp) + module function boundaryParticleName_to_Index(boundaryName) result(bp) use moduleErrors implicit none @@ -209,6 +209,7 @@ submodule(moduleMesh) boundaryParticle select type(boundary) type is(boundaryQuasiNeutrality) boundary%alpha = 0.d0 + allocate(boundary%edges(0)) end select @@ -241,7 +242,7 @@ submodule(moduleMesh) boundaryParticle END SUBROUTINE reflection !Absoption in a surface - SUBROUTINE absorption(self, edge, part) + module SUBROUTINE absorption(self, edge, part) USE moduleCaseParam USE moduleSpecies IMPLICIT NONE @@ -278,7 +279,7 @@ submodule(moduleMesh) boundaryParticle END SUBROUTINE absorption !Transparent boundary condition - SUBROUTINE transparent(self, edge, part) + module SUBROUTINE transparent(self, edge, part) USE moduleSpecies IMPLICIT NONE @@ -294,7 +295,7 @@ submodule(moduleMesh) boundaryParticle !Symmetry axis. Reflects particles. !Although this function should never be called, it is set as a reflective boundary !to properly deal with possible particles reaching a corner and selecting this boundary. - SUBROUTINE symmetryAxis(self, edge, part) + module SUBROUTINE symmetryAxis(self, edge, part) USE moduleSpecies IMPLICIT NONE @@ -307,7 +308,7 @@ submodule(moduleMesh) boundaryParticle END SUBROUTINE symmetryAxis !Wall with temperature - SUBROUTINE wallTemperature(self, edge, part) + module SUBROUTINE wallTemperature(self, edge, part) USE moduleSpecies USE moduleRandom IMPLICIT NONE @@ -329,7 +330,7 @@ submodule(moduleMesh) boundaryParticle !Ionization surface: an electron will pass through the surface ! and create an ion-electron pair based on a neutral background - SUBROUTINE ionization(self, edge, part) + module SUBROUTINE ionization(self, edge, part) USE moduleList USE moduleSpecies USE moduleMesh @@ -426,7 +427,7 @@ submodule(moduleMesh) boundaryParticle END SUBROUTINE ionization - subroutine quasiNeutrality(self, edge, part) + module subroutine quasiNeutrality(self, edge, part) use moduleRandom implicit none @@ -483,7 +484,7 @@ submodule(moduleMesh) boundaryParticle end subroutine genericReflection - subroutine genericTransparent(edge, part) + module subroutine genericTransparent(edge, part) use moduleSpecies implicit none diff --git a/src/modules/mesh/moduleMesh@elements.f90 b/src/modules/mesh/moduleMesh@elements.f90 index bd1b2b1..6c4e7aa 100644 --- a/src/modules/mesh/moduleMesh@elements.f90 +++ b/src/modules/mesh/moduleMesh@elements.f90 @@ -1,7 +1,7 @@ submodule(moduleMesh) elements CONTAINS !Reset the output of node - PURE SUBROUTINE resetOutput(self) + PURE module SUBROUTINE resetOutput(self) USE moduleSpecies USE moduleOutput IMPLICIT NONE @@ -18,7 +18,7 @@ submodule(moduleMesh) elements END SUBROUTINE resetOutput - subroutine meshNodePointerAdd(self, node) + module subroutine meshNodePointerAdd(self, node) implicit none class(meshNodePointer), allocatable, intent(inout):: self(:) @@ -49,7 +49,7 @@ submodule(moduleMesh) elements end subroutine meshNodePointerAdd - function meshNodePointer_equal_type_type(self, other) result(isEqual) + module function meshNodePointer_equal_type_type(self, other) result(isEqual) implicit none class(meshNodePointer), intent(in):: self, other @@ -59,7 +59,7 @@ submodule(moduleMesh) elements end function meshNodePointer_equal_type_type - function meshNodePointer_equal_type_int(self, other) result(isEqual) + module function meshNodePointer_equal_type_int(self, other) result(isEqual) implicit none class(meshNodePointer), intent(in):: self @@ -70,7 +70,7 @@ submodule(moduleMesh) elements end function meshNodePointer_equal_type_int - function meshEdgePointer_equal_type_type(self, other) result(isEqual) + module function meshEdgePointer_equal_type_type(self, other) result(isEqual) implicit none class(meshEdgePointer), intent(in):: self, other @@ -80,7 +80,7 @@ submodule(moduleMesh) elements end function meshEdgePointer_equal_type_type - subroutine meshEdgePointer_add(self, edge) + module subroutine meshEdgePointer_add(self, edge) implicit none class(meshEdgePointer), allocatable, intent(inout):: self(:) @@ -111,7 +111,7 @@ submodule(moduleMesh) elements end subroutine meshEdgePointer_add - function meshEdgePointer_equal_type_int(self, other) result(isEqual) + module function meshEdgePointer_equal_type_int(self, other) result(isEqual) implicit none class(meshEdgePointer), intent(in):: self @@ -123,7 +123,7 @@ submodule(moduleMesh) elements end function meshEdgePointer_equal_type_int !Constructs the global K matrix - SUBROUTINE constructGlobalK(self) + module SUBROUTINE constructGlobalK(self) IMPLICIT NONE CLASS(meshParticles), INTENT(inout):: self @@ -189,7 +189,7 @@ submodule(moduleMesh) elements END SUBROUTINE constructGlobalK ! Gather the value of valNodes at position Xi of an edge - pure function gatherF_edge_scalar(self, Xi, nNodes, valNodes) RESULT(f) + pure module function gatherF_edge_scalar(self, Xi, nNodes, valNodes) RESULT(f) implicit none class(meshEdge), intent(in):: self @@ -205,7 +205,7 @@ submodule(moduleMesh) elements end function gatherF_edge_scalar !Gather the value of valNodes (scalar) at position Xi - PURE FUNCTION gatherF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(f) + PURE module FUNCTION gatherF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(f) IMPLICIT NONE CLASS(meshCell), INTENT(in):: self @@ -221,7 +221,7 @@ submodule(moduleMesh) elements END FUNCTION gatherF_cell_scalar !Gather the value of valNodes (array) at position Xi - PURE FUNCTION gatherF_cell_array(self, Xi, nNodes, valNodes) RESULT(f) + PURE module FUNCTION gatherF_cell_array(self, Xi, nNodes, valNodes) RESULT(f) IMPLICIT NONE CLASS(meshCell), INTENT(in):: self @@ -237,7 +237,7 @@ submodule(moduleMesh) elements END FUNCTION gatherF_cell_array !Gather the spatial derivative of valNodes (scalar) at position Xi - PURE FUNCTION gatherDF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(df) + PURE module FUNCTION gatherDF_cell_scalar(self, Xi, nNodes, valNodes) RESULT(df) IMPLICIT NONE CLASS(meshCell), INTENT(in):: self @@ -262,7 +262,7 @@ submodule(moduleMesh) elements END FUNCTION gatherDF_cell_scalar !Scatters particle properties into cell nodes - SUBROUTINE scatter(self, nNodes, part) + module SUBROUTINE scatter(self, nNodes, part) USE moduleMath USE moduleSpecies USE OMP_LIB diff --git a/src/modules/mesh/moduleMesh@surfaces.f90 b/src/modules/mesh/moduleMesh@surfaces.f90 index ec91f41..5be580d 100644 --- a/src/modules/mesh/moduleMesh@surfaces.f90 +++ b/src/modules/mesh/moduleMesh@surfaces.f90 @@ -1,6 +1,6 @@ submodule(moduleMesh) surfaces contains - function physicalSurface_to_index(ps) result(index) + module function physicalSurface_to_index(ps) result(index) implicit none integer:: ps