getfem-users
[Top][All Lists]

## Re: Fast computation of a quantity

 From: Eloi Martinet Subject: Re: Fast computation of a quantity Date: Fri, 30 Sep 2022 10:01:41 +0200

Hello,
Here is what I do currently :

md = gf.Model("real")
md.add_fem_variable("phi", self.V) # Represents a basis function
md.set_variable("p", p)
md.set_variable("u", u)

for i in tqdm(range(nbdof_V)):
phi = np.zeros(self.nbdof_V)
phi[i] = 1
self.md.set_variable("phi", phi)

grad_norm[i] = (2+2*p)*gf.asm_generic(self.IM, 0, "sign(u)*pow(abs(u), 1+2*p)*phi", -1, md)

Sorry I should have included this snippet from the beginning.
Have a great day.
Best,
Eloi.

Le jeu. 29 sept. 2022 à 21:39, Konstantinos Poulios <logari81@googlemail.com> a écrit :
Hello, would you like to send us a naive implementation of your assembly with asm_generic (and a loop) to take it from there?

BR
Kostas

On Thu, Sep 29, 2022 at 6:27 PM Eloi Martinet <eloi.martinet@univ-smb.fr> wrote:
Hello everyone,
My problem is the following : I have a FE space V with basis phi_i. Let u be a function on V and f a real valued function. What is the quickest way to compute the vector (\int f(u)*phi_i)_i ? I would like to use asm_generic but I don't see how to do it without looping on i and computing it for all i, which is way too long.

Thank you, have a good day.
Best regards,
Eloi.