Custom\Manual waveguide mode addition, for arbitrary waveguide structures#175
Custom\Manual waveguide mode addition, for arbitrary waveguide structures#175gadiLhv wants to merge 21 commits intothliebig:masterfrom
Conversation
84b9aa2 to
387e1ae
Compare
|
Hey @thliebig What I couldn't (easily) overcome here was in the excitation extension, I couldn't pass just the file name. Other than that, pretty straight forward. Hope I didn't mess anything else up, too bad. Cheers |
|
Hey @thliebig First of all, thank you for merging the local obsorber PR. I hope it will be useful for other things, as the SIBC/MUR-SA is a pretty cool addition. This PR went through rather extensive changes (along with it's CSXCAD counterpart) so let me know how do you find it. Cheers |
| self.direction = np.sign(stop[self.exc_ny]-start[self.exc_ny]) | ||
| self.ref_index = 1 | ||
|
|
||
There was a problem hiding this comment.
Please avoid trailing whites-spaces... check if you can configure your editor?
There was a problem hiding this comment.
I really don't know what you meant here. There was no trailing white spaces option enabled (I used Eclipse). I also didn't see anything unclear. The line space is for readability, and the tab is because of the next line.
I also checked to see if there are any un-necessary spaces there, as well. Didn't find anything.
There was a problem hiding this comment.
Lines 358 and 437 were both empty before and now have 8 spaces.
There was a problem hiding this comment.
Okay maybe trailing was a bit misleading, empty lines should not have white-spaces too, just empty please.
|
Hey @thliebig I will review them this week. Seems straightforward enough. Regarding the Octave/Matlab interface, I will put that on the task list. If you insist, I'll do it now, but I really want to organize my Repo a bit. This on-job git training was very deductive, but I really want to keep it cleaner from here on forward. I'm more fluent in m-scripting than I am in Matlab, so should be simpler. I need to think about how to do it in cylindrical CS, as I never really used it. I need to figure out the deal with the mesh there. Also, the interpolation schemes I wrote for the mode parser hardly fit that. Add it to the pile, I guess 😆. Hardly a finalized version, but some of my initial mode solver codes are here: |
|
As I said, keep both points (Octave interface and Cylindrical CS) for later. I would almost think that Cylindrical Coordinates might just work as is (of course with matching csv data)... maybe I will look into it... later... |
|
I've finished the changes requested. Since the local absorbers were already merged, I'd like to add another example with a different T-Line. Maybe remake the MSL case, or add a CPW one. I'll push when done. |
cbb1a5a to
7d5823a
Compare
|
Added another example, for CPW. I couldn't verify it against 3rd party software, regretfully, yet. |
|
Here, a nice video test_CPW.mp4 |
|
Great video. What settings did you use to render the 3D volume correctly? This is worth documenting, the best thing I managed to do in ParaView is to render a slice from a volume rather than a full volume. |
|
Hey @biergaizi |
|
Hey @thliebig Any other changes necessary for thie PR? |
|
@thliebig can this be merged yet? |
|
Give me some more time to start another review soon hopefully... |
|
Hi @thliebig -- any chance you might have an opportunity to merge this soon, to expand support for waveguides? |
|
While I'm not the project owner and can't do any code review on the algorithm, but as the build system and CI/CD maintainer I must point out that this Pull Request should be rebased against the latest Please run: # add an alternative origin named upstream
git remote add upstream https://github.com/thliebig/openEMS
git fetch upstream master
# go to your local feature branch
git checkout WaveguideModes
# save a duplicate backup branch it in case the rebase went wrong
git branch WaveguideModesBackup
# rebase the local feature branch against the upstream git branch
# to reset the time of divergence to the last commit, to avoid a complicated
# fork-in-the-middle merge
git rebase upstream/master
# solve any merge conflicts here, should be none
# use git add and git rebase --continue to mark resolution if any conflict does raise
# overwrite the current Pull Request
git push --forceIf the rebase succeeds and the CI pipeline passes, your next problem is to fixup/squash/reword all isolated fixes together, because no future developer is interested in reviewing facts such as how the folder example has been changed in the draft. All commits ideally should compile because broken commits prevents developers from testing individual commits in Now git should start a text editor. Because a lot of editing is involved, make sure the default editor is easy to use. If not, you can change it using the shell variable such as If you want to merge a commit to its previous commit (common when the next commit fixes a mistake in the previous one), change the keyword Any new feature development should be carefully reintegrated into the main branch. I recommend rebase incrementally, starting from the easiest tasks. This is what I would do - keep a few milestones, and merge unnecessary fixes upwards. When you're done, save the file. After saving, you have three clean commits. Because the last commit message "Compiles, untested!" is now outdated and would mislead futere developers, you should rewrite the commit log of the last commit to reflect the actual changes. What I'd do is to write a full introduction of the feature in the last commit. You can start a rebase again Once you're done, do a force-commit to overwrite the PR: If you use consistently this technique during actual development, you can ensure every single commit is working and also create the impression that there's never any build failures in the project like the Ministry of Truth (but don't abuse it, rewriting history in |
|
Well the alternative and what I would have most likely done is to just squash merge this after review. Said said, if you do not want to rewrite the history and are fine with a squash merge, you can at least rebase to the latest master to see if the CI system finds any build issues... |
|
You want me to rebase, sure, no worries. It won't ever build until the CSXCAD PR is merged. It's based on stuff programmed there... |
| else: | ||
| use_function_expr = False | ||
|
|
||
| if use_function_expr is None: | ||
| raise Exception("Cannot decide if function expression is used or mode file") |
There was a problem hiding this comment.
Whats missing here? After that if/else use_function_expr can never be None? I think the else should have been a check for the file mode?
There was a problem hiding this comment.
True that. Fix will come in the nearby push in this form:
use_function_expr = None
if (self.E_func is not None) and (self.H_func is not None):
use_function_expr = True
elif (self.E_WG_file is not None) and (self.H_WG_file is not None):
use_function_expr = FalseThere was a problem hiding this comment.
Does not seem fixed in my latest pull?
|
|
||
| _,Eext = os.path.splitext(self.E_file) | ||
| _,Hext = os.path.splitext(self.H_file) | ||
| if not ((Eext == '.csv') and (Hext == '.csv')): |
There was a problem hiding this comment.
I am not sure that I am a fan of checking the file ending? Also a *.dat file could be a valid mode file? Or even a file without any extension at all?
There was a problem hiding this comment.
The extension is a design choice.
The amount of times I tried to use a general csv as a far field source, a CST graph export as s-parameters, etc. I feel like enforcing it to be a CSV will cause the user to actually verify before.
Should you demand, I'll remove this input check, no problems.
There was a problem hiding this comment.
Removed, in the next push.
You are right, no need to therefore at this point. I will squash merge and build test locally and let CI check afterwards and fix anything if it is found. Please just look at my initial review comments .. |
I see. As a tip, the openEMS CI/CD pipeline is now enabled globally for all branches, after rebasing your openEMS feature branch, CI/CD will now try using the I need to document that in my website PR... Perhaps it can be improved further in the future, such as falling back to the upstream if the repos don't exist, or use the branch of the same names in two different repos... |
|
I just opened a TODO proposal named Enhanced Dependency-Aware Multi-Repo CI/CD Pipeline Logic to make things easier for both @gadiLhv and reviewers. |
Will do, @thliebig. It requires actual thinking, so I'll get to it tomorrow.
I'm actually more confused by this, somehow. But I'm not a prime example of a developer. Just happen to like computational electromagnetics. |
What I basically said is that, if the idea is implemented in the future, two simultaneous changes targeting CSXCAD and openEMS will be tested together at the same time, if both Pull Requests come from the same developer, and use the same local branch names. This will eliminate the problem of not being able to run meaningful CI in a stalemate like this PR (I've also encountered the problem many times). |
Added test scripts
Not finished Far from compiling. TODO: 1. Finish probes 2. Verify input validity 3. Try to find more elegant solution for excitation.
be0283b to
f732f6e
Compare
|
My "Pull Request Ganging" proposal has just been implemented. Please try a dummy useless force push to force the CI/CD pipeline to rerun: After a force push, your openEMS Pull Request will be tested together with your latest CSXCAD Pull Request commits (because both have the same |
|
I can request a re-run manually |
|
I couldn't figure out what went wrong with the MSVC test. Any hints, @biergaizi & @thliebig? Nice to see some green lights on this, for a change |
Undefined reference due to unexported library functions. On Windows, all symbols are private by default. To make a symbol available to other applications in a DLL, you must mark the class or function as For example, the class But your But we should be careful here. Everything in The class name is not following CSXCAD naming convention of I think we have several choices:
|
|
The fixes here were very minor. Applied, as well. |
Still need to finish the CSXCAD matlab function and port the test script to matlab.
1. Added the test script 2. Attribute setting not working yet
1. Full run successful 2. Minor fixes to script 3. Added propDir property for mode file name
|
Hello again, @thliebig A Matlab/Octave script was added to The m-script functionality is a bit more limited, as it originally supported only TE modes. I matched the same capabilities. I translated only one script of the three, but it should be the same for the rest. |
|
@thliebig anything more needed here? |
|
@gadiLhv I hope not, but I want to do a (hopefully) final code review and testing. But I need to find the time and motivation to do it. |
|
Post python-Test script do not work anymore due to multiple issues... Please fix them. Thanks |
Can you tell exactly what didn't work? I ran the CSXCAD unit tests, and for me, the update_openEMS.sh script worked. |
|
I did not mean the unit tests, I meant the full python demo's. I think they also would have better been added to an examples folder. "python/Tests/Coax_W_WG_Ports.py" and CWP_* is what I meant. |
1. Uniform mesh inside coax 2. Mode files in example path. No relative path redirection. 3. Analytical mode parameter solutions
What should I run to recreate the issues?
This I understood even less. It's in this folder right now. What would you rather? |
Just run and fix them both? I think I only tested one and there were undefined variables and not up to date function calls. |
|
Sure, will take care of it tomorrow. |
1. Increase resolution in CPW script 2. Solved variable problems in Coax script
|
Solved the issue in the Coax example and improved the performance of the CPW. Also added a disclaimer with things to fiddle with. |

This one was rather tricky. Took me a good long while to figure out what functionality I should access in openEMS.
I'll start from the tricky part, in
ports.py. This is where openEMS and CSXCAD are intertwined. I needed some sort of validation of the inputs, to add this functionality toWaveguidePort. Until the CSXCAD PR isn't finalized, this can't be, either. Unless you want to neglect the python functionality for now.https://github.com/thliebig/openEMS/compare/master...gadiLhv:openEMS:WaveguideModes?plain=1#diff-fe6a56ae621157b6691266fcc774ca626b01b38cb611a5b21e623b9a9d3493c7R382-R391
The only bit of redundancy may be this:
master...gadiLhv:openEMS:WaveguideModes#diff-53e7f365700486b254789d1b8ff10d0073b4bfd6b44e4b5823f72f2192d1b96fR282-R305
where this doesn't exist anywhere else in openEMS, rather in CSXCAD. If I understand correctly, you would rather some sort of field file handling class for this.
Here is the clever bit, though. I didn't write anything to the engine extension. It's actually done in the
GetWeightedExcitationfunction, here:https://github.com/gadiLhv/openEMS/blob/4195be2c83c118ea9f26ddf8eff90715744d7a68/FDTD/extensions/operator_ext_excitation.cpp#L205
and here:
https://github.com/gadiLhv/openEMS/blob/4195be2c83c118ea9f26ddf8eff90715744d7a68/FDTD/extensions/operator_ext_excitation.cpp#L260C9-L260C84