Message Boards Message Boards

GROUPS:

NDSolve laplacian equation on meshed boundary?

Posted 24 days ago
138 Views
|
1 Reply
|
2 Total Likes
|

Dear Friends, I trying to solve a simple Laplacian equation on a "bit complex" Geometry using FEM. But i m getting a messege the the aeria is not correctly defind in the NDSolve function.. i still not finding the problem. Here is the Code:

ClearAll["Global`*"]
Needs["NDSolve`FEM`"]

mesh0 = ToBoundaryMesh[
   "Coordinates" -> {{0., 0.}, {8., 0.}, {8. + 0.15 Sqrt[2], 
      0.15 Sqrt[2]}, {10. + 0.15 Sqrt[2], 
      0.15 Sqrt[2]}, {10. + 0.3 Sqrt[2], 0}, {18., 
      0.}, {18., -2.}, {9.5 + 0.1 Sqrt[2], -2}, {9.5 + 
       0.1 Sqrt[2], -1.}, {9.3 + 0.1 Sqrt[2], -1.}, {9.3 + 
       0.1 Sqrt[2], -6.}, {8.7 + 0.1 Sqrt[2], -6}, {8.7 + 
       0.1 Sqrt[2], -1}, {8.5 + 0.1 Sqrt[2], -1}, {8.5 + 
       0.1 Sqrt[2], -2}, {0, -2}},
   "BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 
        5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}, {10, 11}, {11, 
        12}, {12, 13}, {13, 14}, {14, 15}, {15, 16}, {16, 1}}]}
   ];
bmesh0["Wireframe"]

mesh0 = ToElementMesh[bmesh0, MaxCellMeasure -> .04, 
   MeshQualityGoal -> 0]["Wireframe"]
bc0 = DirichletCondition[u[x, y] == 0, y == -6];
sol0 = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 
     NeumannValue[-1, y == 0.15 Sqrt[2]], bc0}, 
   u, {x, y} \[Element] mesh0];

Thank you very much, if you can help, berlin

You have typos in your code and you assigned your mesh0 to a wireframe. I believe the following will correct your current problem.

ClearAll["Global`*"]
Needs["NDSolve`FEM`"]

bmesh0 = ToBoundaryMesh[
   "Coordinates" -> {{0., 0.}, {8., 0.}, {8. + 0.15 Sqrt[2], 
      0.15 Sqrt[2]}, {10. + 0.15 Sqrt[2], 
      0.15 Sqrt[2]}, {10. + 0.3 Sqrt[2], 0}, {18., 
      0.}, {18., -2.}, {9.5 + 0.1 Sqrt[2], -2}, {9.5 + 
       0.1 Sqrt[2], -1.}, {9.3 + 0.1 Sqrt[2], -1.}, {9.3 + 
       0.1 Sqrt[2], -6.}, {8.7 + 0.1 Sqrt[2], -6}, {8.7 + 
       0.1 Sqrt[2], -1}, {8.5 + 0.1 Sqrt[2], -1}, {8.5 + 
       0.1 Sqrt[2], -2}, {0, -2}}, 
   "BoundaryElements" -> {LineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 
        5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}, {10, 11}, {11, 
        12}, {12, 13}, {13, 14}, {14, 15}, {15, 16}, {16, 1}}]}];
bmesh0["Wireframe"]

mesh0 = ToElementMesh[bmesh0, MaxCellMeasure -> .04, 
  MeshQualityGoal -> 0]
mesh0["Wireframe"]
bc0 = DirichletCondition[u[x, y] == 0, y == -6];
sol0 = NDSolveValue[{Laplacian[u[x, y], {x, y}] == 
     NeumannValue[-1, y == 0.15 Sqrt[2]], bc0}, 
   u, {x, y} \[Element] mesh0];
Plot3D[sol0[x, y], {x, y} \[Element] mesh0]

enter image description here

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