CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > EnSight

how to access a variable at two different time instances

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 12, 2017, 05:18
Default how to access a variable at two different time instances
  #1
New Member
 
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Prat991 is on a distinguished road
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.
Prat991 is offline   Reply With Quote

Old   June 12, 2017, 21:35
Default
  #2
Senior Member
 
kevincolburn's Avatar
 
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17
kevincolburn is on a distinguished road
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
kevincolburn is offline   Reply With Quote

Old   June 13, 2017, 09:05
Default
  #3
New Member
 
Join Date: Mar 2017
Posts: 11
Rep Power: 9
Prat991 is on a distinguished road
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?
Prat991 is offline   Reply With Quote

Old   June 13, 2017, 10:26
Default
  #4
Senior Member
 
kevincolburn's Avatar
 
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17
kevincolburn is on a distinguished road
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
kevincolburn is offline   Reply With Quote

Old   June 21, 2017, 15:04
Default
  #5
New Member
 
Anonymous
Join Date: Mar 2017
Posts: 4
Rep Power: 9
housingrico is on a distinguished road
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.
housingrico is offline   Reply With Quote

Old   June 21, 2017, 15:41
Default
  #6
Senior Member
 
kevincolburn's Avatar
 
Kevin Colburn
Join Date: Mar 2009
Location: The Woodlands, TX
Posts: 131
Rep Power: 17
kevincolburn is on a distinguished road
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
kevincolburn is offline   Reply With Quote

Old   June 21, 2017, 16:57
Default
  #7
New Member
 
Anonymous
Join Date: Mar 2017
Posts: 4
Rep Power: 9
housingrico is on a distinguished road
Quote:
Originally Posted by kevincolburn View Post
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
Thank you for your response.

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?
housingrico is offline   Reply With Quote

Old   December 26, 2017, 08:10
Default
  #8
New Member
 
Himanshu Shrivastava
Join Date: Dec 2017
Posts: 1
Rep Power: 0
himanshri is on a distinguished road
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?
himanshri is offline   Reply With Quote

Reply


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
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 06:49
Floating point exception error lpz_michele OpenFOAM Running, Solving & CFD 53 October 19, 2015 03:50
[solidMechanics] solidMechanics gear contact in rotation nlc OpenFOAM CC Toolkits for Fluid-Structure Interaction 3 January 11, 2015 07:41
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 11:08
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34


All times are GMT -4. The time now is 01:44.