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:: electricField(:) ! Electric field normal to the edge that must be applied with a Neumann boundary condition
|
||||||
real(8), allocatable:: deltaElectricField(:) ! Accumulated change in E
|
real(8), allocatable:: deltaElectricField(:) ! Accumulated change in E
|
||||||
integer:: counter
|
integer:: counter
|
||||||
|
integer:: every
|
||||||
contains
|
contains
|
||||||
procedure, pass:: apply => applyFreeCurrent
|
procedure, pass:: apply => applyFreeCurrent
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -312,11 +312,14 @@ submodule(moduleMesh) boundaryEM
|
||||||
! Init
|
! Init
|
||||||
module subroutine initFreeCurrent(self, config, object)
|
module subroutine initFreeCurrent(self, config, object)
|
||||||
use json_module
|
use json_module
|
||||||
|
use moduleErrors, only: warningError
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
class(boundaryEMGeneric), allocatable, intent(inout):: self
|
class(boundaryEMGeneric), allocatable, intent(inout):: self
|
||||||
type(json_file), intent(inout):: config
|
type(json_file), intent(inout):: config
|
||||||
character(:), allocatable, intent(in):: object
|
character(:), allocatable, intent(in):: object
|
||||||
|
logical:: found
|
||||||
|
integer:: every
|
||||||
|
|
||||||
select type(self)
|
select type(self)
|
||||||
type is(boundaryEMFreeCurrent)
|
type is(boundaryEMFreeCurrent)
|
||||||
|
|
@ -324,6 +327,16 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
self%counter = 0
|
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%update => updateFreeCurrent
|
||||||
self%print => writeFreeCurrent
|
self%print => writeFreeCurrent
|
||||||
|
|
||||||
|
|
@ -377,11 +390,6 @@ submodule(moduleMesh) boundaryEM
|
||||||
real(8), allocatable:: den_nodes(:)
|
real(8), allocatable:: den_nodes(:)
|
||||||
class(meshNode), pointer:: node
|
class(meshNode), pointer:: node
|
||||||
real(8):: mom_center, den_center, charge_center
|
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)
|
select type(self)
|
||||||
type is(boundaryEMFreeCurrent)
|
type is(boundaryEMFreeCurrent)
|
||||||
|
|
@ -427,7 +435,7 @@ submodule(moduleMesh) boundaryEM
|
||||||
|
|
||||||
end do
|
end do
|
||||||
|
|
||||||
if (self%counter == every) then
|
if (self%counter == self%every) then
|
||||||
self%electricField = self%electricField - self%deltaElectricField
|
self%electricField = self%electricField - self%deltaElectricField
|
||||||
|
|
||||||
self%counter = 0
|
self%counter = 0
|
||||||
|
|
@ -442,8 +450,8 @@ submodule(moduleMesh) boundaryEM
|
||||||
! Write
|
! Write
|
||||||
subroutine writeFreeCurrent(self, fileID)
|
subroutine writeFreeCurrent(self, fileID)
|
||||||
! use moduleOutput, only: fmtColReal
|
! use moduleOutput, only: fmtColReal
|
||||||
use moduleConstParam, only: qe, eps_0
|
use moduleRefParam, only: EF_ref
|
||||||
use moduleRefParam, only: EF_ref, L_ref, n_ref, v_ref, ti_ref
|
use moduleOutput, only: fmtColInt, fmtColReal
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
class(boundaryEMGeneric), intent(inout):: self
|
class(boundaryEMGeneric), intent(inout):: self
|
||||||
|
|
@ -454,7 +462,8 @@ submodule(moduleMesh) boundaryEM
|
||||||
select type(self)
|
select type(self)
|
||||||
type is(boundaryEMFreeCurrent)
|
type is(boundaryEMFreeCurrent)
|
||||||
do e = 1, self%nEdges
|
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
|
end do
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue