DOES NOT COMPILE: Break
Small break of changing functions. Still some geometries to change.
This commit is contained in:
parent
7f6afd6a87
commit
ba272de4e3
3 changed files with 589 additions and 680 deletions
|
|
@ -24,8 +24,10 @@ MODULE moduleMesh
|
|||
!Lock indicator for scattering
|
||||
INTEGER(KIND=OMP_LOCK_KIND):: lock
|
||||
CONTAINS
|
||||
!DEFERED PROCEDURES
|
||||
PROCEDURE(initNode_interface), DEFERRED, PASS:: init
|
||||
PROCEDURE(getCoord_interface), DEFERRED, PASS:: getCoordinates
|
||||
!GENERIC PROCEDURES
|
||||
PROCEDURE, PASS:: resetOutput
|
||||
|
||||
END TYPE meshNode
|
||||
|
|
@ -83,6 +85,7 @@ MODULE moduleMesh
|
|||
!Physical surface for the edge
|
||||
INTEGER:: physicalSurface
|
||||
CONTAINS
|
||||
!DEFERED PROCEDURES
|
||||
PROCEDURE(initEdge_interface), DEFERRED, PASS:: init
|
||||
PROCEDURE(getNodesEdge_interface), DEFERRED, PASS:: getNodes
|
||||
PROCEDURE(intersectionEdge_interface), DEFERRED, PASS:: intersection
|
||||
|
|
@ -166,37 +169,41 @@ MODULE moduleMesh
|
|||
!Total weight of particles inside cell
|
||||
REAL(8), ALLOCATABLE:: totalWeight(:)
|
||||
CONTAINS
|
||||
!DEFERRED PROCEDURES
|
||||
!Init the cell
|
||||
PROCEDURE(initCell_interface), DEFERRED, PASS:: init
|
||||
PROCEDURE(initCell_interface), DEFERRED, PASS:: init
|
||||
!Get the index of the nodes
|
||||
PROCEDURE(getNodesCell_interface), DEFERRED, PASS:: getNodes
|
||||
PROCEDURE(getNodesCell_interface), DEFERRED, PASS:: getNodes
|
||||
!Calculate random position on the cell
|
||||
PROCEDURE(randPosVol_interface), DEFERRED, PASS:: randPos
|
||||
PROCEDURE(randPosCell_interface), DEFERRED, PASS:: randPos
|
||||
!Obtain functions and values of cell natural functions
|
||||
PROCEDURE(fPsi_interface), DEFERRED, PASS:: fPsi
|
||||
PROCEDURE(dPsi_interface), DEFERRED, PASS:: dPsi
|
||||
PROCEDURE(detJac_interface), DEFERRED, PASS:: detJac
|
||||
PROCEDURE(invJac_interface), DEFERRED, PASS:: invJac
|
||||
PROCEDURE(fPsi_interface), DEFERRED, NOPASS:: fPsi
|
||||
PROCEDURE(dPsi_interface), DEFERRED, NOPASS:: dPsi
|
||||
PROCEDURE(partialDer_interface), DEFERRED, PASS:: partialDer
|
||||
PROCEDURE(detJac_interface), DEFERRED, NOPASS:: detJac
|
||||
PROCEDURE(invJac_interface), DEFERRED, NOPASS:: invJac
|
||||
!Procedures to get specific values in the node
|
||||
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherElectricField
|
||||
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherMagneticField
|
||||
!Compute K and F to solve PDE on the mesh
|
||||
PROCEDURE(elemK_interface), DEFERRED, PASS:: elemK
|
||||
PROCEDURE(elemF_interface), DEFERRED, PASS:: elemF
|
||||
!Check if particle is inside the cell
|
||||
PROCEDURE(inside_interface), DEFERRED, NOPASS:: inside
|
||||
!Convert physical coordinates (r) into logical coordinates (Xi)
|
||||
PROCEDURE(phy2log_interface), DEFERRED, PASS:: phy2log
|
||||
!Returns the neighbour element based on particle position outside the cell
|
||||
PROCEDURE(neighbourElement_interface), DEFERRED, PASS:: neighbourElement
|
||||
!Scatter properties of particles on cell nodes
|
||||
PROCEDURE, PASS:: scatter
|
||||
!Subroutine to find in which cell a particle is located
|
||||
PROCEDURE, PASS:: findCell
|
||||
!Gather value and spatial derivative on the nodes at position Xi
|
||||
PROCEDURE, PASS, PRIVATE:: gatherF_scalar
|
||||
PROCEDURE, PASS, PRIVATE:: gatherF_array
|
||||
PROCEDURE, PASS, PRIVATE:: gatherDF_scalar
|
||||
GENERIC:: gatherF => gatherF_scalar, gatherF_array
|
||||
GENERIC:: gatherDF => gatherDF_scalar
|
||||
!Procedures to get specific values in the node
|
||||
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherElectricField
|
||||
PROCEDURE(gatherArray_interface), DEFERRED, PASS:: gatherMagneticField
|
||||
!Compute K and F to solve PDE on the mesh
|
||||
PROCEDURE(elemK_interface), DEFERRED, PASS:: elemK
|
||||
PROCEDURE(elemF_interface), DEFERRED, PASS:: elemF
|
||||
!Subroutines to find in which cell a particle is located
|
||||
PROCEDURE, PASS:: findCell
|
||||
PROCEDURE(inside_interface), DEFERRED, NOPASS:: inside
|
||||
PROCEDURE(nextElement_interface), DEFERRED, PASS:: nextElement
|
||||
!Convert physical coordinates (r) into logical coordinates (Xi)
|
||||
PROCEDURE(phy2log_interface), DEFERRED, PASS:: phy2log
|
||||
|
||||
END TYPE meshCell
|
||||
|
||||
|
|
@ -219,40 +226,44 @@ MODULE moduleMesh
|
|||
|
||||
END FUNCTION getNodesCell_interface
|
||||
|
||||
PURE FUNCTION fPsi_interface(self, Xi, nNodes) RESULT(fPsi)
|
||||
FUNCTION randPosCell_interface(self) RESULT(r)
|
||||
IMPORT:: meshCell
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
REAL(8):: r(1:3)
|
||||
|
||||
END FUNCTION randPosCell_interface
|
||||
|
||||
PURE FUNCTION fPsi_interface(Xi, nNodes) RESULT(fPsi)
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
INTEGER, INTENT(in):: nNodes
|
||||
REAL(8):: fPsi(1:nNodes)
|
||||
|
||||
END FUNCTION fPsi_interface
|
||||
|
||||
PURE FUNCTION dPsi_interface(self, Xi, nNodes) RESULT(dPsi)
|
||||
IMPORT:: meshCell
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
PURE FUNCTION dPsi_interface(Xi, nNodes) RESULT(dPsi)
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
INTEGER, INTENT(in):: nNodes
|
||||
REAL(8):: dPsi(1:3, 1:nNodes)
|
||||
|
||||
END FUNCTION dPsi_interface
|
||||
|
||||
PURE FUNCTION detJac_interface(self, Xi, nNodes, dPsi_in) RESULT(dJ)
|
||||
PURE FUNCTION partialDer_interface(self, nNodes, dPsi) RESULT(pDer)
|
||||
IMPORT:: meshCell
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
INTEGER, INTENT(in):: nNodes
|
||||
REAL(8), INTENT(in), OPTIONAL:: dPsi_in(1:3,1:nNodes)
|
||||
REAL(8), INTENT(in):: dPsi(1:3, 1:nNodes)
|
||||
REAL(8):: pDer(1:3, 1:3)
|
||||
|
||||
END FUNCTION partialDer_interface
|
||||
|
||||
PURE FUNCTION detJac_interface(pDer) RESULT(dJ)
|
||||
REAL(8), INTENT(in):: pDer(1:3,1:3)
|
||||
REAL(8):: dJ
|
||||
|
||||
END FUNCTION detJac_interface
|
||||
|
||||
PURE FUNCTION invJac_interface(self, Xi, nNodes, dPsi_in) RESULT(invJ)
|
||||
IMPORT:: meshCell
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
INTEGER, INTENT(in):: nNodes
|
||||
REAL(8), INTENT(in), OPTIONAL:: dPsi_in(1:3,1:nNodes)
|
||||
PURE FUNCTION invJac_interface(pDer) RESULT(invJ)
|
||||
REAL(8), INTENT(in):: pDer(1:3,1:3)
|
||||
REAL(8):: invJ(1:3,1:3)
|
||||
|
||||
END FUNCTION invJac_interface
|
||||
|
|
@ -282,13 +293,12 @@ MODULE moduleMesh
|
|||
|
||||
END FUNCTION elemF_interface
|
||||
|
||||
SUBROUTINE nextElement_interface(self, Xi, nextElement)
|
||||
IMPORT:: meshCell, meshElement
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
PURE FUNCTION inside_interface(Xi) RESULT(ins)
|
||||
IMPORT:: meshCell
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
CLASS(meshElement), POINTER, INTENT(out):: nextElement
|
||||
LOGICAL:: ins
|
||||
|
||||
END SUBROUTINE nextElement_interface
|
||||
END FUNCTION inside_interface
|
||||
|
||||
PURE FUNCTION phy2log_interface(self,r) RESULT(Xi)
|
||||
IMPORT:: meshCell
|
||||
|
|
@ -298,19 +308,13 @@ MODULE moduleMesh
|
|||
|
||||
END FUNCTION phy2log_interface
|
||||
|
||||
PURE FUNCTION inside_interface(Xi) RESULT(ins)
|
||||
IMPORT:: meshCell
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
LOGICAL:: ins
|
||||
|
||||
END FUNCTION inside_interface
|
||||
|
||||
FUNCTION randPosVol_interface(self) RESULT(r)
|
||||
IMPORT:: meshCell
|
||||
SUBROUTINE neighbourElement_interface(self, Xi, neighbourElement)
|
||||
IMPORT:: meshCell, meshElement
|
||||
CLASS(meshCell), INTENT(in):: self
|
||||
REAL(8):: r(1:3)
|
||||
REAL(8), INTENT(in):: Xi(1:3)
|
||||
CLASS(meshElement), POINTER, INTENT(out):: neighbourElement
|
||||
|
||||
END FUNCTION randPosVol_interface
|
||||
END SUBROUTINE neighbourElement_interface
|
||||
|
||||
END INTERFACE
|
||||
|
||||
|
|
@ -332,11 +336,13 @@ MODULE moduleMesh
|
|||
TYPE(meshNodeCont), ALLOCATABLE:: nodes(:)
|
||||
!Array of cell elements
|
||||
TYPE(meshCellCont), ALLOCATABLE:: cells(:)
|
||||
!PROCEDURES SPECIFIC OF FILE TYPE
|
||||
PROCEDURE(readMesh_interface), POINTER, PASS:: readMesh => NULL()
|
||||
PROCEDURE(readInitial_interface), POINTER, NOPASS:: readInitial => NULL()
|
||||
PROCEDURE(connectMesh_interface), POINTER, PASS:: connectMesh => NULL()
|
||||
PROCEDURE(printColl_interface), POINTER, PASS:: printColl => NULL()
|
||||
CONTAINS
|
||||
!GENERIC PROCEDURES
|
||||
PROCEDURE, PASS:: doCollisions
|
||||
|
||||
END TYPE meshGeneric
|
||||
|
|
@ -345,7 +351,6 @@ MODULE moduleMesh
|
|||
!Reads the mesh from a file
|
||||
SUBROUTINE readMesh_interface(self, filename)
|
||||
IMPORT meshGeneric
|
||||
|
||||
CLASS(meshGeneric), INTENT(inout):: self
|
||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: filename
|
||||
|
||||
|
|
@ -363,7 +368,6 @@ MODULE moduleMesh
|
|||
!Connects cell and edges to the mesh
|
||||
SUBROUTINE connectMesh_interface(self)
|
||||
IMPORT meshGeneric
|
||||
|
||||
CLASS(meshGeneric), INTENT(inout):: self
|
||||
|
||||
END SUBROUTINE connectMesh_interface
|
||||
|
|
@ -371,7 +375,6 @@ MODULE moduleMesh
|
|||
!Prints number of collisions in each cell
|
||||
SUBROUTINE printColl_interface(self, t)
|
||||
IMPORT meshGeneric
|
||||
|
||||
CLASS(meshGeneric), INTENT(inout):: self
|
||||
INTEGER, INTENT(in):: t
|
||||
|
||||
|
|
@ -388,28 +391,21 @@ MODULE moduleMesh
|
|||
REAL(8), ALLOCATABLE, DIMENSION(:,:):: K
|
||||
!Permutation matrix for P L U factorization
|
||||
INTEGER, ALLOCATABLE, DIMENSION(:,:):: IPIV
|
||||
!PROCEDURES SPECIFIC OF FILE TYPE
|
||||
PROCEDURE(printOutput_interface), POINTER, PASS:: printOutput => NULL()
|
||||
PROCEDURE(printEM_interface), POINTER, PASS:: printEM => NULL()
|
||||
PROCEDURE(doCoulomb_interface), POINTER, PASS:: doCoulomb => NULL()
|
||||
PROCEDURE(printAverage_interface), POINTER, PASS:: printAverage => NULL()
|
||||
CONTAINS
|
||||
!GENERIC PROCEDURES
|
||||
PROCEDURE, PASS:: constructGlobalK
|
||||
|
||||
END TYPE meshParticles
|
||||
|
||||
ABSTRACT INTERFACE
|
||||
!Perform Coulomb Scattering
|
||||
SUBROUTINE doCoulomb_interface(self)
|
||||
IMPORT meshParticles
|
||||
|
||||
CLASS(meshParticles), INTENT(inout):: self
|
||||
|
||||
END SUBROUTINE doCoulomb_interface
|
||||
|
||||
!Prints Species data
|
||||
SUBROUTINE printOutput_interface(self, t)
|
||||
IMPORT meshParticles
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
INTEGER, INTENT(in):: t
|
||||
|
||||
|
|
@ -418,21 +414,25 @@ MODULE moduleMesh
|
|||
!Prints EM info
|
||||
SUBROUTINE printEM_interface(self, t)
|
||||
IMPORT meshParticles
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
INTEGER, INTENT(in):: t
|
||||
|
||||
END SUBROUTINE printEM_interface
|
||||
|
||||
!Perform Coulomb Scattering
|
||||
SUBROUTINE doCoulomb_interface(self)
|
||||
IMPORT meshParticles
|
||||
CLASS(meshParticles), INTENT(inout):: self
|
||||
|
||||
END SUBROUTINE doCoulomb_interface
|
||||
|
||||
!Prints average values
|
||||
SUBROUTINE printAverage_interface(self)
|
||||
IMPORT meshParticles
|
||||
|
||||
CLASS(meshParticles), INTENT(in):: self
|
||||
|
||||
END SUBROUTINE printAverage_interface
|
||||
|
||||
|
||||
END INTERFACE
|
||||
|
||||
TYPE(meshParticles), TARGET:: mesh
|
||||
|
|
@ -440,6 +440,7 @@ MODULE moduleMesh
|
|||
!Collision (MCC) mesh
|
||||
TYPE, EXTENDS(meshGeneric):: meshCollisions
|
||||
CONTAINS
|
||||
!GENERIC PROCEDURES
|
||||
|
||||
END TYPE meshCollisions
|
||||
|
||||
|
|
@ -448,7 +449,6 @@ MODULE moduleMesh
|
|||
ABSTRACT INTERFACE
|
||||
SUBROUTINE readMeshColl_interface(self, filename)
|
||||
IMPORT meshCollisions
|
||||
|
||||
CLASS(meshCollisions), INTENT(inout):: self
|
||||
CHARACTER(:), ALLOCATABLE, INTENT(in):: filename
|
||||
|
||||
|
|
@ -577,12 +577,14 @@ MODULE moduleMesh
|
|||
REAL(8), INTENT(in):: valNodes(1:nNodes)
|
||||
REAL(8):: df(1:3)
|
||||
REAL(8):: dPsi(1:3, 1:nNodes)
|
||||
REAL(8):: pDer(1:3,1:3)
|
||||
REAL(8):: dPsiR(1:3, 1:nNodes)
|
||||
REAL(8):: invJ(1:3, 1:3), detJ
|
||||
|
||||
dPsi = self%dPsi(Xi, nNodes)
|
||||
detJ = self%detJac(Xi, nNodes, dPsi)
|
||||
invJ = self%invJac(Xi, nNodes, dPsi)
|
||||
pDer = self%partialDer(nNodes, dPsi)
|
||||
detJ = self%detJac(pDer)
|
||||
invJ = self%invJac(pDer)
|
||||
dPsiR = MATMUL(invJ, dPsi)/detJ
|
||||
df = (/ DOT_PRODUCT(dPsiR(1,:), valNodes), &
|
||||
DOT_PRODUCT(dPsiR(2,:), valNodes), &
|
||||
|
|
@ -637,7 +639,7 @@ MODULE moduleMesh
|
|||
CLASS(particle), INTENT(inout), TARGET:: part
|
||||
CLASS(meshCell), OPTIONAL, INTENT(in):: oldCell
|
||||
REAL(8):: Xi(1:3)
|
||||
CLASS(meshElement), POINTER:: nextElement
|
||||
CLASS(meshElement), POINTER:: neighbourElement
|
||||
INTEGER:: sp
|
||||
|
||||
Xi = self%phy2log(part%r)
|
||||
|
|
@ -655,16 +657,16 @@ MODULE moduleMesh
|
|||
|
||||
ELSE
|
||||
!If not, searches for a neighbour and repeats the process.
|
||||
CALL self%nextElement(Xi, nextElement)
|
||||
CALL self%neighbourElement(Xi, neighbourElement)
|
||||
!Defines the next step
|
||||
SELECT TYPE(nextElement)
|
||||
SELECT TYPE(neighbourElement)
|
||||
CLASS IS(meshCell)
|
||||
!Particle moved to new cell, repeat find procedure
|
||||
CALL nextElement%findCell(part, self)
|
||||
CALL neighbourElement%findCell(part, self)
|
||||
|
||||
CLASS IS (meshEdge)
|
||||
!Particle encountered a surface, apply boundary
|
||||
CALL nextElement%fBoundary(part%species%n)%apply(nextElement,part)
|
||||
CALL neighbourElement%fBoundary(part%species%n)%apply(neighbourElement,part)
|
||||
|
||||
!If particle is still inside the domain, call findCell
|
||||
IF (part%n_in) THEN
|
||||
|
|
@ -709,7 +711,7 @@ MODULE moduleMesh
|
|||
LOGICAL:: found
|
||||
CLASS(meshCell), POINTER:: cell
|
||||
REAL(8), DIMENSION(1:3):: Xi
|
||||
CLASS(meshElement), POINTER:: nextElement
|
||||
CLASS(meshElement), POINTER:: neighbourElement
|
||||
INTEGER:: sp
|
||||
|
||||
found = .FALSE.
|
||||
|
|
@ -727,11 +729,11 @@ MODULE moduleMesh
|
|||
found = .TRUE.
|
||||
|
||||
ELSE
|
||||
CALL cell%nextElement(Xi, nextElement)
|
||||
SELECT TYPE(nextElement)
|
||||
CALL cell%neighbourElement(Xi, neighbourElement)
|
||||
SELECT TYPE(neighbourElement)
|
||||
CLASS IS(meshCell)
|
||||
!Try next element
|
||||
cell => nextElement
|
||||
cell => neighbourElement
|
||||
|
||||
CLASS DEFAULT
|
||||
!Should never happend, but just in case, stops loops
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue