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

Nature of P_MATERIAL(p) macro

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 21, 2005, 05:31
Default Nature of P_MATERIAL(p) macro
  #1
Henrik Ström
Guest
 
Posts: n/a
Hello!

A short question... I want to use the DPM macro P_MATERIAL(p) in a UDF to change the material of some droplets if some conditions are fulfilled. I just wonder (since I cannot find this information in the manual) on what format the "contents" of P_MATERIAL is? In other words, which of the following commands would work:

P_MATERIAL(p) = SUBSTANCE_2;

P_MATERIAL(p) = 2;

P_MATERIAL(p) = "h2o";

etc...

I simply mean, P_MATERIAL(p) is a "material pointer", but is the material represented by a string (its name), a number or something else here? Maybe I am totally lost here..?

Thanks in advance!

/Henrik
  Reply With Quote

Old   September 21, 2005, 09:33
Default Re: Nature of P_MATERIAL(p) macro
  #2
Henrik Ström
Guest
 
Posts: n/a
Hi again,

I solved this problem by writing a UDF that printed P_MATERIAL(p) to the console window, and it turned out to be a string (in this case, "water-liquid").

/Henrik
  Reply With Quote

Old   September 27, 2005, 09:21
Default Re: Nature of P_MATERIAL(p) macro
  #3
RoM
Guest
 
Posts: n/a
Hello,

i am sorry but nothing of this will work correctly. a pointer is memory adress and the martial pointer points to the memory adress where fluent stores material data. the material itself is not bound with the particle but with the injection. P_MATERIAL(p) will expand to p->injection->material (see dpm.h) and the only way to change the particles material is to change the entire injection wich will affect ofcourse all particles.

the only way to change matrial properties i can think of is

1. delete the the particle when it fullfills your condition

2. define a new injection with different material properties at this point.

3. reinject the deleted particles from the new injection.

sounds like alot of work to do .

RoM
  Reply With Quote

Old   September 27, 2005, 10:06
Default Re: Nature of P_MATERIAL(p) macro
  #4
Henrik Ström
Guest
 
Posts: n/a
Thank you very much for your answer!

Yes, that might sound like a lot to do, but I think I will give it a try. Do you know which is the best way to do this? Can I do it inside a DEFINE_DPM_LAW macro for example? Or do I have to create a second injection that is hooked to a UDF with the DEFINE_DPM_INJECTION_INIT macro that only allows it to trigger when a certain condition is met (i.e. a particle has been removed by some other UDF function)?

Any help is as always highly appreciated.

Thanks, Henrik
  Reply With Quote

Old   September 27, 2005, 11:03
Default Re: Nature of P_MATERIAL(p) macro
  #5
RoM
Guest
 
Posts: n/a
Since your trigger condition will propably apply during a specific law, a DPM_LAW macro should be the best option to decide when to trigger. The greates problem will be the definition a new injection from scratch. You udf will need to create that injection, append it to the list of already existing injections, force fluent to calculate the new particle stream and delete this temporary injection before the next fluid iterations. This leads us deep into the almost undocumented basic functions of fluent. Some of them can be found in dpm.h. They all start with FLUENT_EXPORT. I think your best bet are some long phone calls with fluent support. Sorry i cant help you an further but your problem is far beyond my limited knowledge.

Sincerely RoM
  Reply With Quote

Old   September 28, 2005, 02:23
Default Re: Nature of P_MATERIAL(p) macro
  #6
RoM
Guest
 
Posts: n/a
I just spent some time to think about you problem and maybe the soultion isnt that complicated. To track your particle progress you could use a dpm scalar with a DPM_SCALAR_UPDATE udf. Initialize the scalar to zero and switch it to 1 when your particles changes its state. If you dont want to change the whole material but just some properties, DEFINE_DMP_POPERTY could be used together with this scalar value to decide wich properties the particle should have.

In steady state calculation it should be possible to change the whole injection material. Since fluent trackes particles one by one it doenst hurt to change the injection material as long as you switch it back once a new particle is injected. This could all be done within the DPM_SCALAR_UPDATE udf.

To get the material pointer you could loop over all mixture species

Domian *d;

Thread *t;

Material *sp,*sp2;

int i;

d = Get_Domain(ROOT_DOMAIN_ID);

thread_loop_c(t,d)

{

if(FLUID_THREAD_P(t))

mixture_species_loop(THREAD_MATERIAL(t),sp,i)

{

if(!(strcmp(sp->name,"fill in you name here")) sp2=sp;

}

/*assign new material to injection */

p->injection->material=sp2;

RoM
  Reply With Quote

Old   October 12, 2005, 09:21
Default Re: Nature of P_MATERIAL(p) macro
  #7
Henrik Ström
Guest
 
Posts: n/a
This sounds very interesting!

I already have a DPM_SCALAR_UPDATE to monitor the state of the droplets, and all important properties are changed with DEFINE_DPM_PROPERTY, and that seems to work ok. The last thing that I would like to change is the evaporating species, and that could hopefully be done with P_EVAP_SPECIES_INDEX(p).

It seems, from looking in dpm.h, that this also refers to the evaporating species of the whole injection, but I thought that I could, if the DEFINE_DPM_LAW macro recognizes the droplet as one that has changed state, change P_EVAP_SPECIES_INDEX(p) to a new value, apply a law (e.g. BoilingLaw(p)) and then change it back. Do you think this could work?

Thanks a lot, Henrik
  Reply With Quote

Old   October 12, 2005, 09:38
Default Re: Nature of P_MATERIAL(p) macro
  #8
RoM
Guest
 
Posts: n/a
Your solution sounds very good. The only reason it could fail is if the standard BoilingLaw does not use to the P_EVAP_SPECIES_INDEX(p). But i dont see any logical reasons why it should not use it.

Good Luck

RoM
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Heat Exchanger not selecting (Please help!) zdeth FLUENT 2 September 11, 2012 13:52
Macro Trouble -Winows Explorer Crashes with Macro Martin Castillo FLUENT 1 July 25, 2007 04:18
Macro problem cfddummy CD-adapco 1 April 9, 2007 12:37
Call a macro from a macro Flav CD-adapco 2 July 1, 2004 05:42
Bug in the DEFINE_ADJUST macro? Senthil FLUENT 5 September 3, 2002 22:26


All times are GMT -4. The time now is 01:38.