feature/meshText #57
6 changed files with 179 additions and 1 deletions
Skeleton implementation of text mesh for simple 1D cases.
commit
9f9bacca7c
|
|
@ -9,6 +9,7 @@ OBJECTS = $(OBJDIR)/moduleMesh.o $(OBJDIR)/moduleMeshBoundary.o $(OBJDIR)/module
|
|||
$(OBJDIR)/moduleMeshInputVTU.o $(OBJDIR)/moduleMeshOutputVTU.o \
|
||||
$(OBJDIR)/moduleMeshInputGmsh2.o $(OBJDIR)/moduleMeshOutputGmsh2.o \
|
||||
$(OBJDIR)/moduleMeshInput0D.o $(OBJDIR)/moduleMeshOutput0D.o \
|
||||
$(OBJDIR)/moduleMeshInputText.o $(OBJDIR)/moduleMeshOutputText.o \
|
||||
$(OBJDIR)/moduleMesh3DCart.o \
|
||||
$(OBJDIR)/moduleMesh2DCyl.o \
|
||||
$(OBJDIR)/moduleMesh2DCart.o \
|
||||
|
|
|
|||
|
|
@ -910,6 +910,7 @@ MODULE moduleInput
|
|||
USE moduleMeshInputGmsh2, ONLY: initGmsh2
|
||||
USE moduleMeshInputVTU, ONLY: initVTU
|
||||
USE moduleMeshInput0D, ONLY: init0D
|
||||
USE moduleMeshInputText, ONLY: initText
|
||||
USE moduleMesh3DCart
|
||||
USE moduleMesh2DCyl
|
||||
USE moduleMesh2DCart
|
||||
|
|
@ -1058,6 +1059,20 @@ MODULE moduleInput
|
|||
|
||||
END IF
|
||||
|
||||
case ("text")
|
||||
!Check if the geometry is right.
|
||||
if (mesh%dimen /= 1) then
|
||||
call criticalError("Text mesh is only allowed for 1D geometries", 'readGeometry')
|
||||
|
||||
end if
|
||||
|
||||
!Read the mesh
|
||||
call initText(mesh)
|
||||
if (doubleMesh) then
|
||||
call initText(meshColl)
|
||||
|
||||
end if
|
||||
|
||||
CASE DEFAULT
|
||||
CALL criticalError('Mesh format ' // meshFormat // ' not defined.', 'readGeometry')
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
all: vtu.o gmsh2.o 0D.o
|
||||
all: vtu.o gmsh2.o 0D.o text.o
|
||||
|
||||
vtu.o: moduleMeshInoutCommon.o
|
||||
$(MAKE) -C vtu all
|
||||
|
|
@ -9,5 +9,8 @@ gmsh2.o:
|
|||
0D.o:
|
||||
$(MAKE) -C 0D all
|
||||
|
||||
text.o:
|
||||
$(MAKE) -C text all
|
||||
|
||||
%.o: %.f90
|
||||
$(FC) $(FCFLAGS) -c $< -o $(OBJDIR)/$@
|
||||
|
|
|
|||
7
src/modules/mesh/inout/text/makefile
Normal file
7
src/modules/mesh/inout/text/makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
all: moduleMeshInputText.o moduleMeshOutputText.o
|
||||
|
||||
moduleMeshInputText.o: moduleMeshOutputText.o moduleMeshInputText.f90
|
||||
$(FC) $(FCFLAGS) -c $(subst .o,.f90,$@) -o $(OBJDIR)/$@
|
||||
|
||||
%.o: %.f90
|
||||
$(FC) $(FCFLAGS) -c $< -o $(OBJDIR)/$@
|
||||
85
src/modules/mesh/inout/text/moduleMeshInputText.f90
Normal file
85
src/modules/mesh/inout/text/moduleMeshInputText.f90
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
module moduleMeshInputText
|
||||
!The mesh is stored as a column-wise text file.
|
||||
!Aimed for simple geometries in 1D
|
||||
|
||||
contains
|
||||
!Inits the text mesh
|
||||
subroutine initText(self)
|
||||
use moduleMesh
|
||||
use moduleMeshOutputText
|
||||
implicit none
|
||||
|
||||
class(meshGeneric), intent(inout), target:: self
|
||||
|
||||
if (associated(meshForMCC,self)) then
|
||||
self%printColl => printCollText
|
||||
|
||||
end if
|
||||
|
||||
select type(self)
|
||||
type is (meshParticles)
|
||||
self%printOutput => printOutputText
|
||||
self%printEM => printEMText
|
||||
self%printAverage => printAverageText
|
||||
|
||||
self%readInitial => readInitialText
|
||||
|
||||
end select
|
||||
|
||||
self%readMesh => readText
|
||||
|
||||
end subroutine initText
|
||||
|
||||
!Reads the text mesh
|
||||
subroutine readText(self, filename)
|
||||
use moduleMesh
|
||||
use moduleMesh1DCart
|
||||
use moduleMesh1DRad
|
||||
use moduleErrors
|
||||
implicit none
|
||||
|
||||
class(meshGeneric), intent(inout):: self
|
||||
character(:), allocatable, intent(in):: filename !Dummy file, not used
|
||||
integer:: fileID, reason
|
||||
CHARACTER(LEN=256):: line
|
||||
real(8):: r !dummy 1D coordinate
|
||||
integer:: physicalID
|
||||
|
||||
fileID = 10
|
||||
|
||||
open(fileID, file=trim(filename))
|
||||
|
||||
!Skip header
|
||||
read(fileID)
|
||||
|
||||
do
|
||||
read(fileID, *, iostat=reason) r, physicalID
|
||||
|
||||
if (reason > 0) then
|
||||
call criticalError('Error reading mesh file', 'readText')
|
||||
|
||||
else if (reason < 0) then
|
||||
exit
|
||||
|
||||
end if
|
||||
|
||||
write(*, *) r, physicalID
|
||||
|
||||
|
||||
end do
|
||||
|
||||
close(fileID)
|
||||
|
||||
end subroutine readText
|
||||
|
||||
subroutine readInitialText(filename, density, velocity, temperature)
|
||||
implicit none
|
||||
|
||||
character(:), allocatable, intent(in):: filename
|
||||
real(8), allocatable, intent(out), dimension(:):: density
|
||||
real(8), allocatable, intent(out), dimension(:,:):: velocity
|
||||
real(8), allocatable, intent(out), dimension(:):: temperature
|
||||
|
||||
end subroutine readInitialText
|
||||
|
||||
end module moduleMeshInputText
|
||||
67
src/modules/mesh/inout/text/moduleMeshOutputText.f90
Normal file
67
src/modules/mesh/inout/text/moduleMeshOutputText.f90
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
module moduleMeshOutputText
|
||||
contains
|
||||
|
||||
subroutine writeSpeciesOutput(self, fileID, speciesIndex)
|
||||
use moduleMesh
|
||||
use moduleOutput
|
||||
implicit none
|
||||
|
||||
class(meshParticles), INTENT(in):: self
|
||||
integer, intent(in):: fileID
|
||||
integer, intent(in):: speciesIndex
|
||||
|
||||
end subroutine writeSpeciesOutput
|
||||
|
||||
subroutine writeCollOutput(self, fileID)
|
||||
use moduleMesh
|
||||
use moduleCollisions
|
||||
implicit none
|
||||
|
||||
class(meshGeneric), intent(in):: self
|
||||
integer, intent(in):: fileID
|
||||
|
||||
end subroutine writeCollOutput
|
||||
|
||||
subroutine writeEMOutput(self, fileID)
|
||||
use moduleMesh
|
||||
use moduleRefParam
|
||||
implicit none
|
||||
|
||||
class(meshParticles), intent(in):: self
|
||||
integer, intent(in):: fileID
|
||||
|
||||
end subroutine writeEMOutput
|
||||
|
||||
subroutine printOutputText(self)
|
||||
use moduleMesh
|
||||
implicit none
|
||||
|
||||
class(meshParticles), intent(in):: self
|
||||
|
||||
end subroutine printOutputText
|
||||
|
||||
subroutine printCollText(self)
|
||||
use moduleMesh
|
||||
implicit none
|
||||
|
||||
class(meshGeneric), intent(in):: self
|
||||
|
||||
end subroutine printCollText
|
||||
|
||||
subroutine printEMText(self)
|
||||
use moduleMesh
|
||||
implicit none
|
||||
|
||||
class(meshParticles), intent(in):: self
|
||||
|
||||
end subroutine printEMText
|
||||
|
||||
subroutine printAverageText(self)
|
||||
use moduleMesh
|
||||
implicit none
|
||||
|
||||
class(meshParticles), intent(in):: self
|
||||
|
||||
end subroutine printAverageText
|
||||
|
||||
end module moduleMeshOutputText
|
||||
Loading…
Add table
Add a link
Reference in a new issue