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

Why i can't change injection through DEFINE_DPM_INJECTION_INIT

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 4, 2016, 00:08
Default Why i can't change injection through DEFINE_DPM_INJECTION_INIT
  #1
New Member
 
Weijia Qian
Join Date: Mar 2016
Posts: 6
Rep Power: 10
Weijia Qian is on a distinguished road
Hi, i hope anyone could help me or give me some advices.

The problem is: I create a surface injection in GUI, and the flow is unsteady and particle tracking is also unsteady. Then i want to change the particle temperature through UDF. the UDF can be built, loaded and hooked, but it does no change to the particle temperature at all. I also tried a DEFINE_ADJUST, and the problem is same.

the UDF is:
#include "udf.h"

DEFINE_DPM_INJECTION_INIT(particle, I)
{

Particle *p;
Message("Initializing Injection qwj: %s\n",I->name);


loop(p,I->p_init)
{
P_INIT_TEMP(p)=1500;
P_T(p)=1400;
}

}
Weijia Qian is offline   Reply With Quote

Old   March 8, 2016, 17:14
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
This approach should work fine (both the DEFINE_DPM_INJECTION_INIT and DEFINE_ADJUST macros). Are you sure this macro is being called correctly? Try printing a message to the screen within the loop including the particle ID:

Code:
Message("Particle ID = %d\n",p->part_id);
`e` is offline   Reply With Quote

Old   March 8, 2016, 21:56
Default
  #3
New Member
 
Weijia Qian
Join Date: Mar 2016
Posts: 6
Rep Power: 10
Weijia Qian is on a distinguished road
Quote:
Originally Posted by `e` View Post
This approach should work fine (both the DEFINE_DPM_INJECTION_INIT and DEFINE_ADJUST macros). Are you sure this macro is being called correctly? Try printing a message to the screen within the loop including the particle ID:

Code:
Message("Particle ID = %d\n",p->part_id);
Thanks your help.
I tried, and there is no message show the particle ID. When build the UDF, it shows that warning C4113: void (*)() and void (*)(void) have different parameter list.
I think UDF cannot create a particle when we need one in the solving process via UDF, so i have turned to OpenFOAM.
Weijia Qian is offline   Reply With Quote

Old   March 9, 2016, 03:06
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Quote:
Originally Posted by Weijia Qian View Post
Thanks your help.
I tried, and there is no message show the particle ID.
That means your code is not run. Something is wrong in the way you built or hooked the code.

Quote:
I think UDF cannot create a particle when we need one in the solving process via UDF,
I am not saying that this conclusion is wrong, but you can not base this on the things you tried before. Your code was not executed, so nothing you could have possibly written in the code had any effect.

Quote:
so i have turned to OpenFOAM.
Well, OpenFoam certainly is more flexible than Fluent. But you will encounter more problems similar to the one above, and if you give up so quickly, you will not get anywhere...
pakk is offline   Reply With Quote

Old   March 9, 2016, 05:25
Default
  #5
New Member
 
Weijia Qian
Join Date: Mar 2016
Posts: 6
Rep Power: 10
Weijia Qian is on a distinguished road
Quote:
Originally Posted by pakk View Post
That means your code is not run. Something is wrong in the way you built or hooked the code.


I am not saying that this conclusion is wrong, but you can not base this on the things you tried before. Your code was not executed, so nothing you could have possibly written in the code had any effect.


Well, OpenFoam certainly is more flexible than Fluent. But you will encounter more problems similar to the one above, and if you give up so quickly, you will not get anywhere...
thanks, i hook the UDF in the UDF tab of the injection.
Weijia Qian 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
loop over all injection streams in order to get the particles specifications alighaffari Fluent UDF and Scheme Programming 0 August 28, 2012 01:42
loop over all injection streams alighaffari Main CFD Forum 1 August 27, 2012 16:00
How to change turbulence model in InterFoam Gildeh OpenFOAM Running, Solving & CFD 4 March 28, 2012 12:04
DEFINE_SOURCE, injection in one Cell, mass balance Vitali FLUENT 2 April 27, 2007 16:39
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 10:16.