Replies: 1 comment 2 replies
-
I think you units are wrong? If you define the drawing unit to be in mm, then all objects coordinates should not again multiplied by 1e-3? I think you defined everything 1000x to small?? Please check |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm new to openEMS and currently stuck on a problem when modelling a simple dual‑electrode excitation in Ecoflex for a low‑frequency (10 MHz) application. openEMS keeps picking an extremely small timestep (≈ 1.3 × 10⁻¹⁶ s) and the run eventually produces NaN energy after long time. I’d really appreciate pointers on what I’m overlooking. For the reference, I've attached my code and the log. Thank you for your guidance in advance.
Code*******************
physical_constants;
unit = 1e-3; % [mm] → [m]
%% 1. Waveform & FDTD settings ───────────────────────────────────────
f0 = 10e6; % center frequency 10 MHz
fc = 0.05 * f0; % bandwidth 0.5 MHz
FDTD = InitFDTD();
FDTD.NrTS = 2e6; % 2 million timesteps (≈ 300 ns window)
FDTD.EndCriteria = 1e-4; % energy decay threshold
FDTD = SetGaussExcite(FDTD, f0, fc);
FDTD = SetBoundaryCond(FDTD,{ ...
'PML_8','PML_8','PML_8','PML_8','PML_8','PML_8'});
%% 2. Material definitions ───────────────────────────────────────────
CSX = InitCSX();
CSX = AddMaterial(CSX,'Ecoflex');
CSX = SetMaterialProperty(CSX,'Ecoflex','Epsilon',2.9);
CSX = AddMaterial(CSX,'PEC'); % PEC approximation
CSX = SetMaterialProperty(CSX,'PEC','Epsilon',1e9,'Kappa',1e9);
%% 3. Geometry ───────────────────────────────────────────────────────
wire_radius = 0.05; % 50 µm
wire_len = 2; % 2 mm length
wire_spacing = 0.216; % 216 µm gap between electrodes
p1 = [-wire_spacing/2, 0, 0];
p2 = [ wire_spacing/2, 0, 0];
CSX = AddBox(CSX,'Ecoflex',0,[-2,-2,0]unit,[2,2,wire_len+3] * unit);
CSX = AddCylinder(CSX,'PEC',1,p1unit,[p1(1),p1(2),wire_len] * unit, ...
wire_radius * unit);
CSX = AddCylinder(CSX,'PEC',2,p2*unit,[p2(1),p2(2),wire_len] * unit, ...
wire_radius * unit);
%% 4. Mesh (fine near PEC, coarser outside) ─────────────────────────
mesh.x = SmoothMeshLines([-2,-0.324,-0.108,0,0.108,0.324,2] * unit,2.0);
mesh.y = SmoothMeshLines([-2,-0.1,-0.05,0,0.05,0.1,2] * unit,2.0);
mesh.z = SmoothMeshLines(linspace(0,wire_len+3,14) * unit,2.0);
mesh = AddPML(mesh,8);
CSX = DefineRectGrid(CSX,unit,mesh);
%% 5. Excitation ─────────────────────────────────────────────────────
E_amp = 20 / (0.216e-3); % 92.6 kV/m (20 V across 216 µm)
CSX = AddExcitation(CSX,'pulse1',0,[E_amp,0,0]);
CSX = AddBox(CSX,'pulse1',5, ...
[-wire_spacing/2,-0.05, wire_len/2] * unit, ...
[ wire_spacing/2, 0.05, wire_len/2+0.5] * unit);
%% 6. Voltage probes ────────────────────────────────────────────────
start_probe1 = [-wire_spacing/2,0,wire_len/2];
end_probe1 = [-wire_spacing/2,0,wire_len/2+0.5];
start_probe2 = [ wire_spacing/2,0,wire_len/2];
end_probe2 = [ wire_spacing/2,0,wire_len/2+0.5];
CSX = AddProbe(CSX,'Ex_probe',0);
CSX = AddBox (CSX,'Ex_probe',5,start_probe1 * unit,end_probe1 * unit);
CSX = AddProbe(CSX,'Ex_induced',0);
CSX = AddBox (CSX,'Ex_induced',5,start_probe2 * unit,end_probe2 * unit);
%% 7. Simulation folder ─────────────────────────────────────────────
Sim_Path = fullfile(pwd,'tmp_dual_excite'); % keep original path
Sim_CSX = fullfile(Sim_Path,'dual_electrode_excite.xml');
if exist(Sim_Path,'dir'); rmdir(Sim_Path,'s'); end
mkdir(Sim_Path);
%% 8. Run simulation ────────────────────────────────────────────────
WriteOpenEMS(Sim_CSX,FDTD,CSX);
opts = '--engine=multithreaded --numThreads=12 -v 2';
Settings.LogFile = 'openEMS.log';
Settings.Silent = 0;
RunOpenEMS(Sim_Path,'dual_electrode_excite.xml',opts,Settings);
Log*******************
openEMS - enabled multithreading
openEMS - fixed number of threads: 12
openEMS - verbose level 2
Read openEMS xml file: tmp_dual_excite/dual_electrode_excite.xml ...
Read openEMS Settings...
Read Geometry...
Create FDTD operator (compressed SSE + multi-threading)
Multithreaded operator using 12 threads.
Operator::CalcTimestep_Var3: Smallest timestep (1.30405e-16s) found at position: 1 : 15;18;0
Compressing the FDTD operator... this may take a while...
------- Stat: FDTD Operator -------
Dimensions : 29x39x30 = 33930 Cells (0.03393 MCells)
Size of Operator : 1628640 Byte (1.55319 MiB)
Size of Field-Data : 814320 Byte (0.776596 MiB)
Background materials (epsR/mueR/kappa/sigma): 1/1/0/0
Number of PEC edges : 0
in x direction : 0
in y direction : 0
in z direction : 0
Timestep (s) : 1.30405e-16
Timestep method name : Rennings_2
Nyquist criteria (TS) : 365161807
Nyquist criteria (s) : 4.7619e-08
SSE compression enabled : yes
Unique SSE operators : 7287
--- Excitation Extension ---
Voltage excitations : 6 (6, 0, 0)
Current excitations : 0 (0, 0, 0)
Excitation Length (TS) : 987010949
Excitation Length (s) : 1.28711e-07
--- Uniaxial PML Extension ---
PML range : [0,0,0] to [8,38,29]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
--- Uniaxial PML Extension ---
PML range : [20,0,0] to [28,38,29]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
--- Uniaxial PML Extension ---
PML range : [9,0,0] to [19,8,29]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
--- Uniaxial PML Extension ---
PML range : [9,30,0] to [19,38,29]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
--- Uniaxial PML Extension ---
PML range : [9,9,0] to [19,29,8]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
--- Uniaxial PML Extension ---
PML range : [9,9,21] to [19,29,29]
Grading function : " -log(1e-6)log(2.5)/(2dlZ(pow(2.5,W/dl)-1)) * pow(2.5, D/dl) "
Creation time for operator: 3128.7 s
FDTD simulation size: 29x39x30 --> 33930 FDTD cells
FDTD timestep is: 1.30405e-16 s; Nyquist rate: 365161807 timesteps @1.05e+07 Hz
openEMS::SetupFDTD: Warning, the timestep seems to be very small --> long simulation. Check your mesh!?
Excitation signal length is: 987010949 timesteps (1.28711e-07s)
Max. number of timesteps: 1000000000 ( --> 1.01316 * Excitation signal length)
openEMS::SetupFDTD: Warning, max. number of timesteps is smaller than three times the excitation.
You may want to choose a higher number of max. timesteps...
Create FDTD engine (compressed SSE + multi-threading)
--- Engine::SortExtensionByPriority() ---
#0: Uniaxial PML Extension (1000000)
#1: Uniaxial PML Extension (1000000)
#2: Uniaxial PML Extension (1000000)
#3: Uniaxial PML Extension (1000000)
#4: Uniaxial PML Extension (1000000)
#5: Uniaxial PML Extension (1000000)
#6: Excitation Extension (-1000)
Multithreaded engine using 12 threads. Utilization: (3;3;3;3;3;2;2;2;2;2;2;2)
Setting up processing...
Running FDTD engine... this may take a while... grab a cup of coffee?!?
[@ 62h18m45s] Timestep: 91290451 || Speed: 13.8 MC/s (2.457e-03 s/TS) || Energy: ~-nan(ind) (- 0.00dB)
Beta Was this translation helpful? Give feedback.
All reactions