-
-
March 28, 2025 at 5:01 am
jayasriyadav
SubscriberThis is UDS which i am using to visualize nucleation rate in crystallization. Along with this UDS i am also using a UDF(it is running properly).
#include "udf.h"Â/* Define UDS Source Term for Nucleation Rate */DEFINE_SOURCE(nucleation_uds_source, cell, thread, dS, eqn){Â Â real J;Â Â ÂÂ Â /* Retrieve the nucleation rate from UDM (assuming it's stored in UDM[2] in your nucleation UDF) */Â Â J = C_UDMI(cell, thread, 2);ÂÂ Â ÂÂ Â /* Store nucleation rate in UDS[0] for visualization */Â Â C_UDSI(cell, thread, 0) = J;ÂÂ Â ÂÂ Â /* No derivative dependency */Â Â dS[eqn] = 0.0;Â Â ÂÂ Â return J;}Â/* Define Diffusive Flux for UDS */DEFINE_UDS_FLUX(nucleation_uds_flux, f, thread, i){Â Â return 0.0; /* No flux term, as we only visualize J */}And i am getting a floating point exception error , these are my errors while running simulation. Is there anything wrong in my uds?
Divergence detected in AMG solver: uds-0
Error at host: floating point exception -
March 28, 2025 at 10:12 am
Rob
Forum ModeratorYou're setting a UDS source as being equal to the UDM. What does the UDS do, and is the UDM value physically sensible?Â
-
March 28, 2025 at 10:19 am
jayasriyadav
SubscriberI need UDS for the visualization of Nucleation rate , I am storing values of Nucleation rate from the UDF and using it for UDS.
This is my UDF for the Nucleation rate,/* Negated forms that are more commonly used */
/**********************************************************/
#if !RP_HOST
/* either serial or compute node process is involved */
#endif
/**********************************************************/
/*UDF that computes the particle nucleation rate*/
/**********************************************************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_NUCLEATION_RATE(nuc_rate, cell, thread)
{
real SS;
real J;
real p1 = 0.052; /* nuc constant */
real p2 = 1000.; /*nuc const activation energy constant J/mol */
real p3 = 5.8; /* nucleation law power index */
real R = 8.314; /*gas constant j/mol.k*/
real T, T1, solute_mass_frac, solubility, solubility_mass;
real solute_mol_wt, solvent_mol_wt;
Thread *tc = THREAD_SUPER_THREAD(thread); /*obtain mixture thread */
Thread **pt = THREAD_SUB_THREADS(tc); /* pointer to sub_threads */
Thread *tp = pt[P_PHASE]; /* primary phase thread */
solute_mol_wt = 136.0; /* molecular weight of kdp */
solvent_mol_wt = 18.; /* molecular weight of water */
solute_mass_frac = C_YI(cell,tp,0); /* mass fraction of solute in primary phase (solvent) */
T1 = C_T(cell,tp); /* Temperature of primary phase in Kelvin */
T = (T1-273.15); /* Temperature of primary phase in degree Celcius */
solubility_mass = 15.24+(2.06*0.1*T)+(1.01*0.01*pow(T,2))-(1.45*0.0001*pow(T,3))+(1.23*0.000001*pow(T,4)); /* mass solubility in percentage*/
solubility = (solubility_mass/100.0); /* Solubility Law relating equilibrium solute mole fraction to Temperature*/
SS = solute_mass_frac/solubility; /* Definition of Supersaturation */
if (SS <= 1.)
{
J = 0.;
}
else
{
J = p1*exp(-p2/(R*T1))*pow((SS-1),p3);
C_UDMI(cell,tc,2) = J;
/* saving local nucleation rate to memory */
C_UDMI(cell,tc,0) = SS;
/* saving local supersaturation to memory */
}
return J;
}
/***************************************************************/Â
-
March 28, 2025 at 11:16 am
Rob
Forum ModeratorI assume you've got sufficient UDM & UDS assigned? And is the UDM value sensible? I'd also question any curve fit at 1e-5.x^4 for precision!Â
-
March 28, 2025 at 1:22 pm
-
March 28, 2025 at 2:19 pm
Rob
Forum ModeratorThe above means the Scalar value is nonsense. So, if you plot the UDM do you see a more sensible result? Given the code compiles it's gramatically correct, so next step is to figure out what part of the maths isn't right. Staff aren't permitted to debug code, we're limited to hints and suggesting you read the manual.Â
-
- You must be logged in to reply to this topic.
- How do I get my hands on Ansys Rocky DEM
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- convergence issue for transonic flow
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- Point exception in erosion calculation
- Script Error Ansys
- Errors with multi-connected bodies using AQWA
- Quantitative results
-
2763
-
959
-
825
-
599
-
591
© 2025 Copyright ANSYS, Inc. All rights reserved.