Inout working
This commit is contained in:
parent
9f7b73054b
commit
73f585ed8b
5 changed files with 66 additions and 12 deletions
|
|
@ -493,6 +493,7 @@ MODULE moduleInput
|
||||||
CALL config%get(object // '.numColl', collOutput, found)
|
CALL config%get(object // '.numColl', collOutput, found)
|
||||||
CALL config%get(object // '.EMField', emOutput, found)
|
CALL config%get(object // '.EMField', emOutput, found)
|
||||||
call config%get(object // '.boundariesParticle', boundaryParticleOutput, found)
|
call config%get(object // '.boundariesParticle', boundaryParticleOutput, found)
|
||||||
|
call config%get(object // '.boundariesEM', boundaryEMOutput, found)
|
||||||
call config%get(object // '.injects', injectOutput, found)
|
call config%get(object // '.injects', injectOutput, found)
|
||||||
|
|
||||||
CALL config%get(object // '.triggerCPUTime', triggerCPUTime, found)
|
CALL config%get(object // '.triggerCPUTime', triggerCPUTime, found)
|
||||||
|
|
|
||||||
|
|
@ -964,7 +964,7 @@ MODULE moduleMesh
|
||||||
type(meshNodePointer), allocatable:: nodes(:)
|
type(meshNodePointer), allocatable:: nodes(:)
|
||||||
|
|
||||||
procedure(updateEM_interface), pointer, pass:: update => null()
|
procedure(updateEM_interface), pointer, pass:: update => null()
|
||||||
procedure(printEM_interface), pointer, pass:: print => null()
|
procedure(printEMboundary_interface), pointer, pass:: print => null()
|
||||||
contains
|
contains
|
||||||
procedure(applyEM_interface), deferred, pass:: apply
|
procedure(applyEM_interface), deferred, pass:: apply
|
||||||
|
|
||||||
|
|
@ -989,13 +989,13 @@ MODULE moduleMesh
|
||||||
end subroutine updateEM_interface
|
end subroutine updateEM_interface
|
||||||
|
|
||||||
! Write the values of the particle boundary model
|
! Write the values of the particle boundary model
|
||||||
subroutine printEM_interface(self, fileID)
|
subroutine printEMboundary_interface(self, fileID)
|
||||||
import boundaryEMGeneric
|
import boundaryEMGeneric
|
||||||
|
|
||||||
class(boundaryEMGeneric), intent(inout):: self
|
class(boundaryEMGeneric), intent(inout):: self
|
||||||
integer, intent(in):: fileID
|
integer, intent(in):: fileID
|
||||||
|
|
||||||
end subroutine printEM_interface
|
end subroutine printEMboundary_interface
|
||||||
|
|
||||||
end interface
|
end interface
|
||||||
|
|
||||||
|
|
@ -1060,6 +1060,7 @@ MODULE moduleMesh
|
||||||
type, extends(boundaryEMGeneric):: boundaryEMFloating
|
type, extends(boundaryEMGeneric):: boundaryEMFloating
|
||||||
real(8):: potential
|
real(8):: potential
|
||||||
real(8):: invC ! Inverse of the capacitance of the surface
|
real(8):: invC ! Inverse of the capacitance of the surface
|
||||||
|
real(8):: charge ! Charge accumulated on surface
|
||||||
type(meshEdgePointer), allocatable:: edges(:) !Array with edges
|
type(meshEdgePointer), allocatable:: edges(:) !Array with edges
|
||||||
contains
|
contains
|
||||||
! boundaryEMGeneric DEFERRED PROCEDURES
|
! boundaryEMGeneric DEFERRED PROCEDURES
|
||||||
|
|
|
||||||
|
|
@ -159,8 +159,12 @@ submodule(moduleMesh) boundaryEM
|
||||||
! Inverse of non-dimensional capacitance
|
! Inverse of non-dimensional capacitance
|
||||||
self%invC = 1.0d0 / (capacitance / (eps_0 * L_ref))
|
self%invC = 1.0d0 / (capacitance / (eps_0 * L_ref))
|
||||||
|
|
||||||
|
self%charge = 0.0d0
|
||||||
|
|
||||||
self%update => updateFloating
|
self%update => updateFloating
|
||||||
|
|
||||||
|
self%print => writeFloating
|
||||||
|
|
||||||
allocate(self%edges(0))
|
allocate(self%edges(0))
|
||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
@ -196,9 +200,8 @@ submodule(moduleMesh) boundaryEM
|
||||||
class(meshEdge), pointer:: edge
|
class(meshEdge), pointer:: edge
|
||||||
real(8), allocatable:: mom_nodes(:)
|
real(8), allocatable:: mom_nodes(:)
|
||||||
class(meshNode), pointer:: node
|
class(meshNode), pointer:: node
|
||||||
real(8):: mom_center, edgeDensityCurrent, totalCurrent
|
real(8):: mom_center, edgeDensityCurrent
|
||||||
|
|
||||||
totalCurrent = 0.0d0
|
|
||||||
select type(self)
|
select type(self)
|
||||||
type is(boundaryEMFloating)
|
type is(boundaryEMFloating)
|
||||||
do e = 1, size(self%edges)
|
do e = 1, size(self%edges)
|
||||||
|
|
@ -224,20 +227,34 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
totalCurrent = totalCurrent + edgeDensityCurrent * edge%surface
|
! Accumulate charge of speceis on surface
|
||||||
|
self%charge = self%charge + edgeDensityCurrent * edge%surface * tauMin
|
||||||
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
self%potential = self%potential + self%invC * totalCurrent * tauMin
|
self%potential = self%charge * self%invC
|
||||||
|
|
||||||
! print *, totalCurrent, self%potential
|
|
||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
||||||
end subroutine updateFloating
|
end subroutine updateFloating
|
||||||
|
|
||||||
! Write
|
! Write
|
||||||
subroutine writeFloating()
|
subroutine writeFloating(self, fileID)
|
||||||
|
use moduleOutput, only: fmtColReal
|
||||||
|
use moduleConstParam, only: qe
|
||||||
|
use moduleRefParam, only: Volt_ref
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
class(boundaryEMGeneric), intent(inout):: self
|
||||||
|
integer, intent(in):: fileID
|
||||||
|
|
||||||
|
write(fileID, '(A)') self%name
|
||||||
|
select type(self)
|
||||||
|
type is(boundaryEMFloating)
|
||||||
|
write(fileID, '(A,",",A)') 'Total charge', 'Potential (V)'
|
||||||
|
write(fileID, '('//fmtColReal//','//fmtColReal//')') self%charge * qe, self%potential * Volt_ref
|
||||||
|
|
||||||
|
end select
|
||||||
|
|
||||||
end subroutine writeFloating
|
end subroutine writeFloating
|
||||||
|
|
||||||
|
|
@ -274,7 +291,7 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
do b = 1, nBoundariesEM
|
do b = 1, nBoundariesEM
|
||||||
if (associated(boundariesEM(b)%obj%update)) then
|
if (associated(boundariesEM(b)%obj%update)) then
|
||||||
call boundariesEM(b)%obj%update
|
call boundariesEM(b)%obj%update()
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
@ -282,4 +299,37 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
end subroutine boundariesEM_update
|
end subroutine boundariesEM_update
|
||||||
|
|
||||||
|
! Write all EM boundaries
|
||||||
|
module subroutine boundariesEM_write()
|
||||||
|
use moduleCaseparam, only: timeStep
|
||||||
|
use moduleOutput, only: fileID_boundaryEM, &
|
||||||
|
formatFileName, &
|
||||||
|
informFileCreation,&
|
||||||
|
boundaryEMOutput,&
|
||||||
|
generateFilePath, &
|
||||||
|
prefix
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer:: b
|
||||||
|
character(:), allocatable:: fileName
|
||||||
|
|
||||||
|
if (boundaryEMOutput) then
|
||||||
|
fileName = formatFileName(prefix, 'boundariesEM', 'csv', timeStep)
|
||||||
|
call informFileCreation(fileName)
|
||||||
|
open(fileID_boundaryEM, file = generateFilePath(fileName))
|
||||||
|
|
||||||
|
do b = 1, nBoundariesEM
|
||||||
|
if (associated(boundariesEM(b)%obj%update)) then
|
||||||
|
call boundariesEM(b)%obj%print(fileID_boundaryEM)
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
|
end do
|
||||||
|
|
||||||
|
close(fileID_boundaryEM)
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
|
end subroutine boundariesEM_write
|
||||||
|
|
||||||
end submodule boundaryEM
|
end submodule boundaryEM
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ MODULE moduleOutput
|
||||||
LOGICAL:: collOutput = .FALSE.
|
LOGICAL:: collOutput = .FALSE.
|
||||||
LOGICAL:: emOutput = .FALSE.
|
LOGICAL:: emOutput = .FALSE.
|
||||||
logical:: boundaryParticleOutput = .false.
|
logical:: boundaryParticleOutput = .false.
|
||||||
|
logical:: boundaryEMOutput = .false.
|
||||||
logical:: injectOutput = .false.
|
logical:: injectOutput = .false.
|
||||||
|
|
||||||
! Prefix for iteration files
|
! Prefix for iteration files
|
||||||
|
|
|
||||||
|
|
@ -548,6 +548,7 @@ MODULE moduleSolver
|
||||||
|
|
||||||
! Output of boundaries
|
! Output of boundaries
|
||||||
call boundariesParticle_write()
|
call boundariesParticle_write()
|
||||||
|
call boundariesEM_write()
|
||||||
|
|
||||||
! Output of inejcts
|
! Output of inejcts
|
||||||
call writeInjects()
|
call writeInjects()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue