# how to access a variable at two different time instances

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

 June 12, 2017, 04:18 how to access a variable at two different time instances #1 New Member   Join Date: Mar 2017 Posts: 11 Rep Power: 5 Hello All, Is there a way to access a variable at two different time instances? for example I have to calculate difference of scalar variable pressure p between current time instance and last time instance and repeat the same for all time steps. Thank you in advance.

 June 12, 2017, 20:35 #2 Senior Member     Kevin Colburn Join Date: Mar 2009 Location: The Woodlands, TX Posts: 131 Rep Power: 13 Yes, you can use the curly braces '{}' to denote a value at a particular timestep. Assume you have timesteps 0 through 49. And you want to calculate the difference in pressure between each timestep and that of timestep 49. You'd perform the following two equations in the Calculator: pLast = p{49} pDiff = p - pLast pDiff is now a dynamic variable, changing at each timestep, to be the difference in value between the current and last timestep. Side note: you would not be advised to this in a single equation (p - p{49}), as this would cause EnSight to continually be swapping values between the current and the last timestep. By doing the pLast equation first, that value is obtained and stored in a static register, making the pDiff calculation perform much quicker. -Kevin __________________ Kevin Colburn Computational Engineering International, Inc. www.ceisoftware.com kevin@ensight.com

 June 13, 2017, 08:05 #3 New Member   Join Date: Mar 2017 Posts: 11 Rep Power: 5 Hi Kevin, Thank you very much for your reply, I will keep a note on this point. But I think i worte in a confusing way, I am extremely SORRY for that, I want to calculate difference of scalar variable pressure p between CURRENT time instance and PREVIOUS time instance for all the time intervals FOR THE PURPOSE OF VISUALIZATION IN Ensight for multiphase simulation. in the form of algebra : (p-oldTime(p)/deltaT() I have already calculated the pressure change wrt time at every timestep as a post processing function in openFoam which will give results in form of Excel data and graphs..... Now I want to Visualize this on the model in paraview. Is this possible to perform somehow?

 June 13, 2017, 09:26 #4 Senior Member     Kevin Colburn Join Date: Mar 2009 Location: The Woodlands, TX Posts: 131 Rep Power: 13 In one method, You could do this in a python script, which would figure out the current timestep, and then use the {} notation to grab the previous timestep value. It would force a walk of the time domain, so it wouldn't be interactive (i.e. you couldn't just jump to timestep 33 in the GUI and have it update (you'd need to call the python routine to have it update). So, it is *possible* using that method, but it'd be slow, and forcing you to continually manually update the variable calculation. I'd actually suggest a different approach, which might seem a less 'elegant', but actually far more practical and maintain all of the ability of EnSight... Copy. Since EnSight keeps each variable in a separate file for each timestep, I'd actually do the following: a. Export out EnSight Case Gold format (if you don't have it already). You would have pressure at timestep stored in separate files like : pressure.0000, pressure.0001, pressure.0002... pressure.0049 b. Create a little unix/python script which copied the files new a new name, with a suffix of one more: pressure.0000 -- > old_pressure.0001, pressure.0001 -- > old_pressure.0002, etc. This would be a relatively small/simple script. I'd perhaps also copy in a dummy file for old_pressure.0000. c. Simply add in a line into the .case file to specify the new set of variable files that you have. d. Open up EnSight, and perform your calculation just as you have specified in the variable calculator. You can then operate completely normally in EnSight. Note: for either method to work, your grid must be fixed over time (changing variable transient only, not changing connectivity)... __________________ Kevin Colburn Computational Engineering International, Inc. www.ceisoftware.com kevin@ensight.com

 June 21, 2017, 14:04 #5 New Member   Anonymous Join Date: Mar 2017 Posts: 4 Rep Power: 5 Is there anyway to plot the average of a variable over time on a line tool? In other words, have the distance on the x-axis and a temperature average(of time) on the y-axis.

 June 21, 2017, 14:41 #6 Senior Member     Kevin Colburn Join Date: Mar 2009 Location: The Woodlands, TX Posts: 131 Rep Power: 13 For changing variable only transient (i.e. the grid does not change over time), then you can use the calculator function "TempMean()". This function will calculate the temporal mean of a variable over the specified timesteps. With that new variable created, you just simply use the normal query over distance tool with that average variable. -Kevin __________________ Kevin Colburn Computational Engineering International, Inc. www.ceisoftware.com kevin@ensight.com

June 21, 2017, 15:57
#7
New Member

Anonymous
Join Date: Mar 2017
Posts: 4
Rep Power: 5
Quote:
 Originally Posted by kevincolburn For changing variable only transient (i.e. the grid does not change over time), then you can use the calculator function "TempMean()". This function will calculate the temporal mean of a variable over the specified timesteps. With that new variable created, you just simply use the normal query over distance tool with that average variable. -Kevin

I have a non-uniform grid, and was able to find this example . The problem is my simulation is running Converge with AMR. Any ideas on how to work around working in Ensight for Converge?

 December 26, 2017, 07:10 #8 New Member   Himanshu Shrivastava Join Date: Dec 2017 Posts: 1 Rep Power: 0 Hii kevin, sorry, but I couldn't undersatnd your second method. If possible, can you elaborate it. specially, what lines should we add in case file? do we have to open two case file in same ensight session one with original name and one with change name and perform the calculation?