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

how to visualize new variables written in udf.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 18, 2017, 02:14
Default how to visualize new variables written in udf.
  #1
New Member
 
Hyojeong Lee
Join Date: Sep 2016
Posts: 8
Rep Power: 10
hebe2u. is on a distinguished road
Thank you for your interest.

I'm trying to make a udf to produce custom post-processing variables.

When I make a new variable 'vel2' in user_post.c, what should I do to add the variable to output files.

It cause an error to add the variable 'vel2' to post.in file.
(udf_flag=1 in inputs.in, user_post_flag=1 in udf.in)

Is there something I missed?

Thank you!
hebe2u. is offline   Reply With Quote

Old   January 19, 2017, 16:39
Default
  #2
Member
 
jlemoine's Avatar
 
Jerome Le Moine
Join Date: Jan 2016
Location: Convergent Science, Madison WI
Posts: 50
Rep Power: 10
jlemoine is on a distinguished road
For user defined variables for post-processing, CONVERGE has hardcoded user variables called user1 , user2 and so on. Those variables are set as passives and five are currently available. Here's what needs to be done:
In user_post.c = Use global_passive with user#_index to assign your own variable.
In post.in = Add the user variable name as passive to be able to view them.
If you email support@convergecfd.com, we will be able to give you an example.
__________________
Jerome Le Moine
Support/Application Engineer
CONVERGECFD
jlemoine is offline   Reply With Quote

Old   January 23, 2017, 02:54
Default
  #3
New Member
 
Hyojeong Lee
Join Date: Sep 2016
Posts: 8
Rep Power: 10
hebe2u. is on a distinguished road
Thank you for your reply.

I think you gave me the answer I wanted, But I didn't understand your explanation.(T_T)

CONVERGE has hardcoded user variables called user1 , user2 and so on.
-> This means that I have to use "user1", "user2" and so on as a new variables in user_post.c?

Add the user variable name as passive to be able to view them.
-> So I have to add "user1", "user2" and so on in post.in?

I tried a simple calculation to double the temperature.
When I wrote in user_post.c as below, it worked well.

int user_post(void)
{

int kk;

for (kk=0; kk<tot_num_active; kk++){
global_temp[kk] = 2 * global_temp[kk];
}

return 0;

}

Use global_passive with user#_index to assign your own variable.
-> This means I should use user1_index instead of 'kk' as above?

In this code, I want to use a new variable such as user1 to store the calculated value instead of storing it in global_temp.
So I tried as below.

int user_post(void)
{

int kk;

for (kk=0; kk<tot_num_active; kk++){
user1[kk] = 2 * global_temp[kk];
}

return 0;

}


This source code fails to compile, because 'user1'(or 'global_user1') is undeclared.
When declaring user1(or global_user1) as a double type global variable, compiling succeeds, but CONVERGE solver with post.in including user1 (or global_user1) fails.

Please let me know what is wrong, what should I do.
I would appreciate your explanation.
hebe2u. is offline   Reply With Quote

Old   January 24, 2017, 10:50
Default
  #4
Member
 
jlemoine's Avatar
 
Jerome Le Moine
Join Date: Jan 2016
Location: Convergent Science, Madison WI
Posts: 50
Rep Power: 10
jlemoine is on a distinguished road
In user_post.c the routine could look like this:
for (kk=0; kk<tot_num_active; kk++)
{
global_passive[kk*numpassive+user1_index]= your calculation
}
In post.in add under <cells>
passive(user1).
You can refer to our advanced CONVERGE training UDFs lecture on our download page (https://download.convergecfd.com/) under CONVERGE_2.3>Training_Materials>Advanced_CONVERGE_ Training>UDFs.pdf
__________________
Jerome Le Moine
Support/Application Engineer
CONVERGECFD
jlemoine 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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
How can we save flow variables in a file by udf? moh.sob FLUENT 5 December 25, 2012 10:21
udf to access variables from a different case yashmash Fluent UDF and Scheme Programming 6 January 25, 2012 10:10
UDF to calculate phase-averaged turbulence variables in a periodic flow ShuangqingXu Fluent UDF and Scheme Programming 0 October 27, 2011 00:48
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 20:14.