← Back to team overview

fenics team mailing list archive

Re: Problems with Example Script

 

Hi Johannes,
I had missed that.
Just for the record, the snippet at the end of the email now works as it
is supposed to.
Last question about the example script: did anyone find a more
up-to-date version of the tutorial you can download at

http://www.fenics.org/pub/documents/fenics/tutorial/fenics-tutorial.pdf  ?

Cheers

Lorenzo



##########################################################

from dolfin import *
# Create mesh and define function space
mesh = UnitSquare(6, 4)
V = FunctionSpace(mesh, "CG", 1)
# Define boundary conditions
u0 = Expression("1 + x[0]*x[0] + 2*x[1]*x[1]")

class Boundary(SubDomain): # define the Dirichlet boundary
    def inside(self, x, on_boundary):
        return on_boundary

u0_boundary = Boundary()
bc = DirichletBC(V, u0, u0_boundary)
# Define variational problem
v = TestFunction(V)
u = TrialFunction(V)
f = Constant( -6.0)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
# Compute solution
problem = VariationalProblem(a, L, bc)
u = problem.solve()
# Plot solution and mesh
plot(u)
plot(mesh)
# Dump solution to file in VTK format
file = File("poisson.pvd")
file << u
# Hold plot
interactive()


On Mon, 2010-06-28 at 13:21 +0200, Johannes Ring wrote:
> Hi Lorenzo,
> 
> On Mon, Jun 28, 2010 at 12:39 PM, Lorenzo Isella
> <lorenzo.isella@xxxxxxxxx> wrote:
> > Apologies for the tremendous delay but I have been unwell.
> > After a fresh installation of ubuntu 10.04 and fenics, I still have
> > troubles in running the script.
> > Any suggestions?
> 
> Did you try what Johan was suggesting? You will also need to remove
> the "mesh" argument from the call to Constant in line 15.
> 
> Johannes





Follow ups

References