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

Adding linear generation in InterFOAM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 10, 2013, 22:51
Default Adding linear generation in InterFOAM
  #1
Member
 
Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 7
voingiappone is on a distinguished road
Hello everybody,

I am trying to do something which is probably trivial but I don't find the proper formulation.
I have managed to add a tracer in my InterFOAM simulation by adding a jump condition as per this thread. Now I just want to overcome the lack of chemical reactions in the modified solver by adding a simple parameter. I can calculate an approximate generation term knowing the daily performance of my reactor (it is a bioreactor so it is really slow) and I can add it as follow (the K parameter):

\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C -\nabla K_{gen} = \nabla \cdot D C_{eq}\nabla \alpha

Let's say I have algae growing on CO2 and I want to see how its concentration decreases along the X axis only (linear reactor with negligible culture depth solved in 2D neglecting the y direction). How do I specify not to solve the \nabla K_{gen} along the z axis???

I am quite sure it's a really easy task but I don't know even what to look for.

Thank you everybody for your help

Luca
voingiappone is offline   Reply With Quote

Old   June 11, 2013, 04:05
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Quote:
Originally Posted by voingiappone View Post
Hello everybody,

I am trying to do something which is probably trivial but I don't find the proper formulation.
I have managed to add a tracer in my InterFOAM simulation by adding a jump condition as per this thread. Now I just want to overcome the lack of chemical reactions in the modified solver by adding a simple parameter. I can calculate an approximate generation term knowing the daily performance of my reactor (it is a bioreactor so it is really slow) and I can add it as follow (the K parameter):

\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C -\nabla K_{gen} = \nabla \cdot D C_{eq}\nabla \alpha

Let's say I have algae growing on CO2 and I want to see how its concentration decreases along the X axis only (linear reactor with negligible culture depth solved in 2D neglecting the y direction). How do I specify not to solve the \nabla K_{gen} along the z axis???

I am quite sure it's a really easy task but I don't know even what to look for.

Thank you everybody for your help

Luca
Would this be feasable:
\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C -\nabla K_{gen}\cdot \left(\begin{array}{c}1\\1\\0\\\end{array}
\right) = \nabla \cdot D C_{eq}\nabla \alpha
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   June 12, 2013, 21:30
Default
  #3
Member
 
Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 7
voingiappone is on a distinguished road
Quote:
Originally Posted by akidess View Post
Would this be feasable:
\frac{\partial C}{\partial t}+\nabla \cdot \phi C + \nabla\cdot D \nabla C -\nabla K_{gen}\cdot \left(\begin{array}{c}1\\1\\0\\\end{array}
\right) = \nabla \cdot D C_{eq}\nabla \alpha
Akidess, thanks for the quick reply.
Of course what you wrote is right but I don't know how to translate it in viable code. The equation I wrote in my post above is now (before additions):

Code:
fvm::ddt(C)
+ fvm::div(phi, C)
+ fvm::laplacian(DC, C)
- fvc::laplacian(DCeq, alpha1)
I am using this code on a daily base without problems. Now, I don't have any clue on how to implement that vector... So, in coding language, what should I write? Looking through the documentation I found the product between two vectors needs to be represented like [A & B], thus:

Code:
fvm::ddt(C)
+ fvm::div(phi, C)
+ fvm::laplacian(DC, C) & (1 1 0)
- fvc::laplacian(DCeq, alpha1)
Would this be correct?

Thank you.
voingiappone is offline   Reply With Quote

Old   June 13, 2013, 04:14
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Your code does not match your equation. You completely dropped grad(K)?
Code:
fvm::ddt(C)
+ fvm::div(phi, C)
+ fvm::laplacian(DC, C) 
+ fvc::grad(K) & vector(1 1 0)
- fvc::laplacian(DCeq, alpha1)
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   June 13, 2013, 04:40
Default
  #5
Member
 
Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 7
voingiappone is on a distinguished road
Quote:
Originally Posted by akidess View Post
Your code does not match your equation. You completely dropped grad(K)?
Code:
fvm::ddt(C)
+ fvm::div(phi, C)
+ fvm::laplacian(DC, C) 
+ fvc::grad(K) & vector(1 1 0)
- fvc::laplacian(DCeq, alpha1)
You're right... sorry! I just copy-pasted it from the other file (present formulation) and forgot to add the grad(K) part.
Thank you very much for your help in the proper formulation too! I will add it in the code and post the results even though I suppose it will work right out of the box.

Thank you for your kind help!
voingiappone is offline   Reply With Quote

Old   June 13, 2013, 04:50
Default
  #6
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Quote:
Originally Posted by voingiappone View Post
You're right... sorry! I just copy-pasted it from the other file (present formulation) and forgot to add the grad(K) part.
Thank you very much for your help in the proper formulation too! I will add it in the code and post the results even though I suppose it will work right out of the box.

Thank you for your kind help!
Actually, no. I just realized I forgot to add commas between the components of the vector
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   June 13, 2013, 04:54
Default
  #7
Member
 
Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 7
voingiappone is on a distinguished road
Okey dokey!

Actually I thought it was right that way.... why would you use different notations for the same vector in different part of OF (ie the source files and the boundary conditions)? Will place also the commas then!
voingiappone is offline   Reply With Quote

Old   June 13, 2013, 05:12
Default
  #8
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
In C++ you don't really have a choice - the compiler won't treat the whitespace as delimiter for the arguments (as it does with commas). Why the makers of OpenFOAM decided to go with a different syntax in the case files only they know
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   June 14, 2013, 00:47
Default
  #9
Member
 
Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 7
voingiappone is on a distinguished road
It works like a charm!!
Thank you for the hints and help

Luca
voingiappone 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
A turbulent test case for rhoCentralFoam immortality OpenFOAM Running, Solving & CFD 13 April 20, 2014 06:32
error on turbulence scheme immortality OpenFOAM Pre-Processing 11 August 21, 2013 08:45
suitable boundary condition for scavenging process? immortality OpenFOAM Running, Solving & CFD 3 January 25, 2013 20:10
how to modify fvScheme to converge? immortality OpenFOAM Running, Solving & CFD 15 January 16, 2013 14:06
solution diverges when linear upwind interpolation scheme is used subash OpenFOAM 0 May 29, 2010 01:23


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