### 2-D function definition, getting index 1 is out of bounds for axis 0

106

views

0

class VF(Expression):

def __init__(self, c1 = 0.0, c2 = 0.0, **kwargs):

self.c1 = c1

self.c2 = c2

def eval(self, values, x):

values[0] = self.c1

values[1] = self.c2

def value_shape(self):

return (2,)

c = VF(c1 = 1.0, c2 = 1.0, element = V.ufl_element())

array = project(c, V)

def __init__(self, c1 = 0.0, c2 = 0.0, **kwargs):

self.c1 = c1

self.c2 = c2

def eval(self, values, x):

values[0] = self.c1

values[1] = self.c2

def value_shape(self):

return (2,)

c = VF(c1 = 1.0, c2 = 1.0, element = V.ufl_element())

array = project(c, V)

Community: FEniCS Project

Please login to add an answer/comment or follow this question.

`V`

as VectorFunctionSpace