Hi, all
Can I pass more parameters to the refinement_func other than tri_points and area ? For example, I want to pass a Nx2 points array to a dedicated refinement function, and calling matplotlib.path.Path to decide whether a center (x,y) of an element is contained within that polygon.
Best regards.
Benyuan
--
I hack, I build, I re-invent :)
Thanks Aravind!!
I solved the regional constrains using your method ! but I need to modify the triangle.py code to make both 'volume_constraints' and 'max_volume' work.
in meshpy/triangle, line 155, why "cannot specify both volume_constraints and max_volume" ? in the triangle command manual, we can specify both -a and -a%f , once with a max area constrain and once without. so the following codes works fine!
if volume_constraints:
opts += "a"
if max_volume:
opts += "a%.20f" % max_volume
#raise ValueError("cannot specify both volume_constraints and max_area")
elif max_volume:
opts += "a%.20f" % max_volume
Benyuan,
You could use region attributes and regional volume constraints to do 1 and 2 respectively. Check out the box-in-box.py example in the MeshPy examples folder.
I assume that you want to generate just a single mesh with varying mesh sizes. If you want to dynamically do it (say for adaptive mesh refinement) or want fine-grained control, you need to use the refinement function approach (test_triangle_refine.py in MeshPy examples).
On Mon Dec 08 2014 at 2:15:52 AM liubenyuan <byliu(a)fmmu.edu.cn> wrote:
Hi, all,
Suppose a sub-region is enclosed within a shape, and the conductivity within this subregion is more important than the rest. For example in the attachment (triangle-ex4.py), a square is embedded in a circle, and we want to refine the triangles within the square and also near the boundaries of the square.
The questions are,
1. Can I get an 'element_markers' alike attributes that indicate whether an element is within this sub-region or nor ?
2. How could I refine within this sub-region as well as the places near the boundary of this sub-region ?
Thanks all in advance :)
benyuan
--
I hack, I build, I re-invent :)
_______________________________________________
MeshPy mailing list
MeshPy(a)tiker.net
http://lists.tiker.net/listinfo/meshpy
--
I hack, I build, I re-invent :)
Hi, all,
Suppose a sub-region is enclosed within a shape, and the conductivity within this subregion is more important than the rest. For example in the attachment (triangle-ex4.py), a square is embedded in a circle, and we want to refine the triangles within the square and also near the boundaries of the square.
The questions are,
1. Can I get an 'element_markers' alike attributes that indicate whether an element is within this sub-region or nor ?
2. How could I refine within this sub-region as well as the places near the boundary of this sub-region ?
Thanks all in advance :)
benyuan
--
I hack, I build, I re-invent :)
I will try the regional constrains.
i.e., the variable 'points' in this function. I had to specify a list of points before calling this function.
def needs_refinement_square(tri_points, area):
# you need to set the enclosing facet before refining
polygon = Path(points)
center_tri = np.sum(np.array(tri_points), axis=0)/3.
if area>0.1:
return True
elif (area > 0.05) and psquare.contains_point(center_tri):
return True
else:
return False
Sounds like this can be solved using regional volume contraints, which I mentioned in your other post. If not, could you clarify what exactly you'd like to do, perhaps with a few lines of code?
Aravind
On Mon Dec 08 2014 at 3:06:22 AM liubenyuan <byliu(a)fmmu.edu.cn> wrote:
Hi, all
Can I pass more parameters to the refinement_func other than tri_points and area ? For example, I want to pass a Nx2 points array to a dedicated refinement function, and calling matplotlib.path.Path to decide whether a center (x,y) of an element is contained within that polygon.
Best regards.
Benyuan
--
I hack, I build, I re-invent :)
_______________________________________________
MeshPy mailing list
MeshPy(a)tiker.net
http://lists.tiker.net/listinfo/meshpy
--
I hack, I build, I re-invent :)
Thanks, Alwan. It did solve the problem :)
-----原始邮件-----
发件人: "Aravind Alwan" <aravindalwan(a)gmail.com>
发送时间: 2014/12/4 4:15
收件人: "liubenyuan" <byliu(a)fmmu.edu.cn>; "meshpy(a)tiker.net" <meshpy(a)tiker.net>
主题: Re: [MeshPy] generate appropriate point_markers in range [0, 1, 2] and more
The set_facets method takes an additional optional argument: a list of
facet markers. This will automatically mark the boundary points with a
facet marker (corresponding to the facet that they are a part of), while
interior points will be marked as 0.
Aravind
On Wed Dec 03 2014 at 10:17:24 AM liubenyuan <byliu(a)fmmu.edu.cn> wrote:
> Hi, all
>
> The attachment is a demo in generating the cross-section of co-axial
> square transmission line, however the default point_markers from
> mesh.point_markers are only sequances of [1,0], where 1 denotes the
> boundary (both inner transmission line and outter) and 0 denotes the
> internal nodes. Is there any method in calling meshpy, that can generate
> meaningful point_markers in range [0,1,2], 1 for nodes on the inner, 2 for
> nodes on the outter, and 0 for internal nodes ?
>
> Best wishes!
>
> Benyuan Liu
> @fmmu
>
>
>
> --
> I hack, I build, I re-invent :)
>
>
>
>
> _______________________________________________
> MeshPy mailing list
> MeshPy(a)tiker.net
> http://lists.tiker.net/listinfo/meshpy
>
Hi, all
The attachment is a demo in generating the cross-section of co-axial square transmission line, however the default point_markers from mesh.point_markers are only sequances of [1,0], where 1 denotes the boundary (both inner transmission line and outter) and 0 denotes the internal nodes. Is there any method in calling meshpy, that can generate meaningful point_markers in range [0,1,2], 1 for nodes on the inner, 2 for nodes on the outter, and 0 for internal nodes ?
Best wishes!
Benyuan Liu
@fmmu
--
I hack, I build, I re-invent :)