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

Pass data from DEFINE_AT_END to DEFINFE_PROFILE by UDM(or C_YI(c,t,i))

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2020, 22:18
Post Pass data from DEFINE_AT_END to DEFINFE_PROFILE by UDM(or C_YI(c,t,i))
  #1
New Member
 
John mayer
Join Date: Jun 2020
Posts: 3
Rep Power: 6
John mayer is on a distinguished road
Hello everyone,
I wrote a UDF that calculates the heat flux in DEFINE_AT_END and stores it in UDM(or C_YI(c,t,i)) in a Eulerian model. Then gets the UDM(or C_YI(c,t,i)) in DEFINFE_PROFILE and calculates.
However, the DENINFE_PROFILE doesn't get the data from UDM, and receives a fatal signal while the C_YI(c,t,i) was used to stores datas.
I had a test in a single-phase model with C_YI(c,t,i), and it works well.

Thanks for any suggestion,
John mayer
John mayer is offline   Reply With Quote

Old   June 8, 2020, 22:25
Default
  #2
New Member
 
John mayer
Join Date: Jun 2020
Posts: 3
Rep Power: 6
John mayer is on a distinguished road
Quote:
Originally Posted by John mayer View Post
Hello everyone,
I wrote a UDF that calculates the heat flux in DEFINE_AT_END and stores it in UDM(or C_YI(c,t,i)) in a Eulerian model. Then gets the UDM(or C_YI(c,t,i)) in DEFINFE_PROFILE and calculates.
However, the DENINFE_PROFILE doesn't get the data from UDM, and receives a fatal signal while the C_YI(c,t,i) was used to stores datas.
I had a test in a single-phase model with C_YI(c,t,i), and it works well.

Thanks for any suggestion,
John mayer
This is my UDF.
#include "udf.h"
#include "mem.h"
int ID=15;
int sum=0.;
int cc=0.;
DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d;
Thread *t;
face_t f;
cell_t c;
real h;
real q;
real dt=1.;
real k=1.2;
real cc2;
Thread *t_steel;
d = Get_Domain(2);

thread_loop_c (t,d)
{
t_steel=THREAD_SUB_THREAD(t,S_PHASE);
begin_c_loop (c,t)
{
C_YI(c,t,0)=1/C_UDMI(c,t,0);
}
end_c_loop (c,t)
}
}

DEFINE_PROFILE(up_flux_profile,t,i)
{
Domain *d;
face_t f;
cell_t c;
real h;
real x[ND_ND];
real k=1.2;
real q;
real dt=1.;

Thread *t_steel;
t_steel=THREAD_SUB_THREAD(t,P_PHASE);
begin_c_loop(c,t)
{
C_PROFILE(c,t,i)=C_YI(c,t,0);
}
end_c_loop(c,t)
}

Last edited by John mayer; June 8, 2020 at 22:42. Reason: something is wrong
John mayer is offline   Reply With Quote

Old   June 9, 2020, 02:19
Default
  #3
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you code can't work

do you calculate heat flux (flux through boundary) or heat source (heat, applied to volume) ?

Code:
C_YI(c,t,0)=1/C_UDMI(c,t,0);
C_UDMI(c,t,0) is not defined, most likely you are dividing by 0. But C_UDMI(c,t,0) could contain ANY value inside

why do you use DEFINE_EXECUTE_AT_END but not DEFINE_ADJUST ?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 9, 2020, 03:18
Default
  #4
New Member
 
John mayer
Join Date: Jun 2020
Posts: 3
Rep Power: 6
John mayer is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
you code can't work

do you calculate heat flux (flux through boundary) or heat source (heat, applied to volume) ?

Code:
C_YI(c,t,0)=1/C_UDMI(c,t,0);
C_UDMI(c,t,0) is not defined, most likely you are dividing by 0. But C_UDMI(c,t,0) could contain ANY value inside

why do you use DEFINE_EXECUTE_AT_END but not DEFINE_ADJUST ?
Thank you for your reply! I had patched the value to the C_UDMI(c,t,0). And the value of C_YI(c,t,0) can be acquired in the contours. The PROFILE would report the error while the C_YI(c,t,0) was used in the boundary condition(bu the C_T(c,t) would not report error).
John mayer is offline   Reply With Quote

Old   June 9, 2020, 23:13
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
how many questions can you see in my previous message?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   June 15, 2020, 05:16
Default C_yi
  #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
That's incorrect usage of C_YI. C_YI is not a generic memory like C_UDM. It stores mass fractions of species and is available only if species transport is enabled. And if that is the case, then Fluent will overwrite C_YI values based on the solution of species transport. So, do not use C_YI the way you are using it. You can use more than one UDM though.

And then, you need to store something in UDM before using it. The code does not store any value in UDM. Furthermore, you don't need two functions. You can do all the calculation within DEFINE_PROFILE.
__________________
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

Reply

Tags
udm; udf; profile;


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
[OpenFOAM] How to get the coordinates of velocity data at all cells and at all times vidyadhar ParaView 9 May 20, 2020 21:06
Data Produced From Fine Marine Cant Match with The Experimental Data PeiSan Fidelity CFD 4 August 23, 2014 06:33
Problem running in parralel Val OpenFOAM Running, Solving & CFD 1 June 12, 2014 03:47
[OpenFOAM] saving data in paraview aylalisa ParaView 3 May 31, 2014 12:38
[General] Warping Cells by Vectors? ronwelty ParaView 10 April 29, 2014 06:52


All times are GMT -4. The time now is 22:23.