Comment 2 for bug 785244

Revision history for this message
Martin Sandve Alnæs (martinal) wrote : Re: [Bug 785244] Re: Spatial coordinates in form are scaled by 2/3 in 2D

Written on the bus and untested:

mesh = UnitSquare(30,30)
V = FunctionSpace(mesh, "CG", 1)
y = project(triangle.x[0], V)
print y.vector().max() # should be 1.0, is 0.67

Martin
Den 19. mai 2011 18.10 skrev "Garth Wells" <email address hidden>
følgende:
> This test is a bit cryptic. Can you make it easy for us and explain what
> the expected result is (and how to check it), and what the actual result
> is (and how to check it).
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/785244
>
> Title:
> Spatial coordinates in form are scaled by 2/3 in 2D
>
> Status in DOLFIN:
> New
>
> Bug description:
> Here's a program that plots y=x, y=2x, y=3x in 1D and 2D, giving
> correct plots in 1D but scaled by 2/3 in 2D:
>
>
> from dolfin import *
>
> n = 30
> factor = 1.0
>
> #cell = interval
> cell = triangle
>
> d = cell.d
> if d == 1:
> mesh = UnitInterval(n)
> elif d == 2:
> mesh = UnitSquare(n, n)
> #factor = 3.0/2.0 # Enable this to adjust for bug and get correct plots
>
> # Asserting that x indeed goes from 0 to 1
> assert mesh.coordinates()[:].max() == 1.0
> assert mesh.coordinates()[:].min() == 0.0
>
> # Hack for bug in ffc, fix proposed for merging into dev branch
> x = cell.x if d == 1 else cell.x[0]
>
> V = FunctionSpace(mesh, "CG", 1)
>
> for k in range(1, 4):
> u = factor*k*x
> print str(u)
> uh = project(u, V)
> plot(uh, vmin=-1.0, vmax=1.0)
>
> interactive()
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/dolfin/+bug/785244/+subscribe