How to ensure a line is included in the mesh? Possible source of RuntimeError: Factor is exactly singular #156
Unanswered
duarte-jfs
asked this question in
Q&A
Replies: 1 comment 4 replies
-
Did you try to put the line at highest mesh order? polygons = OrderedDict(
line = line,
box1 = box1,
box2 = box2,
box3 = box3,
background = background
) Lines should have the highest priority to not be overwritten (the boxes will still be there anyway) But even without, the line should be there outside of the two boxes with higher priority 🤔 @simbilod what do you think? Is this the fix or is there a problem with the linemerge? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to include a
LineString
with the purpose of using it for a line integral. However, that line must go through other polygons, and I am not understanding when it is included and when it is not. When it appears to be included, the modes can be computed. When it is not, then it raises an error ofRuntimeError: Factor is exactly singular
. Any clues how to solve this?Code
Running the code above with ``h=0.2` gives the error mentioned above, and when looking at the mesh superimposed with the polygons boundaries we see that the line is not included (green line):
If we now change
h=1
then the mode is computed just fine and we now see that the line is clearly included in the mesh:I'm unsure how to interpret this
EDIT
I have narrowed down the error to a precision one. The problem stems from the function
break_line_
inmesh.geometry
as it tries tosplit
a line myintersection
whenintersection.geo_type = 'Point'
via:This works in some cases and not in others. Yet the intersection is always found. For now I have fixed it through:
I'm unsure if this is the best way to do it, but it caused a significant problem in my case as I was interested in calculating a line integral but since half the line was not being meshed, the calculated integral was far lower than expected.
Beta Was this translation helpful? Give feedback.
All reactions