CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   if Loop in the PRE (https://www.cfd-online.com/Forums/cfx/223653-if-loop-pre.html)

eSKa January 21, 2020 05:41

if Loop in the PRE
 
Hi,

I tried alot of things, I read a lot of posts, but couldnt find a solution.

My Problem:
If there is no Rest File, my variable Pup is zero (Pup =0).
This variable is used in a division (eta= Pdown/Pup).
The Solver doesnt start because of the the problem - dividing with 0.


My idea:
I want to give the variable Pup a value for the first e.g. 50 Iterations. In my case I say Pup = 5. Only to start the Simulation.
And if we have more than 50 Iteration this variable should be calculated like it must be.

my expression in the PRE:
eta = Pdown/Pup
Pup = if(citern<50,5 [kg m^-1 s^-2],torqueMachine*2*pi*n)

--> because the solver cant calculate with a Pup = 0, he should take the Value 5 in the beginning, and after 50 Iteration I wanted him to calculate the real Value

An error appears:
Error on if statement at position 1. The true and false expressions have inconsistensdimensions.

Could it be that all of the expression in the if loop must have the same dimension? In this case impossible


Thanks for ideas.

Opaque January 21, 2020 10:39

Dimensions, or units

Your expression seems to have different units between the True and the False values.

AtoHM January 21, 2020 13:51

I once had a division by zero in my expressions and the solver didnt stop, strange.


Why cant there be consistent dimensions?

Opaque January 21, 2020 15:11

Quote:

Originally Posted by AtoHM (Post 755229)
I once had a division by zero in my expressions and the solver didnt stop, strange.


Why cant there be consistent dimensions?

Not sure I understand the question.

In any case, the dimensions on both results must be the same; otherwise, the expression makes no sense.

Recall the expression is to fulfill a left hand side, say

MyValue = if (conditional, value for TRUE, value for FALSE)

the expected dimensions for MyValue are unique; therefore, either result must provide the same dimensions.

eSKa January 22, 2020 03:53

Hi, thanks for the replies.

It was really the wrong dimension, a big mistake of me, I thought it must be the Pressure (Pascal) dimension, but it wasnt.

Thanks a lot, now it works!


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