Hi
in my simulations, I find myself computing the cross product of two vectors that both change at every time step repeatedly.
See here a minimal example of how I compute the cross product:
import dolfin as df
mesh = df.UnitIntervalMesh(2)
V = df.VectorFunctionSpace(mesh, "CG", 1, dim=3)
a = df.Function(V)
b = df.Function(V)
c = df.Function(V)
a.assign(df.Constant((1, 0, 0)))
b.assign(df.Constant((0, 1, 0)))
# compute a x b and write result into c
# something like this would be done very often in the simulation
df.assemble(df.dot(df.cross(a, b), df.TestFunction(V)) * df.dP,
tensor=c.vector())
print c.vector().array()
Is there any way I can avoid the cost of the assembly at every time step?
Kind regards and many thanks