-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed meshing issues: issue #150 | discussion #156 #159
Conversation
Follow up from #156 (comment) As per the documentation on shapely for the
|
Thanks, looks great! My main worry would be: Is the mesh still exact after snapping? I'd expect a snap to change the mesh in case a line is passing close by a previously defined mesh point? Putting there a fixed number in is a bit dangerous, e.g. I often use 1e-6m instead of 10um and snapping by 0.1 would then change everything... :/ Should we maybe export it as a parameter? Or set the snapping to a wayyy smaller number? (something like the @simbilod Could you have a look? |
femwell/mesh/mesh.py
Outdated
@@ -31,7 +31,7 @@ def break_line_(line, other_line): | |||
): | |||
# if type == "", intersection.type != 'Point': | |||
if intersection.geom_type == "Point": | |||
line = linemerge(split(line, intersection)) | |||
line = snap(line, intersection, 0.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we use the MeshTracker's atol
attribute to choose the snapping tolerance?
It is instanciated over at
Line 321 in d1f0919
meshtracker = MeshTracker(model=model) |
we can set it as an argument to mesh_from_OrderedDict, and pass it when we construct there, and then whenever we call break_line_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea! I'll try it and get back to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simbilod that solution has worked for both examples that I had previous problems with. I think it is fixed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! One more change below and we can merge :)
In general I should start about deprecating this meshing API in favor of meshwell, but there are some features (like the named lines here) that meshwell does not support yet |
femwell/mesh/mesh.py
Outdated
@@ -21,7 +21,7 @@ | |||
initial_settings = np.seterr() # remove when shapely updated to more recent geos | |||
|
|||
|
|||
def break_line_(line, other_line): | |||
def break_line_(line, other_line, snap_tol = 0.1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def break_line_(line, other_line, snap_tol = 0.1): | |
def break_line_(line, other_line, snap_tol): |
Let's not assume a default value, we can let the program crash if this is called without a value
docs/_toc.yml
Outdated
@@ -46,6 +46,7 @@ parts: | |||
- file: photonics/examples/refinement.py | |||
- file: electronics/examples/capacitor.py | |||
- file: electronics/examples/coax_cable.py | |||
- file: electronics\examples\RF CPW transmission line tutorial\RF CPW transmission line tutorial.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more thing I noticed after checking out the branch: I would avoid whitespace in directory and filenames. Could we use underscores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
Looks great, the example runs great for me! The only remaining comment I have is that the packages |
Yeah, putting them under docs sounds good! Pint doesn't need any further integration into femwell, right? Then it would be perfect to just have it in the docs to show that it works. About enlighten: Up to now I used always tqdm. It's maintained a lot, but being able to print output while showing a progress bar sounds just great. So probably best would be to just put the two packages and tqdm all in |
Ah and two extra things:
|
(And you should add the email address you use for commiting to your github account, that way your commits get linked properly) |
Thank you so much for the comments. I'm not experienced with git (and github) so if you feel anything is missing, please let me know. As for the double emails, you're right, that was my bad. I did a push from the bash and another from vscode, each with different users. When I realized it was too late. |
I'd guess the only thing missing is putting the dependencies in the |
Yes, and @duarte-jfs could also add themselves to the README as a contributor :) |
Really sorry but just noticed I forgot to correct the name on the _toc.yml. I can create another pull request if it's easier for you EDIT: nevermind, just saw the fix. Thank you |
No problem :) First of all, the page looks just amazing! I'll read it in detail and then provide more feedback :) Some things I think we should work on:
Should we maybe start a tracking issue where we discuss those things and split them in smaller PRs (as this one is already merged) And again, nice notebook! I'll give it a more detailed read :) |
Thank you so much!! I'm happy that is clear and hopefully it will help people down the line. Indeed, I think there is quite some room for improvement. I will open an issue for the tutorial and reply to those points so that we can keep track of it all. |
Follow up from #150 (comment)