Skip to content

Commit

Permalink
Merge branch 'feature.waveguide' into 'master.dev'
Browse files Browse the repository at this point in the history
[feature.waveguide] Maxwell Coaxial Waveguide

See merge request piclas/piclas!692
  • Loading branch information
scopplestone committed Dec 5, 2022
2 parents 4b6eee7 + 2a3a9ef commit 10cc6a1
Show file tree
Hide file tree
Showing 56 changed files with 3,167 additions and 328 deletions.
60 changes: 31 additions & 29 deletions REGGIE.md

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion docs/documentation/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -804,4 +804,12 @@ @article{Wu2022
volume = {132},
url = {https://aip.scitation.org/doi/10.1063/5.0087909},
year = {2022},
}
}

@inproceedings{Schmid2009,
title={Dynamic mode decomposition and proper orthogonal decomposition of flow in a lid-driven cylindrical cavity},
author={Schmid, Peter J and Meyer, Knud Erik and Pust, Oliver},
booktitle={8th International Symposium on Particle Image Velocimetry},
pages={25--28},
year={2009}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include, periodic, Dirichlet, Silver-Mueller, perfectly conducting, symmetry and
| (/1,-1/) | periodic | -1: negative (opposite) direction of the 1st periodicity vector |
| | | |
| (/2,2/) | Dirichlet | 2: Coaxial waveguide |
| (/2,22/) | Dirichlet | 22: Coaxial waveguide BC (boundary condition or exact flux) |
| (/2,3/) | Dirichlet | 3: Resonator |
| (/2,4/) | Dirichlet | 4: Electromagnetic dipole (implemented via RHS source terms and shape function deposition) |
| (/2,40/) | Dirichlet | 40: Electromagnetic dipole without initial condition (implemented via RHS source terms and shape function deposition) |
Expand All @@ -46,7 +47,7 @@ include, periodic, Dirichlet, Silver-Mueller, perfectly conducting, symmetry and
| (/6,0/) | SM | 1st order absorbing BC (Silver-Mueller) - Munz et al. 2000 / Computer Physics Communication 130, 83-117 with fix |
| | | of div. correction field for low B-fields that only set the correction fields when B is significantly large compared to E |
| | | |
| (/4,0/) | PEC | Perfectly conducting surface (Munz, Omnes, Schneider 2000, pp. 97-98) |
| (/4,0/) | PEC | Perfectly electric conducting surface (Munz, Omnes, Schneider 2000, pp. 97-98) |
| | | |
| (/10,0/) | Symmetry | Symmetry BC (perfect MAGNETIC conductor, PMC) |
| | | |
Expand Down Expand Up @@ -201,7 +202,7 @@ The dielectric module is activated by setting

DoDielectric = T

and specifying values for the permittivity and permeability constants
and specifying values for the permittivity $\varepsilon_{R}$ and permeability $\mu_{R}$ constants

DielectricEpsR = X
DielectricMuR = X
Expand Down Expand Up @@ -255,4 +256,16 @@ setting

which is set true by default, hence, removing the particles.

### Dielectric Zones
Regions or zones (corresponding to zones as defined by hopr) can also be used to define dielectrics.
In this case, the number of zones must be supplied

DielectricNbrOfZones = 8

and a vector of the same size for the corresponding zone IDs, $\varepsilon_{R}$ and $\mu_{R}$ for each zone, respectively

DielectricZoneID = (/9 , 10 , 11 , 12 , 13 , 14 , 15 , 16/)
DielectricZoneEpsR = (/2.0 , 2.0 , 2.0 , 2.0 , 2.0 , 2.0 , 2.0 , 2.0/)
DielectricZoneMuR = (/1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0 , 1.0/)

Note that this method cannot be used in combination with any other way of defining dielectrics.
80 changes: 80 additions & 0 deletions docs/documentation/userguide/visu_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,83 @@ per area per second.

WIP, PartAnalyze/FieldAnalyze

## Dynamic Mode Decomposition
The dynamic mode decomposition is an algorithm that divides a temporal series into a set of modes which are associated with a
frequency and grow/decay rate.
The dynamic mode decomposition (DMD) is implemented according to Schmid et al. {cite}`Schmid2009`.
To use the DMD tool, it needs to be compiled first. In cmake, set the flag

POSTI_BUILD_DMD = ON (default is OFF)

which creates the executable `./bin/dmd`.
The input for the DMD tool is provided by a series of state files with a high temporal resolution between each output file in order
to capture the relevant frequencies that are to be visualized.
To analyze a specific frequency, multiple state files should be created within one period of the oscillation.

Run the DMD executable with the help command to see the available options

./dmd --help

To execute the DMD after a simulation, with e.g. the Maxwell solver, run the command

dmd dmd.ini coaxial_State_000.00*

with an exemplary `dmd.ini` file

N = 4
SvdThreshold = 1e-8 ! Define relative lower bound of singular values

where `N=4` is the polynomial degree of the solution and `SvdThreshold = 1e-8` is used to filter singular values of the DMD.

Depending on the available memory one might have to decrease the number of input state files.
After the execution two additional files **coaxial_DMD.h5** and **coaxial_DMD_Spec.dat** will be created.
The first file contains the field representation of the different modes and the second file contains the Ritz spectrum of the modes.

### Ritz spectrum (coaxial_DMD_Spec.dat)

With the python script *plot_RitzSpectrum.py* the Ritz spectrum of the DMD can be plotted.
The script is placed in the tools folder of **piclas**.
To plot the spectrum execute:

python [PICLAS_DIRECTORY]/tools/plot_RitzSpectrum.py -d coaxial_DMD_Spec.dat

The result is a Ritz spectrum depicting all the calculated modes and their growth rate.
On the *x-axis* the frequency of the modes and on the *y-axis* the growth/decay factor is plotted, whereat modes with $\omega_r<0$
are damped.
The modes placed directly on the x-axis are the global, the first, the second harmonic mode and so on.
The color and size of the plotted modes represent the Euclidian norm of the mode which can be interpreted as an energy norm of the mode.

### Mode visualization (coaxial_DMD.h5)
To visualize the field run the following command:

piclas2vtk [posti.ini] coaxial_DMD.h5

The new file **coaxial_DMD_000.00000000000000000.vtu** now contains multiple modes to visualize.
Two additional input parameters are used to control the output of `piclas2vtk` by placing them in the `posti.ini` file

dmdSingleModeOutput = 2 ! only extract mode 002
dmdMaximumModeOutput = 10 ! only extract modes 001-010

The parameter `dmdSingleModeOutput` is used to convert only a single specific mode to `.vtu` ignoring all other modes and
`dmdMaximumModeOutput` can be used to dump all output modes up to this number.
Note that each mode is written to a separate output file because a single might can become quite large very quickly and is then too
large to visualize.



















Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ BoundaryName =BC_Outflow
BoundaryType =(/3,0/) ! (/Type, BCState/)

TEScale = 4e-9 !.66e-7 !3.8e-9
TERotation = -1
TEPolarization = T
TEPolarization = r ! former TERotation=T and TERotation = -1
TEPulse = T
TEMode = (/1,1/)

Expand Down Expand Up @@ -109,4 +108,4 @@ PMLzetaShape = 1 ! shape function for damping constant (0=const, 1=linea
PMLRampLength = 1 ! ramping length in percent of PML width
PMLalpha0 = 0 ! CFS-PML aplha factor for complex frequency shift
PMLspread = 0 ! spread=1 dont spread=0
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.0046,0.1932/) ! lower/upper boarder M/PHM-System
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.0046,0.1932/) ! lower/upper boarder M/PHM-System
16 changes: 7 additions & 9 deletions regressioncheck/NIG_PIC_maxwell_RK4/builds.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
binary=./bin/piclas

! fixed compiler flags
CMAKE_BUILD_TYPE=Release
LIBS_BUILD_HDF5 =OFF
PICLAS_POLYNOMIAL_DEGREE=N

! include combinations
PICLAS_EQNSYSNAME=maxwell
PICLAS_TIMEDISCMETHOD=RK4
LIBS_USE_MPI =ON
PICLAS_NODETYPE=GAUSS
CMAKE_BUILD_TYPE = Release
LIBS_BUILD_HDF5 = OFF
PICLAS_POLYNOMIAL_DEGREE = N
PICLAS_EQNSYSNAME = maxwell
PICLAS_TIMEDISCMETHOD = RK4
LIBS_USE_MPI = ON
PICLAS_NODETYPE = GAUSS

! exclude combinations
EXCLUDE:PICLAS_EQNSYSNAME=poisson,PICLAS_TIMEDISCMETHOD=DSMC
Expand Down
2 changes: 1 addition & 1 deletion regressioncheck/NIG_code_analyze/Semicircle/parameter.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! =============================================================================== !
! EQUATION (linearscalaradvection)
! =============================================================================== !
IniExactFunc = 2
IniExactFunc = 0
! =============================================================================== !
! DISCRETIZATION
! =============================================================================== !
Expand Down
16 changes: 8 additions & 8 deletions regressioncheck/NIG_convtest_maxwell/builds.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
binary=./bin/piclas

! fixed compiler flags
CMAKE_BUILD_TYPE=Release
LIBS_BUILD_HDF5 =OFF
PICLAS_POLYNOMIAL_DEGREE=N
PICLAS_EQNSYSNAME=maxwell
PICLAS_TIMEDISCMETHOD=RK4
LIBS_USE_MPI =ON
PICLAS_NODETYPE=GAUSS
PICLAS_PARTICLES=OFF
CMAKE_BUILD_TYPE = Release
LIBS_BUILD_HDF5 = OFF
PICLAS_POLYNOMIAL_DEGREE = N
PICLAS_EQNSYSNAME = maxwell
PICLAS_TIMEDISCMETHOD = RK4
LIBS_USE_MPI = ON
PICLAS_NODETYPE = GAUSS
PICLAS_PARTICLES = OFF

! include combinations
!PICLAS_TIMEDISCMETHOD=RK3,RK4, ... .. .. ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ BoundaryType =(/2,5/) ! (/Type, BCState/)
BoundaryName =BC_Outflow
BoundaryType =(/3,0/) ! (/Type, BCState/)
TEScale =2e-9 !3.8e-9
TERotation =-1
TEPulse =F
TEPolarization=T
TEPolarization=r ! TEPolarization=T and TERotation=-1
! =============================================================================== !
! Analysis
! =============================================================================== !
Expand All @@ -63,4 +62,4 @@ PMLzetaShape = 1 ! shape function for damping constant (0=const, 1=linea
PMLRampLength = 1 ! ramping length in percent of PML width
PMLalpha0 = 0. ! CFS-PML aplha factor for complex frequency shift
PMLspread = 0 ! spread=1 dont spread=0
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.011,0.1932/) ! lower/upper boarder M/PHM-System
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.011,0.1932/) ! lower/upper boarder M/PHM-System
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ BoundaryType =(/2,5/) ! (/Type, BCState/)
BoundaryName =BC_Outflow
BoundaryType =(/3,0/) ! (/Type, BCState/)
TEScale =2e-9 !3.8e-9
TERotation =-1
TEPulse =F
TEPolarization=F
TEPolarization=y ! TEPolarization=F
TEDirection=1
! =============================================================================== !
! Analysis
! =============================================================================== !
Expand All @@ -64,4 +64,4 @@ PMLzetaShape = 1 ! shape function for damping constant (0=const, 1=linea
PMLRampLength = 1 ! ramping length in percent of PML width
PMLalpha0 = 0. ! CFS-PML aplha factor for complex frequency shift
PMLspread = 0 ! spread=1 dont spread=0
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.011,0.1932/) ! lower/upper boarder M/PHM-System
xyzPhysicalMinMax = (/-2.0E+00,2.0E+00,-2.0E+00,2.0E+00,0.011,0.1932/) ! lower/upper boarder M/PHM-System
9 changes: 9 additions & 0 deletions regressioncheck/NIG_maxwell_RK4/CoaxialCable_DMD/analyze.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!L2 error norm
analyze_L2=1e12

! compare the last row in coaxial_DMD_Spec.dat with a reference file
compare_data_file_name = post-dmd/coaxial_DMD_Spec.dat
compare_data_file_reference = post-dmd/coaxial_DMD_Spec_ref.dat
compare_data_file_tolerance = 1e-3
compare_data_file_tolerance_type = relative
compare_data_file_max_differences = 3 ! the sign in the DMD data can either be positive or negative for some values
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MPI=1,8,13
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
! maxwell RK
PICLAS_EQNSYSNAME=poisson
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
! --- Externals Tool Reggie
MPI = 1 ! Single execution
externalbinary = ./bin/dmd ! Relative binary path in build directory
externaldirectory = post-dmd ! Directory name, where the files are located for the external tool reggie
externalruntime = post ! Run after piclas is completed (post: after, pre: before)
cmd_suffix = ../coaxial_State_000.00000*.h5 ! Suffix for the binary execution
!cmd_pre_execute = pwd\s>\stest.txt ! "\s" resembles a white space character in the command (simply using " " is not allowed)

!nocrosscombination:MPI,externalbinary,externaldirectory,externalruntime,cmd_suffix,cmd_pre_execute
Loading

0 comments on commit 10cc6a1

Please sign in to comment.