Skip to content

Commit

Permalink
Merge branch 'fix.boundary.field.output' into 'master.dev'
Browse files Browse the repository at this point in the history
[fix.boundary.field.output] Added boundary field output to AC reggie, which writes the electric potential...

See merge request piclas/piclas!803
  • Loading branch information
scopplestone committed Apr 24, 2023
2 parents b981c48 + e5cd6b7 commit fc239c2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
20 changes: 16 additions & 4 deletions docs/documentation/userguide/visu_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ greater or equal 1.
| :--------: | :---------: | :-------------------------------------------------------------------------------------------------------------: | :--------: | :--------: |
| CalcElectricTimeDerivative | F | time derivative $\frac{\partial D}{\partial t}=\varepsilon_{r}\varepsilon_{0}\frac{\partial E}{\partial t}$ | yes | no |
| CalcPotentialEnergy | F | potential field energy of the EM field | yes | yes |
| CalcBoundaryFieldOutput | F | electric potential at user-specified boundaries | yes | no |


**Displacement current:** The temporal change of the electric displacement field $\frac{\partial D}{\partial t}=\varepsilon_{r}\varepsilon_{0}\frac{\partial E}{\partial t}$
Expand All @@ -369,7 +370,7 @@ can be stored for Poisson's equation (`PICLAS_EQNSYSNAME=poisson`) by setting
CalcElectricTimeDerivative = T

The integrated displacement current that traverses each field boundary (except periodic BCs) can be analyzed over time
and is written to FieldAnalyze.csv for each boundary separately, e.g. "007-ElecDisplCurrent-001-BC_left".
and is written to FieldAnalyze.csv for each boundary separately, e.g. *"007-ElecDisplCurrent-001-BC_left"*.
The electric displacement current is also considered when the total electric current on specific surfaces is calculated, for details
see BoundaryParticleOutput (BPO) in Section {ref}`sec:integral-surface-variables`.

Expand All @@ -378,9 +379,20 @@ by setting

CalcPotentialEnergy = T

and is written to FieldAnalyze.csv, e.g. "002-E-El" and "003-E-Mag" (magnetic energy is only calculated for Maxwell's equations').
Additionally, but only when solving Maxwell's equations, the energy stored in the divergence correction fields "004-E-phi" and
"005-E-psi" as well as the total potential energy "006-E-pot", respectively, can be analyzed.
and is written to FieldAnalyze.csv, e.g. *"002-E-El" and "003-E-Mag"* (magnetic energy is only calculated for Maxwell's equations').
Additionally, but only when solving Maxwell's equations, the energy stored in the divergence correction fields *"004-E-phi"* and
*"005-E-psi"* as well as the total potential energy *"006-E-pot"*, respectively, can be analyzed.

**Boundary Field Output** The electric potential for specific boundaries can be analyzed over time by setting

CalcBoundaryFieldOutput = T
BFO-NFieldBoundaries = 3 ! Nbr of boundaries
BFO-FieldBoundaries = (/1,3,5/) ! Field-Boundary1, 3 and 5

where `BFO-NFieldBoundaries` defines the number of boundaries that are of interest and `BFO-FieldBoundaries` the boundary IDs of the
field boundaries where the electric potential is to be recorded. Note that this output is only meaningful when a scalar potential is
used on the corresponding boundary. Therefore, this output is only available for certain BCTypes, e.g., 2, 4, 5 and 6. The output is
written to FieldAnalyze.csv for each boundary separately, e.g. *"006-BFO-boundary001"*.

### Particle Variables
**WIP**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ BoundaryType = (/4,0/) ! 4: Dirichlet with zero potential
BoundaryName = BC_left
BoundaryType = (/5,1/) ! Dirichlet with ExactFunc + Nbr of RefState
RefState = (/10000.0 , 13.56E6 , -1.57079632679/) ! RefState Nbr 1: Voltage, Frequency and Phase shift

! Boundary Field Output: Write current voltage to FieldAnalyze.csv
CalcBoundaryFieldOutput = T
BFO-NFieldBoundaries = 1 ! Nbr of boundaries
BFO-FieldBoundaries = (/5/) ! Field-Boundary1
! =============================================================================== !
! PARTICLES
! =============================================================================== !
Expand Down
11 changes: 10 additions & 1 deletion src/analyze/analyze.f90
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,15 @@ SUBROUTINE InitAnalyze()
#if USE_LOADBALANCE
USE MOD_LoadBalance_Vars ,ONLY: PerformLoadBalance
#endif /*USE_LOADBALANCE*/
USE MOD_Mesh_Vars ,ONLY: BoundaryType,BoundaryName
! IMPLICIT VARIABLE HANDLING
IMPLICIT NONE
!----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
!----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
CHARACTER(LEN=40) :: DefStr
INTEGER :: iElem,CNElemID
INTEGER :: iElem,CNElemID,iBoundary,BCType,BCState,iBC
REAL :: PPWCellMax,PPWCellMin
!===================================================================================================================================
IF ((.NOT.InterpolationInitIsDone).OR.AnalyzeInitIsDone) THEN
Expand Down Expand Up @@ -287,6 +288,14 @@ SUBROUTINE InitAnalyze()
DoFieldAnalyze = .TRUE.
BFO%NFieldBoundaries = GETINT('BFO-NFieldBoundaries')
BFO%FieldBoundaries = GETINTARRAY('BFO-FieldBoundaries',BFO%NFieldBoundaries)
DO iBoundary=1,BFO%NFieldBoundaries
iBC = BFO%FieldBoundaries(iBoundary)
IF(iBC.GT.SIZE(BoundaryName)) CALL abort(__STAMP__,'BFO-FieldBoundaries BC index is too large: ',IntInfoOpt=iBC)
BCType = BoundaryType(iBC,BC_TYPE)
BCState = BoundaryType(iBC,BC_STATE)
LBWRITE(UNIT_stdOut,'(A,I0,A,I0,A)')&
' Activated BFO of electric potential for ['//TRIM(BoundaryName(iBC))//'] with BCType [',BCType,'] and BCState [',BCState,']'
END DO
END IF ! CalcBoundaryFieldOutput

! Get logical for measurement of time spent in analyze routines
Expand Down
2 changes: 1 addition & 1 deletion src/analyze/analyzefield.f90
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ SUBROUTINE AnalyzeField(Time)
! ! Add BoundaryFieldOutput for each boundary that is required
IF(CalcBoundaryFieldOutput)THEN
DO iBoundary=1,BFO%NFieldBoundaries
CALL CalculateBoundaryFieldOutput(iBoundary,Time,BoundaryFieldOutput)
CALL CalculateBoundaryFieldOutput(BFO%FieldBoundaries(iBoundary),Time,BoundaryFieldOutput)
WRITE(unit_index,CSVFORMAT,ADVANCE='NO') ',',BoundaryFieldOutput
END DO
END IF ! CalcBoundaryFieldOutput
Expand Down

0 comments on commit fc239c2

Please sign in to comment.