This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Mesh generation refined at polygon

0 votes

I need a function to be defined as piecewise constant, and its support needs to be quite accurate for my computations.

As a simple example, consider as a domain the unit disk $\mathbb{D}$ and consider a ball $B_r$, then I would like to have something like $u = C_1$ on $B_r$ and $u = C_2$ on $\mathbb{D}\setminus B_r$.

I am aware that it is possible to refine mesh in Fenics, however this is NOT what I am looking for, since it would result in a very fine mesh at the inclusion (and I do not want it to slow down my computations).

In mshr, it is easy to define a hole in a domain, say

dom = Circle(Point(0,0),1)
ball = Circle(center,radius)
geometry = dom - ball

However I have not been able to force the mesh generation to use the boundary of the ball for

geometry = dom + ball

since the ball is already inside the domain. It seems like if you have:

dom = Circle(Point(0,0),1)
ball1 = Circle(center,radius-1e-2)
ball2 = Circle(center,radius+1e-2)
geometry = dom - ball2 + ball1

then you can get something close to what I seek, which is refined near the boundary of the ball inclusion. But somehow I need to repair the hole in the domain between ball1 and ball2, so is there some way to collapse vertices that are close to one another?

asked Mar 2, 2015 by hgar FEniCS Novice (770 points)
...