CNF:Mesh Sizing for CNF data: Difference between revisions

From crtc.cs.odu.edu
Jump to navigation Jump to search
Ctsolakis (talk | contribs)
Ctsolakis (talk | contribs)
 
(7 intermediate revisions by the same user not shown)
Line 51: Line 51:
Image:Paraboloid_2d_mesh_min_10_max_1000_linear.png| min size =10, tranformation linear
Image:Paraboloid_2d_mesh_min_10_max_1000_linear.png| min size =10, tranformation linear
</gallery>
</gallery>
= Sampling-based method =
== Introduction ==
As a simpler alternative one can also use directly the input data/image values to guide the refinement of the mesh.
This approach is also more close to the specific domain since, in contrast to the CFD cases the starting point is
a finer "solution" instead of a coarser.
== Method ==
For this approach, the starting mesh is a triangulation of the bounding box of the image.
The input image is then used as a background mesh while refining the mesh.
In particular, the refinement algorithm will query a sizing function (SF) in order to
verify whether each element satisfies the user constrains.
Each time SF is called upon an element it will check if its size meets the '''global''' user constrains
and then it will create a sample of values from the background mesh by picking points that fall within the
element.
The available picking strategies include a deterministic stencil and a random sample.
For the stencil approach, SF is evaluated on element vertices, barycenter, and edge midpoints.
In the randomized strategy, SF is evaluated on a uniform random sample of points inside the triangle.
The size of the random sample is user-defined.
After a set of values, V, have been sampled (with either approach), the quantity max(V) -min(V) is evaluated and if the difference
exceeds a user-specified limit, the element is split. <ref> Traditional Delaunay methods split elements at
circumcenter to guarantee certain element quality limits. However, since in this case quality is not a concern,
a more appropriate approach that "minimizes the error" can be used. A simple approach is to pick a point between
the points that min and max value. (see also paper from Gagik) </ref>
In summary,
The constrains build in the SF of the example is below are:
* min,max size (area) of the element (user-defined).
** Elements below ''min'' are skipped
** Elememts above ''max'' are split
* if max(V)-min(V)> user_limit (where V is the sample of values from the BG image), split element


== Sampling-based ==
== Sampling-based ==
<gallery widths=450px heights=300px>
<gallery widths=450px heights=300px>
Image:NT X min 1 limit 2e-3.png|minimum size = 1, limit = 2e-3
Image:NT X min 1 limit 2e-3.png|minimum size = 1, limit = 2e-3, # elements = 8617
Image:NT X min 0.5 limit 2e-3.png|minimum size = 0.5, limit = 2e-3
Image:NT X min 0.5 limit 2e-3.png|minimum size = 0.5, limit = 2e-3,  # elements = 14451
Image:NT X min 1 limit 5e-3.png|minimum size = 1, limit = 5e-3
Image:NT X min 1 limit 5e-3.png|minimum size = 1, limit = 5e-3, # elements = 2159
</gallery>
File:NT X min 1 limit 5e-3 qual off.png | minimum size = 1, limit = 5e-3 qual off , # elements = 2102
</gallery>  


[[File:Gaussian2 min 10 limit 1e-1.png|200px|min size = 10, limit = 1e-1]]
[[File:Gaussian2 min 10 limit 1e-1.png|400px|min size = 10, limit = 1e-1]]


== 3D ==
== 3D ==
CNF Data looks like it follows exponential distribution,  
Is there a more generic way tha avoid all these complications ?, How about gradient limiting (of the sizing) <ref> http://persson.berkeley.edu/pub/persson05sizefunc.pdf </ref>? '''
 
See also Mesh  Gradation control <ref> https://www.ljll.math.upmc.fr/frey/publications/ijnme4398.pdf </ref>'''
'''How do we map exponential distribution properly to element size ? '''


''' Is there a more generic way tha avoid all these complications ?, How about gradient limiting (of the sizing) <ref> http://persson.berkeley.edu/pub/persson05sizefunc.pdf </ref>? '''
== Notes ==
''' See also Mesh  Gradation control <ref> https://www.ljll.math.upmc.fr/frey/publications/ijnme4398.pdf </ref>'''
* For higher dimensions the stencil can be extended easily:
** Evaluate BG at the "centroid" of each lower dimensional entity. For example edge midpoints in 2D, edge midpoints and face centroids in 3D, etc.
** OR Evaluate always at edge midpoints 
** Or evaluate centroid and midpoints of (vertex,centoid) edge (maybe the best, because it creates may points inside the element)
* For the randomized sampling, a [https://en.wikipedia.org/wiki/Dirichlet_distribution Dirichlet distribution] can be used with alpha = (1,1,1......)


= References =
= References =
https://userweb.jlab.org/~gavalian/articles/0203033.pdf
https://userweb.jlab.org/~gavalian/articles/0203033.pdf

Latest revision as of 17:37, 24 September 2019

Gradient-based approach for a mesh sizing

Abstract

The data we acquire from Jlab represented evaluations of a “function” on a cube. What it needed is to provide a mesh with a gradation that captures the changes of these values.

Introduction

A similar problem is solved when one refines/adapts a surface mesh with the goal of capturing the curvature of the mesh. In this situation the usual (but not unique) approach is to identify areas of high curvature by styding the deviation of neighboring normals on the surface. If the (normalized) inner product between the normals of two neighboring triangles is close to 1 there is a small angle between them and thus no need for extra refinement . On the other hand as the values of the inner products decreases the angle between the vectors increases and a finer mesh and thus more points are needed to resolve the curvature. The limit and amount of refinement are usually user defined, (see also refine [1] on refining the boundary of the mesh).

Similarly for the case in hand a method based on the local rate of change of values is used.

Gradient-based Method

1. Evaluate the gradient of the image. In the case of the CNF data a simple finite difference stencil is enough, since accuracy is not an issue. ITK has a filter for that already [2].

2. Perform some kind of preprocessing on these data. There are many options here, a literature review of gradient based sizing eg ( [3] [4] [5] ) could be usefull. For the results below the transformation is


Intuition:

2.1 “invert” the range by mapping small gradient(small rate of change) to small values and big gradient magnidute (high rate of change) to big values:

2.2 normalize by max to acquire values between 0,1 , in order to remove the notion of size and make it easier to manipulate for the mesh generator program:


2.3 Optionally use a transformation ( in this case square function) to slowdown the size increase (size x^2 < x for x in [0,1])

3. Pass this second image to the mesh generator, scale the value by the diagonal of the bounding box to bring it to input data dimensions and use it to constrain the size of the elements. Optionally support also min and max size as cut-off values.

Notes

  • In step 2.2 by nomalizing by max we also loose the “natural” sizing of the data
  • In step 2.3 the square is just a convinient transofmation but in some other case another polynomial or even other function, exp,log, tanh could be more appropriate. We can also look in the documentation of AFLR about sizing function in Boundary layer meshes ot any other sizing specific information.
  • Step 2.3 is related to the distribution of the data is they are exponential we need something(?) else

Examples

2D

(x^2 +y^2) Gradient based

Sampling-based method

Introduction

As a simpler alternative one can also use directly the input data/image values to guide the refinement of the mesh. This approach is also more close to the specific domain since, in contrast to the CFD cases the starting point is a finer "solution" instead of a coarser.

Method

For this approach, the starting mesh is a triangulation of the bounding box of the image. The input image is then used as a background mesh while refining the mesh. In particular, the refinement algorithm will query a sizing function (SF) in order to verify whether each element satisfies the user constrains.

Each time SF is called upon an element it will check if its size meets the global user constrains and then it will create a sample of values from the background mesh by picking points that fall within the element. The available picking strategies include a deterministic stencil and a random sample. For the stencil approach, SF is evaluated on element vertices, barycenter, and edge midpoints. In the randomized strategy, SF is evaluated on a uniform random sample of points inside the triangle. The size of the random sample is user-defined.

After a set of values, V, have been sampled (with either approach), the quantity max(V) -min(V) is evaluated and if the difference exceeds a user-specified limit, the element is split. [6]

In summary, The constrains build in the SF of the example is below are:

  • min,max size (area) of the element (user-defined).
    • Elements below min are skipped
    • Elememts above max are split
  • if max(V)-min(V)> user_limit (where V is the sample of values from the BG image), split element

Sampling-based

min size = 10, limit = 1e-1

3D

Is there a more generic way tha avoid all these complications ?, How about gradient limiting (of the sizing) [7]? See also Mesh Gradation control [8]

Notes

  • For higher dimensions the stencil can be extended easily:
    • Evaluate BG at the "centroid" of each lower dimensional entity. For example edge midpoints in 2D, edge midpoints and face centroids in 3D, etc.
    • OR Evaluate always at edge midpoints
    • Or evaluate centroid and midpoints of (vertex,centoid) edge (maybe the best, because it creates may points inside the element)
  • For the randomized sampling, a Dirichlet distribution can be used with alpha = (1,1,1......)

References

https://userweb.jlab.org/~gavalian/articles/0203033.pdf

  1. ↑ https://github.com/nasa/refine
  2. ↑ https://itk.org/Doxygen/html/classitk_1_1GradientMagnitudeImageFilter.html
  3. ↑ https://link.springer.com/article/10.1007/s00366-006-0014-1
  4. ↑ http://persson.berkeley.edu/pub/persson05qualmesh.pdf
  5. ↑ http://persson.berkeley.edu/pub/persson05thirdmit.pdf
  6. ↑ Traditional Delaunay methods split elements at circumcenter to guarantee certain element quality limits. However, since in this case quality is not a concern, a more appropriate approach that "minimizes the error" can be used. A simple approach is to pick a point between the points that min and max value. (see also paper from Gagik)
  7. ↑ http://persson.berkeley.edu/pub/persson05sizefunc.pdf
  8. ↑ https://www.ljll.math.upmc.fr/frey/publications/ijnme4398.pdf