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

Initialization Additional Variables for time integration

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2013, 07:07
Exclamation Initialization Additional Variables for time integration
  #1
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Hi everyone!

Hope someone can help me. I have to calculate a time integral variable in an unsteady simulation. As read in other topics I have defined my variable A and edited it adding " Update Loop = TRANS_LOOP " so that in each time step A = A (t-1) where t is time step. ( as also described in http://www.edr.no/blogg/ansys_blogge...rations_in_cfx )

I created a function AI defined as " A+B*Time Step Size" where B is the time derivative of A.

My problem is that even initializing with a .res file containg A=A0, CFX give me error. I have also tried enabling " allow cbck for initcon " in expert parameter.

Any advice? Using an if() or step() function has no effect
Atze is offline   Reply With Quote

Old   October 26, 2013, 07:59
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
This option is not a supported option so I would expect to have problems with it - like you can see.

If you need this time integrated value for post processing I recommend sending it to a monitor point and doing the time integration in a maths package like matlab, python/numpy or even excel if you must.

If you need this time integrated variable during the simulation (as it couples back to some solution parameter) then I would do it in user fortran. Then you have proper control over these sort of things and can do the integration properly.
ghorrocks is offline   Reply With Quote

Old   October 26, 2013, 08:21
Default
  #3
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Thanks for your answer ghorrocks

Unfortunatly I need a countor plot of this variable all over the time, so I can't use matlab. I'm using wall condensation model but the only variable available is wall condensation mass flux (kg m^-2 s^-1), instead of condense concentation (kg m^-2).... probably I could set a Phase change simulation (with Air Vapour and Water), but I'm afraid it could be too expensive in terms of computational time. Using fortran give me some problem in partitioning on a hpc cluster, but I'm working on it.
Atze is offline   Reply With Quote

Old   October 27, 2013, 06:24
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
I suspect you will have to use fortran then. And yes, getting this to work over parallel is an additional challenge.

What is the variable you are integrating over time anyway? And why do you need it?
ghorrocks is offline   Reply With Quote

Old   October 27, 2013, 09:57
Default
  #5
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
I want to simulate condensation on a window. A friend of mine asked me to help him for an exam at university. He has to verify if condensation occurs and where on the window. A simple model with humid air gives us a map of the relative humidity but in certain points we find 110% RH and more. This is because water mass fraction is constant in the room while if condensation occurs it should decrease. The problem is that wall condensation model actually don't give any information about condensation layer but creates a sink/source for water mass fraction. The only outputs are condensation mass transfer and condensation heat flux. I usually use fluent ( which is easier ) but unfortunately he has to use cfx
Atze is offline   Reply With Quote

Old   October 27, 2013, 17:40
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Have you seen the CFX built in wall condensation model? What do you need which it does not already have?
ghorrocks is offline   Reply With Quote

Old   October 27, 2013, 17:51
Default
  #7
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Yes. I was trying to use that model. I only need to se condense/fog contour on the window. How it evolves through time, aside water mass concentration in the room... But unfortunately it's not possible using this model
Atze is offline   Reply With Quote

Old   October 27, 2013, 18:12
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,871
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
I have not used the model so am not familiar with its details. But keeping track of the amount of material condensed seems pretty basic stuff which should already be in there. Have you talked to ANSYS support about this? There probably is a built-in option which already keeps track of the amount of condensed material over time.
ghorrocks is offline   Reply With Quote

Old   October 27, 2013, 18:18
Default
  #9
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
I'll tell my friend to ask to the support. Thanks for your help. It has been a pleasure to talk with you.
Atze is offline   Reply With Quote

Old   October 29, 2013, 12:56
Default
  #10
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
By the way.... for your experience, ghorrocks, is it possible to write a perl ( power syntax ) code in order to obtain fog/condensation layer just in the postpro? This code should perform the loop A(t) = A(t-1)+A(t-2)+...A(0) for t = selected time step.

I really prefer fluent...
Atze is offline   Reply With Quote

Old   October 29, 2013, 14:01
Default
  #11
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
I think that you need to make one step of solution with additional variable set through algebraic equation option in domain setup with value = A0. Then you need to restore your expression and continue calculation. BTW what error did you get?
Antanas is offline   Reply With Quote

Old   October 31, 2013, 13:41
Default
  #12
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Hi Antanas,

At a first time it gave me an error such like " memerr - vertx_solv " ( I haven't the .out file with me now ). Now I have fixed it initializing A = B*timestepsize. In this way it calculate A only on the boundaries with wall condensation model activated.

When I start a new simulation ( or modify the def on run ) initializing with the previous .res file, CFX simply deletes my variable.... so I haven't it in the post ( It's really frustrating...) or better saying, I have it in the first time step, and then disappears.
Atze is offline   Reply With Quote

Old   December 10, 2013, 12:46
Default
  #13
HLo
New Member
 
HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 13
HLo is on a distinguished road
Hello,
I looked for time integration of variables/expressions too and found a way to do without fortran and initialisation steps, it is not too obvious but straightforward if one reads deeper into the manual.
The trick is to have CFX solve the integration for an additional variable psi with a diffusion equation (Solver Theory Guide 1.6.2) in one of the domains.
If one assumes a almost 0 (1e-9) kinematic diffusivity then the nabla-stuff is practically zero and the solver solves for d(rho*phi)/dt = source offering rho*phi = integral(source) and source is the expression to be integrated.
For specific not volumetric psi is calculated as integral of an expression when as source term 'expr to be integrated*Density' is given, this way even compensating for regions with different density (proved in an example, but not sure if density iy varying to much)
Assume for a heating control you need a PI-control, so one needs for power: integr.coeff*integral(delta T) + prop.coeff(delta T) so there is the need for a integration of delta T:
0) CAVEAT: Because in steady state runs with automatic time scale CFX does not use a "real" time step, this kind of integration is weighted form of the "real" integration with an unknown weight factor (I'm not sure but I suppose even a time-varying weight)
But it should be good enough for the PI control as there are coefficients also.
To force a "real" integral give physical timesteps in the domain types where the integral is solved (solid or fluid)
1) create an expression for delta T, example: delta T = desired Temp - VolumeAve(Temperature)@heating
2) create an additional variable 'TempInt' of type Specific and units [K s]
3) in one domain (best a solid)->Tab:Fluid or Solid Models activate 'TempInt' as Diffusive Transport Equation and specify 0 or 1e-9 kinematic diffusivity. (with 0 the solver will complain but solves, though)
4) the domain needs a subdomain to apply the source term, so create a dummy one if a subdomain is not needed anyway
5) in subdomain->Tab:Sources activate source term for 'TempInt' and enter following source expression: delta T*Density and for Source Coeff -1, or don't activate
6) cfx will complain to define a 'TempInt' condition at boundaries of the domain, simply set to 'zero flux'
7) Temperature integral is accessible via volumeAve(TempInt)@...

Good luck
HLo is offline   Reply With Quote

Old   December 11, 2013, 18:44
Default
  #14
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Hi HLo ,
Your solution scares me to death, but I will try. Thanks
PranjalNewton and Saeef like this.
Atze is offline   Reply With Quote

Old   December 12, 2013, 03:14
Default Additonal Variables
  #15
HLo
New Member
 
HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 13
HLo is on a distinguished road
Hello Atze,
you are right, it sounds some kind of scary.
I am scared myself, because I didn't find any hint in documentation or web, whether the co-solution with additional variables influences the full solution internally somehow.
And when I read into the docs the term "Diffusive Transport Equation" (DTE) confused me. There is a similar Eq. 1-172 in Chap. 1.6.1 called "General Transport Equation" (GTE) which includes a motion term. It is poorly documented, whether CFX actually omitting motion when choosing DTE.
And the density compensation thing ...?. Best to use a domain with spatially constant density, then there is no doubt that the differential equation is solved correctly throughout the domain.

Let me know about your experiments' results.
Thanks
Lo
HLo is offline   Reply With Quote

Old   December 12, 2013, 05:20
Default
  #16
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Quote:
Originally Posted by HLo View Post
If one assumes a almost 0 (1e-9) kinematic diffusivity then the nabla-stuff is practically zero and the solver solves for d(rho*phi)/dt = source offering rho*phi = integral(source) and source is the expression to be integrated.
[...]
3) in one domain (best a solid)->Tab:Fluid or Solid Models activate 'TempInt' as Diffusive Transport Equation and specify 0 or 1e-9 kinematic diffusivity. (with 0 the solver will complain but solves, though)
I believe that if you do not tick the check box for kinematic diffusivity, it is not included at all, i.e. no need for 1e-9 values.
Lance is offline   Reply With Quote

Old   December 12, 2013, 06:53
Default Kinematic Diffusivity
  #17
HLo
New Member
 
HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 13
HLo is on a distinguished road
Hallo Lance,
thanks you for your remark.
Unfortunately in my CFX-Pre-UI there is no checkbox to exclude diffusivity, if one chooses the equation model for the variable in a domain.
In my case a value is mandatory.
See attached image

I talk about CFX 14.5.7

Lo
Attached Images
File Type: png cfx.png (19.0 KB, 91 views)
HLo is offline   Reply With Quote

Old   December 12, 2013, 07:02
Default
  #18
Senior Member
 
Lance
Join Date: Mar 2009
Posts: 669
Rep Power: 22
Lance is on a distinguished road
Interesting. The checkbox is there, but only for fluid domains. It seems that for solid domains you have to specify a kinematic diffusivity for an AV. Probably because there is no convective transfer in solids.
Lance is offline   Reply With Quote

Old   December 12, 2013, 07:15
Default diffusivity in solids
  #19
HLo
New Member
 
HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 13
HLo is on a distinguished road
Hello Lance,
I see. As I didn't do more detailed tests on the density concerns in fluid domains and in my current model(s) there ARE solid domains, I'd better rely on those. Maybe it is even better to include a tiny dummy solid domain somewhere if you want to use the proposed technique.
HLo is offline   Reply With Quote

Old   January 23, 2014, 02:53
Default
  #20
Member
 
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16
Atze is on a distinguished road
Hi HLo,

Sorry for late answer. I tried your method and It seems to work well. Thanks. By the way I suggested my friend to switch to Fluent. With Eulerian film model It's much easier and efficient.

I wonder why Mr. Ansys do not implement same models in its software -_-

Thanks and have a nice day
Atze is offline   Reply With Quote

Reply

Tags
loop, time integral, wall condesation model


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
ADDITIONAL VARIABLES LIMITERS N.P CFX 5 December 1, 2011 08:47
emag beta feature: charge density charlotte CFX 4 March 22, 2011 10:14
additional variables' effect ariel CFX 9 April 2, 2008 01:41
user SUBROUTINE for additional variables Tuks CFX 0 November 8, 2005 03:09
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 05:40.