CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Can CEL read a C-Program (https://www.cfd-online.com/Forums/cfx/164056-can-cel-read-c-program.html)

AK5 December 11, 2015 05:06

Can CEL read a C-Program
 
Hi Guys,
I am trying to write a expression for a transient study.
The temperature of the body increases 10[c] for every 10[s] till it reaches a temperature of some 120[c]. (llike a step to the top).
so can CEL read a c-program that contains i++, for, if ,else...etc?

Thankyou
Best Regards

ghorrocks December 11, 2015 06:42

No, CEL cannot read a C++ file.

You can write a fortran file which can return values you can refer to as a CEL variable.

But the function you describe can be written directly in CEL. No need for fortran or C++ for a simple function like that.

AK5 December 11, 2015 08:34

Thankyou for replying

I am kind of new to writing CEL expressions.. so i wanted to try something which i knew.

can you recommend me some link or study material so that i can learn how to write this step function in CEL.

Thankyou in Advance

ghorrocks December 11, 2015 17:38

Have a look at the CFX tutorial examples and the reference manual.

AK5 December 12, 2015 05:48

Thankyou Glenn

AK5 December 18, 2015 01:49

I have written this expression for the above said problem


step((t-10[s])/1[s])*10[c]+ step((t-20[s])/1[s])*10[c]+ ....
+ step((t-120[s])/1[s])*10[c]

Is there any way i can reduce the size of the expression ?

Thankyou in Advance

ghorrocks December 18, 2015 05:30

The if() statement can simplify some expressions. The mod() function is good for repeating functions. You can also use 1D interpolation functions as well.


All times are GMT -4. The time now is 14:32.