- **OpenFOAM**
(*https://www.cfd-online.com/Forums/openfoam/*)

- - **How to add a summison term in the source code**
(*https://www.cfd-online.com/Forums/openfoam/81814-how-add-summison-term-source-code.html*)

How to add a summison term in the source codeHi,
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 |

if a and b are vectors you can use the inner product operator
look at page 18 and 23 of the programmer's guide. |

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 |

1 Attachment(s)
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. |

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 |

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. |

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. |

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