Issues with mass source macros in a multiphase system
1 Attachment(s)
Hi everyone,
I'm trying to write a UDF that describes phase change (just working on getting evaporation right now). I've been trying out my UDF on a "1D" Stefan problem (see attached PDF). My biggest problem right now is with an if statement in the mass source macro (DEFINE_SOURCE) that is hooked to my primary phase, the vapor. Here's the macro in question: Code:
DEFINE_SOURCE(gas, cell, thread, dS, eqn) My specific issue is that the solver doesn't always enter into the if statement when it should. When the interface temperature gets above 373.1K, I would expect a mass source to appear along the entire length interface. However, I don't see that at all. Instead, it's just one localized circular region where a mass source appears. Does anyone have any experience with if statements inside DEFINE_SOURCE macros for a mass source in a multiphase simulation? Have I formatted it correctly? I've been trying to figure out if it's something to do with the data structures in multiphase situations, i.e. phase-level threads versus mixture-level threads, or a data type problem, or a problem with the if statement syntax. I haven't been able to find anything helpful in the UDF manual or elsewhere online. I've submitted my question to ANSYS but am waiting to hear back. Thank you!! |
You're multiplying C_UDMI(cell,tm,0) by other terms to evaluate 'source'. If this UDM value is zero, then your 'source' would also be zero: could this case be true, and what does your UDM-0 represent?
I see no reason for the solver not to enter the if statement when it should; try some debugging to be sure this logic isn't the cause of your problem. Add in a Message(); line where 'source' is evaluated in the if statement to print the cell details to screen and compare the number of these messages with the number of nonzero source terms in your simulation. |
Quote:
Thanks for your idea re: debugging the if statement. Could you clarify how to add in the Message(); line? I've never used that before, and I haven't seen it in the UDF manual. Thank you again! |
The Message() function is similar to printf() where you can print text to the screen. Note that in parallel every process will print this same message (for example on DEFINE_ADJUST outside a cell loop), so you could use Message0() for only node 0 to print the message to screen (and has the same functions as Message() in serial mode).
Start with adding these lines of code (I've assumed you're running in 3-D, if you're solving in 2-D remove the z-direction components) to see at which cells your DEFINE_SOURCE macro is being called: Code:
real cellcentroid[ND_ND]; |
store_vof_norm
hi every body
I'm modeling a three-phase problem with Eulerian (+Multi fluid VOF model) model. I also use Population balance model. I want to use a UDF for nucleation rate for third phase (second secondary phase). bellow are some part of this UDF: #include "udf.h" #include "sg_pb.h" #include "sg_mphase.h" DEFINE_PB_NUCLEATION_RATE(nuc, cell, thread) { real Epsilon_Entrainment; real Vof_CutOff = 0.05; int phase1_domain_index = 0; int phase2_domain_index = 1; Thread *mixture_thread = THREAD_SUPER_THREAD(thread); Thread *ContinuousPhaseThread = THREAD_SUB_THREAD(mixture_thread,phase1_domain_ind ex); Thread *LargeBubbles = THREAD_SUB_THREAD(mixture_thread,phase2_domain_ind ex); Vof_CutOff= C_VOF(cell, LargeBubbles); if (C_U(cell,LargeBubbles) > 8) { Epsilon_Entrainment = 100000; } return (Epsilon_Entrainment); } But when I interpret this UDF, I encounter this error: Error: D:\\xxx: line 20: label "store_vof_norm" not found (pc=74). this UDF has 19 lines. this error refers to line 20.I found that this error is from sg_mphase.h file. In this file there is "store_vof_norm", But I don't know what is the problem???? please help me. it is very important to me. thanks of all |
should C_UDMI(cell,tm,0) be re-calculated in DEFINE_SOURCE if it is not global variable?
Or should it be in a begin_c_loop? |
User-defined memory is stored within Fluent and C_UDMI is a macro which accesses this memory (it's not a variable which would require initialising or being globally defined).
|
All times are GMT -4. The time now is 07:28. |