scalemesh.py 610 B

12345678910111213141516171819202122232425
  1. """Scale a mesh asymmetrically in one coordinate"""
  2. from dolfin import *
  3. from mshr import *
  4. domain = Rectangle(Point(0.0, 0.0), Point(5.0, 0.01))
  5. mesh = generate_mesh(domain, 20)
  6. V = FunctionSpace(mesh, "CG", 2)
  7. e = Expression("sin(2*pi*(x[0]*x[0]+x[1]*x[1]))", degree=2)
  8. f = interpolate(e, V)
  9. ####################################################
  10. from vedo.dolfin import plot
  11. plt = plot(
  12. f,
  13. xtitle="y-coord is scaled by factor 100",
  14. scale_mesh_factors=(0.01, 1, 1),
  15. style=1,
  16. lw=0,
  17. warp_zfactor=0.001,
  18. scalarbar="horizontal",
  19. axes={"xtitle_offset": 0.2},
  20. text=__doc__,
  21. )