← Back to team overview

dolfin team mailing list archive

Plot a constant Expression with different values in the x and y directions

 

Hi,

I have difficulties with plotting a constant function in dolfin version
0.9.4. I can do it in version 0.9.3, but need it to work in 0.9.4 too.

The problem is that I have different values in the x and y directions, 0
and 9.82 respectively.

The code is as follows:

------------

mesh = Mesh("circle.xml.gz")

# Define function space
V = VectorFunctionSpace(mesh, "CG", 1)
W = FunctionSpace(mesh, "CG", 1)

# I have tried with two different definitions of the function, but don't
know which one is correct:

# Expression for acceleration force
class Acceleration(Expression):
    def eval(self, value, x):
        value[0] = 0.0
        value[1] = -9.82 # 1g acceleration downwards

f = Acceleration(V=W)

g = Constant(mesh,(0, 9.82)) # I can plot g in dolfin version 0.9.3 and
it works correctly there

-----------------------------------------

Do the Constant definition of g also work in dolfin version 0.9.4 even
if I can't plot it?

Anna
-- 
This message was sent from Launchpad by the user
Anna Blechingberg (https://launchpad.net/~anna-blechingberg)
using the "Contact this team" link on the DOLFIN Team team page.
For more information see
https://help.launchpad.net/YourAccount/ContactingPeople



Follow ups