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/)
-   -   transient boundary condition for UDS (https://www.cfd-online.com/Forums/fluent-udf/152073-transient-boundary-condition-uds.html)

moloykb April 23, 2015 06:01

transient boundary condition for UDS
 
1 Attachment(s)
Dear all,
I am trying to give a voltage input as defined by the square pulse (attached figure), while doing some mhd calculation using electric potential method in Fluent. Could u suggest me how to implement this in the boundary condition panel for the potential value defined by the UDS.
with regards,

`e` April 23, 2015 06:34

This topic has been covered a number of times, here's a recent thread (less than two weeks old!) which should help get you started: UDF for unsteady velocity inlet.

moloykb April 23, 2015 06:45

Thanks for your quick response, but the same UDF I have already used for the definition of velocity but when it comes for the UDS boundary condition it gives the access violation error.

`e` April 23, 2015 06:53

Could you provide us further details including your UDF and the error? Have you enabled a sufficient number of User-Defined Scalars?

moloykb April 23, 2015 07:10

In fluent when the mhd model is initiated then it automatically load 1 UDS and 42 UDM through predefined UDF, which is automatically hooked during the initialization of the model. The 1st UDS gives the value for electric potential (E) and the 13th UDM gives magnitude of electric field.
So, I just want to define the UDS as a function that I have mentioned before with the following udf, it compiled without any error but once i hook this in the boundary condition panel for the electrode surface, it gives the access violation error.

#include "udf.h"

DEFINE_PROFILE(voltage, t, i)
{
real voltage;
real the_current_time;
face_t f;
cell_t c;

the_current_time = CURRENT_TIME;

if ((the_current_time>=0) && (the_current_time<=.1))
{
C_UDSI(c,t,0)=10;
}
else
{
C_UDSI(c,t,0)=0;
}
if ((the_current_time>=1.) && (the_current_time<=1.1))
{
C_UDSI(c,t,0)=10;
}
else
{
C_UDSI(c,t,0)=0;
}
if ((the_current_time>=2.) && (the_current_time<=2.1))
{
C_UDSI(c,t,0)=10;
}
else
{
C_UDSI(c,t,0)=0;
}

begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = C_UDSI(c,t,0);
}
end_f_loop(f,t)
}


Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0
tx86\3d\fl1450s.exe 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: #f

`e` April 23, 2015 08:54

Your first two if statements are effectively doing nothing because the third if statement overwrites by setting your electric potential to 10 for time between 2 s and 2.1 s, and an electric potential of zero otherwise.

Why are you trying to set a value to C_UDSI(c,t,0) and then use this value for the F_PROFILE? Use if statements within the face loop and set a value directly, for example:

Code:

if ((the_current_time>=2.) && (the_current_time<=2.1))
    F_PROFILE(f,t,i) = 10.;
else
    F_PROFILE(f,t,i) = 0.;

You're receiving the access violation error because you're attempting to access "c", via C_UDSI(c,t,0), which has no value initialised (you have only declared it with "cell_t c").

moloykb April 24, 2015 01:15

1 Attachment(s)
Thanks for pointing the error. I have made the follwing correction in the code as mentioned by you.

begin_f_loop(f,t)
{
if ((the_current_time>=0) && (the_current_time<=.1))
F_PROFILE(f,t,i)=10;
else
F_PROFILE(f,t,i)=0;
}
end_f_loop(f,t)
}

but still, the voltage is not becoming zero once the time is>0.1

moloykb April 24, 2015 03:03

2 Attachment(s)
Please go through the attached figures, which says that the there is no option to enter the udf for the voltage value in the BC panel for the mhd model window (fig.1) and thus it remains unaltered throughout the simulation, irrespective of the UDF entered as in fig.2

moloykb April 25, 2015 21:44

Any body working with the mhd module please help me. I desperately need the support from your end.

yona April 25, 2017 16:53

I have the same issue, anyone who has resolved this problem?

sina_sls August 1, 2022 08:11

1 Attachment(s)
Quote:

Originally Posted by moloykb (Post 543751)
Any body working with the mhd module please help me. I desperately need the support from your end.

Hello

I want to set sinusoidal value of electric potential (MHD module) for a wall, first i try expression but i faced to error :

Error: wta(2nd) to string_eq

Error Object: __expr__

then i try Profile and UDF profile , but agian i faced to problem , when i use them it consider the wall to insulated.

Could you help me how can i set sinusoidal value for current density ( Electric Potential MHD) ?

Best Regards,

sina_sls August 3, 2022 06:51

Quote:

Originally Posted by `e` (Post 543394)
Your first two if statements are effectively doing nothing because the third if statement overwrites by setting your electric potential to 10 for time between 2 s and 2.1 s, and an electric potential of zero otherwise.

Why are you trying to set a value to C_UDSI(c,t,0) and then use this value for the F_PROFILE? Use if statements within the face loop and set a value directly, for example:

Code:

if ((the_current_time>=2.) && (the_current_time<=2.1))
    F_PROFILE(f,t,i) = 10.;
else
    F_PROFILE(f,t,i) = 0.;

You're receiving the access violation error because you're attempting to access "c", via C_UDSI(c,t,0), which has no value initialised (you have only declared it with "cell_t c").

Hello,

How can i change UDS boundary value in a Define Adjust UDF? i mean how can i call UDS boundary value to changing in a UDF of Define Adjust?

Regards,


All times are GMT -4. The time now is 11:30.