
[Sponsors] 
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: 7 
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: 7 
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: 7 
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. 

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: 7 
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:
Quote:
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  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF source term  Rajani Kanth.B  Fluent UDF and Scheme Programming  4  May 1, 2013 09:31 
Add time dependent Source term  libe  OpenFOAM Running, Solving & CFD  13  September 23, 2010 09:12 
DxFoam reader update  hjasak  OpenFOAM PostProcessing  69  April 24, 2008 01:24 
Please help me run UDF code for source  Suga  FLUENT  1  February 3, 2006 04:40 
Add a source term into the Y mom. eq.  Rucy  FLUENT  0  December 12, 2005 05:24 