From 6b96d56c9d1ae1a01057f6cef240e763a2816f31 Mon Sep 17 00:00:00 2001 From: JGonzalez Date: Fri, 13 Feb 2026 10:58:31 +0100 Subject: [PATCH] Init for edges changed. Now, input --- src/modules/mesh/1DCart/moduleMesh1DCart.f90 | 21 ++++++++------------ src/modules/mesh/1DRad/moduleMesh1DRad.f90 | 21 ++++++++------------ src/modules/mesh/2DCart/moduleMesh2DCart.f90 | 21 ++++++++------------ src/modules/mesh/2DCyl/moduleMesh2DCyl.f90 | 19 +++++++----------- src/modules/mesh/3DCart/moduleMesh3DCart.f90 | 21 ++++++++------------ src/modules/mesh/moduleMesh.f90 | 15 +++++++++----- 6 files changed, 49 insertions(+), 69 deletions(-) diff --git a/src/modules/mesh/1DCart/moduleMesh1DCart.f90 b/src/modules/mesh/1DCart/moduleMesh1DCart.f90 index f7e91e2..5a9e512 100644 --- a/src/modules/mesh/1DCart/moduleMesh1DCart.f90 +++ b/src/modules/mesh/1DCart/moduleMesh1DCart.f90 @@ -100,16 +100,15 @@ MODULE moduleMesh1DCart !EDGE FUNCTIONS !Init edge element - SUBROUTINE initEdge1DCart(self, n, p, bt, physicalSurface) - USE moduleSpecies + SUBROUTINE initEdge1DCart(self, n, p, bt) + USE moduleSpecies, only: nSpecies USE moduleErrors IMPLICIT NONE CLASS(meshEdge1DCart), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nSpecies) REAL(8), DIMENSION(1:3):: r1 INTEGER:: s @@ -125,17 +124,13 @@ MODULE moduleMesh1DCart self%normal = (/ 1.D0, 0.D0, 0.D0 /) - !Boundary index - self%boundary => boundaries(bt) - ALLOCATE(self%fboundary(1:nSpecies)) + !Boundary particle linking + allocate(self%boundariesParticle(1:nSpecies)) !Assign functions to boundary - DO s = 1, nSpecies - CALL pointBoundaryFunction(self, s) + do s = 1, nSpecies + self%boundariesParticle(s)%obj => boundariesParticle(bt(s))%obj - END DO - - !Physical Surface - self%physicalSurface = physicalSurface + end do END SUBROUTINE initEdge1DCart diff --git a/src/modules/mesh/1DRad/moduleMesh1DRad.f90 b/src/modules/mesh/1DRad/moduleMesh1DRad.f90 index 983743e..6e35fe2 100644 --- a/src/modules/mesh/1DRad/moduleMesh1DRad.f90 +++ b/src/modules/mesh/1DRad/moduleMesh1DRad.f90 @@ -100,16 +100,15 @@ MODULE moduleMesh1DRad !EDGE FUNCTIONS !Init edge element - SUBROUTINE initEdge1DRad(self, n, p, bt, physicalSurface) - USE moduleSpecies + SUBROUTINE initEdge1DRad(self, n, p, bt) + USE moduleSpecies, only:nSpecies USE moduleErrors IMPLICIT NONE CLASS(meshEdge1DRad), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nSpecies) REAL(8), DIMENSION(1:3):: r1 INTEGER:: s @@ -125,17 +124,13 @@ MODULE moduleMesh1DRad self%normal = (/ 1.D0, 0.D0, 0.D0 /) - !Boundary index - self%boundary => boundaries(bt) - ALLOCATE(self%fboundary(1:nSpecies)) + !Boundary particle linking + allocate(self%boundariesParticle(1:nSpecies)) !Assign functions to boundary - DO s = 1, nSpecies - CALL pointBoundaryFunction(self, s) + do s = 1, nSpecies + self%boundariesParticle(s)%obj => boundariesParticle(bt(s))%obj - END DO - - !Physical Surface - self%physicalSurface = physicalSurface + end do END SUBROUTINE initEdge1DRad diff --git a/src/modules/mesh/2DCart/moduleMesh2DCart.f90 b/src/modules/mesh/2DCart/moduleMesh2DCart.f90 index 5886e85..e2014a7 100644 --- a/src/modules/mesh/2DCart/moduleMesh2DCart.f90 +++ b/src/modules/mesh/2DCart/moduleMesh2DCart.f90 @@ -140,16 +140,15 @@ MODULE moduleMesh2DCart !EDGE FUNCTIONS !Init edge element - SUBROUTINE initEdge2DCart(self, n, p, bt, physicalSurface) - USE moduleSpecies + SUBROUTINE initEdge2DCart(self, n, p, bt) + USE moduleSpecies, only:nSpecies USE moduleErrors IMPLICIT NONE CLASS(meshEdge2DCart), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nSpecies) REAL(8), DIMENSION(1:3):: r1, r2 INTEGER:: s @@ -169,17 +168,13 @@ MODULE moduleMesh2DCart 0.D0 /) self%normal = self%normal/NORM2(self%normal) - !Boundary index - self%boundary => boundaries(bt) - ALLOCATE(self%fboundary(1:nSpecies)) + !Boundary particle linking + allocate(self%boundariesParticle(1:nSpecies)) !Assign functions to boundary - DO s = 1, nSpecies - CALL pointBoundaryFunction(self, s) + do s = 1, nSpecies + self%boundariesParticle(s)%obj => boundariesParticle(bt(s))%obj - END DO - - !Physical surface - self%physicalSurface = physicalSurface + end do END SUBROUTINE initEdge2DCart diff --git a/src/modules/mesh/2DCyl/moduleMesh2DCyl.f90 b/src/modules/mesh/2DCyl/moduleMesh2DCyl.f90 index 9634204..8b64b9d 100644 --- a/src/modules/mesh/2DCyl/moduleMesh2DCyl.f90 +++ b/src/modules/mesh/2DCyl/moduleMesh2DCyl.f90 @@ -140,7 +140,7 @@ MODULE moduleMesh2DCyl !EDGE FUNCTIONS !Init edge element - SUBROUTINE initEdge2DCyl(self, n, p, bt, physicalSurface) + SUBROUTINE initEdge2DCyl(self, n, p, bt) USE moduleSpecies USE moduleErrors USE moduleConstParam, ONLY: PI @@ -149,8 +149,7 @@ MODULE moduleMesh2DCyl CLASS(meshEdge2DCyl), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nsPecies) REAL(8), DIMENSION(1:3):: r1, r2 INTEGER:: s @@ -178,17 +177,13 @@ MODULE moduleMesh2DCyl 0.D0 /) self%normal = self%normal/NORM2(self%normal) - !Boundary index - self%boundary => boundaries(bt) - ALLOCATE(self%fboundary(1:nSpecies)) + !Boundary particle linking + allocate(self%boundariesParticle(1:nSpecies)) !Assign functions to boundary - DO s = 1, nSpecies - CALL pointBoundaryFunction(self, s) + do s = 1, nSpecies + self%boundariesParticle(s)%obj => boundariesParticle(bt(s))%obj - END DO - - !Physical surface - self%physicalSurface = physicalSurface + end do END SUBROUTINE initEdge2DCyl diff --git a/src/modules/mesh/3DCart/moduleMesh3DCart.f90 b/src/modules/mesh/3DCart/moduleMesh3DCart.f90 index 1cbcac2..a10616a 100644 --- a/src/modules/mesh/3DCart/moduleMesh3DCart.f90 +++ b/src/modules/mesh/3DCart/moduleMesh3DCart.f90 @@ -103,8 +103,8 @@ MODULE moduleMesh3DCart !EDGE FUNCTIONS !Init surface element - SUBROUTINE initEdge3DCartTria(self, n, p, bt, physicalSurface) - USE moduleSpecies + SUBROUTINE initEdge3DCartTria(self, n, p, bt) + USE moduleSpecies, only: nSpecies USE moduleErrors USE moduleMath USE moduleRefParam, ONLY: L_ref @@ -113,8 +113,7 @@ MODULE moduleMesh3DCart CLASS(meshEdge3DCartTria), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nSpecies) REAL(8), DIMENSION(1:3):: r1, r2, r3 REAL(8), DIMENSION(1:3):: vec1, vec2 INTEGER:: s @@ -143,17 +142,13 @@ MODULE moduleMesh3DCart self%surface = 1.D0/L_ref**2 !TODO: FIX THIS WHEN MOVING TO 3D - !Boundary index - self%boundary => boundaries(bt) - ALLOCATE(self%fBoundary(1:nSpecies)) + !Boundary particle linking + allocate(self%boundariesParticle(1:nSpecies)) !Assign functions to boundary - DO s = 1, nSpecies - CALL pointBoundaryFunction(self, s) + do s = 1, nSpecies + self%boundariesParticle(s)%obj => boundariesParticle(bt(s))%obj - END DO - - !Physical surface - self%physicalSurface = physicalSurface + end do END SUBROUTINE initEdge3DCartTria diff --git a/src/modules/mesh/moduleMesh.f90 b/src/modules/mesh/moduleMesh.f90 index 144305c..f2011e3 100644 --- a/src/modules/mesh/moduleMesh.f90 +++ b/src/modules/mesh/moduleMesh.f90 @@ -87,9 +87,8 @@ MODULE moduleMesh ! Surface of edge REAL(8):: surface = 0.D0 !Pointer to boundary per species - TYPE(boundaryCont), POINTER:: boundariesParticle(:) + TYPE(boundaryPointer), allocatable:: boundariesParticle(:) !Physical surface for the edge - INTEGER:: physicalSurface CONTAINS !DEFERED PROCEDURES PROCEDURE(initEdge_interface), DEFERRED, PASS:: init @@ -117,14 +116,14 @@ MODULE moduleMesh ABSTRACT INTERFACE !Inits the edge parameters - SUBROUTINE initEdge_interface(self, n, p, bt, physicalSurface) + SUBROUTINE initEdge_interface(self, n, p, bt) + use moduleSpecies, only:nSpecies IMPORT:: meshEdge CLASS(meshEdge), INTENT(out):: self INTEGER, INTENT(in):: n INTEGER, INTENT(in):: p(:) - INTEGER, INTENT(in):: bt - INTEGER, INTENT(in):: physicalSurface + INTEGER, INTENT(in):: bt(1:nSpecies) END SUBROUTINE initEdge_interface @@ -779,6 +778,12 @@ MODULE moduleMesh END TYPE boundaryCont + type:: boundaryPointer + class(boundaryGeneric), pointer:: obj + contains + + end type boundaryPointer + !Number of boundaries INTEGER:: nBoundaries = 0 !Array for boundaries