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

udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 12, 2016, 04:33
Default udf
  #1
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
who can write a udf for this equation
zeta=-0.2T-78.2
mahayheidari is offline   Reply With Quote

Old   October 12, 2016, 04:57
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I can do that!

Code:
#include "udf.h"

DEFINE_ON_DEMAND(udf_for_this_equation) {
 Message("zeta=-0.2T-78.2\n");
}
Have fun with it.
pakk is offline   Reply With Quote

Old   October 12, 2016, 05:13
Default
  #3
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
Quote:
Originally Posted by pakk View Post
I can do that!

Code:
#include "udf.h"

DEFINE_ON_DEMAND(udf_for_this_equation) {
 Message("zeta=-0.2T-78.2\n");
}
Have fun with it.
Thanks so much
If i want to add it into an other udf ,i can use your code?
mahayheidari is offline   Reply With Quote

Old   October 12, 2016, 05:24
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Of course you can use it for anything you want.

I can not imagine that it is useful for you, because I had no idea what you needed because your question is too vague. You never said what the UDF should do, only that it should be for the equation "zeta=-0.2T-78.2", so what my UDF does is print this equation.
If you want the UDF to do something else, be more specific.
pakk is offline   Reply With Quote

Old   October 12, 2016, 05:32
Default
  #5
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
Quote:
Originally Posted by pakk View Post
Of course you can use it for anything you want.

I can not imagine that it is useful for you, because I had no idea what you needed because your question is too vague. You never said what the UDF should do, only that it should be for the equation "zeta=-0.2T-78.2", so what my UDF does is print this equation.
If you want the UDF to do something else, be more specific.

i attach my udf
in this udf i should add (zeta_p) with above equation
because this udf should use (zeta_P) for the other part
Attached Files
File Type: c 4.c (1.6 KB, 2 views)
mahayheidari is offline   Reply With Quote

Old   October 12, 2016, 05:35
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
So, what is the difficult part for you?
The minus sign? The constants? The multiplication? The "T"? Where are you stuck?
pakk is offline   Reply With Quote

Old   October 12, 2016, 05:41
Default
  #7
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
Quote:
Originally Posted by pakk View Post
So, what is the difficult part for you?
The minus sign? The constants? The multiplication? The "T"? Where are you stuck?
im dont know much about udf .Im new user .
and when i add this equation to my udf .
i see this error
'zeta_p' : undeclared identifier
'T' : undeclared identifier

i dont know what should i write in my code to declare it

you know , i dont have the amount of(T)
my codes should catch (T) from fluent
i dont know how should i write it
mahayheidari is offline   Reply With Quote

Old   October 12, 2016, 06:03
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I understand that it is difficult to tell the computer what you want, if you don't speak the language of the computer.

But I am a human. Use human words for me. Talk to me like you would talk to your neighbor.

You write "my codes should catch (T) from fluent".
You make me guess what "T" is. Why? I guess you need temperature, but why don't you just say "temperature"?

About the undeclared identifier: If you use "zeta_p" in your code, the program needs to know what to expect. Is zeta_p a number? Text? A complicated data structure? The program needs to know that so it knows how much memory to reserve for it.

Basically you need to tell to the computer:
"zeta_p is a number."
But in the c-code, that is not enough, because there are many kinds of numbers. Small numbers, big numbers, whole numbers, numbers with fractional parts... The kind of number that you need is a floating point number, which basically means that there can be digits behind the point. So you want to tell the computer:
"zeta_p is a floating point number."
And the way to say that in c-code:
"float zeta_p;"

The c-language that Fluent uses, wants to know what all variables are before you do anything else. That is why in your code, the function starts with the "real ..." declarations. You should put your declaration for zeta_p in between/directly above/directly below these declarations.

You see, if you give some context, it is much easier for other persons to give a useful answer!
pakk is offline   Reply With Quote

Old   October 12, 2016, 06:11
Default
  #9
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
Quote:
Originally Posted by pakk View Post
I understand that it is difficult to tell the computer what you want, if you don't speak the language of the computer.

But I am a human. Use human words for me. Talk to me like you would talk to your neighbor.

You write "my codes should catch (T) from fluent".
You make me guess what "T" is. Why? I guess you need temperature, but why don't you just say "temperature"?

About the undeclared identifier: If you use "zeta_p" in your code, the program needs to know what to expect. Is zeta_p a number? Text? A complicated data structure? The program needs to know that so it knows how much memory to reserve for it.

Basically you need to tell to the computer:
"zeta_p is a number."
But in the c-code, that is not enough, because there are many kinds of numbers. Small numbers, big numbers, whole numbers, numbers with fractional parts... The kind of number that you need is a floating point number, which basically means that there can be digits behind the point. So you want to tell the computer:
"zeta_p is a floating point number."
And the way to say that in c-code:
"float zeta_p;"

The c-language that Fluent uses, wants to know what all variables are before you do anything else. That is why in your code, the function starts with the "real ..." declarations. You should put your declaration for zeta_p in between/directly above/directly below these declarations.

You see, if you give some context, it is much easier for other persons to give a useful answer!
Sorry
Because i know what i want
I think the other person know what i mean
You say write ,i should explain more
mahayheidari is offline   Reply With Quote

Old   October 12, 2016, 06:23
Default
  #10
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by mahayheidari View Post
Sorry
Because i know what i want
I think the other person know what i mean
You say write ,i should explain more
In your defense: it is quite natural to do this; you are probably already working for hours/days on this problem, so for you one letter really is enough to describe what you mean. Many engineers talk like this. But it can give communication problems.

Real story: one group was told that the 'mu' of their design was too high. In their world, 'mu' meant dynamic viscosity, so they spent a few weeks to find out if they could use another gas with lower viscosity. After these weeks, they showed their result, and then they found out that for the one who asked the question, 'mu' meant electromagnetic permeability.
pakk is offline   Reply With Quote

Old   October 12, 2016, 06:23
Default
  #11
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
Quote:
Originally Posted by pakk View Post
.
first :Code should be written so that the temperature of the cells take in FLUENT.
second:The temperature must be entered zeta potential equation.
And the zeta potential can calculate the electric field and other things I want

i want to know which coded should be written for task 1 and 2?
mahayheidari 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
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
Parallelize UDF? Which kind of UDF? Lilly FLUENT 5 March 25, 2014 03:05
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 10:01
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


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