Dear Firedrakers,


When taking a Firedrake (functional/form) derivative, say the derivative of the functional int (du/dx)^2 dx (plus some bc's) is the outcome the functional derivative (i) with or (ii) without integration by parts? I.e. is it:

(ii) 2 int du/dx dv/dx dx

or

(i) -2 int d^2u/d x^2 v dx, modulo bc's, and with v = delta u?


https://www.firedrakeproject.org/firedrake.html#firedrake.ufl_expr.derivative


(I am trying to understand why the below would work, and it does, with CG1 for X, or in the above with CG1 for v and u, which only can work when no ibp is done. )


Kind regards,


Onno


PS:


 # Kinematics                # Right Cauchy-Green tensor

        if self.nonlin:

            d = self.X.geometric_dimension()

            I = fd.Identity(d)             # Identity tensor

            F = I + fd.grad(self.X)             # Deformation gradient

            C = F.T*F   

            E = (C-I)/2.               # Green-Lagrangian strain

#            E = 1./2.*( fd.grad(self.X).T + fd.grad(self.X) + fd.grad(self.X).T * fd.grad(self.X) ) # alternative equivalent definition

        else:

            E = 1./2.*( fd.grad(self.X).T + fd.grad(self.X) ) # linear strain

            

        self.W = (self.lam/2.)*(fd.tr(E))**2 + self.mu*fd.tr( E*E )

#        f = fd.Constant((0, 0, -self.g)) # body force / rho

#        T = self.surface_force()

        

        # Total potential energy

        Pi = self.W * fd.dx

        # Compute first variation of Pi (directional derivative about X in the direction of v)

        F_expr = fd.derivative(Pi, self.X, self.v)