-
-
June 17, 2019 at 3:34 pm
Jancos
SubscriberHi all,
Can anyone help me with this UDF. After I interpreted my UDF , set UDMs on 4 and put new momentum source I initializate my calculation but when I am checking counturs the values of my UDMs are 0. And when I start calculation my Fluent crashed.
THIS MY UDF:
-
June 17, 2019 at 3:41 pm
DrAmine
Ansys EmployeeWe will provide guidance only. Paste the lines here. -
June 17, 2019 at 3:42 pm
Jancos
Subscriber#include "udf.h"
#define N 94208
#define xm -8.86E-9
#define ro 997.96
#define beta 21.37E-5
#define To 298.5
#define mi 12.566E-7
#define vf 3.28E-5
float GradB[N] =
{...};// my values number of elements 94208
DEFINE_SOURCE(xmagnetic_source,c,t,dS,eqn)
{
real xm_source;
real Temp;
Domain *d;
int i;
i = 0;
thread_loop_c(t,d)// loop over all cells in model
{
begin_c_loop(c,t)
{
Temp = C_T(c,t);
xm_source=(-((xm*ro*beta*(Temp-To)*GradB*vf)/(2*mi)));
C_UDMI(c,t,0) = GradB;
C_UDMI(c,t,1) = xm_source;
i++;
}
end_c_loop(c,t)
}
return xm_source;
}
DEFINE_SOURCE(ymagnetic_source,c,t,dS,eqn)
{
real ym_source;
real Temp;
Domain *d;
int i;
i = 0;
thread_loop_c(t,d)// loop over all cells in model
{
begin_c_loop(c,t)
{
Temp = C_T(c,t);
ym_source=(-((xm*ro*beta*(Temp-To)*GradB*vf)/(2*mi)));
C_UDMI(c,t,2) = ym_source;
i++;
}
end_c_loop(c,t)
}
return ym_source;
}
DEFINE_SOURCE(zmagnetic_source,c,t,dS,eqn)
{
real zm_source;
real Temp;
Domain *d;
int i;
i = 0;
thread_loop_c(t,d)// loop over all cells in model
{
begin_c_loop(c,t)
{
Temp = C_T(c,t);
zm_source=(-((xm*ro*beta*(Temp-To)*GradB*vf)/(2*mi)));
C_UDMI(c,t,3) = zm_source;
i++;
}
end_c_loop(c,t)
}
return zm_source;
}
-
June 17, 2019 at 3:50 pm
DrAmine
Ansys EmployeeActually there is no need to do a loop inside of a define source udf. Check the manual for more details and attend a training if possible. Gradb is declares but not defined. You require a loop if the counter i if you need to use values from the array. -
June 17, 2019 at 3:57 pm
Jancos
SubscriberIn my array i have values which represent gradient of magnetic field in every cell center, so I need to have it . And my loop in define source calculate in every cell value of magnetic buoyacy force. Do you have any idea how write this UDF?
-
June 17, 2019 at 4:03 pm
DrAmine
Ansys EmployeeCheck the manual and standard C manuals.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
3744
-
2570
-
1789
-
1236
-
594
© 2023 Copyright ANSYS, Inc. All rights reserved.