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

Looping Profile in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 17, 2020, 12:00
Default Looping Profile in UDF
  #1
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
Hi,,

I am trying to create a temperature profile for the wall using the tutorial. The profile using a formula to define the temperature. The formula has a constant whose value I need to change . So is possible to create a loop of temperature profile for each different value of the constant?

For eg- I save the constants in array named A= [ 100 200 300 400 500].

So is possible to create a loop for defining the UDf of temperature_profile_x where for a particular value of x it takes constant from array.

So if I give i goes from 1 to 5, it should create 5 temperature profile using the 5 different constants values from the array.



Thank you.
manish1308 is offline   Reply With Quote

Old   June 17, 2020, 12:23
Default Loop
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
What is the basis for changing the value? Is it different for different boundaries, or does it depend on time or some other parameter? On what basis should the function choose 2nd or 3rd value instead of 1st or 4th?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 17, 2020, 12:28
Default
  #3
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
Quote:
Originally Posted by vinerm View Post
What is the basis for changing the value? Is it different for different boundaries, or does it depend on time or some other parameter? On what basis should the function choose 2nd or 3rd value instead of 1st or 4th?
Hello,
I want to run the simulations for all the cases. The temperature profile is to be applied on the same wall everytime just the value of the above mentioned constant should change.For each constant i want to create a temperature profile and then for each temperature profile I want to run the simulations.

The idea is to take a .csv file, read the data from it. Store the data in an array. And for each value from the array create a temperature_profile and run the simulation for each case.
Constant here is from the sinusoidal temperature on the 2D wall of the channel.
manish1308 is offline   Reply With Quote

Old   June 17, 2020, 12:43
Default Udf
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Then an array is not a proper approach. Use Input Parameter instead.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 17, 2020, 15:35
Default
  #5
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
Okay. But how will I read a .csv file data in input parameter?
manish1308 is offline   Reply With Quote

Old   June 17, 2020, 16:07
Default Reading from File
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
If you are using Fluent standalone, then a good approach is to define a scheme variable (an rpvar) that represents the value of this parameter. The value can be changed either via command within the journal file or using a scheme list. UDF can read the value of this rpvar and do the calculation accordingly.

If you are using WB, then there is direct option to use Excel within WB, which can read a csv file for input parameters.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 18, 2020, 14:34
Default
  #7
New Member
 
Join Date: Apr 2018
Posts: 2
Rep Power: 0
golukumar40gaon is on a distinguished road
Use parametric analysis
golukumar40gaon is offline   Reply With Quote

Old   June 18, 2020, 15:38
Default
  #8
Member
 
George Corner
Join Date: Dec 2016
Posts: 30
Rep Power: 10
sam_cfdd is on a distinguished road
Hi,

I want to measure particle velocity in a fluidized bed using UDF. I am using Transient mode to see how particle velocity changes in every time step. My question is how I command to UDF in order to determine velocity in each time step.
sam_cfdd is offline   Reply With Quote

Old   June 18, 2020, 15:45
Default Model
  #9
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
It depends on the model being used for particles. Is it Lagrangian or Eulerian? You don't need UDF for any of these. For Lagrangian, you can enable Sampling and then run the simulation. For Eulerian, just write ASCII files with granular phase velocity components or magnitude at each cell.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 18, 2020, 16:02
Default
  #10
Member
 
George Corner
Join Date: Dec 2016
Posts: 30
Rep Power: 10
sam_cfdd is on a distinguished road
Quote:
Originally Posted by vinerm View Post
It depends on the model being used for particles. Is it Lagrangian or Eulerian? You don't need UDF for any of these. For Lagrangian, you can enable Sampling and then run the simulation. For Eulerian, just write ASCII files with granular phase velocity components or magnitude at each cell.
Actually I want to measure granular temperature in each time step. I already write the UDF but I am not sure is it measuring granular temperature every time step or not. I share my UDF below. Please have a look.

#include "udf.h"

DEFINE_EXCHANGE_PROPERTY(user_velo,cell,mix_thread ,s_col,f_col)
{

Thread *thread_g, *thread_s;

/*face_t f;
real t=CURRENT_TIMESTEP;*/

real x_vel_s, y_vel_s, z_vel_s;


thread_g = THREAD_SUB_THREAD(mix_thread, f_col);/* gas phase */
thread_s = THREAD_SUB_THREAD(mix_thread, s_col);/* solid phase*/

x_vel_s = C_U(cell, thread_s);
y_vel_s = C_V(cell, thread_s);
z_vel_s = C_W(cell, thread_s);

/* return x_vel_s
return y_vel_s
return z_vel_s */
}

DEFINE_PROPERTY(user_gran_temp,c,t)
{
real gran_temp;
real x_vel_s;
real y_vel_s;
real z_vel_s;

gran_temp=(x_vel_s*x_vel_s+y_vel_s*y_vel_s+z_vel_s *z_vel_s)/3;

return gran_temp;
}
sam_cfdd is offline   Reply With Quote

Old   June 19, 2020, 06:37
Default UDFs
  #11
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
Both of the UDFs are not doing anything. If you want Granular Temperature, you do not need UDF. Just go to File > Export > During Solution, select ASCII and Granular Temperature under appropriate headings, and chose frequency for writing.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   June 19, 2020, 13:50
Default
  #12
New Member
 
Manish Vankudre
Join Date: Feb 2020
Posts: 15
Rep Power: 6
manish1308 is on a distinguished road
Quote:
Originally Posted by vinerm View Post
If you are using Fluent standalone, then a good approach is to define a scheme variable (an rpvar) that represents the value of this parameter. The value can be changed either via command within the journal file or using a scheme list. UDF can read the value of this rpvar and do the calculation accordingly.

If you are using WB, then there is direct option to use Excel within WB, which can read a csv file for input parameters.
Thank you I will write this.
manish1308 is offline   Reply With Quote

Reply

Tags
fluent, udf and programming


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
please help UDF for velocity profile in y-directio raju Fluent UDF and Scheme Programming 6 April 13, 2019 00:21
UDF Parabolic 2D Velocity Profile Issue chrislyn FLUENT 2 December 11, 2018 13:11
UDF inlet velocity profile mismatch with Fluent ChristineL Fluent UDF and Scheme Programming 15 November 25, 2016 07:45
UDF error - parabolic velocity profile - 3D turbine Zaqie Fluent UDF and Scheme Programming 9 June 25, 2016 20:08
Read profile file from UDF DonQuijote Fluent UDF and Scheme Programming 0 February 18, 2013 12:56


All times are GMT -4. The time now is 17:18.