CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Adding U*U as a source term

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 30, 2010, 16:45
Default Adding U*U as a source term
  #1
New Member
 
Ozgur Kirlangic
Join Date: May 2009
Location: Istanbul
Posts: 16
Rep Power: 8
ozgur is on a distinguished road
Hi Foamers,

I am trying to solve the following equation:

dU/dt = grad(p) - 0.5*(f/L)*(U*U)

here, U(velocity vector), p (pressure), and L is length, (f is dimensionless scalar).

In fact, I made an attempt and it seems working for 1D .. However, I can not be very sure about the approach that I use (especially for 2D and 3D problems), and I need some comments from more experienced people.

I constructed my equations as follows:

Code:
        ...

        vector identity(1,1,1);

        ...
    
        volVectorField gradp = fvc::grad(p);

        ...

        fvVectorMatrix UEqn
        (
         	fvm::ddt(U) + fvm::Sp((U & identity)/2*(1/L+f/D), U)
        );

        ...

        solve(UEqn == -fvc::grad(p));

        ...
The reason that I am not sure is about the term "U*U" in the original equation. Since U is a vector, U*U will produce a matrix, and therefore it was not possible to write "U*U" as it is to the code as a source term.

Instead, assuming that only the i component of the vectors will be used while solving Ux, I wrote "U & identity" to obtain the value of the x component of U and put it in to the first parameter place of Sp function.

This works for 1D but I cannot be sure about my assumption about the behavior of U & identity expression in 2D and 3D problems..

In short, say that U(1, 2, 3) then will "U & identity" produce 1+2+3=6 in ALL Ux, Uy and Uz solutions OR will it produce 1 in Ux solution, 2 in Uy solution and 3 in Uz solution??

Kind regards,

Ozgur
ozgur is offline   Reply With Quote

Old   August 31, 2010, 11:05
Default
  #2
New Member
 
Ozgur Kirlangic
Join Date: May 2009
Location: Istanbul
Posts: 16
Rep Power: 8
ozgur is on a distinguished road
Hi,

PS: The above is not a realistic CFD problem, but I am just playing a little with the code so to get some understanding...

Anyway, I think I got the answer of my question by constructing a 2D case. And, I saw that unfortunately (in fact fortunately) my assumption was wrong, i.e. use of "U & identity" produced Ux+Uy+Uz.

So, in this problem, what is needed is something like scale(U,U) function, which gives the product of corresponding components of vectors U and U; so it will produce another vector (not a matrix which only the main diagonal is useful).

I couldn't still make scale(U,U) work. But asked about it under another title.

Ozgur
ozgur is offline   Reply With Quote

Old   July 20, 2011, 11:22
Default
  #3
New Member
 
Amin
Join Date: Oct 2010
Location: Notre Dame, US
Posts: 6
Rep Power: 6
AcfdO is on a distinguished road
scale(U,U) doesn't work and unfortunately it has not been updated in programmers guide. You should use cmptMultiply(U,U) instead.
AcfdO is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
momentum source term zwdi FLUENT 13 December 5, 2013 18:58
Adding volumetric Source Term mohanamuraly OpenFOAM 0 May 17, 2009 22:00
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Adding a momentum source term segersson OpenFOAM Running, Solving & CFD 5 March 3, 2006 00:06


All times are GMT -4. The time now is 08:51.