Open oberstet opened 11 months ago
Thank you for this and I can see the issue. But I'm not sure yet how to solve this correctly. CSXCAD and openEMS are supposed to be separate projects as CSXCAD can and should be usable with other solvers, e.g. a static field solver. And this lumped port is more or less an FDTD version of this port and CSXCAD should not really be bothered with the details. Thus this implementation should happen in openEMS and openEMS should be able to write the xml file and add details e.g. about all the different ports and how they reference CSXCAD (lower level) objects. Does that make sense?
And this lumped port is more or less an FDTD version of this port and CSXCAD should not really be bothered with the details.
Talking about "lumped port" in general - thus, not the specific flavor used by openEMS - even these are considered NOT be part of what CSXCAD addresses in its scope?
I am really a bit of an outsider with a fragment slice of perspective on EM and openEMS:
"lumped ports" are
but they are required for any kind of simulation?
is there a "simulation level" file format - if that is not what CSXCAD also wants to cover?
put differently, for geometry alone, STL / STEP are enough, and CSXCAD is not needed, but for a complete simulation - a definition which I can roundtrip - CSXCAD is required, but not enough? catch22? ;)
A lumped port in general could be part of CSXCAD, but all the sub-objects created by openEMS do only make sense for FDTD. And then openEMS does offer lots more ports that make even less sense for other types of field solvers.
openEMS can and does create its own xml file where CSXCAD is only a part of. I think this would be the correct place to save/load higher level objects like ports. I will have a look into it because the python interface currently cannot do this.
CSXCAD itself is indeed only meant to be a CAD tool. But for me STL/Step was only a last resort. Usually everything is defines as boxed, polygons and e.g. cylinders and CSXCAD offers an easy interface to all that.
openEMS can and does create its own xml file where CSXCAD is only a part of. I think this would be the correct place to save/load higher level objects like ports.
fwiw, and as far as I understand topics / matters, I agree, sounds good +1!
I want to round-trip openEMS simulations via CSXCAD files stored via
Write2XML
and re-created usingReadFromXML
.Doing so required me to create a custom class LumpedPortExt - code is below.
I have tested this with the CSXCAD created from the tutorial "Simple Patch" antenna: https://gist.github.com/oberstet/cf93ac19332ccbedeb1d414b461b9692
There is only a minor question left, pls see FIXME in the code below.
Should there be interest in merging, please let me know, I could push a PR.
Otherwise this might still help other users, hence I am posting this as an issue.
There is a problem doing so, since a CSXCAD.CSProperties.CSPropLumpedElement and other elements are stored in CSXCAD, but NOT the openEMS.ports.LumpedPort (as its own serialized object refering to the 4 objects created).
When originally calling AddLumpedPort, e.g. as in Simple Patch Antenna
this will actually create 4 objects in the CSXCAD continuous structure
which gets serialized into XML via Write2XML like so
However, when reading in such XML again via ReadFromXML, this will re-create the 4 individual objects
but it will not re-created a LumpedPort!!
Specifically, it will create a CSXCAD.CSProperties.CSPropLumpedElement but NOT a openEMS.ports.LumpedPort