# Initialization Additional Variables for time integration

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

 October 26, 2013, 06:07 Initialization Additional Variables for time integration #1 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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

 October 26, 2013, 06:59 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,704 Rep Power: 98 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.

 October 26, 2013, 07:21 #3 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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.

 October 27, 2013, 06:24 #4 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,704 Rep Power: 98 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?

 October 27, 2013, 09:57 #5 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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

 October 27, 2013, 17:40 #6 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,704 Rep Power: 98 Have you seen the CFX built in wall condensation model? What do you need which it does not already have?

 October 27, 2013, 17:51 #7 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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

 October 27, 2013, 18:12 #8 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 12,704 Rep Power: 98 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.

 October 27, 2013, 18:18 #9 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 I'll tell my friend to ask to the support. Thanks for your help. It has been a pleasure to talk with you.

 October 29, 2013, 12:56 #10 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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...

 October 29, 2013, 14:01 #11 Senior Member   Join Date: Feb 2011 Posts: 288 Rep Power: 9 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?

 October 31, 2013, 13:41 #12 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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.

 December 10, 2013, 12:46 #13 New Member   HLo Join Date: Dec 2013 Location: Germany Posts: 26 Rep Power: 4 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

 December 11, 2013, 18:44 #14 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 Hi HLo , Your solution scares me to death, but I will try. Thanks PranjalNewton likes this.

 December 12, 2013, 03:14 Additonal Variables #15 New Member   HLo Join Date: Dec 2013 Location: Germany Posts: 26 Rep Power: 4 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

December 12, 2013, 05:20
#16
Senior Member

Lance
Join Date: Mar 2009
Posts: 598
Rep Power: 12
Quote:
 Originally Posted by HLo 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.

December 12, 2013, 06:53
Kinematic Diffusivity
#17
New Member

HLo
Join Date: Dec 2013
Location: Germany
Posts: 26
Rep Power: 4
Hallo Lance,
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

Lo
Attached Images
 cfx.png (19.0 KB, 57 views)

 December 12, 2013, 07:02 #18 Senior Member   Lance Join Date: Mar 2009 Posts: 598 Rep Power: 12 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.

 December 12, 2013, 07:15 diffusivity in solids #19 New Member   HLo Join Date: Dec 2013 Location: Germany Posts: 26 Rep Power: 4 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.

 January 23, 2014, 02:53 #20 Member   Join Date: Apr 2010 Location: Pisa / Italy Posts: 60 Rep Power: 8 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

 Tags loop, time integral, wall condesation model

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post N.P CFX 5 December 1, 2011 08:47 charlotte CFX 4 March 22, 2011 10:14 ariel CFX 9 April 2, 2008 00:41 Tuks CFX 0 November 8, 2005 03:09 lego CFX 3 November 5, 2002 21:09

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