Group Abstract Group Abstract

Message Boards Message Boards

0
|
19.5K Views
|
9 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Solving Laplace Equation using Finite Elements

Posted 11 years ago
Attachments:
POSTED BY: Rene Samson
9 Replies
Posted 11 years ago

Dear Craig, In the attachment please find my "working solution" for the Laplace eqn in a spherical shell domain. I put "working solution" in quotation marks because obviously this isn't yet a correct solution. I suspect that I have to refine the boundary mesh to get a decent solution and I didn't have the time to do that yet, but at least the error messages I was getting in the earlier Mathematica release which told me - basically - that the programme failed to set up a mesh in the shell domain, have disappeared, and I do get a solution to the NDSolve-command. Progress ..., but still some work left to be done. I hope you find this useful. (René Samson).

Attachments:
POSTED BY: Rene Samson
Posted 11 years ago

It seems that this problem has been solved in the most recent release of Mathematica (10.0.2). The mesh generation which failed before in the shell region between two concentric balls now seems to work fine. I am happy that this problem has been solved and look forward to start working with this tool. (René Samson).

POSTED BY: Rene Samson

In contrast to the case with two concentric Balls which generate the errors when executing ToElementMesh on the RegionDifference, using Cuboids does not generate the error:

Needs["NDSolve`FEM`"]; 

inner = 10;
outer = 20;

c1 = Cuboid[{-inner, -inner, -inner}, {inner, inner, inner}];

c2 = Cuboid[{-outer, -outer, -outer}, {outer, outer, outer}];

\[CapitalOmega] = RegionDifference[c2, c1];

RegionPlot3D[\[CapitalOmega], PlotStyle -> Opacity[.5]] 

mesh = ToElementMesh[\[CapitalOmega], MaxCellMeasure -> {"Volume" -> 1}]; 

The generation of the mesh is time consuming and especially so as the "Volume" is decreased. One can see that the number of mesh elements in this case is already quite significant:

In[54]:= mesh

Out[54]= ElementMesh[{{-20., 20.}, {-20., 20.}, {-20., 
   20.}}, {TetrahedronElement["<" 106250 ">"]}]

All of this suggests a bug in the Ball case....

I also encountered Udo's bug (http://community.wolfram.com/groups/-/m/t/357364) when exploring plots of the above RegionPlot3D.

POSTED BY: David Reiss

It has to do with the ToElementMesh[] function

In[1]:= Needs["NDSolve`FEM`"]

In[2]:= Clear[\[CapitalOmega]]
\[CapitalOmega] = ImplicitRegion[2 <= (x^2 + y^2 + z^2) <= 4, {x, y, z}]

Out[3]= ImplicitRegion[2 <= x^2 + y^2 + z^2 <= 4, {x, y, z}]

In[4]:= mesh = ToElementMesh[\[CapitalOmega], MaxCellMeasure -> 0.01];
During evaluation of In[4]:= ToElementMesh::fememib: The input has or generated an intersecting boundary and cannot be processed. >>
During evaluation of In[4]:= ToElementMesh::femtemnm: A mesh could not be generated. >>

this function has interesting options,

In[5]:= Options[ToElementMesh]

Out[5]= {"BoundaryMarkerFunction" -> None, 
 "BoundaryMeshGenerator" -> Automatic, 
 "CheckIncidentsCompletness" -> True, "CheckIntersections" -> True, 
 "CheckQuality" -> Automatic, "DeleteDuplicateCoordinates" -> True, 
 "ElementMeshGenerator" -> Automatic, 
 "ImproveBoundaryPosition" -> Automatic, "IncludePoints" -> {}, 
 "MaxBoundaryCellMeasure" -> Automatic, "MeshElementBlocks" -> 1, 
 "MeshElementConstraint" -> Automatic, "MeshElementType" -> Automatic,
  "MeshOrder" -> Automatic, "MessageHead" -> Automatic, 
 "NodeReordering" -> Automatic, "PointMarkerFunction" -> None, 
 "RegionHoles" -> Automatic, "RegionMarker" -> None, 
 "SteinerPoints" -> Automatic, AccuracyGoal -> Automatic, 
 MaxCellMeasure -> Automatic, MeshQualityGoal -> Automatic, 
 MeshRefinementFunction -> None, PrecisionGoal -> Automatic, 
 PerformanceGoal :> $PerformanceGoal}

some of them, like RegionHoles are still undocumented. Nevertheless, the solid ball works in 3D out of the box

solid ball 3D

only the result has to be understood.

POSTED BY: Udo Krause

FEM is used to have as much as possible flexibility about the regions, the region is triangulated and the basic tiles (triangles, tetrahedra, ...) do usually not preserve any symmetry of the original problem: they are by refinement procedures fitted to the region; let's do it for the shell in 3D (see notebook), it ends in an

During evaluation of In[49]:= NDSolveValue::fememib: The input has or generated an intersecting boundary and cannot be processed. >>
During evaluation of In[49]:= NDSolveValue::femtemnm: A mesh could not be generated. >>

that did not work. The intersecting boundary is again some artefact. But it works in 2D

variable DirichletCondidion 2D

Attachments:
POSTED BY: Udo Krause
Posted 11 years ago

Dear Dr. Krause,

Thanks a great deal for your reaction.

To explain better what I did and why I did it: I am a relative newcomer to Mathematica and this is the first time I tried to use the 3D-PDE module of Mathematica. I tried my hand on this problem because: 1. the domain is finite so that it lends itself to a Finite Element treatment; 2. the solution is a very simple analytical expression. It's nice to have a check on the Mathematica outcome.

To stay on the safe side I tried - as much as possible - to copy code I read in the Mathematica documentation on this subject (http://reference.wolfram.com/language/FEMDocumentation/tutorial/SolvingPDEwithFEM.html). I agree with you that there's nothing implicit in my first line of code. I also tried the region definition without the ImplicitRegion statement; e.g. as a RegionDifference between a Ball of radius 100 and a Ball of radius 1. That didn't help, unfortunately: I got the same error message.

I will try out your suggestion to do everything consistently in Cartesian coordinates although it "feels" very weird to do that in a geometry that so obviously has spherical symmetry. I will let you know whether that works.

Thanks, René Samson

POSTED BY: Rene Samson
POSTED BY: Udo Krause

Dear Rene, Would you be able to post your code of a working solution of the Laplace equation in the spherical shell domain? I would find that useful. Kind regards, WCC

POSTED BY: W. Craig Carter
Posted 11 years ago
Attachments:
POSTED BY: Rene Samson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard