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

different methods in hooking source terms

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 27, 2011, 10:17
Default different methods in hooking source terms
  #1
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Hi FOMERs,

I have a question about different method of hooking source terms which cause different solutions.
Would you please explain these methods:

Code:
1)     tmp<fvVectorMatrix> UEqn
    (
			fvm::ddt(U)
		 + fvm::div(phi, U)
		 - fvm::laplacian(nu, U)
		 == -source
    );

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

2)    tmp<fvVectorMatrix> UEqn
    (
			fvm::ddt(U)
		 + fvm::div(phi, U)
		 - fvm::laplacian(nu, U)
		 +source
    );

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

3)    tmp<fvVectorMatrix> UEqn
    (
			fvm::ddt(U)
		 + fvm::div(phi, U)
		 - fvm::laplacian(nu, U)
    );

    solve
    (
        UEqn() == -fvc::grad(p) - source
    )
Amir is offline   Reply With Quote

Old   July 27, 2011, 16:18
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
They all should be equivalent. Are you getting different solutions?

Wait... the solve function should always be receiving the same fvVectorMatrix... but it's what happens afterwards that may be different. In 1 and 2, the object UEqn already includes source, but in 3, it doesn't. So if you are later using UEqn, keep this in mind. In all examples above, UEqn doesn't include the pressure gradient. But solve is always seeing the same thing, so what you have written there should not show any difference.
marupio is offline   Reply With Quote

Old   July 28, 2011, 01:07
Default
  #3
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by marupio View Post
They all should be equivalent. Are you getting different solutions?

Wait... the solve function should always be receiving the same fvVectorMatrix... but it's what happens afterwards that may be different. In 1 and 2, the object UEqn already includes source, but in 3, it doesn't. So if you are later using UEqn, keep this in mind. In all examples above, UEqn doesn't include the pressure gradient. But solve is always seeing the same thing, so what you have written there should not show any difference.
Thanks David,

I checked that in many cases, and it can be shown that in method 3 different solution is achieved, but methods 1 & 2 seems to be equivalent!
As you said,the only difference is that in methods 1 & 2, source term is included in UEqn., but in the 3rd one, it's included in pEqn.!
Amir is offline   Reply With Quote

Old   July 28, 2011, 09:27
Default
  #4
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
The differences would take place later in the code. Is the UEqn object ever used again below the point you've quoted? #3 differs from the rest of the options above because the UEqn object it produces is different.
marupio is offline   Reply With Quote

Old   July 28, 2011, 09:37
Default
  #5
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Shiraz, Iran
Posts: 739
Blog Entries: 1
Rep Power: 14
Amir is on a distinguished road
Quote:
Originally Posted by marupio View Post
The differences would take place later in the code. Is the UEqn object ever used again below the point you've quoted? #3 differs from the rest of the options above because the UEqn object it produces is different.
No, UEqn. is used once in each of them. I'm not sure but may be manipulating source terms in UEqn and pEqn. is totally different.
Amir 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
Source Terms in Star-CCM+ mk_mat CD-adapco 2 March 13, 2012 09:14
Source Terms in momentum Balance vidyaraja FLUENT 0 May 25, 2009 13:16
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
Source Terms Sas Main CFD Forum 5 November 24, 2006 04:40


All times are GMT -4. The time now is 13:47.