CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   u.del v notation in openfoam (https://www.cfd-online.com/Forums/openfoam-programming-development/72144-u-del-v-notation-openfoam.html)

suniljain January 27, 2010 04:53

u.del v notation in openfoam
 
hi,
how to write u . del v
or u dot del v in openfoam language for solver modification . here u and v are both vector.
please help me.

pedromiglopes November 6, 2014 08:54

Hi Sunil,

Have you found the answer for your question?

Best regards,
Pedro

wyldckat November 9, 2014 06:05

Greetings to all!

I'm not familiar with the operator "del". What exactly is it?

Can you provide the expression in LaTeX form (explained here: http://www.cfd-online.com/Forums/sit...ne-forums.html ) or an image of the equation?

Best regards,
Bruno

pedromiglopes November 10, 2014 05:54

Hi Bruno,

I supose that the word "del" means the "nabla" \nabla.
At least this is what makes more sense i.e. (\vec u \cdot \nabla) \vec u.

Do you know how to solve this term in OpenFOAM?

Kind regards,
Obrigado,

Pedro

wyldckat November 10, 2014 16:25

Hi Pedro,

:eek: So it is! I found this today by chance on Wikipedia and everything: http://en.wikipedia.org/wiki/Del - weird name they gave it... the first thing that comes to mind is always that it would be a deletion operator, which doesn't make much sense :(

I don't have enough time right now (this week for that matter :(), so the best I can do is suggest that you study the OpenFOAM Programmer's Guide, which is mentioned here: http://openfoamwiki.net/index.php/Ma...rGuideAddendum
It has a lot of information on this topic and that wiki page has already a few fixes for said document.

In addition, this comes to mind: http://openfoamwiki.net/index.php/ScalarTransportFoam

Good luck! Best regards,
Bruno

pedromiglopes November 10, 2014 18:08

Hi Bruno, thank you for the tips provided!

After some investigation I think I found the answer. Please correct me if I'm wrong.

(\vec u \cdot \nabla) \vec u = \nabla (\vec u \cdot \vec u)/2 - \vec u \times ( \nabla \times \vec u)
Font: http://pt.wikipedia.org/wiki/Nabla#Identidades (Just the Portuguese version of Wikipedia has this explanation)

which in OpenFOAM can be solved as:

(\vec u \cdot \nabla) \vec u = fvc::grad(U&U)/2 - (U^(fvc::curl(U)))

The compilation works at least. Let's wait for the results.

Regards,
Pedro

wyldckat November 16, 2014 17:45

Hi Pedro,

Looks good to me! Although the "2" should probably be "2.0", to avoid any accidental intermediate conversions of the calculations in between to integer values. In other words:
Code:

fvc::grad(U&U)/2.0 - (U^(fvc::curl(U)))
In Wikipedia in English, it's provided here: http://en.wikipedia.org/wiki/Vector_...or_dot_product - but it's in another format:
Quote:

As a special case, when A = B,
\frac{1}{2} \nabla \left( \mathbf{A}\cdot\mathbf{A} \right)
= \mathbf{J}^\mathrm{T}_\mathbf{A} \mathbf A
= (\mathbf{A} \cdot \nabla) \mathbf{A} + \mathbf{A} \times (\nabla \times \mathbf{A})
Best regards,
Bruno

danny123 July 6, 2015 05:58

Hello,

Is there any answer to the original question? I think it is related to the convective term in UEqn.

In interFoam, we have the annotation:

Code:

fvm::div(rhoPhi, U)
which is (I guess):

\triangledown \cdot \left ( \rho \varphi U \right ) = \triangledown \cdot\left ( \rho \varphi \right ) U + \rho \varphi \cdot \triangledown U

The 1st product RHS term can be further split off:

\triangledown \cdot\left ( \rho \varphi \right ) = \rho \triangledown \cdot\left (  \varphi \right ) + \varphi \cdot \triangledown\rho

So, we get 2 so called directional derivatives. (Note:

\triangledown \cdot\left (  \varphi \right ) = 0

, so one term can be removed)

How can we implement this into OpenFoam? I see a potential advantage that U is present both as linear value and derivation, which potentially is faster in integration than just as a gradient.

Regards,

Daniel

ssss July 6, 2015 06:36

Quote:

Originally Posted by danny123
Hello,

Is there any answer to the original question? I think it is related to the convective term in UEqn.

In interFoam, we have the annotation:

Code:
fvm::div(rhoPhi, U)
which is (I guess):

\triangledown \cdot \left ( \rho \varphi U \right ) = \triangledown \cdot\left ( \rho \varphi \right ) U + \rho \varphi \cdot \triangledown U

The 1st product RHS term can be further split off:

\triangledown \cdot\left ( \rho \varphi \right ) = \rho \triangledown \cdot\left ( \varphi \right ) + \varphi \cdot \triangledown\rho

So, we get 2 so called directional derivatives. (Note:

\triangledown \cdot\left ( \varphi \right ) = 0

, so one term can be removed)

How can we implement this into OpenFoam? I see a potential advantage that U is present both as linear value and derivation, which potentially is faster in integration than just as a gradient.

Regards,

Daniel

In finite volume methods it is not necessary to apply the chain rule as you are trying to do. FVM works with the integral form of the transport equation an thus the term you are trying to discretise is the following:

\int_V \nabla \cdot (\rho \phi \vec{u} ) dV = \int_S (\rho \phi)_f \vec{u}_f  \cdot dS \simeq \sum_f (\rho \phi)_f \vec{u}_f \cdot \vec{S}_f

As you can see there is no need to split the divergence term with the chain rule. Although your approximation might be true in the differential form of the momentum equation, one must bare in mind that we are working with the weak form of the equation. Your approximation might also work, but numerically it might introduce instabilities because of the large gradients of the density in the interphase.

danny123 July 6, 2015 07:59

Well,

I know how it is implemented right now. Nevertheless, there may be some benefit in describing the term differently. The original question was how to describe directional derivatives as I understand. If you apply this on the momentum equation, as an example, this may be useful or not. I want to try it out. The reason is that the U field is calculated as if it is a linear function in the momentum equation. The rho phi field contains the quadatic term and must be iterated separatly. This works only if both pEqn and the phi interpolation converge. So, I see the advantage of a potentially faster and more stable iteration.

The other point is that the above decribed formulation means that the momnetum equation is split of into a term due to the concentration gradient, the divergence of the flux and the gradient in U. If you remove the divergence of the flux term, you might get a more independent momentum equation (less influenced by the volumetric balance).

So, is there a way to describe directional derivatives in OpenFoam or not? I did not find anything of that kind in the user guide.

Regards,

Daniel

danny123 July 7, 2015 03:03

It seems that there is no such thing in OpenFoam as
Code:

fvm::grad
, at least nothing within the official version. There is one in the extend version, I understand. I did not find if there is something like
Code:

&fvm::grad
or
Code:

&fvc::grad
which would be a possible way to formulate a directional derivative.

There is another area where this could be useful that is viscosity as function of shear rate.

Regards,

Daniel

wyldckat July 19, 2015 14:35

Greetings to all!

@Daniel: I've taken a somewhat quick look at your questions and I'm having trouble understanding what is the exact problem!?
I ask this because I'm not seeing what is the exact problem of writing the chain expression as explicit equation terms in OpenFOAM's C++ terminology?

Best regards,
Bruno

danny123 July 20, 2015 04:54

Hello Bruno,

The explicit expressions are largely covered by OpenFOAM, even though I do not think that directional derivatives are. Or do you know that they are?

The implicit schemes are largely limited to fvm::div what I have seen so far. This is a pity since I could imagine that convergence is better if some other fvm schemes would be available.

The original question starts ( I have to guess) with the dyad product. My understanding is that the the momentum eq. contains such a dyad product U U. If you apply the divergence of a dyad product, and apply the product rule you get a directional derivative.

Maybe look at this: http://planetmath.org/nablaactingonproducts

So, I think this is not available within OpenFoam. But you may confirm. Or you think it is anyway a bad idea.

Regards,

Daniel

wyldckat July 25, 2015 16:42

Hi Daniel,

Well, for better or for worse, this is getting way over my head... possibly because it's the weekend and my brain isn't at full throttle :)

From what I know, "dyad" operators are not available in OpenFOAM. Beyond that, my guess is that this approach you're referring to will increase the complexity of the equation to be solved, with little benefit in the results.

Unfortunately I don't have time to test any of this :(.
You can try contacting the OpenFOAM Foundation directly, or proposing this idea at the bug tracker as a possible feature, since they are the experts on this.
Beyond this, I vaguely remember seeing that other approaches into multiphase solvers have been talked about in OpenFOAM workshops... you can also check how the multiphase Euler approaches are implemented in OpenFOAM, since those usually require a lot more complex equations... at least from what I briefly remember...

Best regards,
Bruno

danny123 July 31, 2015 06:14

Thanks Bruno,

You are right that there is likely little benefit in this. My original intent was to correct my equations since div(phi) seems never to go down below a certain barrier, around 10^-8. So, I though substracting a div(phi) term or more implicit formulation may help to get the error down.

Now, I have found there is another issue. This is really a tricky one, but I think this is the fundamental problem. I would appreciate your help. See

http://www.cfd-online.com/Forums/ope...auf-p_rgh.html

Have a nice weekend.

Regards,

Daniel


All times are GMT -4. The time now is 00:12.