-
-
October 10, 2024 at 2:55 am
yf70512
SubscriberHello all,
I am trying to modify the source term (Changing the temperature power exponent from 1 to 4) of energy equation in non-equilibrium thermal model by UDS and UDF (DEFINE_SOURCE macro). But the Fluent crashed when the code runned with the error "999999:mpt_accept:error: accept failed: No error". I think there may be two questions:
1 how to access the solid temperature in the fluid zone and fluid temperature in the solid zone?
2 how to specify the UDS Scalar as the energy source (Figure 2)?
Could anybody help with this? Thank you in advance.
Best regards,Fan
-
October 10, 2024 at 7:33 am
yf70512
SubscriberHere is my UDF:
#include "udf.h"
#define HFS_CONSTANT 1000
#define AFS_CONSTANT 0.1// Fluid Source Term
DEFINE_SOURCE(Fluid_source, c, t, dS, eqn)
{
real Tf, Ts;
real hfs, Afs;
real source;// Obtain the fluid temperature (Tf) and solid temperature (Ts)
Tf = C_STORAGE_R(c, t, SV_T_F); // Access fluid temperature
Ts = C_STORAGE_R(c, t, SV_T_S); // Access solid temperature
// Calculate or use constants for hfs (heat transfer coefficient) and Afs (interfacial area density)
hfs = HFS_CONSTANT; // Define or calculate hfs
Afs = AFS_CONSTANT; // Define or calculate Afs// Calculate the source term using modified expression hA(Tf^4 - Ts^4)
source = hfs * Afs * (pow(Ts, 4) - pow(Tf, 4));// Define the derivative of the source term with respect to Tf
dS[eqn] = -4 * hfs * Afs * pow(Tf, 3);return source; // Return the calculated source term
}// Solid Source Term
DEFINE_SOURCE(Solid_source, c, t, dS, eqn)
{
real Tf, Ts;
real hfs, Afs;
real source;// Obtain the fluid temperature (Tf) and solid temperature (Ts)
Ts = C_STORAGE_R(c, t, SV_T_S); // Access solid temperature
Tf = C_STORAGE_R(c, t, SV_T_F); // Access fluid temperature// Calculate or use constants for hfs (heat transfer coefficient) and Afs (interfacial area density)
hfs = HFS_CONSTANT; // Define or calculate hfs
Afs = AFS_CONSTANT; // Define or calculate Afs// Calculate the source term using modified expression hA(Ts^4 - Tf^4)
source = hfs * Afs * (pow(Ts, 4) - pow(Tf, 4));// Define the derivative of the source term with respect to Ts
dS[eqn] = 4 * hfs * Afs * pow(Ts, 3);return source; // Return the calculated source term
}I am not sure if it is right to access the solid temperature in the fluid zone and fluid temperature in the solid zone.
-
October 10, 2024 at 1:33 pm
Rob
Forum ModeratorThe problem isn't so much getting the fluid temperature as seen by the solid or vice versa but that you need to link to the two cells: so some care will be needed there.
Changing the exponent from 1 to 4 suggests radiation effects? Will this effect anything other than the front and rear (ie external surfaces) of the solid?
-
October 11, 2024 at 12:37 am
yf70512
SubscriberHi Rob,
Many thanks for your suggestions. I would like to ask how to link the two cells.
I have tried to link them by the spatial coordinate because a dual cell approach is used in non-equilibrium thermal model.
But the same errors occured "999999:mpt_accept:error: accept failed: No error" . The code is following:
DEFINE_SOURCE(Fluid_source,c,t,dS,eqn){real xc[ND_ND], xcs[ND_ND];real Tf, Ts;real hfs = HFS_CONSTANT; // Placeholder value for heat transfer coefficientreal Afs = AFS_CONSTANT; // Placeholder value for interfacial area densityreal source;int zone_ID;Thread *st;cell_t sc;Domain *domain;// Solid_Cell_id *st;// Find the coordinate position of the centroidC_CENTROID(xc,c,t);// Obtain fluid and solid temperaturesTf = C_T(c, t); // Fluid temperature// Ts = C_STORAGE_R(c, t, SV_T_S); // Solid temperaturezone_ID = THREAD_ID (t);if (zone_ID == 11){domain = Get_Domain(27);thread_loop_c(st, domain) // loop over all cell threads in the domain{begin_c_loop (sc,st) // loop over all cells{C_CENTROID(xcs,sc,st);if (fabs(xc[0] - xcs[0]) < 1.0e-6 && fabs(xc[1] - xcs[1]) < 1.0e-6 && fabs(xc[2] - xcs[2]) < 1.0e-6)Ts = C_T(sc,st);break;}end_c_loop (sc,st)}// DEFINE_PROFILE(Ts, st, xc);}if (zone_ID == 14){domain = Get_Domain(33);thread_loop_c(st, domain){begin_c_loop (sc,st){C_CENTROID(xcs,sc,st);if (fabs(xc[0] - xcs[0]) < 1.0e-6 && fabs(xc[1] - xcs[1]) < 1.0e-6 && fabs(xc[2] - xcs[2]) < 1.0e-6)Ts = C_T(sc,st);break;}end_c_loop (sc,st)}}// DEFINE_PROFILE(Ts, st, xc);// Calculate the source term based on the modified expressionsource = hfs * Afs * (pow(Ts, 4.0) - pow(Tf, 4.0));// Set the derivative of the source term with respect to TfdS[eqn] = - 4.0 * hfs * Afs * pow(Tf, 3.0);return source;}Besides, the effect (exponent from 1 to 4) in my case only affect the heat transfer in the interface between the solid and fluid.
-
-
October 12, 2025 at 2:50 pm
786868082
SubscriberHi Fan
I encountered the same issue as you: how to obtain fluid temperature and concentration in the solid zone, and how to obtain solid temperature in the fluid zone. Have you managed to resolve this?
thanks
-
October 13, 2025 at 1:51 pm
Rob
Forum ModeratorFrom: https://innovationspace.ansys.com/forum/forums/topic/fluent-solid-fluid-data-transfer-in-non-equilibrium-model-in-porous-zone-by-udf/
I'm not sure about a macro, and I'm unable to discuss undocumented macros and storage variables that may be found in the /src header files.
I'm also very limited in what I can cover that's "non-public knowledge" which includes UDFs. However, this sort of problem does allow me a little leeway on the rules. Have a look at DEFINE_ON_DEMAND to see if you can pair the cells up (ie loop over the fluid zone to find the equivalent solid cell). This may be more complicated given the parallel conditions, so also review the IF_HOST and IF_NODE terms.
-
- You must be logged in to reply to this topic.
- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- I am doing a corona simulation. But particles are not spreading.
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
-
4077
-
1487
-
1318
-
1156
-
1021
© 2025 Copyright ANSYS, Inc. All rights reserved.