The Schmitt Trigger: Let STAR-CCM+ remember things.

Siemens Creator Siemens Creator
Siemens Creator

 

1937 was the year that appeared the first electronic circuit specifically designed as a pulse coded neural circuit. It was described by his inventor Otto Herbert Arnold Schmitt in his 1937 PhD thesis: "An Electrical Theory of Nerve Impulse propagation". In 1938 he coined the name thermionic trigger to his invention, though nowadays is best known as the Schmitt trigger. That circuit was built to better study the neural function and test the theory of "impulse propagation"  in nerves. It can be defined as a binary-output electrical circuit that realizes a threshold function and can be considered as the minimal building block for modelling hysteretic phenomena. 

 

But let explain it better with a practical example:


You have an environment that generates a contaminant (let´s call it SMOG). You accept a maximum (volume-averaged) concentration of 0.1 of SMOG. When that limit is reached you inject clean air (10 m/s), and the injection takes place, so long as the SMOG concentration is below 0.07.  That would be represented by the following diagram:

 

User-added image

In the horizontal axis, we keep track of the SMOG concentration and in the vertical axis, we keep track of the injection velocity of clean air. 

This diagram could be interpreted as the transfer function of the trigger controlling the injection system where the horizontal and vertical axes are input voltage and output voltage, respectively, T and −T  are the switching thresholds, and and −M are the output voltage levels. 

 

You see that the inlet velocity has different values in the interval (0.07,0.1) depending on past values. If the injection of clean air was on, it continues to remain on. And if no injection was taking place, it remains off. This dependence of a system on its past is called hysteresis. And therefore the Schmitt trigger can be conceived as the circuit that simulates the minimal possible hysteretic effect in a system. 

The Schmitt trigger can easily be implemented in STAR-CCM+. With it, we can implement hysteretic effects in the program. In other words: memory.

 

Please note that the memory, in this case, is not a static procedure where we store data in the computer but a dynamical one where the data is memorized by endlessly repeating the previous value. 


What are the main ingredients?  You need to select your input. In our case, this input is provided by a report that gives us the volumetric average of the SMOG contaminant. This is Vol.AverageSMOGReport in the attached simulation. We need now to define our output which will be the InletVelocity.  And finally, we need to store the previous values of the InletVelocity field function. This is done with the field mean monitor oldInletVelocity (explained here). 

The InletVelocity field function is then defined as:

  (${Vol.AverageSMOGReport} > 0.1)
              ? 
10 
              : ( (
${Vol.AverageSMOGReport} > 0.07)
                            ? 
${oldInletVelocity} 
                            : 
0 )


where you simply tell the program to use past values within the (0.07,0.1) interval. 
 
You can now see the trigger in action here:

 

 

A generic Schmitt trigger could be implemented by defining an OutputSignal as

 

   (${InputSignal} > T)
              ? 

              : ( (${InputSignal} > -T)
                            ? 
${oldOutputSignal} 
                            : 
-M)

 


Finally, a word of caution. The OutputSignal is defined in terms of its previous value. Therefore,
we recommend the following safety measure when defining the above functions.
To wrap them with the alternateValue keyword which provides a default value if the program can not find a value for it. With the example above the InletVelocity field function would then be defined as:

 

 

 alternateValue
           (
${Vol.AverageSMOGReport} > 0.1)
              ? 
10 
              : ( (
${Vol.AverageSMOGReport} > 0.07)
                            ? 
${oldInletVelocity} 
                            : 
0 )
 ,
0)


where 0 is the default value in this case. 

You can find the example above in the simulation attached to this article. The simulation can be opened with STAR-CCM+ version 12.04 onwards. (Tested successfully till 2019.2)


See also:

Memorizing High Water Marks and High Water Times.
How to store and access results from the previous iteration or previous time step?
How to make your simulation setup more flexible with the alternateValue field function?

and previous Swiss STAR-CCM+ Knife tools: 

Swiss STAR-CCM+ Knife: [1] Big Sources: How to override equations and fix cell physical values.
Swiss STAR-CCM+ Knife: [2] Taming of the Courant Number: Automatic Time-Step Control.
Swiss STAR-CCM+ Knife: [3] Ignore box: Robin, Zero Pressure Gradient and Slip Flow boundary conditio....
Swiss STAR-CCM+ Knife: [4] Manual cosimulator: How to transfer information across multiple simulatio...
Swiss STAR-CCM+ Knife: [5] Pixel comparison: Integrate image processing tools in your CFD workflow.
Swiss STAR-CCM+ Knife: [6] Streamline rider: Integrate scalar and vector fields along streamlines.
Swiss STAR-CCM+ Knife: [7] Command and conquer: How to pass command line parameters to your macros.