On 26 Jan 2020, at 10:59, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
So then, it is (ii) below, the one option without integration by parts.
(ii) 2 int du/dx dv/dx dx
Which is the reason why it worked.
It may be useful to add the word "weak" in the description of "derivative", and also maybe my silly example, for clarity? I deduced it from the outcome but missed it (somehow) in the description?
I am lecturing next week so I am seeking clarity, anticipating the possible questions, and hope to promote Firedrake.
Thank you.
--Onno
From: Cotter, Colin J <colin.cotter@imperial.ac.uk>
Sent: Sunday, January 26, 2020 10:48 AM
To: Onno Bokhove <O.Bokhove@leeds.ac.uk>
Cc: firedrake <firedrake@imperial.ac.uk>
Subject: Re: [firedrake] fd.derivativeHi Onno,It is the element-wise derivative ie the usual derivative when restricted to each element. So if the FE space is continuous, that’s the usual global weak derivative.
all the bestcjc
On 26 Jan 2020, at 10:32, Onno Bokhove <O.Bokhove@leeds.ac.uk> wrote:
_______________________________________________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)
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake