websights

Fill out the form to download

Required field
Required field
Not a valid email address
Required field
Required field

Documentation

How to Create Conditional Expressions in FEA Simulations?

Skip to main content

Introduction

This article cover the conditional expressions IF, IF-OR and IF-AND.

VM-Stresses for disc model using conditional expressions
Figure 1: Von-Mises stress distribution in a disc model.

With the expression language available on platform, the user can build conditional IF-statements through logical expressions based on True (1) or False (0). As an example, we will look at a double-disc model with a spacially-varying pressure as a function of the radius:

$$
P = 1000 \cdot r^2 = 1000 \cdot (x^2 + y^2) Pa
$$

Disc model used for conditional expressions
Figure 2: Concentric-Discs Model used for the creation of expressions

The pressure expression can be easily implemented in SimScale using the expression option in the Pressure Boundary Condition pop-up window

Implement expression for pressure as a function of coordinates x and y in SimScale
Figure 3: Implementationof pressure distribution as a function of coordinates x and y.
VM-Stress due to pressure as a function of coordintaes x and y
Figure 4: Von-Mises stress due to pressure applied as a function of coordinates x and y.

IF-Statement

Now, an IF-statement can be implemented if we wish to apply the pressure distribution at a specific portion of disc. As an example, the pressure will be applied only when the radius is larger then 0.0375m. The required expression is

1000*sqrt(x^2 + y^2)*(sqrt(x^2 + y^2)>0.0375)

where the if-condition is represented in the logical expression

(sqrt(x^2 + y^2)>0.0375)

In SimScale, the implementation of the expression follows the same idea depicted in Figure 3. Considering the aforementioned if-statement, we obtain the following:

IF Statement for pressure distribution and its results VM stress
Figure 5: IF -Statement for pressure distribution considering a radius larger than 0.035m and its corresponding Von-Mises stress distribution.

IF with AND-Statement

We can include the AND-logic to the IF-Statement from above by multiplying two logical expressions. Considering the radius larger than 0.0375m AND lower than 0.05m, we need the following expression:

1000*sqrt(x^2 + y^2)*(sqrt(x^2 + y^2)>0.0375)*(sqrt(x^2 + y^2)<0.05)

where the if with and-condition is represented in the logical expression:

(sqrt(x^2 + y^2)>0.0375)*(sqrt(x^2 + y^2)<0.05)

In the platform, this pressure distribution implementation and its corresponding Von-Mises stress distribution on the disc are depicted as follows:

IF with AND-Statement for pressure distribution and its results VM stress
Figure 6: IF with AND-Statement for pressure distribution considering a radius larger than 0.035m and smaller than 0.05m with its corresponding Von-Mises stress distribution.

IF with OR-Statement

Following the same idea of the previous conditional statement, the OR-Statement is implemented by an addition (+) operation. Considering a pressure distribution applied if the radius is smaller than 0.0375m OR larger than 0.05m, the expression is as follows:

1000*sqrt(x^2 + y^2)*(sqrt(x^2 + y^2)<0.0375) + 1000*sqrt(x^2 + y^2)*(sqrt(x^2 + y^2)>0.05)

with the or-condition represented with the following logical expression

+ 1000*sqrt(x^2 + y^2)*(sqrt(x^2 + y^2)>0.05)

In SimScale, this pressure distribution implementation and its corresponding Von-Mises stress distribution on the disc are depicted as follows:

IF with OR-Statement for pressure distribution and its results VM stress
Figure 7: IF with OR-Statement for pressure distribution considering a radius smaller than 0.035m OR larger than 0.05m with its corresponding Von-Mises stress distribution.

IF with AND-Statement with Spatial and Temporal Dependency

In the case of nonlinear or dynamic simulations, might also be helpful to couple spatial with time-dependent statements. We look at an example where the pressure distribution is applied for a radius between 0.0375 and 0.05m AND for the a time interval from 0.3 to 0.7s. In this case, the expression is defined as:

1000*sqrt(x^2+y^2)*(sqrt(x^2+y^2)>0.0375)*(sqrt(x^2+y^2)<0.05)*(t>=0.3)*(t<=0.7)

where the AND time-dependent logical expression is accounted for in the for in the follow portion

*(t>=0.3)*(t<=0.7)

In SimScale, the spatial- and time-dependent pressure distribution is implemented as follows:

Pressure distribution on disc as a function of spatial and time coordinates
Figure 8: IF with AND-Statement considering a spatial- and time-dependent pressure distribution

The expression from Figure 8 produced the following Von-Mises stress distribution over time:

Animation 1: Von-Misses stress distribution according to spatial- and time-dependent pressure distribution.

Last updated: March 31st, 2026

Contents