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

Undefined variable

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2018, 22:53
Post Undefined variable
  #1
New Member
 
Zhu
Join Date: Mar 2018
Posts: 5
Rep Power: 8
SJTUmoyu is on a distinguished road
Please help me! When I start my UDF program, there is an error "rpgetvar: part/charge-rate: undefined variable". What's wrong with it?
SJTUmoyu is offline   Reply With Quote

Old   March 29, 2018, 23:19
Default
  #2
New Member
 
yanghai
Join Date: Mar 2018
Posts: 16
Rep Power: 8
yanghai is on a distinguished road
Quote:
Originally Posted by SJTUmoyu View Post
Please help me! When I start my UDF program, there is an error "rpgetvar: part/charge-rate: undefined variable". What's wrong with it?
you should talk about your model and what you want to do, and put your udf on. because we know nothing about you want to do.
yanghai is offline   Reply With Quote

Old   March 29, 2018, 23:28
Post Undefined variable
  #3
New Member
 
Zhu
Join Date: Mar 2018
Posts: 5
Rep Power: 8
SJTUmoyu is on a distinguished road
Quote:
Originally Posted by yanghai View Post
you should talk about your model and what you want to do, and put your udf on. because we know nothing about you want to do.
Thank you. In dpm model, I want to charge particles.
I should know the charge rate of particles. I used "RP_Get_Real(part/charge-rate)" to get parameter. But when I start my udf program. An error appeared. "rpgetvar: part/charge-rate: undefined variable". So I wonder whether I should define the variable of "part/charge-rate" and how to define it.
Following is my partial udf about "RP_Get_Real".

#include "udf.h"
#include "sg_udms.h"
#include "charge_udf.h"

Domain *fl_domain=NULL;
real epsilon_0=8.854e-12;
real d_charge=0.;
real charge_max=0.;

/*
* Get charge parameters (set via Scheme)
*/

void get_charge_parameters(void)
{
d_charge=RP_Get_Real("part/charge-rate");
charge_max=RP_Get_Real("part/charge-max");
}
SJTUmoyu is offline   Reply With Quote

Old   March 30, 2018, 03:08
Default
  #4
New Member
 
yanghai
Join Date: Mar 2018
Posts: 16
Rep Power: 8
yanghai is on a distinguished road
Quote:
Originally Posted by SJTUmoyu View Post
Thank you. In dpm model, I want to charge particles.
I should know the charge rate of particles. I used "RP_Get_Real(part/charge-rate)" to get parameter. But when I start my udf program. An error appeared. "rpgetvar: part/charge-rate: undefined variable". So I wonder whether I should define the variable of "part/charge-rate" and how to define it.
Following is my partial udf about "RP_Get_Real".

#include "udf.h"
#include "sg_udms.h"
#include "charge_udf.h"

Domain *fl_domain=NULL;
real epsilon_0=8.854e-12;
real d_charge=0.;
real charge_max=0.;

/*
* Get charge parameters (set via Scheme)
*/

void get_charge_parameters(void)
{
d_charge=RP_Get_Real("part/charge-rate");
charge_max=RP_Get_Real("part/charge-max");
}
are you sure you can complied the udf successful? there is no DEFINE macro? i know a little about the dpm model.but i think it must have DEFINE macro in any udf. or, part/charge-rate may not is a parameter in fluent, it is why to occur the error.
yanghai is offline   Reply With Quote

Old   March 30, 2018, 03:37
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
where did you get this code?

inside your "own" code there is a comment

Code:
/* 
* Get charge parameters (set via Scheme)
*/
it tells that rp-vars should be set through scheme

best regards
AlexanderZ is offline   Reply With Quote

Old   March 30, 2018, 05:47
Post
  #6
New Member
 
Zhu
Join Date: Mar 2018
Posts: 5
Rep Power: 8
SJTUmoyu is on a distinguished road
Quote:
Originally Posted by yanghai View Post
are you sure you can complied the udf successful? there is no DEFINE macro? i know a little about the dpm model.but i think it must have DEFINE macro in any udf. or, part/charge-rate may not is a parameter in fluent, it is why to occur the error.
yes! I have defined macro. The udf I showed is just a partial udf. The error occurs due to this udf.
SJTUmoyu is offline   Reply With Quote

Old   March 30, 2018, 05:53
Post
  #7
New Member
 
Zhu
Join Date: Mar 2018
Posts: 5
Rep Power: 8
SJTUmoyu is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
where did you get this code?

inside your "own" code there is a comment

Code:
/* 
* Get charge parameters (set via Scheme)
*/
it tells that rp-vars should be set through scheme

best regards
Do you mean that "part/charge-rate" should be defined through scheme?
And can you tell me how to define vars through scheme?
Thank you very much !
SJTUmoyu is offline   Reply With Quote

Old   March 31, 2018, 11:47
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
And did you compile (do this!) or interpret (don't do this!)?
pakk is offline   Reply With Quote

Old   April 1, 2018, 21:36
Post
  #9
New Member
 
Zhu
Join Date: Mar 2018
Posts: 5
Rep Power: 8
SJTUmoyu is on a distinguished road
Quote:
Originally Posted by pakk View Post
And did you compile (do this!) or interpret (don't do this!)?
Yes,I have compiled it successfully.
SJTUmoyu is offline   Reply With Quote

Reply

Tags
rp_get_real


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
Second Derivative Zero - Boundary Condition fu-ki-pa OpenFOAM 11 March 27, 2021 04:28
LEMOS InflowGenerator r_gordon OpenFOAM Running, Solving & CFD 103 December 18, 2018 00:58
OpenFOAM 1.6-ext git installation on Ubuntu 11.10 x64 Attesz OpenFOAM Installation 45 January 13, 2012 12:38
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
G95 + CGNS Bruno Main CFD Forum 1 January 30, 2007 00:34


All times are GMT -4. The time now is 04:51.