-
-
March 19, 2021 at 9:21 pmvedamaSubscriberHello,nnI am trying to write a UDF to calculate turbulent viscosity based on Prandtl's mixing layer model (mu_t = a*delta) to use with the Spalart-Allmaras model. I performed the simulation using the default values first so I have a solution blueprint and then compiled the UDF, changed the Turbulent Viscosity in the Viscous dialog box to the udf value. However, I am now getting floating point exception in the first iteration itself. Could someone check my code, please? Not sure why I'm getting that error.nnI'm running a 2D second-order, pressure-based solver with Coupled scheme.n#include udf.hDEFINE_TURBULENT_VISCOSITY(mu_t1,c,t)n{ntreal a_const = 0.1;ntreal rho = C_R(c,t);ntreal dudy = C_DUDY(c,t);ntreal del = .000125;ntreal lm = a_const*del;ntreal mu_t = dudy*SQR(lm);ntntreturn mu_t;nn
-
March 24, 2021 at 12:23 pmKarthik RemellaAdministratorHello,nHave you attempted to run the model without the UDF? Does it work?nAlso, I'd strongly recommend that you print the values of mu_t in your UDF. Use the Message statements. This will do two things: nIs the UDF working properly?nIs the magnitude of mu_t correct?nI don't see anything wrong with the UDF straightaway. I'm worried about the magnitude though (if it is too large or small depending on your initial conditions). nAlso, check your overall mesh quality and make sure that you have a good mesh.nKarthikn
-
March 24, 2021 at 2:49 pmvedamaSubscriberHi Karthik,nnThanks for your response. You were right, the magnitude is rather large. I scaled it down by 3 orders of magnitude and it seems to work fine now. I'm relatively new to the world of UDFs, if you don't mind answering, why does a large magnitude cause it to fail? Would it not just give you a (horribly) wrong answer? My understanding of floating point exceptions is that it tries to divide by zero. How or where is the zero popping up, if the mu_t is off by a large magnitude? Thanks for your help!n
-
March 24, 2021 at 3:37 pmYasserSelimaSubscriberThe way the solver works is by iterations ... having initial guess, and using it to calculate the residuals which is used to modify the guess ... by repeating this process, the values of the residuals keeps decreasing and the solution converges. However, if the initial guess is too far from the solution, the the 2nd guess might be further away ... and as iterations proceed, the values become too large and/or too small ... for example velocity = 1e+35 ... n
-
Viewing 3 reply threads
- The topic ‘Turbulent Viscosity UDF?’ is closed to new replies.
Ansys Innovation Space
Trending discussions
- How do you approach this?
- Convective Augmentation Factor in DEFINE_HEAT_FLUX
- Conservation issue with a UDS solution
- Non-Premixed Combustion PDF generation with 4th-order interpolation
- Where is the Electrolyte Projected Area in the Reports tab of PEMFC Model?
- ANSYS fluent – Rocky DEM coupling
- Solar load , Mesh Orientation and Beam direction
Top Contributors
-
461
-
220
-
200
-
177
-
162
Top Rated Tags
© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.