|
[Sponsors] |
how to access previous timestep by user routine |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 21, 2018, 23:06 |
how to access previous timestep by user routine
|
#1 |
New Member
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8 |
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! |
|
October 21, 2018, 23:45 |
|
#2 |
New Member
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8 |
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. |
|
October 22, 2018, 07:13 |
|
#3 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,854
Rep Power: 144 |
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. |
|
October 22, 2018, 07:16 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,854
Rep Power: 144 |
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. |
|
October 22, 2018, 09:41 |
|
#5 |
New Member
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8 |
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!
|
|
October 23, 2018, 21:34 |
|
#6 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,854
Rep Power: 144 |
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. |
|
October 24, 2018, 04:46 |
|
#7 |
New Member
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8 |
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 |
|
October 24, 2018, 07:33 |
|
#8 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,854
Rep Power: 144 |
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. |
|
October 24, 2018, 08:37 |
|
#9 |
New Member
陈晨
Join Date: Oct 2018
Posts: 7
Rep Power: 8 |
THANK you for reply
Last edited by FWP; November 9, 2018 at 05:34. |
|
Tags |
previous timestep |
|
|
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 |