How to creates a serie of iso-clips in CFDpost in order to cut a surface by equal angular sectors?


Assumption:
1-The axis is Z axis.
2- Each angular sectors have the same size.

Note:
Theta function uses atan2(x,y) function.
Due to smoothing of atan2(x,y) function discontinuity (-180°/+180°) , the created surface with iso-clip may include a very small surface in the area close to the discontinuity (close to +180° of angle Theta). For example, if you want to clip your surface between 0 and 45° you may have include a small part that comes from the smoothing between -180 and + 180°.

An additional test on postive X or postive Y is added to avoid this artifact in the script.

How to run it?:
In CFD post read the following PERL script via Session-->Play Session.

SCRIPT:

#enter name of the surface to split with angles.
!$name="FLOW_OUTFLOW";
# enter the number of angular sectors.
!$numsteps=7;

LIBRARY:
CEL:
EXPRESSIONS:
theta1 = atan2(y,x)
theta2 = atan2(-x,y)
END
END
END

USER SCALAR VARIABLE: Theta 1
Boundary Values = Conservative
Calculate Global Range = Off
Expression = theta1
Recipe = Expression
END

USER SCALAR VARIABLE: Theta 2
Boundary Values = Conservative
Calculate Global Range = Off
Expression = theta2
Recipe = Expression
END


! for ($i=0;$i<$numsteps;$i++)
!{
!$dangle=360/$numsteps;
!$num0=$i*$dangle;
!$num1=($i+1)*$dangle;

! if ($num1<180.0)
!{
ISO CLIP: Iso Clip $i
Location List = $name
ISO CLIP LIMITER: Iso Clip Limiter 1
Limiter Operation = Greater Or Equal To
Value = $num0 [degree]-90 [degree]
Variable = Theta 2
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 2
Limiter Operation = Less Or Equal To
Value = $num1 [degree]-90 [degree]
Variable = Theta 2
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 3
Limiter Operation = Greater Or Equal To
Value = 0 [m]
Variable = Y
Variable Boundary Values = Hybrid
END
END
! }
! else
!{
!if ($num0<180.0)
! {
ISO CLIP: Iso Clip $i
Location List = $name
ISO CLIP LIMITER: Iso Clip Limiter 1
Limiter Operation = Greater Or Equal To
Value = $num0 [degree]-90 [degree]
Variable = Theta 2
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 2
Limiter Operation = Less Or Equal To
Value = $num1 [degree]-90 [degree]
Variable = Theta 2
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 3
Limiter Operation = Less Or Equal To
Value = 0 [m]
Variable = X
Variable Boundary Values = Hybrid
END
END
!} else
!{
ISO CLIP: Iso Clip $i
Location List = $name
ISO CLIP LIMITER: Iso Clip Limiter 1
Limiter Operation = Greater Or Equal To
Value = $num0 [degree]-360 [degree]
Variable = Theta 1
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 2
Limiter Operation = Less Or Equal To
Value = $num1 [degree]-360 [degree]
Variable = Theta 1
Variable Boundary Values = Conservative
END
ISO CLIP LIMITER: Iso Clip Limiter 3
Limiter Operation = Less Or Equal To
Value = 0 [m]
Variable = Y
Variable Boundary Values = Hybrid
END
END
!}
!}
!}





Show Form
No comments yet. Be the first to add a comment!