# different methods in hooking source terms

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

 July 27, 2011, 10:17 different methods in hooking source terms #1 Senior Member     Amir Join Date: May 2009 Location: Montreal, QC Posts: 739 Blog Entries: 1 Rep Power: 16 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 UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) == -source ); solve ( UEqn() == -fvc::grad(p) ) 2) tmp UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) +source ); solve ( UEqn() == -fvc::grad(p) ) 3) tmp UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); solve ( UEqn() == -fvc::grad(p) - source )

 July 27, 2011, 16:18 #2 Senior Member   David Gaden Join Date: Apr 2009 Location: Winnipeg, Canada Posts: 436 Rep Power: 15 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.

July 28, 2011, 01:07
#3
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 16
Quote:
 Originally Posted by marupio 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.!

 July 28, 2011, 09:27 #4 Senior Member   David Gaden Join Date: Apr 2009 Location: Winnipeg, Canada Posts: 436 Rep Power: 15 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.

July 28, 2011, 09:37
#5
Senior Member

Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 16
Quote:
 Originally Posted by marupio 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.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mk_mat Siemens 2 March 13, 2012 09:14 vidyaraja FLUENT 0 May 25, 2009 13:16 hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24 jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51 Sas Main CFD Forum 5 November 24, 2006 04:40

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