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

Use of F_UDMI(f,t,i) for compiled UDF

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 14, 2002, 10:42
Default Use of F_UDMI(f,t,i) for compiled UDF
  #1
Damien
Guest
 
Posts: n/a
Dear Ladies and Gentlemen, I'm working hard on UDF's since last week and I get some troubles with the use of F_UDMI in UDF. I tried C_UDMI, by looping over cells in a cell thread, to store Flow Variable Macros like C_T(c,t), C_P(c,t). This works fine. But using F_UDMI, looping over faces in a face thread doesn't work... for me...

Did anybody ever tried this Utility with succes? Do you have an example?

Here is a sample of my code: -------------------------- #include "udf.h"

int id_tyre_surf[6]={1,7,8,15,17,18}; real x[ND_ND], Area[ND_ND],fx[ND_ND]; Domain* d;

DEFINE_ADJUST(test,d) { real press1; Thread *t; cell_t c; face_t f; int n,k=0;

// for(k=0; k>5; k++)

// { int j=0; t=Lookup_Thread(d,id_tyre_surf[k]); Message ("id= %d\n", id_tyre_surf[k]); begin_f_loop(f,t) { F_AREA(Area,f,t); Message ("A=%e\t%e\t%e\n", Area[0], Area[1], Area[2]); press1=F_P(f,t); Message ("press1=%f\n", press1); F_CENTROID(fx,f,t); Message("face centroid%f\t%f\t%f\n",fx[0],fx[1],fx[2]); F_UDMI(f,t,0)=press1; Message("test2%f\n",press1); } end_f_loop(f,t);

// } } ------------------------------

As you can see I print some Messages on the console window to find out where the code crashes. The console window prints " id= 1 A= value value value press1= value face centroid value value value "

And nothing more just the boring: " Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () "

Thank you in advance !

Greetings

Damien
  Reply With Quote

Old   June 14, 2002, 10:50
Default re-pasting of the UDF code
  #2
Damien
Guest
 
Posts: n/a
Sorry ! The pasting of the code made it difficult to read. So...

Here is a sample of my code: -------------------------- #include "udf.h"

int id_tyre_surf[6]={1,7,8,15,17,18}; real x[ND_ND], Area[ND_ND],fx[ND_ND]; Domain* d;

DEFINE_ADJUST(test,d) { real press1; Thread *t; cell_t c; face_t f; int n,k=0;

// for(k=0; k>5; k++)

// { int j=0; t=Lookup_Thread(d,id_tyre_surf[k]); Message ("id= %d\n", id_tyre_surf[k]); begin_f_loop(f,t) { F_AREA(Area,f,t); Message ("A=%e\t%e\t%e\n", Area[0], Area[1], Area[2]); press1=F_P(f,t); Message ("press1=%f\n", press1); F_CENTROID(fx,f,t); Message("face centroid%f\t%f\t%f\n",fx[0],fx[1],fx[2]); F_UDMI(f,t,0)=press1; Message("test2%f\n",press1); } end_f_loop(f,t);

// } } ------------------------------

Damien
  Reply With Quote

Old   June 14, 2002, 11:00
Default re-SORRY, re-re-pasting of the UDF code
  #3
Damien
Guest
 
Posts: n/a
One more time, and I give up... Ooopss I forget the Preview Message....!!!

--------------------------

#include "udf.h"

int id_tyre_surf[6]={1,7,8,15,17,18};

real x[ND_ND], Area[ND_ND],fx[ND_ND];

Domain* d;

DEFINE_ADJUST(test,d)

{

real press1;

Thread *t;

cell_t c;

face_t f;

int n,k=0;

int j=0;

t=Lookup_Thread(d,id_tyre_surf[k]);

Message ("id= %d\n", id_tyre_surf[k]);

begin_f_loop(f,t)

{

F_AREA(Area,f,t);

Message ("A=%e\t%e\t%e\n", Area[0], Area[1], Area[2]);

press1=F_P(f,t);

Message ("press1=%f\n", press1);

F_CENTROID(fx,f,t);

Message("face centroid%f\t%f\t%f\n",fx[0],fx[1],fx[2]);

F_UDMI(f,t,0)=press1;

Message("test2%f\n",press1);

}

end_f_loop(f,t);

}

------------------------------

I hope it succeeded this time...

Damien

  Reply With Quote

Old   June 16, 2002, 22:31
Default Re: re-SORRY, re-re-pasting of the UDF code
  #4
keilmeyer
Guest
 
Posts: n/a
In my experiences, some macros don't seems to be defined in your code. Please try the following loop. --

thread_loop_f(t, d) { begin_f_loop(f,t) { YOUR CODE }end_f_loop(f,t) }

-- And if you are using a PC-Windows, the "Domain* d" doesn't work. So you have to replace "Domain* d" to Domain *domain = Get_Domain(1)".

Best regards,
  Reply With Quote

Old   June 16, 2002, 22:36
Default SORRY, I've mistaken.
  #5
keilmeyer
Guest
 
Posts: n/a
Hi,

The loops is the following.

---

thread_loop_f(t, d)

{

begin_f_loop(f,t)

{

YOUR CODE

}end_f_loop(f,t)

}

---
  Reply With Quote

Old   June 17, 2002, 11:23
Default Re: SORRY, I've mistaken.
  #6
Damien
Guest
 
Posts: n/a
Thanks for reply, I tried my code (without thread_loop_f(t, d)) by stopping trying to use the F_UDMI(f,t,i) (because, this is what is the problem, crashing the calculations)

The loops are running as wanted.

When starting as you preconise, the first itération never stops............................. Aaaaahhhhhh.... stop, stop, stop, ctrl+alt+del, was the only solution, )

I didn't expect that,... that's strange, there is some things not easy to understand immediatly with FLUENT. Is that the black box effect? That's not so cool...

Sometime, I would like to make a comment like that: Software companies, I understand that you keep secrets for protecting your copyright, but keeping secrets about the use of the most advanced tools of your codes will kill your users...

I mean, If we use so much time finding out the possibilities of the code, our companies will say: "CFD is too expensive (Software, hardware, human ressources...)" And then "finito". OK some companies are very rich... No problem... Life's hard...
  Reply With Quote

Old   June 17, 2002, 21:25
Default Re: F_UDMI
  #7
Greg Perkins
Guest
 
Posts: n/a
Hi

I'm not a fan of using the F_UDMI macros to store face value information. In fact, in general its not a great idea.

Why?

Well Fluent is a Finite Volume code, so its stores values at cell centres. You'll find that if you store infomation in F_UDMI it may not be saved with your case and data file and when you read it back in you won't be able to continue iterating from the same position as when you saved.

I used it in the past but I think a better approach if you're wanting to save face information of a boundary thread, is to store the information in the adjacent cell to the thread.

You can do this by using the macros described in the udf manual. F_C0 etc.

This way, info is not lost when you save and reload.

If you want to store information on interior faces this basically doesn't make sense. Fluent only stores information at cell centres and face data are reconstructed from cell centre data. So, you should be following the same principles.

Whether thess conceptual ideas help you fix your code is perhaps another matter, but good luck. Greg
  Reply With Quote

Old   June 18, 2002, 08:50
Default Re: F_UDMI
  #8
Damien
Guest
 
Posts: n/a
Hi Greg !

Thank you very much for your explaination and your share of experience.

In fact as the F_UDMI doesn't work in my code I am shifting my strategy by taking the value in the neighboring cells and handle them to make the job needed.

I didn't think about all the consequences and advantages it can have in comparison to F_UDMI...

Once more, thank you Greg, and please greets the koalas for me... is there koalas in Australia?

Kind Regards

Damien

  Reply With Quote

Old   June 18, 2002, 08:55
Default Re: F_UDMI
  #9
Greg Perkins
Guest
 
Posts: n/a
Yeah I have one as a pet at home!!!!

(Only joking!)

Hope it goes well....

Greg
  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
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 07:57.