CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Undefined variable (https://www.cfd-online.com/Forums/fluent-udf/200333-undefined-variable.html)

SJTUmoyu March 29, 2018 22:53

Undefined variable
 
Please help me! When I start my UDF program, there is an error "rpgetvar: part/charge-rate: undefined variable". What's wrong with it?

yanghai March 29, 2018 23:19

Quote:

Originally Posted by SJTUmoyu (Post 687088)
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.

SJTUmoyu March 29, 2018 23:28

Undefined variable
 
Quote:

Originally Posted by yanghai (Post 687090)
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");
}

yanghai March 30, 2018 03:08

Quote:

Originally Posted by SJTUmoyu (Post 687092)
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.

AlexanderZ March 30, 2018 03:37

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

SJTUmoyu March 30, 2018 05:47

Quote:

Originally Posted by yanghai (Post 687103)
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 March 30, 2018 05:53

Quote:

Originally Posted by AlexanderZ (Post 687106)
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 !

pakk March 31, 2018 11:47

And did you compile (do this!) or interpret (don't do this!)?

SJTUmoyu April 1, 2018 21:36

Quote:

Originally Posted by pakk (Post 687248)
And did you compile (do this!) or interpret (don't do this!)?

Yes,I have compiled it successfully.


All times are GMT -4. The time now is 00:02.