add_fdtd_setup#
- simpleEMS.fdtd_standalone_model.add_fdtd_setup(structure_xml_path: str | Path, freq_range: tuple[float, float], output_xml_path: str | Path | None = None, excitation: str = 'gauss', FDTD_boundary: list[str] | None = None, FDTD_timestep: int = 90000000, FDTD_end_criteria: float = 0.0001, overwrite: bool = False) Path#
Attach an openEMS FDTD setup to a geometry-only
structure.xml.A file written by
CSX.Write2XML()(root<ContinuousStructure>) holds the mesh, materials, metals, lumped-port properties and probes, but none of the solver settingssimulate_model()needs – the excitation waveform, the boundary conditions and the run limits all live in the<FDTD>section that onlyopenEMS.Write2XML()writes. This function supplies those settings and re-writes the model as a full<openEMS>document, ready forsimulate_model().An existing
<openEMS>file is also accepted, in which case its<FDTD>section is replaced – use that to re-band or re-terminate a model without rebuilding its geometry.- Parameters:
structure_xml_path (str | Path) – Path to the model, root
<ContinuousStructure>or<openEMS>.freq_range (tuple[float, float]) –
(fmin, fmax)in Hz. The Gaussian excitation is centred at(fmin + fmax) / 2with cutoff(fmax - fmin) / 2, matchingsetup_simulation().output_xml_path (str | Path, optional) – Where to write the result. Defaults to
<stem>_fdtd.xmlincwd / "Sim_Path".excitation (str) –
"gauss"(default),"sinus","dirac"or"step". Only"gauss"letssimulate_model()derive its post-processing band from the file; the others require an explicitfreqs=argument there.FDTD_boundary (list[str], optional) – Six openEMS boundary-condition strings, in the order
[xmin, xmax, ymin, ymax, zmin, zmax]. Defaults to["PML_8"] * 6.FDTD_timestep (int) – Maximum FDTD time-step count. Default
90000000.FDTD_end_criteria (float) – Energy decay stopping criterion. Default
1e-4.overwrite (bool) – Allow writing over an existing
output_xml_path. DefaultFalse.
- Returns:
Path to the written
<openEMS>XML.- Return type:
Path
- Raises:
ValueError – If the source root element is neither
<ContinuousStructure>nor<openEMS>, iffreq_rangeis not a positive increasing pair, ifexcitationis unknown, or if the loaded structure carries no mesh lines on some axis (openEMS cannot run an unmeshed model).RuntimeError – If the loaded structure carries no lumped ports (
port_resist_<N>properties).FileExistsError – If
output_xml_pathexists andoverwriteisFalse.