Hi everyone! I need to write a code for solving p-Poisson equation:
\begin{cases}
\int_{\Omega} |\nabla u|^{p-2} \langle \nabla u, \nabla v \rangle d\Omega = \int_{\Omega} fv \: d\Omega \quad \forall v \in W_0^{1,p}(\Omega), \\
u\big|_{\partial \Omega} \equiv 0
\end{cases}
for arbitrary p > 1, where for my purposes f = w^{p-1} is the exponent of some element w beloning to my finite-element space. For my purposes I also need to calculate L^p- and W_0^{1,p}-norms:
||u||_{L^p}^p \colon= \int_{\Omega}|u|^p d\Omega, \quad ||u||_{W_0^{1,p}}^p \colon = \int_{\Omega} |\nabla u|^p d\Omega
(it seems like in-build norm calculation functions like fem.norms.norm
are not designed for p \ne 2?)
Having literally no experience with FEniCS, I don’t quite get how it deals with both integration and functions composition. My first guess was to define norms as functions like
def Lp(u):
return float((abs(u)**p) * dx)
def Wp(u):
return float((fem.norms.norm(grad(f))**p) * dx)
but this expectedly leads to different typization errors. I also don’t understand what Form
and Measure
data types are and how one operates them. Do I need to define something like dx = Measure('dx',domain=mesh)
if I need to integrate outside of solvers? Can I work with functions of the form w^{p-1}, |w| directly or there must be a more complicated way to define such things? I would be grateful for any help
Thank you
P.S. Yeah, I figured out I just needed to use assemble
to make integrals out of Form
s.