|
[Sponsors] |
Creating, loop or iteration using expression edito |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 17, 2003, 06:45 |
Creating, loop or iteration using expression edito
|
#1 |
Guest
Posts: n/a
|
Hi all, I am modelling a reaction between metal and hydrogen. I have a modified arrhenius equation for determining rate of the above reaction. I am modelling the above reaction in a tricky way. The hydrogen is not reacting with metal but it is entering the domain and disappearing at the rate given by the modified arrhenius expression and this arrhenius expression takes into account the properties of the metal that I am using. Now, coming to my question.
I have a term like the following in the arrhenius expression. (1.0 - (x/1.85)) In the above expression 1.85 represents the weight percentage of total amount of hydrogen which the metal can hold (i.e., 100 gm of metal will hold 1.85gm of hydrogen). This means the reaction will end once this number is achieved (when the x=1.85 then the resultant term is 1.0 and the whole term spells out to zero and the modified arrhenius expression is zero). The reaction goes like this, at the first iteration the hydrogen enters and reacts(not really reaction but it disappears at the rate given by the rate expression which I explained above). Then x has some value, perhaps x=0.01. Then in the second iteration this x will be say again 0.01. During the beginning of the third iteration I want the x to have the value of (0.01(first iteration) + 0.01(second iteration)) 0.02 and not zero(which is the case now). Say after some number of iterations x will have the value of 1.85 and the reaction stops. But this can happen only when I succeed in adding the rate term consecutively to the x after every iteration. For this I need to do something like loop or iteration kind of thing which we do in Fortran or other programming languages. Can anyone guide me through this? Thanks in advance. Jan |
|
July 28, 2003, 00:34 |
Re: Creating, loop or iteration using expression e
|
#2 |
Guest
Posts: n/a
|
Jan,
You should use an additional variable. Robin |
|
July 28, 2003, 05:53 |
Re: Creating, loop or iteration using expression e
|
#3 |
Guest
Posts: n/a
|
Hello Robin, I didnt understand this additional variable concept. I am trying to make it something like one dimensional array. In which the x term is a function of time. But I dont think the expression editor can take the x in the form of x(t) and x(t-1). Let me write a bit in detail. My modified arrhenius expression looks like the following ArrRate = * (1-x/1.85) * * -there are lot of other terms.
this x is a ratio of weight. and it will not go more than 1.85(I explained in original message). this x should be computed from ArrRate(t-1) and should be put into ArrRate(t). Besides this I also have to sum up the x for all the previous timesteps to compute my present timestep. Is there a way to deal with these arrays in expression editor? thanks in advance. Jan |
|
July 28, 2003, 12:01 |
Re: Creating, loop or iteration using expression e
|
#4 |
Guest
Posts: n/a
|
Hi Jan,
Okay, I see. So an additional variable would not help in this case. You can do what you are asking by creating a user CEL function which executes your own user fortran routine. For futher assistance, I suggest you contact technical support. Regards, Robin |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Gmsh] Problem with Gmsh | nishant_hull | OpenFOAM Meshing & Mesh Conversion | 23 | August 5, 2015 03:09 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 19:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |
[CAD formats] my stl surface is seen as just a line | rcastilla | OpenFOAM Meshing & Mesh Conversion | 2 | January 6, 2010 02:30 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |