2024-02-01T17:50:02.000-0500

Simcenter STAR-CCM+
Simcenter STAR-CCM+ Virtual Reality
Teamcenter Share
Simcenter STAR-CCM+ Viewer
Simcenter STAR-CCM+ Application Specific Solutions

How to access values of a previous time step with Lagrangian Multiphase

Attachments: | lagrangianPassiveScalarTest_03.sim (1 MB) |

The idea is that in every time step we will store the desired scalar function (1 value that is, not a vector) and in the next time step we will look at this value. Of course, there is an issue with wanting to store a value at the same time as you want to look at the value you just had. We will solve this by adding another passive scalar!

For passive scalar 1 we will store values on odd time steps and look at these values on even time steps.

For passive scalar 2 we will store values on even time steps and look at these values on odd time steps.

Odd/even can easily be done using the modulus function in a field function. The odd field function looks like this:

And the even field function is 1-${odd_FF}.

To add data to our 2 passive scalars we enable the user source option “Scalar rate with inferred density”

This option wants the input in the units 1/Time and so what ever value we want to store, we have to divide by the time step. But not the “normal” time step. We have to divide by the time step of the parcel!

So the source for the odd passive scalar looks like this:

${ParcelTimeStep} > 0 ? (${target_FF} - ${odd_ps})/${ParcelTimeStep}*${odd_FF} : 0

To make it simpler to look at the stored data of any field function I’ve created a new field function called target_FF where you just have to enter the field function you are interested in. in my case I made it simple by letting target_FF be just ${TimeLevel}. I then create a final field function called passiveScalar that is just “odd passive scalar on even time steps and even passive scalar on odd time steps”. This is the field function that you will use. It looks like this:

${even_FF}*${odd_ps} + ${odd_FF}*${even_ps}

The result for my simple test case then looks like this:

As you can see, every particle has the value of the previous time step. Easy to see if it is correct or not. If I set up some post processing and switch target_FF to Parcel Centroid and rerun, I’ll get something useful instead:

Attached to this article you’ll find the simple test case with all the field functions and passive scalars needed. The only thing you need to change to store a different field function is the target_FF.