Good morning!
I have the following linear form defined:
V = FunctionSpace(mesh, "DG", 1)
W = MixedFunctionSpace([DG]*n)
...
L = ... # some terms
L += 1/sqrt(4*PI)*Sigma_a[0]*ac*T**4*(Cv/(Cv + dt*Sigma_a[0]*4*ac*T**3))*v[0]*dx
Where:
- ac and Cv are some constants,
- v[0] is my first test function
- T is a function in V
- Sigma is defined as:
class MyXS_a(Expression):
def eval(self, value, x):
value[0] = ...
def value_shape(self):
return (1,)
Sigma_a = MyXS_a()
The code thus written runs but the results are wrong.
However, if I simply change the place of the first Sigma_a[0] term, namely if I replace:
L += 1/sqrt(4*PI)*Sigma_a[0]*ac*T**4*(Cv/(Cv + dt*Sigma_a[0]*4*ac*T**3))*v[0]*dx
with:
L += 1/sqrt(4*PI)*ac*T**4*(Cv/(Cv + dt*Sigma_a[0]*4*ac*T**3))*Sigma_a[0]*v[0]*dx
it works... Does it make any sense? In my more complicated code, it is really annoying because depending on where I add this Sigma_a[0] term, I get completely different answers...
I looked at the manual but it does not seem to mention any rules for the ordering of the terms of the forms.
Does anyone know what the problem with the first expression is?
Thanks a lot!
Vincent