CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CFX

Read values from previous timesteps

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 18, 2011, 11:10
Default Read values from previous timesteps
  #1
Senior Member
 
Ugly Kid Joe
Join Date: Aug 2010
Posts: 193
Rep Power: 6
vmlxb6 is on a distinguished road
I wrote a FORTRAN subroutine for a RK-4 order scheme and want to know how do I have access to the values at previous timesteps ?????????

Can anyone help me out ???? Thank you very much.
vmlxb6 is offline   Reply With Quote

Old   April 18, 2011, 15:34
Default
  #2
Senior Member
 
Join Date: Mar 2009
Location: Europe
Posts: 168
Rep Power: 8
joey2007 is on a distinguished road
CFX is economic. It stores only what it requires. More than two time steps are never required.

It will be very challaging to overcome this. Contact ANSYS service. May be they can help.
__________________
-
-
-
-
-
------------------------------------------------------------------------
Please do not forget: I am not paid for answering your questions.


Thousands of issues can cause a division by zero. Please do not capture a thread, with the argument: "I have the same issue ...."
joey2007 is offline   Reply With Quote

Old   April 18, 2011, 16:39
Default @ joey2007
  #3
Senior Member
 
Ugly Kid Joe
Join Date: Aug 2010
Posts: 193
Rep Power: 6
vmlxb6 is on a distinguished road
Can you please explain " It stores only what it requires. More than two time steps are never required" ???

Can CFX STORE values from previous timesteps ???

What I figured out was to use the write and read command in FORTRAN to write/read a value to/from an externally created txt file

The following link gives examples on how to READ/WRITE to an external file.

http://www.livephysics.com/computati...-handling.html

Hope this thread helps other people having similar problems.


Regards.
vmlxb6 is offline   Reply With Quote

Old   April 18, 2011, 18:27
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 10,797
Rep Power: 84
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
Quote:
Can CFX STORE values from previous timesteps ???
If you are using second order time differencing it has to store previous time steps. If not there is no reason to store it so it is not stored. So make sure you are using second order time stepping.

If you wish to store a small number of values then writing to a file is OK. But if you want the whole solution field then writing to a file will slow the simulation down. This is not a very elegant solution, better to access the variables that are already stored in CFX than write them to a file.

Or do you need access to variables further back then the last time step?
ghorrocks is offline   Reply With Quote

Old   April 18, 2011, 18:47
Default @ Ghorrocks
  #5
Senior Member
 
Ugly Kid Joe
Join Date: Aug 2010
Posts: 193
Rep Power: 6
vmlxb6 is on a distinguished road
I only need access to a small number of variables like displacement and velocity at every timestep. So I guess writing a subroutine is the best way.

BTW whats a second order time differencing ????????
vmlxb6 is offline   Reply With Quote

Old   April 18, 2011, 20:14
Default @ghorrocks
  #6
Senior Member
 
Ugly Kid Joe
Join Date: Aug 2010
Posts: 193
Rep Power: 6
vmlxb6 is on a distinguished road
Can I have access to velocity and displacement values at previous time steps using 2nd order time differencing ????? I just need the values of velocity and displacement from previous time step.

According to you what would be the best way ???
vmlxb6 is offline   Reply With Quote

Old   April 19, 2011, 04:07
Default
  #7
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 6
Matjaz is on a distinguished road
Hi, does this fortran writing to and reading from file in your simulation work OK?
I have the same problem, but when i try to write to file i find that my fortran routine executes many times during the first time step, and then an error occurs. In a file created by fortran routine there are about 3000 entries then.
The cfx fortran manual on the third page says that:
"Note that, in general, your user CEL function will be called several times during each iteration and the value of NLOC will be different for each call. This is because the CFX-Solver will split the specified region (for example, a boundary condition region) into a number of smaller ‘pieces’ and call your function for each piece. Your user subroutine should be coded to deal with this."

It is interesting, that if my routine doesn't write to a file, the values of velocity comes back to cfx solver right, but these are delta_values. What i would like to do is to memorize the total value like: v = v + dv , but i stil haven't figured out how to do it.
Regards, Matjaz
Matjaz is offline   Reply With Quote

Old   April 19, 2011, 06:40
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 10,797
Rep Power: 84
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
Prof Chaos, I suggest you look 2nd order time differencing up - it is pretty basic CFD stuff so you had better understand it.

I suspect with 2nd order time differencing you will be able to access previous timesteps through fortran. I have never done it, but I suspect it can be done.
ghorrocks is offline   Reply With Quote

Old   April 22, 2011, 16:07
Default
  #9
Senior Member
 
Join Date: Mar 2009
Location: Europe
Posts: 168
Rep Power: 8
joey2007 is on a distinguished road
@vmlxb6: It is quite challenging to know more than Glenn. However it is even more challenging to access field variable values from previous time steps. I discussed it already here:
USER_FORTRAN call variable at past timestep

If you just want to store single values at the actual time step and read again later on, you may use MMS as it is explained in the modeling manual chapter 17.6.
__________________
-
-
-
-
-
------------------------------------------------------------------------
Please do not forget: I am not paid for answering your questions.


Thousands of issues can cause a division by zero. Please do not capture a thread, with the argument: "I have the same issue ...."
joey2007 is offline   Reply With Quote

Old   April 22, 2011, 18:56
Default @ Matjaz
  #10
Senior Member
 
Ugly Kid Joe
Join Date: Aug 2010
Posts: 193
Rep Power: 6
vmlxb6 is on a distinguished road
My subroutine takes in 4 arguments and returns just 1 argument back i.e the displacement. my code had the statement RET(1,1) = displacement but that wrote thousands of values for RET
Then I changed it to

DO ILOC = 1,NLOC
RET(ILOC,1)=displacement
END DO

This set all my RET values at all the locations to the same value as that of displacement. Now my code works fine.

Hope this helps !!!!!!!!!!!
vmlxb6 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
It would be wonderful if a tool for FoamToTecplot is available luckyluke OpenFOAM Post-Processing 165 November 27, 2012 07:54
Velocity gradients from previous timesteps Ed Kay FLUENT 0 March 4, 2010 09:04
max node values exceed max element values in contour plot jason_t FLUENT 0 August 19, 2009 11:32
exact face values RubenG Main CFD Forum 0 June 22, 2009 11:09
Plotting raw data values Wilesco CD-adapco 0 January 5, 2006 06:34


All times are GMT -4. The time now is 07:39.