Guest User

Untitled

a guest
Oct 24th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. << NDSolve`FEM`
  2.  
  3. λ = 0.53; k0 = 2 π/λ; R = λ;
  4.  
  5. mesh = ToElementMesh[FullRegion[2], {{0, R}, {0, R}},
  6. "MaxCellMeasure" -> 0.0005];
  7.  
  8. mesh["Wireframe"]
  9.  
  10. op =
  11. Most[Curl[Curl[{u[x, y], v[x, y], 0}, {x, y, z}], {x, y, z}] -
  12. k0^2 {u[x, y], v[x, y], 0}]
  13.  
  14. pde = op == {0, 0};
  15.  
  16. Subscript[Γ, D] =
  17. DirichletCondition[{u[x, y] == 0., v[x, y] == Exp[I k0 x]}, True];
  18.  
  19. {us, vs} =
  20. NDSolveValue[{pde, Subscript[Γ, D]}, {u, v}, {x, y} ∈ mesh]
  21.  
  22. DensityPlot[Re[vs[x, y]], {x, y} ∈ mesh,
  23. ColorFunction -> "Rainbow",
  24. PlotLegends -> Automatic,
  25. PlotPoints -> 50,
  26. PlotRange -> All]
Add Comment
Please, Sign In to add comment