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

how to access previous timestep by user routine

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2018, 23:06
Default how to access previous timestep by user routine
  #1
FWP
New Member
 
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8
FWP is on a distinguished road
I'm simulating Multicomponent single phase flow(oxygen-water),i want to record the time when the wall oxygen-mass fraction is not 0. I've defined a variable array time-accumulate[NLOC] and I want to save its value for the next call , but an error showed that "save" attribute cannot be used for automatic arrays.
Could anyone help me, please! THANK YOU!
FWP is offline   Reply With Quote

Old   October 21, 2018, 23:45
Default
  #2
FWP
New Member
 
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8
FWP is on a distinguished road
I mean,if oxygen.mass fraction>0 then

i get some troubles in realizing the time-accumulate(pre t) since i can't save the array

Last edited by FWP; November 9, 2018 at 05:35.
FWP is offline   Reply With Quote

Old   October 22, 2018, 07:13
Default
  #3
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,864
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Do you want to track the time a piece of fluid has mass fraction above 0 (that is, does the accumulation convect with the flow)? Or some other spatial or temporal distribution (if so, what)?

Also, you can use greater than zero for mass fractions. With numerical noise a value of zero will jiggle about with small values like 1E-10, which do not show real mass fraction just noise in the numerics. You are going to have to define a tolerance which is larger than the numerical noise but small enough to pick up when the mass fraction really does change.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   October 22, 2018, 07:16
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,864
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
And I suspect you don't need user fortran to do this. It can be done by normal CFX built in features. But I need to understand exactly what you are trying to do before I can make a recommendation.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   October 22, 2018, 09:41
Default
  #5
FWP
New Member
 
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8
FWP is on a distinguished road
Thanks for your reply. i want to simulate process of oxide film, d=sqrt(k.t),k is constant, t is the time when the oxygen concentration is greater than a certain value. So I'm going to count the time of each node.The noise problem you mentioned helped me a lot, thank you!
FWP is offline   Reply With Quote

Old   October 23, 2018, 21:34
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,864
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Use an additional variable, maybe a diffusion variable but with the diffusion coefficient of zero. Then define a source term which generates the variable based on sqrt(k.t). There should be no fortran required for this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   October 24, 2018, 04:46
Default
  #7
FWP
New Member
 
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8
FWP is on a distinguished road
hello,ghorrocks
sorry for late answer. Your method is very ingenious, but when i creat a additional variable named "timer", and set the kinematic diffusivity to 0, an error showed in cfx-solver: bounds error detected, variable: timer.Dynamic Diffusivity. And "timer" has a very large negative value like -2.E-20
FWP is offline   Reply With Quote

Old   October 24, 2018, 07:33
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,864
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
If zero diffusivity does not work make it something like 1E-10. That is effectively nothing.

Your values are wrong because your source term function is wrong. I said the source term will be based on sqrt(k.t), not that it should be sqrt(k.t).

Make the units of your additional variable seconds [s]. Then look at the units of the source term and see if you can work out the source term required to make it work.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   October 24, 2018, 08:37
Default
  #9
FWP
New Member
 
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8
FWP is on a distinguished road
THANK you for reply

Last edited by FWP; November 9, 2018 at 05:34.
FWP is offline   Reply With Quote

Reply

Tags
previous timestep

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
OpenFOAM - Quick way to delete previous calculation & HowTo get access to variables kriz OpenFOAM 12 March 6, 2023 04:20
How to get multiple outputs from CFX user routine doublestrong CFX 7 April 11, 2017 12:25
Obtain local volume at node/vertex in user routine honcho62 CFX 6 January 19, 2016 07:39
How to access a parameter from a previous timestep Ridley CFX 5 June 15, 2010 07:56
Accessing Variables from Previous Timestep Vinayak Barve FLUENT 1 March 10, 2004 08:40


All times are GMT -4. The time now is 11:20.