フィルターのクリア

How to generate two PEC boundary conditions in 1D FDTD?

2 ビュー (過去 30 日間)
royed
royed 2020 年 9 月 20 日
コメント済み: RANIT ROY 2021 年 3 月 3 日
I want to implement a boundary condition in a 1D FDTD for Maxwells Equations in which the field is Purely Reflected in Both the boundaries for the electric field.
In short :
How to generate two PEC walls in 1D FDTD ? What is the boundary condition?

回答 (1 件)

Shouri Chatterjee
Shouri Chatterjee 2021 年 3 月 3 日
編集済み: Shouri Chatterjee 2021 年 3 月 3 日
I am using a template from Prof John B Schneider's book on understanding FDTD, with a minor modification. Increase the size of the E-field array by 1. The end edge of the E-field is now set to 0. Don't recompute this. Compute the H-field all the way to the end, based on this outer E-field.
Reference:
  • Understanding the Finite-Difference Time-Domain Method, John B. Schneider, www.eecs.wsu.edu/~schneidj/ufdtd, 2010.
The below code is a modification of Program 3.1. Program 3.1 had a PEC at x=0, a PMC at x=200. The code below has a PEC at x=0, a PEC at x=201.
#include <stdio.h>
#include <math.h>
#define SIZE 200
int main()
{
double ez[SIZE+1] = {0.}, hy[SIZE] = {0.}, imp0=377.0;
int qTime, maxTime = 1000, mm;
char basename[80] = "sim", filename[100];
int frame=0;
FILE* snapshot;
/* do time stepping */
for (qTime = 0; qTime < maxTime; qTime++) {
/* Magnetic field */
for(mm=0; mm < SIZE; mm++)
hy[mm] = hy[mm] + (ez[mm+1]-ez[mm])/imp0;
/* Electric field */
for(mm=1; mm < SIZE; mm++)
ez[mm] = ez[mm] + (hy[mm]-hy[mm-1]) * imp0;
/* Additive current source at node 50 */
ez[50] += exp(-(qTime -30.) * (qTime - 30.) / 100.);
// Explicit forcing function at node 0
// ez[0] = exp(-(qTime - 30.) * (qTime - 30.) / 100.);
if (qTime % 10 == 0) {
sprintf(filename, "%s.%d", basename, frame++);
snapshot = fopen(filename, "w");
for(mm=0; mm<SIZE+1; mm++)
fprintf(snapshot, "%g\n", ez[mm]);
fclose(snapshot);
}
}
return 0;
}
  1 件のコメント
RANIT ROY
RANIT ROY 2021 年 3 月 3 日
That seems interesting! So we are forcing a secondary source at the Magnetic Field Reflector! Thank You for suggesting this, I shall try this out.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeElectromagnetism についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by