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

Return the number of cells on one side of the wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2018, 21:32
Default Return the number of cells on one side of the wall
  #1
New Member
 
newuser
Join Date: Dec 2017
Posts: 11
Rep Power: 8
new_cfd is on a distinguished road
I'm trying to write a program that linearly increases the heat flux on one side of the wall. How do I determine the number of cells in the first column of the mesh? Please do help.
new_cfd is offline   Reply With Quote

Old   April 18, 2018, 03:41
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
I'm trying to write a program that linearly increases the heat flux on one side of the wall.
So go to the help, see that there is an example for a parabolic profile, and change it to linear...
Code:
#include "udf.h"
DEFINE_PROFILE(lin_incr,t,i) {
 face_t f;
 float x[ND_ND];

 begin_f_loop(f,t) {
  F_CENTROID(x,f,t);
  F_PROFILE(f,t,i) = 213.12512 + 1.135 * x[0]; 
   /* change the coefficients above to what you need */
 }
 end_loop(f,t);
}
Quote:
How do I determine the number of cells in the first column of the mesh?
Why do you want to know this? It has nothing to do with your first question.
pakk is offline   Reply With Quote

Old   April 18, 2018, 19:42
Default
  #3
New Member
 
newuser
Join Date: Dec 2017
Posts: 11
Rep Power: 8
new_cfd is on a distinguished road
Thanks a lot.
I thought I would need it to determine the rate of increase.
new_cfd is offline   Reply With Quote

Old   April 18, 2018, 21:45
Default Error message for code
  #4
New Member
 
newuser
Join Date: Dec 2017
Posts: 11
Rep Power: 8
new_cfd is on a distinguished road
Also, how do I linearly increase from 0 to 500?

Last edited by new_cfd; April 19, 2018 at 01:13.
new_cfd is offline   Reply With Quote

Old   April 19, 2018, 02:45
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Choose the coefficient such that it is 0 on one end and 500 on the other end.
pakk is offline   Reply With Quote

Old   April 19, 2018, 05:38
Default
  #6
New Member
 
newuser
Join Date: Dec 2017
Posts: 11
Rep Power: 8
new_cfd is on a distinguished road
I used the code

F_PROFILE(f,t,i) = 0+1.25*x[0]

Will the above work? I aimed to increase from 0 to 500 by increasing each cell by 1.25.
new_cfd is offline   Reply With Quote

Old   April 19, 2018, 05:43
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
This will give 0 at x=0m, and 500 at x=400m.

So if you have a 400 meter long boundary, starting at x=0, then it works.

If not, do some (simple) mathematics. You (should) know at which x-position you want zero heat flux, and you (should) know at which x-position you want 500 heat flux. So you have to points, find a line that goes through these two points, write down the equation, and put this equation in your udf.
pakk is offline   Reply With Quote

Old   April 20, 2018, 04:11
Default
  #8
New Member
 
newuser
Join Date: Dec 2017
Posts: 11
Rep Power: 8
new_cfd is on a distinguished road
It worked for the right vertical wall. But, for my left vertical wall it did not. I used 0 + 1250 y[0].
Can you tell me what to use for the left one? One time when I tried, the heat flux continued to the bottom portion as well and didn't stop.

Also, how do I know from which cell the centroid calculation starts? From the top most cell or bottom?

Last edited by new_cfd; April 20, 2018 at 05:28.
new_cfd is offline   Reply With Quote

Reply


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
decomposePar problem: Cell 0contains face labels out of range vaina74 OpenFOAM Pre-Processing 37 July 20, 2020 05:38
[OpenFOAM.org] OF2.3.1 + OS13.2 - Trying to use the dummy Pstream library aylalisa OpenFOAM Installation 23 June 15, 2015 14:49
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 17:12
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 03:23
[snappyHexMesh] external flow with snappyHexMesh chelvistero OpenFOAM Meshing & Mesh Conversion 11 January 15, 2010 19:43


All times are GMT -4. The time now is 15:44.