Question #153352 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/153352
Kristian B. Ølgaard proposed the following answer: On 18 April 2011 22:10, Chaffra <question153...@answers.launchpad.net> wrote: > New question #153352 on DOLFIN: > https://answers.launchpad.net/dolfin/+question/153352 > > I don't know if it makes sense but I'd like to do: > > m = UnitInterval(11) > Q= FunctionSpace(m,'CG',1) > W = VectorFunctionSpace(m,'CG',1,dim=3) > > f = Function(Q) > df = grad(f) In 1D, this will be a scalar, so you don't need the vector space. Kristian > g = project(df,W) > > but I get the errpr below. Any help? > > Thanks, > Chaffra > > > /usr/local/lib/python2.6/dist-packages/dolfin/fem/project.py in project(v, V, > mesh, solver_type, preconditioner_type, form_compiler_parameters) > 50 Pv = TrialFunction(V) > 51 a = ufl.inner(w, Pv)*ufl.dx > ---> 52 L = ufl.inner(w, v)*ufl.dx > 53 > 54 # Assemble linear system > > > /usr/local/lib/python2.6/dist-packages/ufl/operators.pyc in inner(a, b) > 56 if a.shape() == () and b.shape() == (): > 57 return a*b > ---> 58 return Inner(a, b) > 59 #return contraction(a, range(a.rank()), b, range(b.rank())) > > 60 > > /usr/local/lib/python2.6/dist-packages/ufl/tensoralgebra.pyc in __new__(cls, > a, b) > 160 > 161 def __new__(cls, a, b): > --> 162 ufl_assert(a.shape() == b.shape(), "Shape mismatch.") > 163 if isinstance(a, Zero) or isinstance(b, Zero): > 164 free_indices, index_dimensions = merge_indices(a, b) > > /usr/local/lib/python2.6/dist-packages/ufl/assertions.pyc in > ufl_assert(condition, *message) > 18 def ufl_assert(condition, *message): > 19 "Assert that condition is true and otherwise issue an error with > given message." > ---> 20 if not condition: error(*message) > 21 > 22 > > /usr/local/lib/python2.6/dist-packages/ufl/log.pyc in error(self, *message) > 122 "Write error message and raise an exception." > 123 self._log.error(*message) > --> 124 raise UFLException(self._format_raw(*message)) > 125 > 126 def begin(self, *message): > > UFLException: Shape mismatch. > > > -- > You received this question notification because you are a member of > DOLFIN Team, which is an answer contact for DOLFIN. > > _______________________________________________ > Mailing list: https://launchpad.net/~dolfin > Post to : dolfin@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dolfin > More help : https://help.launchpad.net/ListHelp > -- You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp