Guest User

Untitled

a guest
Nov 20th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. Needs["NDSolve`FEM`"]
  2.  
  3. mesh = ToElementMesh[
  4. "Coordinates" -> {{1.293, 0.228}, {1., 0.}, {0.94, 0.342}, {1.293,
  5. 0.}, {1.215, 0.442}, {2., 0.}, {1.879, 0.684}},
  6. "MeshElements" -> {TriangleElement[{{1, 3, 2}, {1, 2, 4}, {1, 4,
  7. 6}, {1, 6, 7}, {1, 7, 5}, {1, 5, 3}}, {66, 66, 66, 44, 44,
  8. 44}]},
  9. "BoundaryElements" -> {LineElement[{{3, 2}, {1, 3}, {2, 4}, {4,
  10. 6}, {6, 1}, {6, 7}, {7, 5}, {5, 3}}, {11, 22, 33, 33, 22, 44,
  11. 55, 55}]},
  12. "PointElements" -> {PointElement[{{1}, {2}, {3}, {4}, {5}, {6},
  13. {7}}, {1, 2, 2, 3, 3, 4, 4}]}]
  14.  
  15. Show[mesh["Wireframe"],
  16. mesh["Wireframe"["MeshElement" -> "PointElements",
  17. "MeshElementIDStyle" -> Brown]]]
  18.  
  19. Show[
  20. mesh["Wireframe"],
  21. mesh["Wireframe"["MeshElementMarkerStyle" -> Blue]],
  22. mesh["Wireframe"["MeshElement" -> "BoundaryElements",
  23. "MeshElementMarkerStyle" -> Red]],
  24. mesh["Wireframe"["MeshElement" -> "PointElements",
  25. "MeshElementMarkerStyle" -> Brown]]
  26. ]
  27.  
  28. ufun = NDSolveValue[{Laplacian[u[x, y], {x, y}] ==
  29. If[ElementMarker == 44, 10, 1] +
  30. NeumannValue[-1, ElementMarker == 44],
  31. DirichletCondition[u[x, y] == 0, ElementMarker == 1]},
  32. u, {x, y} [Element] mesh]
  33.  
  34. Plot3D[ufun[x, y], {x, y} [Element] mesh]
Add Comment
Please, Sign In to add comment