CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   n_uds error (https://www.cfd-online.com/Forums/fluent/40831-n_uds-error.html)

Nathan May 4, 2006 09:39

n_uds error
 
Hi all,

I have included the header file 'models.h' into my UDF and am using n_uds to check that the scalar has been defined. Every time have interpreted the file I get this response:

Error: C:\models\anode.c: line 172: label "n_uds" not found (pc=8768)

I'm baffled by this one!

Cheers, Nathan

Aidan May 4, 2006 15:28

Re: n_uds error
 
did you use N_UDS in capital letters?

Nathan Molyneaux May 5, 2006 04:37

Re: n_uds error
 
Hi Aidan,

I have tried both the lower case and higher case versions and there does not seem to be a change.

Nathan

Maryam-A September 16, 2015 10:56

How did you solve the problem.
I have the same problem.
I would appreciate if you can help me.

Bruno Machado September 16, 2015 11:03

Quote:

Originally Posted by Maryam-A (Post 564277)
How did you solve the problem.
I have the same problem.
I would appreciate if you can help me.

First you need to enumerate them.

enum
{
... your UDS...
NUM_UDS
};

Then later you can use NUM_UDS.

Maryam-A September 16, 2015 13:32

Thank you for your reply.
But I used enum for specifying my user scalar,too.
enum
{
alpha,

N_REQUIRED_UDS
};

do you have any other idea for me?

Maryam-A September 16, 2015 13:48

Actuly these are my program's error after a part of my udf:

enum
{
alpha,
A,
B,
N_REQUIRED_UDS
};

/************************************************** *********************************/
DEFINE_ADJUST(alpha_adjust,d)
{

Thread *t;
cell_t c;
if(N_UDS<N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
/**************************************************
line 316: label "n_uds" not found (pc=18).
line 316: function "internal_Error" not found (pc=50).

Bruno Machado September 16, 2015 15:24

Quote:

Originally Posted by Maryam-A (Post 564310)
Actuly these are my program's error after a part of my udf:

enum
{
alpha,
A,
B,
N_REQUIRED_UDS
};

/************************************************** *********************************/
DEFINE_ADJUST(alpha_adjust,d)
{

Thread *t;
cell_t c;
if(N_UDS<N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
/**************************************************
line 316: label "n_uds" not found (pc=18).
line 316: function "internal_Error" not found (pc=50).

Got this piece of code in the internet. Try to use DEFINE_ON_DEMAND or DEFINE_INIT instead of DEFINE_ADJUST.


#include "udf.h"
enum {
VORT_Z, /* Index of UDS: VORT_Z=0 */
N_REQUIRED_UDS /* # of UDS variables: N_REQUIRED_UDS=1 */
};

DEFINE_ON_DEMAND(vortz_on_demand)
{
Domain d; /* domain is not passed in */ Thread t;
cell_t c;
face_t f;
/* Make sure there are enough user-defined scalars. */
if (n_uds < N_REQUIRED_UDS) {
Internal_Error("not enough UDSs allocated");
}

Maryam-A September 17, 2015 01:38

Hi
Thanks for your response.
I tried this function but still doesn't work.:(
I 'm wondering if I have mistake about using UDS.
I have 3 uds, 1 is for volume fraction transport equation of nanoparticle, and 2 others I use only for calculating temperature gradient and consequently calculation Laplacian. I want to use them as scalars.
I would appreciate if you can help me.

Maryam-A September 17, 2015 01:46

Hi
Thanks for your response.
I tried this function but still doesn't work.:(
I 'm wondering if I have mistake about using UDS.
I have 3 uds, 1 is for volume fraction transport equation of nanoparticle, and 2 others I use only for calculating temperature gradient and consequently calculation Laplacian. I want to use them as scalars.:confused:
I would appreciate if you can help me.

Bruno Machado September 17, 2015 05:01

Quote:

Originally Posted by Maryam-A (Post 564354)
Hi
Thanks for your response.
I tried this function but still doesn't work.:(
I 'm wondering if I have mistake about using UDS.
I have 3 uds, 1 is for volume fraction transport equation of nanoparticle, and 2 others I use only for calculating temperature gradient and consequently calculation Laplacian. I want to use them as scalars.
I would appreciate if you can help me.

I tested and the code worked. Did you set the scalars in the Fluent menu? I mean, Define... User define... Scalar... Try it in the DEFINE_INIT instead of the EXECUTE_ON_DEMAND and hook it.

Maryam-A September 17, 2015 09:23

Yes I set it and checked the number of scalars in fluent by export-solution data,too.
my English is weak that's because I cant explain my code enough:(.
At first I used property of material like viscosity and ...
and then I used enum and adjust for udsi.
all the macross are in 1 udf by #include"udf.h" and #include "sg.h" headers.

Maryam-A September 17, 2015 09:33

As you said alpha is index of my first UDSI(C_UDSI(c,t,0)),
so I have only one Adjust function (Adjust_alpha),
but I have 3 scalars, Is it true?

Bruno Machado September 17, 2015 09:57

Quote:

Originally Posted by Maryam-A (Post 564429)
Yes I set it and checked the number of scalars in fluent by export-solution data,too.
my English is weak that's because I cant explain my code enough:(.
At first I used property of material like viscosity and ...
and then I used enum and adjust for udsi.
all the macross are in 1 udf by #include"udf.h" and #include "sg.h" headers.

This part of the code should not be placed in the ADJUST macro. Put it in the INIT macro.

if(N_UDS<N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");

But to be honest with you, for the small piece of your problem I know, this is something that does not affect your code at all. If you are not sure how to implement it now, make your code work and later you try to implement this part.

Maryam-A September 18, 2015 00:27

Thank you for all your responses.
I did it and have this error "Divergence detected AMG solver-Temperature"

Bruno Machado September 18, 2015 05:25

Quote:

Originally Posted by Maryam-A (Post 564522)
Thank you for all your responses.
I did it and have this error "Divergence detected AMG solver-Temperature"

well, this is something else. Not related with this part of the code at all. Check your under relaxation factor to see if your problem can get convergence.

Maryam-A September 20, 2015 11:57

I changed one part of my code but this time I face this error
" received a fatal signal error"
I even can not initialize my code any more!!!!!!!!!!
I need help:(
If you give me some advice , I would appreciate it.

Maryam-A September 20, 2015 12:21

I found the error is because of wrong boundary condition UDS on the wall.
This is my B.C udf:

DEFINE_PROFILE(alpha_bc1,thread,position)
{
Thread *t;
cell_t c;
.
.
.

begin_f_loop(f,thread)
{

C_UDSI_G(c,t,0)[0]=-(D_T/D_B)*C_T_G(c,t)[0];
F_PROFILE(f,thread,position)=C_UDSI_G(c,t,0)[0];
}
end_f_loop(f,t)
}

Maryam-A September 20, 2015 12:28

As you see I wanted to return C_UDSI_G(c,t,0)[0] .
It means I wanted to return derivative of UDS as wall boundary value.(volume fraction)
Is it right?

Bruno Machado September 21, 2015 04:41

Quote:

Originally Posted by Maryam-A (Post 564852)
I found the error is because of wrong boundary condition UDS on the wall.
This is my B.C udf:

DEFINE_PROFILE(alpha_bc1,thread,position)
{
Thread *t;
cell_t c;
.
.
.

begin_f_loop(f,thread)
{

C_UDSI_G(c,t,0)[0]=-(D_T/D_B)*C_T_G(c,t)[0];
F_PROFILE(f,thread,position)=C_UDSI_G(c,t,0)[0];
}
end_f_loop(f,t)
}

here you did not initialized the face_t f.
I think the way you are defining the gradient is not the best way to do it. create a profile that returns the value you want for the gradient and in the boundary condition panel in fluent, you can set as a gradient profile using the profile you created. Be careful once you are working with faces and not cells, your macros should not contain cells.


All times are GMT -4. The time now is 15:19.