How to code the Brinkman-Forchheimer equation

Hello everyone!
I’m tring to solve the Brinkman-Forchheimer equations.
But I do not know how to code this term \int_{\Omega }| \vec{u}_{h} |^{p-2} \vec{u}_{h} \cdot \vec{v}_{h} dx, \vec{u}_{h}, \vec{v}_{h} \in BDM .
where p=3,4, |\vec{u}_{h}| = \sqrt{\vec{u}_{1}^2 + \vec{u}_{2}^2} .

Did anyone code a similar problem before?

See, e.g. Form language — Unified Form Language (UFL) 2021.1.0 documentation

1 Like

Thanks nate.
I could code it like this inner( pow(cof, 3.0/2.0) * u, v) *dx for p=3 .
But cof = u_{1}^2 + u_{2}^2. I don’t know how to get each component of u.

sqrt(dot(u,u)) or simply sqrt(u[0]**2+u[1]**2)

1 Like