# Convection Term

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

June 4, 2013, 10:25
Convection Term
#1
New Member

Join Date: Mar 2012
Posts: 18
Rep Power: 5
Hello Foamers,
I have modified the solver MRFInterFoam to solve the population balance equation via the Quadratic method of Moments.
Now I would like to add the convection term (see attached file)
m is a scalarField
c1 and c2 are constants (scalars)

First I tried this Equation, but I understand, that I can't calculate "scalar - tensor".
Code:
```fvScalarMatrix mEqn
(
+c2
);```
So I tried this Equation (found in a paper) and add c2 later on.
Code:
```fvScalarMatrix mEqn
(
fvm::div(phi, m)
- fvm::laplacian(c1, m)
);```
Does this Equation computes the Equation given in the attachment?

Attached Images
 convection.png (15.0 KB, 14 views)

 June 5, 2013, 18:49 #2 New Member   Thomas Boucheres Join Date: May 2013 Posts: 12 Rep Power: 4 Hi, yes it is better. Don't forget to add the temporal derivative and the source term. Look at applications/solvers/basic/scalarTransportFoam.

 June 6, 2013, 10:05 #3 New Member   Join Date: Mar 2012 Posts: 18 Rep Power: 5 Thank you Thomas. Do you mean something like that? Code: ```solve ( fvm::ddt(m) + fvm::div(phi, m) - fvm::laplacian(c1, m) +c2 );```

 June 6, 2013, 16:52 #4 New Member   Thomas Boucheres Join Date: May 2013 Posts: 12 Rep Power: 4 Ok for the time derivative. For the source term, it is not good. Ok, I assume your "c2" is a fixed variable. This way, you have 2 possibility: 1- use solve ( fvm::ddt(m) + fvm::div(phi, m) - fvm::laplacian(c1, m) == fvm::Su(c2f,m) ); ...where c2f can be declared after the m variable as follows: DimensionedField c2f ( IOobject ( "c2f", m.time().timeName(), m.mesh(), IOobject::NO_READ, IOobject::NO_WRITE ), m.mesh(), dimensionedScalar("c2f",m.dimensions()/dimTime,c2) ); 2- cleaner approach by using the fvOptions framework. Needs to write: solve ( fvm::ddt(m) + fvm::div(phi, m) - fvm::laplacian(c1, m) == fvOptions(m) ); In this approach, you need to define in the right way the fvOptions file located in the system file. Look at the tutorials to find the syntax you need. N.B : if c2 is not a fixed variable, the first approach is probably the simpler for first try (you could use the second one in combinaison of the codedFunctionObject)

 June 18, 2013, 08:02 #5 New Member   Join Date: Mar 2012 Posts: 18 Rep Power: 5 Thank you thomas its working

 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 Cyp OpenFOAM Programming & Development 8 June 12, 2012 09:36 Ryan, Lee FLUENT 4 October 18, 2004 10:20 Maciej Matyka Main CFD Forum 3 October 7, 2004 04:32 nicolas FLUENT 0 December 10, 2003 08:34 Richard Phoenics 4 March 19, 2001 04:10

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