Message Boards Message Boards

Avoid this issue with ToElementMesh in MMA 11.3?

This program work finewithe Mathematica 11.2, but not with Mathematica 11.3. Why ?

(*Equation reaction diffusion temporelle *)
ClearAll["Global`*"]
Needs["NDSolve`FEM`"]
parisradius = 0.3;
parisdiffusionvalue = 150;
carto = DiscretizeGraphics[
   CountryData["France", {"Polygon", "Mercator"}] /. 
    Polygon[x : {{{_, _} ..} ..}] :> Polygon /@ x];
paris = First@
   GeoGridPosition[
    GeoPosition[
     CityData[Entity["City", {"Paris", "IleDeFrance", "France"}]][
      "Coordinates"]], "Mercator"];
bmesh = ToBoundaryMesh[carto, AccuracyGoal -> 1, 
   "IncludePoints" -> CirclePoints[paris, parisradius, 50]];
mesh = ToElementMesh[bmesh, MaxCellMeasure -> 0.05, 
   "MeshOrder" -> 0.1];
mesh["Wireframe"];
op = \!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x, y]\)\) - \!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[t, x, y]\)\) + 
   1.2*u[t, x, y] - 20;

usol = NDSolveValue[{op == 1, 
   DirichletCondition[u[t, x, y] == 0, Norm[{x, y} - paris] > .6], 
   DirichletCondition[u[t, x, y] == parisdiffusionvalue, 
    Norm[{x, y} - paris] < .6], u[0, x, y] == 100}, 
  u, {t, 0, 20}, {x, y} \[Element] mesh]

frames = Table[
   Plot3D[usol[t, x, y], {x, y} \[Element] usol["ElementMesh"], 
    PlotRange -> {0, 160}], {t, 0, 20, 2}];
ListAnimate[frames, SaveDefinitions -> True]
frames = Table[
   ContourPlot[usol[t, x, y], {x, y} \[Element] usol["ElementMesh"], 
    PlotRange -> {0, 160}], {t, 0, 20, 2}];
ListAnimate[frames, SaveDefinitions -> True]

II receive this information :

ToElementMesh::femimq: The element mesh has insufficient quality of -359.763. A quality estimate below 0. may be caused by a wrong ordering of element incidents or self-intersecting elements.

NDSolveValue::femnr: {x,y}\[Element]ImproveBoundaryPosition[<<1>>,NumericalRegion[None,{{-4.79537,9.56036},{45.5126,59.623}}]] is not a valid region specification.

Thanks for your help A. Dauphine

POSTED BY: André Dauphiné
2 Replies

Dear Professor Dauphine,

I could not figure that one out, but had help from the Wolfram's technical support, which I would like to share with you. If you change the respective line in your code to:

mesh = ToElementMesh[bmesh, MaxCellMeasure -> 0.05, MeshQualityGoal -> 0];

the program will run without error message in MMA11.3.

So:

ClearAll["Global`*"]
Needs["NDSolve`FEM`"]
parisradius = 0.3;
parisdiffusionvalue = 150;
carto = DiscretizeGraphics[
      CountryData["France", {"Polygon", "Mercator"}] /. 
        Polygon[x : {{{_, _} ..} ..}] :> Polygon /@ x];
paris = First@
      GeoGridPosition[
        GeoPosition[
          CityData[Entity["City", {"Paris", "IleDeFrance", "France"}]][
            "Coordinates"]], "Mercator"];
bmesh = ToBoundaryMesh[carto, AccuracyGoal -> 1, 
      "IncludePoints" -> CirclePoints[paris, parisradius, 50]];
mesh = ToElementMesh[bmesh, MaxCellMeasure -> 0.05, 
   MeshQualityGoal -> 0];
mesh["Wireframe"];
op = \!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(u[t, x, y]\)\) - \!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(u[t, x, y]\)\) + 
      1.2*u[t, x, y] - 20;

usol = NDSolveValue[{op == 1, 
      DirichletCondition[u[t, x, y] == 0, 
    Norm[{x, y} - paris] > .6], 
      DirichletCondition[u[t, x, y] == parisdiffusionvalue, 
        Norm[{x, y} - paris] < .6], u[0, x, y] == 100}, 
    u, {t, 0, 20}, {x, y} \[Element] mesh]

frames = Table[
      Plot3D[usol[t, x, y], {x, y} \[Element] usol["ElementMesh"], 
        PlotRange -> {0, 160}], {t, 0, 20, 2}];
ListAnimate[frames, SaveDefinitions -> True]
frames = Table[
      ContourPlot[
    usol[t, x, y], {x, y} \[Element] usol["ElementMesh"], 
        PlotRange -> {0, 160}], {t, 0, 20, 2}];
ListAnimate[frames, SaveDefinitions -> True]

should do the trick.

enter image description here

As a side note, the technical support was outstanding. I used the chat interface and was directed to developers who suggested a fix very quickly.

Best wishes from Aberdeen,

Marco

POSTED BY: Marco Thiel

Thanks very much André From Nice

POSTED BY: André Dauphiné
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract