### How to implement the following projection of a gradient to reduce spurious on Level Set Method?

130

views

0

Hi folks,

I am new here and I would like some help, if it is possible, to implement the following problem.

Assuming \( \nabla \phi^{n+1} \equiv \vec{\psi}^{n+1} \), where \(\vec{\psi} \) has higher order elements than \( \nabla \phi \) and \(\phi\) is a known function.

\( \int_{\Omega} \vec{v}\cdot \vec{\psi}^{n+1} + \mu \nabla \vec{v}\cdot \nabla \vec{\psi}^{n+1} d\Omega \) = \( \int_{\Omega} \vec{v}\cdot \nabla \phi^{n+1}d\Omega \)

where \( \mu = 0.0005h\) (\( h\) is the mesh size) is a filter parameter and \(\vec{v}\) is a piecewise vector-evaluated test function.

Thanks for your time!
You are right in everything (it is redundant) and I made corrections in my post as well. The problem here is the following: the function \(\phi\) is known and the approach in my post is one way to calculate the gradient of \(\phi\), I mean \(\vec{\psi}\), in order reduce errors.

If you have any idea about how I can implement this Fenics, it would be really helpful. Thanks for your time any way!

I am new here and I would like some help, if it is possible, to implement the following problem.

Assuming \( \nabla \phi^{n+1} \equiv \vec{\psi}^{n+1} \), where \(\vec{\psi} \) has higher order elements than \( \nabla \phi \) and \(\phi\) is a known function.

\( \int_{\Omega} \vec{v}\cdot \vec{\psi}^{n+1} + \mu \nabla \vec{v}\cdot \nabla \vec{\psi}^{n+1} d\Omega \) = \( \int_{\Omega} \vec{v}\cdot \nabla \phi^{n+1}d\Omega \)

where \( \mu = 0.0005h\) (\( h\) is the mesh size) is a filter parameter and \(\vec{v}\) is a piecewise vector-evaluated test function.

Thanks for your time!

Community: FEniCS Project

If you have any idea about how I can implement this Fenics, it would be really helpful. Thanks for your time any way!

written
11 weeks ago by
Cassia

### 1 Answer

0

You can specify higher-order function spaces for the projection of gradients and the like via the syntax

```
V = VectorFunctionSpace(mesh, 'CG', 2)
grad_u = project(grad(u), V)
```

Read the docs regarding project function:

https://fenicsproject.org/olddocs/dolfin/2016.2.0/python/programmers-reference/fem/projection/project.html?highlight=project#project

In my case this is true when \(\mu=0\).

I am sorry, but is this make sense?

I am sorry, but is this make sense?

`Grad_u = project(grad(u),v)+mu*project(grad(u),grad(v))`

written
11 weeks ago by
Cassia

1

No, that doesn't make sense... I suggest you test these ideas with a terminal such as Ipython.

I am not entirely certain what you want to do, but note that you can add extra terms like

I am not entirely certain what you want to do, but note that you can add extra terms like

`grad_u = project(grad(u) + extra_vector_math, V)`

where *extra_vector_math* is an expression with terms defined on arbitrary function spaces.
written
11 weeks ago by
pf4d

Please login to add an answer/comment or follow this question.

\[

\nabla \vec{v} \cdot \nabla \vec{\psi}

\]

which is a matrix! Perhaps you mean to use the inner product

\[

\nabla \vec{v} : \nabla \vec{\psi}

\]

?

Finally, if \(\phi\) is the unknown, what exactly is the purpose of using \(\psi\)? This appears redundant. Perhaps restate the problem in strong form.