# Adding linear generation in InterFOAM

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 10, 2013, 22:51 Adding linear generation in InterFOAM #1 Member   Luca Giannelli Join Date: Jun 2010 Location: Kobe, Japan Posts: 58 Rep Power: 9 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): 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 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

June 11, 2013, 04:05
#2
Senior Member

Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,267
Rep Power: 23
Quote:
 Originally Posted by voingiappone 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): 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 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:
__________________
*Spend as much time formulating your questions as you expect people to spend on their answer.

June 12, 2013, 21:30
#3
Member

Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 9
Quote:
 Originally Posted by akidess Would this be feasable:
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.

 June 13, 2013, 04:14 #4 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,267 Rep Power: 23 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.

June 13, 2013, 04:40
#5
Member

Luca Giannelli
Join Date: Jun 2010
Location: Kobe, Japan
Posts: 58
Rep Power: 9
Quote:
 Originally Posted by akidess 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!

June 13, 2013, 04:50
#6
Senior Member

Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,267
Rep Power: 23
Quote:
 Originally Posted by voingiappone 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
__________________
*Spend as much time formulating your questions as you expect people to spend on their answer.

 June 13, 2013, 04:54 #7 Member   Luca Giannelli Join Date: Jun 2010 Location: Kobe, Japan Posts: 58 Rep Power: 9 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!

 June 13, 2013, 05:12 #8 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,267 Rep Power: 23 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.

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

 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 immortality OpenFOAM Running, Solving & CFD 13 April 20, 2014 06:32 immortality OpenFOAM Pre-Processing 11 August 21, 2013 08:45 immortality OpenFOAM Running, Solving & CFD 3 January 25, 2013 20:10 immortality OpenFOAM Running, Solving & CFD 15 January 16, 2013 14:06 subash OpenFOAM 0 May 29, 2010 01:23

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

 Contact Us - CFD Online - Privacy Statement - Top