I define the metric tensor as a sum of a constant metric tenor plus another 2-tensor, upon which I minimize. How do I do that?
I tried the following code:
TFS = fem.VectorFunctionSpace(domain, ("CG", 1),dim=2)
q = fem.Function(TFS)
g0=fem.Constant(domain, ScalarType((((1,0)), (0,1))))
gbar=g0+q
but I get the error
Can’t add expressions with different shapes.
Then, I would like to write the elastic tensor using the metric \bar{g}, namely A^{\alpha\beta\gamma\delta}=\frac{nu Y}{1-\nu^2}\left[\bar{g}^{\alpha\beta}\bar{g}^{\gamma\delta}+\frac{1-\nu}{2\nu}\left(\bar{g}^{\alpha\gamma}\bar{g}^{\beta\delta}+\bar{g}^{\alpha\delta}\bar{g}^{\beta\gamma}\right)\right]
and using is, define the energy which I would like to minimize:
E=\frac{1}{2}A^{\alpha\beta\gamma\delta}\epsilon^{\alpha\beta}\left(u\right)\epsilon^{\gamma\delta}\left(u\right)-\frac{1}{2}A^{\alpha\beta\gamma\delta}\epsilon^{\alpha\beta}\left(u\right)q^{\gamma\delta}\left(u\right)+\frac{1}{8}A^{\alpha\beta\gamma\delta}q^{\alpha\beta}q^{\gamma\delta}
where \epsilon\left(u\right) is defined as
def epsilon(u):
return sym(grad(u))
How should I define A and E?