# How to add a summison term in the source code

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

 LinkBack Thread Tools Display Modes
 November 8, 2010, 01:03 How to add a summison term in the source code #1 Senior Member   Nakul Join Date: Apr 2010 Location: India Posts: 147 Rep Power: 8 Hi, I want to add a term like: Σaibi; i=1,2,...,n to a solver's governing equations. Is there any inbuilt function in openfoam that can be used to sum the individual terms I don't think I can use for loop to add the terms because the values of these parameters are obtained simultaneoulsy by the solution of the governing equations. Any help would be appreciated!! Thanx

 November 8, 2010, 05:28 #2 Senior Member   Steven van Haren Join Date: Aug 2010 Location: The Netherlands Posts: 149 Rep Power: 8 if a and b are vectors you can use the inner product operator look at page 18 and 23 of the programmer's guide.

 November 8, 2010, 08:00 #3 New Member   Patricia Join Date: Oct 2010 Posts: 22 Rep Power: 7 I am not sure if I understand your question correctly. If both the ai and bi are part of your solution vector and you solve an equation including a*b on the left hand side (like M(a,b)+a*b=c), this is a nonlinear equation. Linearize the equation and you will be able to add the linearized expression for a*b as a source term. Patricia

November 9, 2010, 01:38
#4
Senior Member

Nakul
Join Date: Apr 2010
Location: India
Posts: 147
Rep Power: 8
Hi Patricia,

To be more specific I want to code the energy equation for combustion. The energy equation is in the form, shown in the attached screenshot.

The "summision" term that I want to code is the equ. (1. 48) in the screenshot. And this energy equation needs to be solved simultaneously with continuity, momentum and species equations.

So my question is how can I code this term in the OpenFOAM's source code?
I would be adding this term to the energy equation of rhoCentralFoam.
Attached Images
 Screenshot.jpg (43.5 KB, 37 views)

 November 9, 2010, 04:56 #5 New Member   Patricia Join Date: Oct 2010 Posts: 22 Rep Power: 7 Hi Nakul, unfortunately the screenshot is still not a complete description of the problem. Maybe you can start coding a solver using similar principles as in the existing OpenFoam solvers. Then describe where your solver fails, and people will be able to assist. If you want to solve for all variables simultaneously, you have to wait until OpenFoam supports block matrices, and even then you have to linearize the problem. But I don't see why you'd need block matrices. Why not start with a loop summing over the species instead of giving up before you have tried? Patricia

 November 9, 2010, 05:17 #6 Senior Member   Nakul Join Date: Apr 2010 Location: India Posts: 147 Rep Power: 8 Hi Patricia, Actually I was just mentioning the equation, that I want to code, in the screenshot. The problem is that I am unaware of the correct way to code that summision term in the solver. All I want to know is that, .if there is some way to add such summision terms. I don't think that for loop is a correct option because at every time step the values of Yk, ie, the species mass fraction is unkown. They are the variables that are being solved for. So adding them using a loop might not generate any result.

November 9, 2010, 06:36
#7
New Member

Patricia
Join Date: Oct 2010
Posts: 22
Rep Power: 7
Quote:
 Originally Posted by nakul Actually I was just mentioning the equation, that I want to code, in the screenshot.
Yes, but an equation is not a problem description.

Quote:
 Originally Posted by nakul I don't think that for loop is a correct option because at every time step the values of Yk, ie, the species mass fraction is unkown. They are the variables that are being solved for.
I think you should try things out before you think they don't work. Many of the existing solvers show how to solve for variables that are needed simultaneously. Most of them use the segregrated approach which I think will work for you as well. If you don't want to spend any time by yourself, there are companies behind OpenFoam who can do the work for you (no, I am not affiliated to any).

I am out of this discussion. Good luck!

Patricia

Edit: You cannot solve for the Yk from equation 1.48. You need at least N additional equations (transport equations with reaction kinetics?) to get a well posed problem.

Last edited by schmittp54; November 9, 2010 at 07:06.

 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 Rajani Kanth.B Fluent UDF and Scheme Programming 4 May 1, 2013 09:31 libe OpenFOAM Running, Solving & CFD 13 September 23, 2010 09:12 hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24 Suga FLUENT 1 February 3, 2006 04:40 Rucy FLUENT 0 December 12, 2005 05:24

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

 Contact Us - CFD Online - Top