Tagged: udf
-
-
January 24, 2023 at 7:02 pm
ehsan.sadeghi
SubscriberI want to calculate the gradient of UDS0 and save it in a UDMI to later use it in the UDF. I calculate the cell values of gradient of UDS0 by using C_UDSI_G macro and save it to UDMI. i.e.:
C_UDMI(c,t,0) = -1.*C_UDSI_G(c,t,0)[0]; //Ex
Based on UDF manual tha face value of an scalar is calculated by:As there are no macros (as far as I know) to give me the face values of scalar so I do the next for boundary faces:
BOUNDARY_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0)
F_UDMI(f,t,0) = C_UDMI(c,t0,0) + (C_UDSI_G(c0,t0,0)[0]*dr0[0]);Is it a correct way of calculating the gradient? my code compiles corrrectly but after one iteration fluent gives me an error message like this:
Node 0 Fatal signal raised sig = Segmentation fault
-
January 25, 2023 at 11:10 am
Rob
Ansys EmployeeThere's a flag in the code to retain gradient data after it's used in the solver. If you don't some of the gradients aren't there to use in UDFs.
/solve/set/advanced/retain-temporary-solver-mem and "yes" when asked.
This assumes you have sufficient UDM and UDS assigned in the case.
-
January 26, 2023 at 8:51 am
ehsan.sadeghi
SubscriberThanks Rob. It was memory related issue. I retained the memory from freeing. One question more: is it the correct way of calculating gradient? comparing electric field (i.e. gradient of UDS0 or gradient of potential) with MHD module I get slightly different results .
-
-
January 26, 2023 at 4:41 pm
Rob
Ansys EmployeeI tend to use the Fluent macros. Remember scalars diffuse so depending on how the MHD module is coded up (UDM rather than UDS) there may be a difference.
-
January 26, 2023 at 7:04 pm
ehsan.sadeghi
SubscriberI didn´t get exactly what you mean. Considering that the potential equation or Poisson´s equation take diffusion coefficient of 1 (depending on how you incorporate source term), do you mean that partly the result accuracy will depend on discretization scheme of UDS? second order schemes should minimize false diffusion no?
-
-
January 27, 2023 at 1:13 pm
Rob
Ansys Employee2.2.1.4 https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_GeneralSolverDEFINE.html
A UDS is a scalar, similar to species, so as well as convection it'll diffuse with the flow. A UDM is a calculated value in a cell, it can only "move" based on what maths creates it.
-
January 27, 2023 at 5:12 pm
ehsan.sadeghi
SubscriberBut it doesn´t explain why there are differences in MHD and UDS for potential equation. With same diffusivity and BC it should produce same results. That is why I am suspecting that the way that I am calculating gradient is not correct, perhaps gradient on faces. Fleunt´s MHD documentation is very breif and there are no macros related to MHD in the manual.
-
-
January 30, 2023 at 11:13 am
Rob
Ansys EmployeeYes, we tend not to share everything, and I can't comment other than to refer to the manual(s). Look for [123] or similar in the documentation, that'll be a reference to the theory. If the results are close, you may be right, but I suspect you've missed something more significant.
-
- 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
-
2700
-
2138
-
1355
-
1142
-
462
© 2023 Copyright ANSYS, Inc. All rights reserved.