Commit Graph

1226 Commits (5b8cf2f2ed52567e2696d67e647bf906843cef7c)

Author SHA1 Message Date
Chris Madsen 5b8cf2f2ed Dmax is in linear power units, so convert to dB power before adding to dB power. 2023-11-18 13:25:28 +01:00
gammaxy1 6212d1de68 PML_8 typo in docstring 2023-11-18 13:25:28 +01:00
Yifeng Li 840c9755d5 Handle SIGINT for openEMS and Python, with graceful exit support.
Currently, openEMS doesn't have any special code to handle SIGINT (which
is raised by pressing Control-C). By default, the program is terminated
without saving data. This worked okay in the past, but now its
limitations are becoming obvious.

1. When openEMS is used as a Python module, Control-C stops working
because SIGINT is now managed by Python in order to generate
KeyboardInterrupt exceptions, normally this isn't a problem, but if
we are running an external C++ (Cython) function such as openEMS, the
Python interpreter mainloop has no control until we return. As a
result, SIGINT is received but never handled. In Cython, programs are
expected to call PyErr_CheckSignals() in its blocking loop periodically
to temporally transfer control back to Python to handle signals. But
this introduces a dependency of Cython in the FDTD mainloop.

2. During a simulation, it's not possible to abort it gracefully by
pressing Control-C, this is a limitation of openEMS itself, it's
always a force exit. Currently the only supported method for graceful
exit is creating a file called "ABORT" in the simulation directory.
If we already need to implement a signal handler, adding a graceful
exit at the same time would be a good idea.

This commit installs SIGINT handlers during SetupFDTD() and RunFDTD().

1. In RunFDTD(), if SIGINT is received once, a status flag is set, which
is then checked in CheckAbortCond(), allowing a graceful exit with the
same effect of an "ABORT" file. If SIGINT is received twice, openEMS
force exit without saving data (just like the old default behavior).

2. In SetupFDTD(), if SIGINT is received, openEMS immediately force
exit without saving data, identical to the old behavior. In a huge
simulation, initializing and compressing operators may have a long
time. so we want an early exit before RunFDTD().

3. Before RunFDTD() and SetupFDTD() return, the original signal handler
for SIGINT is restored. This is important since when we're acting as
a shared library. When a program (such as the Python interpreter) calls
us, changing the SIGINT handler unilaterally may overwrite the original
handler and affect the functionality of the original program. For
example, Python would never be able to raise KeyboardInterrupt again.
Thus, we save the original handler and restore it later.

Signed-off-by: Yifeng Li <tomli@tomli.me>
2023-11-18 12:32:44 +01:00
G. L ee3f2b7d80
Lumped RLC parallel & series implementation (openEMS) (#121) 2023-11-18 12:23:15 +01:00
Thorsten Liebig 5f36e7f3a2 version 0.0.36
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-10-22 16:25:51 +02:00
Yifeng Li 782a7381bf CMakeLists.txt: append instead of overwrite CMAKE_CXX_FLAGS
Currently, on ARM and PPC, CMakeLists.txt uses:

    set(CMAKE_CXX_FLAGS "-DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS")

but this overwrites the default value of CMAKE_CXX_FLAGS from CMake,
including user-specified CXXFLAGS via environmental variable, making
it impossible to change CXXFLAGS.

This patch appends instead of overwrite CMAKE_CXX_FLAGS via:

    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_WARN_X86_INTRINSICS -DSSE_CORRECT_DENORMALS")

Signed-off-by: Yifeng Li <tomli@tomli.me>
2023-05-17 19:01:06 +02:00
Yifeng Li 486f3140cb openEMS.pyx: check canonical path in assert, close #113.
Currently, running openEMS's example Python scripts on macOS always fails
with the following error:

    $ python3 MSL_NotchFilter.py
    Traceback (most recent call last):
      File "/Users/gentoo/code/openEMS-Project/openEMS/python/Tutorials/MSL_NotchFilter.py", line 103, in <module>
        FDTD.Run(Sim_Path, cleanup=True)
      File "openEMS/openEMS.pyx", line 489, in openEMS.openEMS.openEMS.Run
    AssertionError

This is caused by an oversight of an assertion in openEMS.pyx:

    os.chdir(sim_path)
    # ...
    assert os.getcwd() == sim_path

The problem here is that "sim_path" is not a canonical path name,
so the assertion would fail if the path we're switching into contains
a symbolic link. This problem affects all operating systems, it's not
limited to macOS. But on macOS, the problem is especially serious,
since macOS's "/tmp" is a link to "/private/tmp" by default. Thus, it
causes an AssertionError in all the included Python examples.

Instead of doing "assert os.getcwd() == sim_path", we should write
"assert os.getcwd() == os.path.realpath(sim_path)" to ensure that
we're checking a canonical path.

Signed-off-by: Yifeng Li <tomli@tomli.me>
2023-05-03 18:46:29 +02:00
Thorsten Liebig c651cce61f Merge remote-tracking branch 'drake/feature/estimate-cfl-timestep' 2023-03-19 11:45:14 +01:00
Thorsten Liebig 568cdbdfac PML: try to fix pml working for a finite conductor waveguide
sigma > 1000 S/m is considered a conductor (not ideal solution)

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-03-08 22:10:30 +01:00
Gonzalo José Carracedo Carballal cf34998b01 Add missing import 2023-03-06 21:46:43 +01:00
Gonzalo José Carracedo Carballal 3eb4439959 Improve readability of mesh_estimate_cfl_timestep 2023-03-06 21:45:17 +01:00
Gonzalo José Carracedo Carballal 6440b408ac Implement mesh_estimate_cfl_timestep 2023-03-06 20:36:50 +01:00
Thorsten Liebig cb63ab01c4 python: fix automesh type detection
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-03-05 20:33:07 +01:00
Thorsten Liebig 704fad6dc4 python: cleanup should not crash if folder cannot be removed
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-02-22 18:57:52 +01:00
Thorsten Liebig cbbae61c24 python: fix TD for MSL ports with set ref. impedance
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-02-22 18:57:17 +01:00
Yifeng Li 8e408307b8 python/ports.py: replace deprecated "np.int" with "int".
Accroding to NumPy's development team, "for a long time, np.int has
been an alias of the builtin int. This is repeatedly a cause of
confusion for newcomers, and existed mainly for historic reasons."

This and many other aliases have been deprecated since NumPy v1.20.0,
and at this point they've been completely removed. Replace "np.int"
with "int" allows ports.py to run again.

Signed-off-by: Yifeng Li <tomli@tomli.me>
2023-02-22 18:41:43 +01:00
Thorsten Liebig ecf0c160e0 nf2ff main: update year info
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-02-19 12:47:33 +01:00
Thorsten Liebig b49bd2af80 MT engine: fix threads not cleaned up, #104
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-02-11 10:43:28 +01:00
Thorsten Liebig 0342eefd27 python tutorials: use new/better automesh options for CRLH examples
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-07 20:52:36 +01:00
Thorsten Liebig 595c8effbd python: improve automesh options
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-07 20:50:32 +01:00
Thorsten Liebig a0e45f8869 python: fix numpy datatype
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-07 20:50:10 +01:00
Thorsten Liebig 55068629b0 cmake: drop support for vtk<=5
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-06 20:05:13 +01:00
Thorsten Liebig 6673aefd70 engine: try to find optimal number of engine threads
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-06 20:01:07 +01:00
Thorsten Liebig 63c5fe561d fix hdf5 search to not find opencv hdf5.h
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2023-01-06 16:43:21 +01:00
aWZHY0yQH81uOYvH 115aeb64e2 update setup.m to work on Mac 2023-01-06 03:31:01 -08:00
aWZHY0yQH81uOYvH 3162c487d9 detect `arm64` under macOS 2023-01-06 00:38:53 -08:00
Apostolos 638d875906 Expose Debugs to Python API 2023-01-03 21:30:20 +01:00
Apostolos 3772497901 Expose DebugMaterial, DebugOperator and DebugBox 2023-01-03 21:30:20 +01:00
Thorsten Liebig 9677c457e8 python: update Tutorials meta data, remove verbose call
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2023-01-02 12:32:28 +01:00
Thorsten Liebig 0777302f1f python Tutorial: fix CRLH mesh hints
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2023-01-01 14:14:15 +01:00
Thorsten Liebig 164d3983e3 python: allow windows to find AppCSXCAD
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2023-01-01 14:13:53 +01:00
Thorsten Liebig df7c58d961 info: update welcome screen
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2022-12-30 17:18:53 +01:00
Thorsten Liebig e52babccbf MSVC: fix for windows compiler
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2022-12-29 13:08:44 +01:00
Thorsten Liebig 9737661b94 python: language level 3
Signed-off-by: Thorsten Liebig <thorsten.liebig@gmx.de>
2022-12-29 10:06:11 +01:00
Georg Zachl 8c08cf5312 Expose sinusoidal, dirac pulse and step pulse excitation to the Python API. 2022-12-11 11:33:21 +01:00
luz paz 026f12355f Fix various typos
Found via `codespell -q 3 -L adress,imag`
2022-12-11 11:32:04 +01:00
Stefan Biereigel 0b43416651 add aarch64 build support 2022-12-11 11:30:33 +01:00
pkubaj 2215eba9ef Fix build on FreeBSD/powerpc64*
FreeBSD uses powerpc64 and powerpc64le names for 64-bit POWER.
2022-12-11 11:29:48 +01:00
Thorsten Liebig d260025a6d numeric: make sure that LC_NUMERIC is set to en_US for function parser
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2022-05-31 20:09:43 +02:00
Thorsten Liebig d4448fa294 octave: make sure to find the serial hdf5 include first
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2022-02-15 19:12:06 +01:00
Thorsten Liebig 46f4084555 fix line integral calc
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2021-09-07 16:56:08 +02:00
Thorsten Liebig 0e54fbf7ac core: fix probe handling
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2021-08-25 19:05:38 +02:00
Thorsten Liebig bad842a710 voltage probes: better voltage integration with direction
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
2021-08-25 19:05:11 +02:00
Yuri Victorovich 2a7506482c Fixes in openEMS.sh
1. use Bourne shell to prevent unnecessary dependencies
2. fix $@ to handle arguments with spaces properly
2021-08-18 23:46:45 -07:00
Thorsten Liebig 4c24b6ec75 python: replace distutils with setuptools
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2021-07-13 19:17:15 +02:00
Thorsten Liebig 0dcbcf7651 python Tutorial: fix bent patch antenna
Signed-off-by: Thorsten Liebig <liebig@imst.de>
2021-07-08 15:23:47 +02:00
Thorsten Liebig 566962c516 cmake: static link hdf5
maybe only windows?

Signed-off-by: Thorsten Liebig <liebig@imst.de>
2021-07-08 15:15:55 +02:00
Thorsten Liebig f9c8954ed3 python: improve init on windows
CSXCAD adds the dll path as needed on windows install version

Signed-off-by: Thorsten Liebig <liebig@imst.de>
2021-07-08 15:14:30 +02:00
funkmaus a013077854 Allow whitespaces in simulation path (remote)
A simulation path that contains a whitespace character (and probably a lot of other characters that have special meanings inside a shell) leads to an scp failure when the simulation data is copied back to the host machine. Replacing [pwd '/'] by just './' as the back-copying destination fixes this problem.
2021-04-11 12:39:15 +02:00
Stefan Biereigel 06aa959f29 fix boost library path variable 2021-04-11 12:23:34 +02:00