January 24, 2023 at 7:02 pmehsan.sadeghiSubscriber
I 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); //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:
F_UDMI(f,t,0) = C_UDMI(c,t0,0) + (C_UDSI_G(c0,t0,0)*dr0);
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 amRobAnsys Employee
There'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 amehsan.sadeghiSubscriber
Thanks 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 pmRobAnsys Employee
I 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 pmehsan.sadeghiSubscriber
I 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 pmRobAnsys Employee
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 pmehsan.sadeghiSubscriber
But 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 amRobAnsys Employee
Yes, we tend not to share everything, and I can't comment other than to refer to the manual(s). Look for  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.
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
© 2023 Copyright ANSYS, Inc. All rights reserved.