welcome to a quick tutorial this is tech
block 360 e^x 2015 r1 and today I want
to introduce a new capability using if
statements for data altar for the
example I chose a relatively modest size
this is a 2d wind turbine we're looking
at one time step but I think it would
apply to effectively any type of data
you might process and tech block for
those of you who haven't used our data
altar capabilities one can access them
through the data menu via data alter
specify equation and it's always
convenient to have the data set info
information available as you're doing
this analysis so a couple of things
we're going to do quickly we will go
ahead and turn on a contour of the X
velocity just for a context and not just
you can see here if you want to change
the contour you can do that as well by
going in here you can set it to anything
in the first eight variables or you can
go into the dialogue itself and we'll
set this to turbulent viscosity and once
we have that variable as a contour
variable or contour group we can turn
that on as well let's go ahead and do a
quick probe and we're gonna look at what
those values are so you can see that the
values are actually quite low so we're
looking at values of point zero zero
five eight so effectively these values
are zero or pretty close to zero as you
might expect and so if we go out here
that value is actually about point zero
zero nine and maybe we want to kind of
make that a cutoff so we're going to use
an if statement and first we'll create a
new variable to create a variable use
the curly brackets and
type in a name and so let's call this
mod TV for modified turbulent viscosity
and we're gonna set that equal to so you
could do something very simple you for
those of you haven't used this before
you could do just a cosine of the twelve
for example if you wanted to apply a
simple mathematical operator and if I
compute that you'll see down here that
this is what the value is for the new
variable data set info you'll if we go
down to the bottom you can see what the
modded turbulent viscosity is but that
that's not particularly interesting you
can get pretty sophisticated with the
mathematical operators that you use
including derivatives second derivatives
etc for this example we're use a if test
and we will set that if test and the if
test syntax is quite similar to say
using Microsoft Excel for example v12
which represents turbulent viscosity we
can set that say okay well let's say
that we these lower values aren't
particularly interesting to us so we're
gonna say for v12 that is less than or
equal to a value of zero point zero zero
nine nine if that's true then we're
going to set it to a value of zero and
if it's false we'll set it to v12 so
basically we want to carry over those
values and we'll hit compute and you can
see there's the value now for mod
turbulent viscosity and you can see what
the values range now go from zero to
0.14 and if we go back to v12 you see
originally when we got rid of these
lower values I can show that in a
contour by contouring on this and
let's add a contour group here modify
the variable for that contour group of
modded okay and if I right click on this
one here
I can now set that to the moderate value
now again there isn't gonna be anything
overly dramatic outside of the fact that
if I you can see that outside those
values now it's exclusively zero that
can be very convenient because if you go
into contouring you can say I want to do
a color cutoff and you can say cutoff
values that are below a value of zero
point zero zero eight for example and if
you do that you'll see to redraw here
that the values are all the color is cut
off in essence you can kind of isolate
contour variables so in addition to
doing kind of simple operators within if
you can also use if and and or
statements so let's do an or statement
so we'll say this is mod two TV and it's
just a new variable we're going to
calculate that based on an if statement
and let's go ahead and do something some
more just for context so we'll say V 12
and you know another thing that you can
do is you can just copy if you don't
want to use the variable number you can
in fact use the variable name using the
curly brackets around them so you can
say have turbulent viscosity is let's
see equal to and what did we say zero or
and well let's make it slightly more
interesting okay so if it's equal to or
an equal just for the the way the syntax
is actually more programmatic so it's
two equal signs or which is two vertical
bars and we can
or v2 or X or Y I guess I'll choose Y is
greater than 1.5 then what do we want to
do so let's set let's set the value here
equal to 1 which would be off scale if
it's true and if it's false let's set
that value back to be 12 I I used to be
12 only because it's faster okay
this equation is going to run we don't
really need it so if I want to I can
delete it but it doesn't matter it's
pretty small okay so now that's that's
been computed you can see we have mod 2
and it goes from one to six point zero
point six to the minus nine okay so and
that again goes back to the or statement
so we didn't clip off all of the lower
values like we did with the first
equation so if I probe I should probe
here for example you see that should be
equal to one because it's greater than
one point five and Y and if I go to the
contour variables here very quickly we
will select mod two and close that you
can see now that mod two values are
shown here now we probably would want to
remove the color cutoff then for this
one so let's not cut off anything and
you can see the actual values so
hopefully that gives you some ideas of
the new capability so just to quickly
explain we have equals not equal greater
than greater than or equal to less than
less than or equal to and logical tests
such as end which is to end and friends
our two vertical bars for or thanks for
watching a quick tutorial good luck with
data alter and let us know if you have
any questions