CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CFX

Creating, loop or iteration using expression edito

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 17, 2003, 05:45
Default Creating, loop or iteration using expression edito
  #1
Jan
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
  Reply With Quote

Old   July 27, 2003, 23:34
Default Re: Creating, loop or iteration using expression e
  #2
Robin
Guest
 
Posts: n/a
Jan,

You should use an additional variable.

Robin
  Reply With Quote

Old   July 28, 2003, 04:53
Default Re: Creating, loop or iteration using expression e
  #3
Jan
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
  Reply With Quote

Old   July 28, 2003, 11:01
Default Re: Creating, loop or iteration using expression e
  #4
Robin
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
  Reply With Quote

Reply

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Gmsh nishant_hull Open Source Meshers: Gmsh, Netgen, CGNS, ... 23 Today 02: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
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 15:57


All times are GMT -4. The time now is 03:51.