3
$\begingroup$

I am solving Laplace equation with particular geometry and boundary conditions:

L = 10; a = 1; k = 1/2; mesh = 0.06; BoxL = x == L || x == -L || y == L || y == -L; reg = ImplicitRegion[(-L <= x <= L && -L <= y <= L) && (x^2 + y^2 >= a^2), {x, y}]; rp = RegionPlot[reg, AspectRatio -> Automatic, ImageSize -> Tiny] 

enter image description here

Boundary condition for θ

bcθ = {DirichletCondition[u[x, y] == ArcTan[x, y] k, x^2 + y^2 == a^2], DirichletCondition[u[x, y] == 0, BoxL]}; 

Solving equation for θ

θ = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 0, bcθ}, u, {x, y} ∈ reg, Method -> {"FiniteElement", "MeshOptions" -> {MaxCellMeasure -> mesh}, "InterpolationOrder" -> {u -> 2}}]; 

And then plot:

enter image description here

Magnifying and showing the mesh:

enter image description here

There appears to be some small imperfections. Of course I have tuned the parameter mesh to minimize them, i.e., the mesh "scale" is the best I could find within this "shape".

Here comes my question: how do I define a mesh which is finer around the central circular hole (which is a boundary)? Is there a simple way without going down to draw it?

Thanks!

$\endgroup$

1 Answer 1

7
$\begingroup$

You can use "MaxBoundaryCellMeasure" for that:

L = 10; a = 1; k = 1/2; mesh = 0.06; BoxL = x == L || x == -L || y == L || y == -L; reg = ImplicitRegion[(-L <= x <= L && -L <= y <= L) && (x^2 + y^2 >= a^2), {x, y}]; bcθ = {DirichletCondition[u[x, y] == ArcTan[x, y] k, x^2 + y^2 == a^2], DirichletCondition[u[x, y] == 0, BoxL]}; θ = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 0, bcθ}, u, {x, y} ∈ reg, Method -> {"FiniteElement", "MeshOptions" -> {"MaxBoundaryCellMeasure" -> mesh}}]; Show[ContourPlot[θ[x, y], {x, y} ∈ θ["ElementMesh"], PlotRange -> All], θ["ElementMesh"]["Wireframe"], PlotRange -> {{0, 2}, {-1, 1}}] 

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.