From 8a21595f01f2e2b907c46f54316fcc7c37772d7b Mon Sep 17 00:00:00 2001 From: Stephen Copplestone Date: Thu, 13 Apr 2023 18:32:37 +0200 Subject: [PATCH 1/2] Added boundary field output to AC reggie, which writes the electric potential on specific BCs over time to FieldAnalyze.csv --- .../parallel_plates_AC/parameter.ini | 5 +++++ src/analyze/analyze.f90 | 11 ++++++++++- src/analyze/analyzefield.f90 | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/regressioncheck/NIG_PIC_poisson_Leapfrog/parallel_plates_AC/parameter.ini b/regressioncheck/NIG_PIC_poisson_Leapfrog/parallel_plates_AC/parameter.ini index 87672f6f6..f1dbe52d9 100644 --- a/regressioncheck/NIG_PIC_poisson_Leapfrog/parallel_plates_AC/parameter.ini +++ b/regressioncheck/NIG_PIC_poisson_Leapfrog/parallel_plates_AC/parameter.ini @@ -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 ! =============================================================================== ! diff --git a/src/analyze/analyze.f90 b/src/analyze/analyze.f90 index d93a2d71f..b293d4252 100644 --- a/src/analyze/analyze.f90 +++ b/src/analyze/analyze.f90 @@ -183,6 +183,7 @@ 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 !---------------------------------------------------------------------------------------------------------------------------------- @@ -190,7 +191,7 @@ SUBROUTINE InitAnalyze() !---------------------------------------------------------------------------------------------------------------------------------- ! 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 @@ -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 diff --git a/src/analyze/analyzefield.f90 b/src/analyze/analyzefield.f90 index be2c89b81..7486743ee 100644 --- a/src/analyze/analyzefield.f90 +++ b/src/analyze/analyzefield.f90 @@ -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 From e5cd6b79ef03efb78e704ee80396ea989f1dd59f Mon Sep 17 00:00:00 2001 From: Stephen Copplestone Date: Thu, 13 Apr 2023 18:46:07 +0200 Subject: [PATCH 2/2] Added user guide description for CalcBoundaryFieldOutput=T (recording the electric potential over time at specific field boundaries). --- docs/documentation/userguide/visu_output.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/documentation/userguide/visu_output.md b/docs/documentation/userguide/visu_output.md index bef2c1c9f..dd64fd98f 100644 --- a/docs/documentation/userguide/visu_output.md +++ b/docs/documentation/userguide/visu_output.md @@ -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}$ @@ -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`. @@ -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**