Improved some general things using pointers.
This commit is contained in:
parent
ec128902ad
commit
46348c86ee
9 changed files with 45 additions and 40 deletions
|
|
@ -71,7 +71,7 @@ MODULE moduleMesh1DCart
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
REAL(8):: arNodes(1:2)
|
||||
CONTAINS
|
||||
PROCEDURE, PASS:: init => initVol1DCartSegm
|
||||
|
|
@ -459,7 +459,7 @@ MODULE moduleMesh1DCart
|
|||
|
||||
CLASS(meshVol1DCartSegm), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
|
||||
NULLIFY(nextElement)
|
||||
IF (xi(1) < -1.D0) THEN
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ MODULE moduleMesh1DRad
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
REAL(8):: arNodes(1:2)
|
||||
CONTAINS
|
||||
PROCEDURE, PASS:: init => initVol1DRadSegm
|
||||
|
|
@ -470,7 +470,7 @@ MODULE moduleMesh1DRad
|
|||
|
||||
CLASS(meshVol1DRadSegm), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
|
||||
NULLIFY(nextElement)
|
||||
IF (xi(1) < -1.D0) THEN
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ MODULE moduleMesh2DCart
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL(), n3 => NULL(), n4 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
REAL(8):: arNodes(1:4) = 0.D0
|
||||
CONTAINS
|
||||
PROCEDURE, PASS:: init => initVolQuad2DCart
|
||||
|
|
@ -107,7 +107,7 @@ MODULE moduleMesh2DCart
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL(), n3 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL()
|
||||
REAL(8):: arNodes(1:3) = 0.D0
|
||||
|
||||
CONTAINS
|
||||
|
|
@ -607,7 +607,7 @@ MODULE moduleMesh2DCart
|
|||
|
||||
CLASS(meshVol2DCartQuad), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
REAL(8):: xiArray(1:4)
|
||||
INTEGER:: nextInt
|
||||
|
||||
|
|
@ -638,7 +638,6 @@ MODULE moduleMesh2DCart
|
|||
INTEGER, INTENT(in):: n
|
||||
INTEGER, INTENT(in):: p(:)
|
||||
REAL(8), DIMENSION(1:3):: r1, r2, r3
|
||||
REAL(8):: A
|
||||
|
||||
!Assign node index
|
||||
self%n = n
|
||||
|
|
@ -950,7 +949,7 @@ MODULE moduleMesh2DCart
|
|||
|
||||
CLASS(meshVol2DCartTria), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
REAL(8):: xiArray(1:3)
|
||||
INTEGER:: nextInt
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ MODULE moduleMesh2DCyl
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL(), n3 => NULL(), n4 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
REAL(8):: arNodes(1:4) = 0.D0
|
||||
|
||||
CONTAINS
|
||||
|
|
@ -108,7 +108,7 @@ MODULE moduleMesh2DCyl
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL(), n3 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL()
|
||||
REAL(8):: arNodes(1:3) = 0.D0
|
||||
|
||||
CONTAINS
|
||||
|
|
@ -628,7 +628,7 @@ MODULE moduleMesh2DCyl
|
|||
|
||||
CLASS(meshVol2DCylQuad), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
REAL(8):: xiArray(1:4)
|
||||
INTEGER:: nextInt
|
||||
|
||||
|
|
@ -979,7 +979,7 @@ MODULE moduleMesh2DCyl
|
|||
|
||||
CLASS(meshVol2DCylTria), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
REAL(8):: xiArray(1:3)
|
||||
INTEGER:: nextInt
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ MODULE moduleMesh3DCart
|
|||
!Connectivity to nodes
|
||||
CLASS(meshNode), POINTER:: n1 => NULL(), n2 => NULL(), n3 => NULL(), n4 => NULL()
|
||||
!Connectivity to adjacent elements
|
||||
CLASS(*), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
CLASS(meshElement), POINTER:: e1 => NULL(), e2 => NULL(), e3 => NULL(), e4 => NULL()
|
||||
CONTAINS
|
||||
PROCEDURE, PASS:: init => initVolTetra3DCart
|
||||
PROCEDURE, PASS:: randPos => randPosVolTetra
|
||||
|
|
@ -579,7 +579,7 @@ MODULE moduleMesh3DCart
|
|||
|
||||
CLASS(meshVol3DCartTetra), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
REAL(8):: xiArray(1:4)
|
||||
INTEGER:: nextInt
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,16 @@ MODULE moduleMesh
|
|||
USE moduleBoundary
|
||||
IMPLICIT NONE
|
||||
|
||||
!Parent of Node element
|
||||
TYPE, PUBLIC, ABSTRACT:: meshNode
|
||||
!Node index
|
||||
!Generic mesh element
|
||||
TYPE, PUBLIC, ABSTRACT:: meshElement
|
||||
!Index
|
||||
INTEGER:: n = 0
|
||||
CONTAINS
|
||||
|
||||
END TYPE meshElement
|
||||
|
||||
!Parent of Node element
|
||||
TYPE, PUBLIC, ABSTRACT, EXTENDS(meshElement):: meshNode
|
||||
!Node volume
|
||||
REAL(8):: v = 0.D0
|
||||
!Output values
|
||||
|
|
@ -44,26 +50,26 @@ MODULE moduleMesh
|
|||
!Containers for nodes in the mesh
|
||||
TYPE:: meshNodeCont
|
||||
CLASS(meshNode), ALLOCATABLE:: obj
|
||||
CONTAINS
|
||||
|
||||
END TYPE meshNodeCont
|
||||
|
||||
!Type for array of boundary functions (one per species)
|
||||
TYPE, PUBLIC:: fBoundaryGeneric
|
||||
PROCEDURE(boundary_interface), POINTER, NOPASS:: apply => NULL()
|
||||
CONTAINS
|
||||
|
||||
END TYPE
|
||||
|
||||
!Parent of Edge element
|
||||
TYPE, PUBLIC, ABSTRACT:: meshEdge
|
||||
!Element index
|
||||
INTEGER:: n = 0
|
||||
TYPE, PUBLIC, ABSTRACT, EXTENDS(meshElement):: meshEdge
|
||||
!Connectivity to vols
|
||||
CLASS(meshVol), POINTER:: e1 => NULL(), e2 => NULL()
|
||||
!Normal vector
|
||||
REAL(8):: normal(1:3)
|
||||
!Weight for random injection of particles
|
||||
REAL(8):: weight = 1.D0
|
||||
!Pointer to boundary element
|
||||
!Pointer to boundary type
|
||||
TYPE(boundaryCont), POINTER:: boundary
|
||||
!Array of functions for boundary conditions
|
||||
TYPE(fBoundaryGeneric), ALLOCATABLE:: fBoundary(:)
|
||||
|
|
@ -98,7 +104,7 @@ MODULE moduleMesh
|
|||
|
||||
END FUNCTION getNodesEdge_interface
|
||||
|
||||
!Returns the intersecction between an edge and a line defined by point r0 and vector v0
|
||||
!Returns the intersecction between an edge and a line defined by point r0
|
||||
PURE FUNCTION intersectionEdge_interface(self, r0) RESULT(r)
|
||||
IMPORT:: meshEdge
|
||||
CLASS(meshEdge), INTENT(in):: self
|
||||
|
|
@ -136,9 +142,7 @@ MODULE moduleMesh
|
|||
END TYPE meshEdgeCont
|
||||
|
||||
!Parent of Volume element
|
||||
TYPE, PUBLIC, ABSTRACT:: meshVol
|
||||
!Volume index
|
||||
INTEGER:: n = 0
|
||||
TYPE, PUBLIC, ABSTRACT, EXTENDS(meshElement):: meshVol
|
||||
!Maximum collision rate
|
||||
REAL(8):: sigmaVrelMax = 0.D0
|
||||
!Volume
|
||||
|
|
@ -211,10 +215,10 @@ MODULE moduleMesh
|
|||
END FUNCTION elemF_interface
|
||||
|
||||
SUBROUTINE nextElement_interface(self, xi, nextElement)
|
||||
IMPORT:: meshVol
|
||||
IMPORT:: meshVol, meshElement
|
||||
CLASS(meshVol), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: xi(1:3)
|
||||
CLASS(*), POINTER, INTENT(out):: nextElement
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
|
||||
END SUBROUTINE nextElement_interface
|
||||
|
||||
|
|
@ -343,6 +347,7 @@ MODULE moduleMesh
|
|||
!Find next cell for particle
|
||||
RECURSIVE SUBROUTINE findCell(self, part, oldCell)
|
||||
USE moduleSpecies
|
||||
USE moduleErrors
|
||||
USE OMP_LIB
|
||||
IMPLICIT NONE
|
||||
|
||||
|
|
@ -350,7 +355,7 @@ MODULE moduleMesh
|
|||
CLASS(meshVol), OPTIONAL, INTENT(in):: oldCell
|
||||
CLASS(particle), INTENT(inout), TARGET:: part
|
||||
REAL(8):: xi(1:3)
|
||||
CLASS(*), POINTER:: nextElement
|
||||
CLASS(meshElement), POINTER:: nextElement
|
||||
|
||||
xi = self%phy2log(part%r)
|
||||
!Checks if particle is inside 'self' cell
|
||||
|
|
@ -389,7 +394,8 @@ MODULE moduleMesh
|
|||
END IF
|
||||
|
||||
CLASS DEFAULT
|
||||
WRITE(*,*) "ERROR, CHECK findCell"
|
||||
WRITE (*, "(A, I6)") "Element = ", self%n
|
||||
CALL criticalError("No connectivity found for element", "findCell")
|
||||
|
||||
END SELECT
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ MODULE moduleMeshBoundary
|
|||
!rpp = final position of particle
|
||||
!vpp = final velocity of particle
|
||||
REAL(8), DIMENSION(1:3):: rp, vpp
|
||||
REAL(8):: tI
|
||||
REAL(8):: taup !time step for reflecting process
|
||||
|
||||
!Reflect particle velocity
|
||||
vpp = part%v - 2.D0*DOT_PRODUCT(part%v, edge%normal)*edge%normal
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ MODULE moduleBoundary
|
|||
REAL(8):: effectiveTime
|
||||
REAL(8):: eThreshold
|
||||
REAL(8):: deltaV
|
||||
|
||||
CONTAINS
|
||||
|
||||
END TYPE boundaryIonization
|
||||
|
|
@ -53,23 +52,26 @@ MODULE moduleBoundary
|
|||
|
||||
END TYPE boundaryAxis
|
||||
|
||||
!Wrapper for boundary types (one per species)
|
||||
TYPE:: bTypesCont
|
||||
CLASS(boundaryGeneric), ALLOCATABLE:: obj
|
||||
CONTAINS
|
||||
|
||||
END TYPE bTypesCont
|
||||
|
||||
!Wrapper for boundary conditions
|
||||
TYPE:: boundaryCont
|
||||
INTEGER:: id = 0
|
||||
INTEGER:: n = 0
|
||||
CHARACTER(:), ALLOCATABLE:: name
|
||||
INTEGER:: physicalSurface = 0
|
||||
CLASS(bTypesCont), ALLOCATABLE:: bTypes(:)
|
||||
INTEGER:: physicalSurface = 0 !Physical surface as defined in the mesh file
|
||||
CLASS(bTypesCont), ALLOCATABLE:: bTypes(:) !Array for boundary per species
|
||||
CONTAINS
|
||||
|
||||
END TYPE boundaryCont
|
||||
|
||||
!Number of boundaries
|
||||
INTEGER:: nBoundary = 0
|
||||
!Array for boundary information
|
||||
!Array for boundaries
|
||||
TYPE(boundaryCont), ALLOCATABLE, TARGET:: boundary(:)
|
||||
|
||||
CONTAINS
|
||||
|
|
@ -82,7 +84,7 @@ MODULE moduleBoundary
|
|||
|
||||
id = 0
|
||||
DO i = 1, nBoundary
|
||||
IF (physicalSurface == boundary(i)%physicalSurface) id = boundary(i)%id
|
||||
IF (physicalSurface == boundary(i)%physicalSurface) id = boundary(i)%n
|
||||
|
||||
END DO
|
||||
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ MODULE moduleInput
|
|||
WRITE(istring, '(i2)') i
|
||||
object = 'boundary(' // TRIM(istring) // ')'
|
||||
|
||||
boundary(i)%id = i
|
||||
boundary(i)%n = i
|
||||
CALL config%get(object // '.name', boundary(i)%name, found)
|
||||
CALL config%get(object // '.physicalSurface', boundary(i)%physicalSurface, found)
|
||||
CALL config%info(object // '.bTypes', found, n_children = nTypes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue