Input and output done
This commit is contained in:
parent
770277a569
commit
61c07972da
2 changed files with 19 additions and 9 deletions
|
|
@ -1120,6 +1120,7 @@ MODULE moduleMesh
|
|||
real(8), allocatable:: electricField(:) ! Electric field normal to the edge that must be applied with a Neumann boundary condition
|
||||
real(8), allocatable:: deltaElectricField(:) ! Accumulated change in E
|
||||
integer:: counter
|
||||
integer:: every
|
||||
contains
|
||||
procedure, pass:: apply => applyFreeCurrent
|
||||
|
||||
|
|
|
|||
|
|
@ -312,11 +312,14 @@ submodule(moduleMesh) boundaryEM
|
|||
! Init
|
||||
module subroutine initFreeCurrent(self, config, object)
|
||||
use json_module
|
||||
use moduleErrors, only: warningError
|
||||
implicit none
|
||||
|
||||
class(boundaryEMGeneric), allocatable, intent(inout):: self
|
||||
type(json_file), intent(inout):: config
|
||||
character(:), allocatable, intent(in):: object
|
||||
logical:: found
|
||||
integer:: every
|
||||
|
||||
select type(self)
|
||||
type is(boundaryEMFreeCurrent)
|
||||
|
|
@ -324,6 +327,16 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
self%counter = 0
|
||||
|
||||
call config%get(object // '.every', every, found)
|
||||
if (found) then
|
||||
self%every = every
|
||||
|
||||
else
|
||||
self%every = 50
|
||||
call warningError('Using "every" = 50 for Free Current boundary')
|
||||
|
||||
end if
|
||||
|
||||
self%update => updateFreeCurrent
|
||||
self%print => writeFreeCurrent
|
||||
|
||||
|
|
@ -377,11 +390,6 @@ submodule(moduleMesh) boundaryEM
|
|||
real(8), allocatable:: den_nodes(:)
|
||||
class(meshNode), pointer:: node
|
||||
real(8):: mom_center, den_center, charge_center
|
||||
real(8):: l_c ! Characteristic length
|
||||
integer:: every
|
||||
|
||||
! TODO: Make an input parameter
|
||||
every = 10
|
||||
|
||||
select type(self)
|
||||
type is(boundaryEMFreeCurrent)
|
||||
|
|
@ -427,7 +435,7 @@ submodule(moduleMesh) boundaryEM
|
|||
|
||||
end do
|
||||
|
||||
if (self%counter == every) then
|
||||
if (self%counter == self%every) then
|
||||
self%electricField = self%electricField - self%deltaElectricField
|
||||
|
||||
self%counter = 0
|
||||
|
|
@ -442,8 +450,8 @@ submodule(moduleMesh) boundaryEM
|
|||
! Write
|
||||
subroutine writeFreeCurrent(self, fileID)
|
||||
! use moduleOutput, only: fmtColReal
|
||||
use moduleConstParam, only: qe, eps_0
|
||||
use moduleRefParam, only: EF_ref, L_ref, n_ref, v_ref, ti_ref
|
||||
use moduleRefParam, only: EF_ref
|
||||
use moduleOutput, only: fmtColInt, fmtColReal
|
||||
implicit none
|
||||
|
||||
class(boundaryEMGeneric), intent(inout):: self
|
||||
|
|
@ -454,7 +462,8 @@ submodule(moduleMesh) boundaryEM
|
|||
select type(self)
|
||||
type is(boundaryEMFreeCurrent)
|
||||
do e = 1, self%nEdges
|
||||
print*, self%edges(e)%obj%n, self%electricField(e)*EF_ref
|
||||
write(fileID, '(A,",",A)') 'Edge id', 'Electric Field (V m^-1)'
|
||||
write(fileID, '('//fmtColInt//','//fmtColReal//')') self%edges(e)%obj%n, self%electricField(e)*EF_ref
|
||||
|
||||
end do
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue