TAGGED: define-source, udf, udm
-
-
January 25, 2025 at 1:33 pm
sjohn
SubscriberI am using a DEFINE_SOURCE UDF to remove mass from liquid phase. The output is also being saved to a UDM so that it can be used in another DEFINE_SOURCE UDF to add mass to the gas phase.
In my simulation results, the mass in the liquid phase is seen to reduce when I compare the inlet and outlet mass flowrates but the mass in the gas phase does not show any significant increase. I made a contour plot of the UDM with exponential format values and it seems to be zero in the mixture domain. -
January 25, 2025 at 10:25 pm
sjohn
SubscriberI can confirm that mass is being removed but it is not being stored in the UDM. Form the User Defined Menu, I have allocated one spot for the UDM.
Here is how I am removing mass from the liquid phase and assigning it to the UDM
#include “udf.h”#include “math.h”/* Define the source term function */DEFINE_SOURCE(species_sub_ig2, c, t, dS, eqn){real source = 0.0;real temperature = 0.0;real k = 0.0;real vol_fract = 0.0;real density = 0.0;real A = 3.85E4;real B= 948;Thread *phase_thread = THREAD_SUB_THREAD(t, 1);if (phase_thread != NULL){vol_fract = C_VOF(c, phase_thread);density = C_R(c, phase_thread);temperature = C_T(c, phase_thread);k = A * (B * temperature);source = -k * vol_fract * density;}else{source = 0.0;}/* Store the source term in user-defined memory */C_UDMI(c, t, 0) = – source; /* Assuming UDM index is 0 */dS[eqn] = -k;return source;}-
January 25, 2025 at 10:29 pm
sjohn
SubscriberI have tried to add #include "sg_mphase.h" in case C_VOF needs it but I get some warning when I try to include it.
-
-
January 27, 2025 at 11:37 am
Rob
Forum ModeratorWhat is going into the UDM?
-
January 27, 2025 at 2:33 pm
sjohn
SubscriberSee 4th line from the bottom. That statement defines what is going into the UDM.
-
-
January 27, 2025 at 2:58 pm
Rob
Forum ModeratorYes, and what value is that? Ie what does the contour of UDM look like?
-
January 27, 2025 at 3:02 pm
sjohn
SubscriberI already mentioned in my first post that it is zero.
Actually, I figured out the issue and solved it.
-
January 27, 2025 at 3:03 pm
Rob
Forum ModeratorOK, please post your solution so others may benefit.
-
- You must be logged in to reply to this topic.
-
2858
-
970
-
851
-
599
-
591
© 2025 Copyright ANSYS, Inc. All rights reserved.