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

volScalarMatrix adding and subtracting

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2019, 13:35
Default volScalarMatrix adding and subtracting
  #1
New Member
 
Filipe Dias
Join Date: Jul 2019
Posts: 6
Rep Power: 7
FilipeDias93 is on a distinguished road
Good afternoon!
I have a question about the usage of the -= command in implementing in volScalarMatrix.
For example, consider the species continuity equation:
ddt(rho)+div(rho*U)+div(J)=w

So, starting by defining the Matrix with the convective terms:
fvScalarMatrix rhoYEqn
(fvm::ddt(rhoY)+fvc::div(rho*U));

Then to add the diffusive term:
rhoYeqn+= fvc::div(J);

And, finally, the source term:
rhoYeqn-= w;

I copied this from another code, and haven't been able to find it elsewhere. The code is also fairly complex, and I can't compare the equations.

My question is this: are the signs on the diffusive and source term correct?

Thank you kindly for your help
FilipeDias93 is offline   Reply With Quote

Old   July 14, 2019, 09:34
Default
  #2
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Seems like everything is fine here. Moreover you can replace
rhoYeqn-= w;
with
rhoYeqn == w;
to state explicitly that your source tern goes to the right hand side.
Zeppo is offline   Reply With Quote

Old   July 14, 2019, 19:51
Default
  #3
New Member
 
Filipe Dias
Join Date: Jul 2019
Posts: 6
Rep Power: 7
FilipeDias93 is on a distinguished road
Thank you for your help. Is there any page with these kinds of information?
FilipeDias93 is offline   Reply With Quote

Old   July 19, 2019, 15:01
Default
  #4
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 22
Zeppo will become famous soon enough
Maybe reading the source code can help.
Zeppo is offline   Reply With Quote

Reply

Tags
openfoam 2.1.1, volscalarmatrix


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an internal heat source for compressibleTwoPhaseEulerFoam Kenna OpenFOAM Programming & Development 3 September 17, 2013 04:51


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