CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Accessing variables from an old time step

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2024, 08:24
Default Accessing variables from an old time step
  #1
New Member
 
Fabian
Join Date: Apr 2023
Posts: 4
Rep Power: 2
Fabian Web is on a distinguished road
Hello everybody,
I am trying to set up a simulation where a calculated value from an old time step is used to calculate the new value in the next time step. These values are no fields but single values. Is there a way to do that in Star CCM+ and if so how? I have tried using field histories but it seems that with these I can only access fields.
Fabian Web is offline   Reply With Quote

Old   February 22, 2024, 00:03
Default
  #2
Member
 
Join Date: Nov 2019
Posts: 93
Rep Power: 6
FliegenderZirkus is on a distinguished road
You could try using the Statistics report. I would set the Statistic to Mean and the Sample collection policy to Last N samples with N=1
FliegenderZirkus is offline   Reply With Quote

Old   February 23, 2024, 10:58
Default
  #3
New Member
 
Fabian
Join Date: Apr 2023
Posts: 4
Rep Power: 2
Fabian Web is on a distinguished road
Thank you very much for your idea. However it seems that with the statistics report you only get the value at the newest time. Instead you can get the value by using a statistics report of the last 2 time steps. So N = 2. Since you get a mean value you have to multiply it by 2 and subtract the newest value.

With this I had the issue that I can not update the latest value. I always had either a self or a circle reference.

In the end it was possible using field functions and histories.
The problem is that in the beginning of a simulation field histories seem to store nans. This means that when you create a field function like: y_new = y_old + 1, you always get nans. Even when you skip the first iterations using if functions the whole function becomes nan. Therefore you need to start the simulation with a fixed value and change it manually to the aforementioned function afterwards.

Another problem was that you can not plot the values using reports directly since you have a field eventhough the values are the same everywhere. You can easily circumvent that using Max or Min reports.
Fabian Web is offline   Reply With Quote

Old   February 23, 2024, 11:25
Default
  #4
Member
 
Join Date: Nov 2019
Posts: 93
Rep Power: 6
FliegenderZirkus is on a distinguished road
You're right about the N=1 giving you the current value, I didn't realize that. But it should still be possible similarly to how you suggest doing it.
Quote:
With this I had the issue that I can not update the latest value. I always had either a self or a circle reference.
I don't see why there would be a circular reference. Just try
Report1 = normal report of your quantity of interest (current value)
Report2 = statistics report of the type Sum with last N = 2
Report3 = Expression report = ${Report2} - ${Report1}
Shouldn't that do the trick?
FliegenderZirkus is offline   Reply With Quote

Old   March 1, 2024, 12:28
Default
  #5
New Member
 
Fabian
Join Date: Apr 2023
Posts: 4
Rep Power: 2
Fabian Web is on a distinguished road
I didn't see your answer yet. Sorry for that.
So what I wanted to do was change a certain value using a value from the calculation. I wanted to update the set value each time step.
Let's say for example I have a certain amount of particles (n) in a container. Each step a certain amount leaves the container (m). What I wanted to do was to get the new amount of particles by saying: n_old - m = n_new.
Both of the ways we suggested with the sum and the mean give the old value.
My problem occured afterwards though. I couldn't use the formula above for reports since it gave me a circle reference.

But I managed to do it with field functions and field histories. So it is working now.
Thanks for your help
Fabian Web is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postprocess: sampleDict works but creates no output folder shock77 OpenFOAM Post-Processing 14 November 15, 2021 08:27
Convergence problem of OF WUYing OpenFOAM Running, Solving & CFD 2 September 20, 2021 10:09
SU2 7.0.7 Built on CentOS 7, parallel computation pyscript mpi exit error? EternalSeekerX SU2 3 October 9, 2020 18:28
pimpleDyMFoam computation randomly stops babapeti OpenFOAM Running, Solving & CFD 5 January 24, 2018 05:28
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47


All times are GMT -4. The time now is 05:48.