Implementation of 0D grid for analysis of collisional operators.

Still need to add a 0D pusher and the corresponding input configuration
and documentation.
This commit is contained in:
Jorge Gonzalez 2021-04-12 18:54:33 +02:00
commit d2b36632c9
12 changed files with 339 additions and 13 deletions

View file

@ -0,0 +1,7 @@
all: moduleMeshInput0D.o moduleMeshOutput0D.o
moduleMeshInput0D.o: moduleMeshOutput0D.o moduleMeshInput0D.f90
$(FC) $(FCFLAGS) -c $(subst .o,.f90,$@) -o $(OBJDIR)/$@
%.o: %.f90
$(FC) $(FCFLAGS) -c $< -o $(OBJDIR)/$@

View file

@ -0,0 +1,66 @@
MODULE moduleMeshInput0D
!Creates a 0D mesh. mostly used for testing collisional processes.
!This mesh consists on 1 node and 1 volume in which all particles are located.
!No boundary conditions and no pusher should be applied to this geometry.
!Output should go to a single file (per species) in which each row represents an iteration.
!In principle, no EM field is applied.
CONTAINS
!Inits the 0D mesh
SUBROUTINE init0D(self)
USE moduleMesh
USE moduleMeshOutput0D
IMPLICIT NONE
CLASS(meshGeneric), INTENT(inout), TARGET:: self
IF (ASSOCIATED(meshForMCC, self)) self%printColl => printColl0D
SELECT TYPE(self)
TYPE IS(meshParticles)
self%printOutput => printOutput0D
self%printEM => printEM0D
END SELECT
self%readMesh => read0D
END SUBROUTINE init0D
!Reads a 0D mesh file.
!No reading is actually done as the 0D mesh is a fixed one
SUBROUTINE read0D(self, filename)
USE moduleMesh
USE moduleMesh0D
IMPLICIT NONE
CLASS(meshGeneric), INTENT(inout):: self
CHARACTER(:), ALLOCATABLE, INTENT(in):: filename !Dummy file, not used
REAL(8):: r(1:3)
!Allocates one node
self%numNodes = 1
ALLOCATE(self%nodes(1:1))
!Allocates one volume
self%numVols = 1
ALLOCATE(self%vols(1:1))
!Allocates matrix K
SELECT TYPE(self)
TYPE IS(meshParticles)
ALLOCATE(self%K(1:1, 1:1))
ALLOCATE(self%IPIV(1:1, 1:1))
self%K = 0.D0
self%IPIV = 0.D0
END SELECT
!Creates the node
ALLOCATE(meshNode0D:: self%nodes(1)%obj)
r = 0.D0
CALL self%nodes(1)%obj%init(1, r)
!Creates the volume
ALLOCATE(meshVol0D:: self%vols(1)%obj)
CALL self%vols(1)%obj%init(1, (/ 1/), self%nodes)
END SUBROUTINE read0D
END MODULE moduleMeshInput0D

View file

@ -0,0 +1,61 @@
MODULE moduleMeshOutput0D
CONTAINS
SUBROUTINE printOutput0D(self, t)
USE moduleMesh
USE moduleRefParam
USE moduleSpecies
USE moduleOutput
IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self
INTEGER, INTENT(in):: t
INTEGER:: i
TYPE(outputFormat):: output
CHARACTER(:), ALLOCATABLE:: fileName
DO i = 1, nSpecies
fileName='OUTPUT_' // species(i)%obj%name // '.dat'
IF (t == 0) THEN
OPEN(20, file = path // folder // '/' // fileName, action = 'write')
WRITE(20, "(A1, 8X, A1, 6(A20))") "#","t","density", "velocity", "pressure", "temperature"
WRITE(*, "(6X,A15,A)") "Creating file: ", fileName
CLOSE(20)
END IF
OPEN(20, file = path // folder // '/' // fileName, position = 'append', action = 'write')
CALL calculateOutput(self%nodes(1)%obj%output(i), output, self%nodes(1)%obj%v, species(i)%obj)
WRITE(20, "(I10, 6(ES20.6E3))") t, output%density, output%velocity, output%pressure, output%temperature
CLOSE(20)
END DO
END SUBROUTINE printOutput0D
SUBROUTINE printColl0D(self, t)
USE moduleMesh
USE moduleRefParam
USE moduleCaseParam
USE moduleCollisions
USE moduleOutput
IMPLICIT NONE
CLASS(meshGeneric), INTENT(in):: self
INTEGER, INTENT(in):: t
END SUBROUTINE printColl0D
SUBROUTINE printEM0D(self, t)
USE moduleMesh
USE moduleRefParam
USE moduleCaseParam
USE moduleOutput
IMPLICIT NONE
CLASS(meshParticles), INTENT(in):: self
INTEGER, INTENT(in):: t
END SUBROUTINE printEM0D
END MODULE moduleMeshOutput0D