Inout working
This commit is contained in:
parent
9f7b73054b
commit
73f585ed8b
5 changed files with 66 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue