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 // '.EMField', emOutput, 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 // '.triggerCPUTime', triggerCPUTime, found)
|
||||
|
|
|
|||
|
|
@ -963,8 +963,8 @@ MODULE moduleMesh
|
|||
integer:: nNodes
|
||||
type(meshNodePointer), allocatable:: nodes(:)
|
||||
|
||||
procedure(updateEM_interface), pointer, pass:: update => null()
|
||||
procedure(printEM_interface), pointer, pass:: print => null()
|
||||
procedure(updateEM_interface), pointer, pass:: update => null()
|
||||
procedure(printEMboundary_interface), pointer, pass:: print => null()
|
||||
contains
|
||||
procedure(applyEM_interface), deferred, pass:: apply
|
||||
|
||||
|
|
@ -989,13 +989,13 @@ MODULE moduleMesh
|
|||
end subroutine updateEM_interface
|
||||
|
||||
! Write the values of the particle boundary model
|
||||
subroutine printEM_interface(self, fileID)
|
||||
subroutine printEMboundary_interface(self, fileID)
|
||||
import boundaryEMGeneric
|
||||
|
||||
class(boundaryEMGeneric), intent(inout):: self
|
||||
integer, intent(in):: fileID
|
||||
|
||||
end subroutine printEM_interface
|
||||
end subroutine printEMboundary_interface
|
||||
|
||||
end interface
|
||||
|
||||
|
|
@ -1060,6 +1060,7 @@ MODULE moduleMesh
|
|||
type, extends(boundaryEMGeneric):: boundaryEMFloating
|
||||
real(8):: potential
|
||||
real(8):: invC ! Inverse of the capacitance of the surface
|
||||
real(8):: charge ! Charge accumulated on surface
|
||||
type(meshEdgePointer), allocatable:: edges(:) !Array with edges
|
||||
contains
|
||||
! boundaryEMGeneric DEFERRED PROCEDURES
|
||||
|
|
|
|||
|
|
@ -159,8 +159,12 @@ submodule(moduleMesh) boundaryEM
|
|||
! Inverse of non-dimensional capacitance
|
||||
self%invC = 1.0d0 / (capacitance / (eps_0 * L_ref))
|
||||
|
||||
self%charge = 0.0d0
|
||||
|
||||
self%update => updateFloating
|
||||
|
||||
self%print => writeFloating
|
||||
|
||||
allocate(self%edges(0))
|
||||
|
||||
end select
|
||||
|
|
@ -196,9 +200,8 @@ submodule(moduleMesh) boundaryEM
|
|||
class(meshEdge), pointer:: edge
|
||||
real(8), allocatable:: mom_nodes(:)
|
||||
class(meshNode), pointer:: node
|
||||
real(8):: mom_center, edgeDensityCurrent, totalCurrent
|
||||
real(8):: mom_center, edgeDensityCurrent
|
||||
|
||||
totalCurrent = 0.0d0
|
||||
select type(self)
|
||||
type is(boundaryEMFloating)
|
||||
do e = 1, size(self%edges)
|
||||
|
|
@ -224,20 +227,34 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
end do
|
||||
|
||||
totalCurrent = totalCurrent + edgeDensityCurrent * edge%surface
|
||||
! Accumulate charge of speceis on surface
|
||||
self%charge = self%charge + edgeDensityCurrent * edge%surface * tauMin
|
||||
|
||||
end do
|
||||
|
||||
self%potential = self%potential + self%invC * totalCurrent * tauMin
|
||||
|
||||
! print *, totalCurrent, self%potential
|
||||
self%potential = self%charge * self%invC
|
||||
|
||||
end select
|
||||
|
||||
end subroutine updateFloating
|
||||
|
||||
! 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
|
||||
|
||||
|
|
@ -274,7 +291,7 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
do b = 1, nBoundariesEM
|
||||
if (associated(boundariesEM(b)%obj%update)) then
|
||||
call boundariesEM(b)%obj%update
|
||||
call boundariesEM(b)%obj%update()
|
||||
|
||||
end if
|
||||
|
||||
|
|
@ -282,4 +299,37 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ MODULE moduleOutput
|
|||
LOGICAL:: collOutput = .FALSE.
|
||||
LOGICAL:: emOutput = .FALSE.
|
||||
logical:: boundaryParticleOutput = .false.
|
||||
logical:: boundaryEMOutput = .false.
|
||||
logical:: injectOutput = .false.
|
||||
|
||||
! Prefix for iteration files
|
||||
|
|
|
|||
|
|
@ -548,6 +548,7 @@ MODULE moduleSolver
|
|||
|
||||
! Output of boundaries
|
||||
call boundariesParticle_write()
|
||||
call boundariesEM_write()
|
||||
|
||||
! Output of inejcts
|
||||
call writeInjects()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue