dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22521
Re: [Question #152076]: Initial Concition for vector valued function
Question #152076 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/152076
Status: Answered => Open
Melanie Jahny is still having a problem:
Sorry, I just wanted to keep the question text brief.
The code is
mesh = Rectangle(0,0,150,0.29, 750, 20)
mesh.order()
# Define function spaces (P2-P1)
V = VectorFunctionSpace(mesh, "CG", 2)
W = FunctionSpace(mesh, "CG", 1)
# combined Function Space
VW = V*W
(u,p) = TrialFunctions(VW)
class InitialConditions(Expression):
def __init__(self):
random.seed(2 + MPI.process_number())
def eval(self, values, x):
values[0] = 0.02
values[1] = 0.02
def value_shape(self):
return (2,)
I tried now to use a Function for Interpolation:
u_init = InitialConditions()
u_test = Function(V)
u_test.interpolate(u_init)
I get an error message in eval. It works if I change the eval function
in the InitalConditions class:
def eval(self, values, x):
values[0] = 0.02
But if I do this, are the two components of the vector valued function
initialized?
And I've got another question:
Can I define the solution of a differential equation as a Function instead of
a TrialFunction?
Can I use u_test now as the solution function?
What is the difference?
Thanks for your help!!!
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.
Follow ups