How to specify a variable coefficient tensor
Hi
I'd like to specify a variable coefficient tensor, but not in the ufl form file. A snippet of the ufl form file is:
==
D = TensorConstant(
....
a = u*v*dx + dt*theta*inner( D*grad(u), grad(v) )*dx
L = u_old*v*dx - dt*(1-theta) * inner( D*grad(u_old), grad(v) )*dx + dt*theta*f*v*dx
==
D is a 2x2 tensor which I construct from main.cpp in a subclass of expression. So, I have:
class VariableCoeffic
public:
....
void eval(Array<double>& values, const Array<double>& x) const {
...
values[0] = some_value;
values[1] = some_value_too
};
int main()
{
...
VariableCo
a.D = D;
...
}
==
When I execute the program, I get:
terminate called after throwing an instance of 'std::runtime_
what(): *** Error: Invalid value rank for coefficient 0, got 0 but expecting 2. Did you forget to specify the value rank correctly in an Expression sub class?
What's the correct way to go about this?
Thanks
Jack
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Garth Wells
- Solved:
- Last query:
- Last reply: