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

Fetching face temperature(F_T) at zero iterations.

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2015, 10:57
Default Fetching face temperature(F_T) at zero TIMESTEPS
  #1
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear all,

I am currently doing a project on wood sphere gasification, where there will be a sphere in the middle of a cylindrical flow domain having "velocity-inlet" on one side and "pressure-outlet" on other side.

While, since the gasification involves devolatilization (evaporation in simple). There will be a mass flow of gases from the surface of the sphere. This is dependent on "time, mass, surface area and surrounding temperature".

Thankfully with the help of a member of this group, I was able to obtain the mass flow rate from the sphere surface which is currently "dependent" on "time" and "mass".

As a next step I was trying to include "flow domain (cylinder)" temperature as a variable deciding the mass flow rate from the surface of the sphere.

I have proceeded with a separate zone surrounding the sphere inside a cylinder. Using this Zone ID, I am trying to use F_T(f,t,i) to find the temperature of the sphere surrounding.

If I use the code having F_T(f,t,i) or C_T(c,t,i). The solver is giving ACCESS VIOLATION error.

From what I have seen in some cases, "Energy equation usually starts solving after few iterations say 3 or 4 iterations.
QUESTION:

Is this the reason for ACCESS VIOLATION error??

Any help on this regard will be of great use for me.

Thanks in advance,
Bharadwaj B S

Last edited by Bharadwaj B S; March 31, 2015 at 02:34.
Bharadwaj B S is offline   Reply With Quote

Old   March 30, 2015, 17:19
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Before we get started, check you have the energy equation enabled under models (this oversight is common). If you're still receiving this access violation error then try restricting your access to C_T until after the first iteration (if statement checking the current time step/iteration).

Typically, the reason for an access violation error is when you're trying to access a variable that doesn't exist (or perhaps is empty/NULL).

I'd be surprised if the temperature is not available from the first iteration because we initialise the temperature field before solving.
`e` is offline   Reply With Quote

Old   March 31, 2015, 02:32
Default Energy is ON
  #3
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear e,

I have switched on "energy equation". I also thought of same error. But that part I think it is clear.

I will try by starting the code after few "time steps" say 4 or 5. And will let you know as soon as possible.

And one more question.

"Do I have to make a "face" or "cell loop" to get the temperature of the zone or the command "C_T(c,t,i) or F_T(f,t,i)" in single is enough to fetch the temperature of the surrounding zone??.

Because currently I have used face looping with F_T macro, is that what is giving an error of "ACCESS VIOLATION"??

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   March 31, 2015, 03:29
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Try both C_T and F_T to determine if either or both of these macros cause the access violation error. The local temperature in a cell is given by the macro C_T; I'm unsure why you're looping or looking at face temperatures.
`e` is offline   Reply With Quote

Old   March 31, 2015, 03:38
Default Thank you.
  #5
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear e,

I will try both C_T and F_T, I was quizzed about looping. Now I will try with only "C_T and F_T" in single.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 07:16
Default reason
  #6
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear e,

I am using face looping because I want to find the average temperature of a zone (fluid flow). And use that value in some other function.

I tried with F_T(f,t,i); it is working fine. It is not giving access violation. But it is showing divergence TEMPERATURE.

This is the code I am using.

UDF
DEFINE_ADJUST(tempt_calc,d)
{

Thread *t2;
face_t f2;
real tempt=0.0;

d = Get_Domain(1);
t2 = Lookup_Thread(d,ID2);

Message("At is %e\n",At);/*from previous function for surface area*/

begin_f_loop(f2,t2)
{
tempt=tempt+(F_T(f2,t2)*F_UDMI(f,t,0));
/*F_UDMI(f,t,0) is from previous function for "surface area"*/
}
end_f_loop(f2,t2)

tempt=tempt/F_UDMI(f,t,0);/*area avging*/
F_UDMI(f2,t2,1)=tempt;

Message("Averaged tempt is %e\n",F_UDMI(f2,t2,1);
}


When I use this I am getting "Divergence error". So I changed the cycle type of ENERGY to "F cycle" and Stabilization method to BCGSTAB.

The simulation runs but The temperature keeps on "increasing" every TIMESTEP (transient analysis).

Please go through the UDF and suggest me for changes so that I can get a constant value of average temperature or at least, least varying average temperature.

Thanks in advance,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 08:30
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
The simulation runs but The temperature keeps on "increasing" every TIMESTEP (transient analysis).
I can read this in two ways.

1. The simulation runs, and the temperature in your simulation (the one you get when you plot temperatures) is increasing.
2. The simulation runs, and the number that this UDF shows ("Averaged tempt is ..." is increasing.

Which one is it? Or both?
pakk is offline   Reply With Quote

Old   April 3, 2015, 09:38
Default 2nd
  #8
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

Its second one which is increasing.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 09:47
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Ok, then the mistake must be in your current UDF.

Looking at the code, I am surprised it compiles. You use variables "f" and "t" that are not defined. So you multiply the temperature of the cell in the loop by F_UDMI of an undefined face. This is very strange.
But after that, you divide your result by that same unknown F_UDMI. So first you multiply, then you divide. So it does nothing...

And then you say "F_UDMI(f2,t2,1)=tempt;". What is f2 supposed to be here? You used f2 inside the loop, but you are now outside the loop. It is undefined here...

Didn't you get errors and warnings when you compiled this UDF???
pakk is offline   Reply With Quote

Old   April 3, 2015, 09:55
Default Definition
  #10
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear e,

f and t are declared GLOBALLY but I did not know that I have to define them with numbers. F_UDMI(f,t,0) is from a previous function which is for calculation of surface area of sphere which is present inside a cylindrical flow domain.

Here F_UDMI(f,t,0) is the area of a sphere surface which is already calculated.

f2,t2 are related to the zone surrounding the sphere which is a cylindrical flow domain.

I saw one example where temperature is calculated as area average. IF I AM WRONG IN CONCEPT OR IN UDF, CORRECT ME, please.

Message is to know what is the value of tempt after completion of the loop.

Please correct me if I am anywhere wrong. I am still learning how to write UDF.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 09:59
Default Mistake
  #11
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

I should have mentioned all this before. Its a mistake from my side. Please pardon me.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 10:03
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
It's ok, I see you are still learning. But it is hard to say what you did wrong, when I don't know why you did things.

I have tried to put comments next to your code, guessing what you tried to do. Can you check if I guessed your intentions right? (Especially the last three comments?)

Code:
DEFINE_ADJUST(tempt_calc,d)
{

Thread *t2;                      /*t2 will be the thread of ID2*/
face_t f2;                       /*f2 will be the face in the loop */
real tempt=0.0;                  /*tempt will be the sum of temperatures */

d = Get_Domain(1);               /* get the domain */
t2 = Lookup_Thread(d,ID2);       /* make t2 the required thread */

Message("At is %e\n",At);        /*from previous function for surface area*/

begin_f_loop(f2,t2)              /*let f2 be all faces of the thread */
{
tempt=tempt+(F_T(f2,t2)*F_UDMI(f,t,0)); 
                                 /*add the temperature of f2 to "tempt", with the surface area of the ball as weight factor? */
}
end_f_loop(f2,t2)

tempt=tempt/F_UDMI(f,t,0);       /*divide "tempt" by the surface area of the ball?*/
F_UDMI(f2,t2,1)=tempt;           /* what is the goal of this? */

Message("Averaged tempt is %e\n",F_UDMI(f2,t2,1);
}
pakk is offline   Reply With Quote

Old   April 3, 2015, 10:07
Default Okay
  #13
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

I think I should have used the area of the CYLINDRICAL flow domain area instead of the sphere i.e, using f2 and t2 I should have found out the area of ID2(zone).

Yes it is totally conceptually wrong.

Am I interpreting it in correct way?

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 10:10
Default F_UDMI(f2,t2,1) use
  #14
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

I just wanted to store the value of final value of tempt to F_UDMI(f2,t2,1).

Is that possible?

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 10:14
Default
  #15
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Am I interpreting it in correct way?
It seems like you are interpreting my post of a few minutes ago as if I said that your approach was completely wrong.

If that is so, then you are interpreting it in the wrong way.

I said that I did not understand why you did some things, and asked you to clarify this. I did not make any judgement about if it was conceptually wrong or right, only that I did not understand it.

Quote:
I just wanted to store the value of final value of tempt to F_UDMI(f2,t2,1).
I don't believe you wanted that. I think you thought that this was the best approach to achieve something else. What you really wanted was something else. Maybe you wanted to show the final value of tempt on the screen? Or use the final value of tempt in a different calculation? What was your real goal?
pakk is offline   Reply With Quote

Old   April 3, 2015, 10:18
Default Sorry
  #16
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

Yes I was about to store that value in UDM (F_UDMI(f2,t2,1)) so that I could use that in other calculations.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 10:26
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
So you goal is to make the value available in other calculations.
And you attempted method was to use a UDM.

But a UDM is in this case not a good method. If you use a UDM, memory is reserved for all cells in your domain. So if you have a simulation with one million cells, you can store one million numbers in your UDM, one for each cell. But you don't need to store one number for every cell, you only need to store one number for your entire simulation. So a UDM is not the best choice.

What I would do, is simply make "tempt" a global variable. So declare it outside this function. In that way, all functions can access it.


But you still haven't explained what the goal of doing manipulations with F_UDMI(f,t,0) in your code is. I don't understand that. What did you try to achieve with that?
pakk is offline   Reply With Quote

Old   April 3, 2015, 10:36
Default Clarification.
  #18
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

I was confused, I have used the surface area of sphere instead of flow domain. And I think I should have multiplied the MAGNITUDE of area Vector of the flow domain instead of total area(At of sphere), i.e,

here "At" is the total calculated area of sphere previously I had assigned the total surface area of the sphere "At" to F_UDMI(f,t,0).

So I thought by multiplying and dividing "At" I would get the area averaged temperature.

But I think I should have multiplied by magnitude of "area vector" of FLUID DOMAIN and then at the end of loop I should have DIVIDED by TOTAL AREA of FLUID DOMAIN.

Instead I did a mistake by multiplying and dividing tempt with SAME NUMBER. So it was of no use. And that too the surface area values are of SPHERE.

Thank you,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 3, 2015, 10:39
Default
  #19
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Hi,

I think you are now thinking in the right direction!

But maybe you now understand that assigning the total surface area of the sphere to F_UDMI(f,t,0) was a silly idea; you should have just assigned it to the global variable "At".
pakk is offline   Reply With Quote

Old   April 3, 2015, 10:43
Default Yes
  #20
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear pakk,

Yes my mind never thought of using GLOBAL variable. And I was only aware of storing a value by using UDMs.

Huge thanks from my side. I will make the changes accordingly. And run the simulations. Will post the results as soon as possible.

Thanks a ton,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Reply

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
Maximum number of iterations exceeded chtmultiregionsimpleFoam Moncef OpenFOAM Running, Solving & CFD 28 July 13, 2020 15:26
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Courant-number explodes after a lon while (icoFoam) Rody- OpenFOAM Running, Solving & CFD 6 January 29, 2014 05:27
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 04:34


All times are GMT -4. The time now is 09:38.