CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   "do loop" in cfx expression (

sajad_abasi August 2, 2011 03:30

"do loop" in cfx expression
hi dear friends.

is it possible to write do loop by CEL in cfx?

the project is a tube with a porous domain at the end of that.
then the inlet pressure decreased suddenly and so the flowrate decreased. i want to change the resistance of the porous domain to obtain the initial flowrate and i need to have sumation of flowrate in all passed time.

i dont know if it is possible or not???????????

singer1812 August 2, 2011 09:44

Do-Loop isnt what you need. Follow this thread. It shows a method to do what you want within CEL. If you dont like this, you can use user fortran.

sajad_abasi August 3, 2011 09:20

hi singer 1812 and thanks for your help.

but im still confused.i do what you wrote me but i dont know how should i use the "res file" as an initial condition?

can you guide me?
another question for me is that after i add an additional variable and run one itration then should i add an expression??????

thanks again.

singer1812 August 3, 2011 13:29

You need to run an intial run, a "dummy" run if you will, needs only be one iteration, to initialize the variable that you want to addup. If you try adding up that variable, (ie. a=a+1), CFX will complain because a doesnt exist upon start.

If you make a dummy run, only needs to be 1 iteration, with a=0. Then use that run as an initialization for your real run (with a=a+1 or whatever you are using), then CFX will not complain.

sajad_abasi August 3, 2011 14:32

hi singer 1812
should i write "a=a+1" as a ""CEL expression"" or another "additional variable"?

i want to have sum of flowrate in all of the passed times.

i realy need that so if it is possible for you guide me in detail.

best regards

sajad_abasi August 3, 2011 18:39


i see you posted a topic about "Update Loop = TRANS_LOOP" .

i want to sum the flow rate at all the time step passed but i dont know how...

i defined a AV by name of debi and add "Update Loop = TRANS_LOOP" to it in the "edit in command" part then i run for one iteration to have a given initial value for debi=0 then i defined a expression by name of "totdebi=debi+flowrate@inlet"

when i run it gives me error im really confused.
if it is possible for you give me help in detail


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