TAGGED: udferror
-
-
January 6, 2025 at 4:49 amsjohnSubscriber
I am using the following UDF for a heterogeneous reaction consisting of a reactants in liquid phase and products in gas phase. I am using a VOF model consisting of two phases. Each phase has a mixture consisting of 3-5 species.
#include "udf.h"
/* Define constants */
#define Ru 8.314 /* Universal gas constant in J/(mol*K) */
#define Pre 8.887E12 /* Pre-exponential factor in kg/(m^3*s) */
#define EA 15000 /* Activation energy in J/mol */
#define MWA 76.53 /* Molecular weight in g/mol */
/* Heterogeneous reaction rate definition */
DEFINE_HET_RXN_RATE(simple_reaction_3, c, t, r, mw, yi, rr, rr_t)
{
Thread **pt = THREAD_SUB_THREADS(t);
/*retrieves the sub-threads of the main thread t and assigns them to the pointer pt*/
Thread *tp = pt[2]; /* Assigns liquid phase sub-thread to the pointer tp */
/* Get the temperature of the liquid phase */
real T_liquid = C_T(c, tp); /* Temperature in K */
real vof_l = C_VOF(c, tp); /* Fraction of liquid phase */
/* Calculate the reaction rate in kmol/(m^3*s) */
*rr = Pre * exp(-EA / (Ru * T_liquid)) * vof_l * 1000 / MWA / 1000;
}
Here are the main settings for my model
1.Mesh: 664k polyhedral cells, orthogonal quality ~0.97, skewness~0.0072.Pressure-based Solver3.Steady simulation4.Physics:•Multiphase – VOF: Phase 1 (multi-species propellant) and Phase 2 multi-species (multi-species ambient air)•Heterogeneous reaction UDF: aA(l) + bB(l) à cC(g) + dD(g) + fF2(g)•Mass transfer - Evaporation-Condensation: F1(l)à F2(g)•Viscous – Laminar•Species•Phase properties – Chemkin thermo (l) and Mixture-template (g)•No Turbulence Chemistry Interaction•Volumetric Reaction•Energy – Heating through wall5.Boundary conditions:•Inlet - Mass flowrate and species mass fraction•Wall 1 and Wall 2 - Fixed temperature•Outlet - Ambient pressureI get the following error:
Hybrid initialization is done.
==============================================================================
Node 1: Process 15688: Received signal SIGSEGV.
==============================================================================
Node 5: Process 14444: Received signal SIGSEGV.
==============================================================================
Node 0: Process 1660: Received signal SIGSEGV.
==============================================================================
Node 4: Process 1780: Received signal SIGSEGV.
==============================================================================
Node 3: Process 13948: Received signal SIGSEGV.
==============================================================================
Node 2: Process 3252: Received signal SIGSEGV.
==============================================================================
Node 8: Process 16252: Received signal SIGSEGV.
==============================================================================
Node 10: Process 9364: Received signal SIGSEGV.
==============================================================================
Node 11: Process 1292: Received signal SIGSEGV.
==============================================================================
Node 6: Process 10492: Received signal SIGSEGV.
==============================================================================
Node 7: Process 13544: Received signal SIGSEGV.
==============================================================================
Node 9: Process 14216: Received signal SIGSEGV.
==============================================================================
Error in the fluent (fl) process : connection reset
-
January 6, 2025 at 10:10 amRobForum Moderator
SIGSEV suggests there's some data missing somewhere, so Fluent wants something in the model. Check C_VOF as I think the thread part is cell, and you may want C_VOF(c,t)[0] or similar.
-
January 6, 2025 at 4:29 pmsjohnSubscriber
Hi Rob,
Thanks for your reply.
vof_l = C_VOF(c, tp) and t*tp = pt[2]. Here 2 is the ID for the phase. vof_l is assigned the concentration of phase 2.
In your proposed change, C_VOF(c,t)[0], what does 0 stand for? 1st species in phase 2!? -
January 6, 2025 at 4:51 pmRobForum Moderator
That should be phase 0.
Once you've got that working you may find getting the phase transfer to be an issue as you're likely not going to have a clean interface between liquid and gas. You may need to switch to Mixture or Eulerian multiphase models.
-
January 6, 2025 at 5:12 pmsjohnSubscriber
Okay. My model includes two phase flow and that's why I was using VOF model and HET_RXN_RATE is listed as compatible with VOF in the Fluent Customization Model.
-
January 6, 2025 at 5:14 pmRobForum Moderator
Compatible yes, but that doesn't mean it's the best choice. Do you have sufficient mesh to capture any and all bubbles/droplets that form as the reaction & flow interact?
-
January 6, 2025 at 5:29 pmsjohnSubscriber
My current model uses 864k cells to get things going but I have created mesh with 2-8 million cells that I can use to fine tune. I also have access to HPC.
I am hoping to model spray structure, heat transfer and chemical species formation using VOF with hereteogeneous UDF.
I have seen literature where Eulerian with heterogeneous UDF was found to be unstable for Fluent 16.2:
"Through these simulations it was concluded that with the setup used in this simulation
it is not possible to simulate the fluid flow in a monopropellant rocket engine in ANSYS
Fluent 16.2 due to stability issues connected to the Eulerian multiphase model and by
enabling the heterogeneous reaction model modelled in the mixture multiphase model." -
January 6, 2025 at 5:41 pmRobForum Moderator
Spray structure, OK, work on around 10 cells across the droplets. Then work back to get an idea of expected cell count. VOF to DPM may save you some cell count.
The multiphase models were significantly upgraded in R17-R18 time frame, and we're now on 2024R2 (roughly 25.2 in old versioning). But may not give you the spray effect that you're after.
-
January 6, 2025 at 6:28 pmsjohnSubscriber
Thanks for the tip on cell size! Need a clarification - Say many droplets are too fine to be captured by the VOF model, does that result in divergence (continuity equation residual) due to unaccounted mass of very fine droplets? If that is the case, then VOF to DPM transition becomes necessary I guess.
-
January 6, 2025 at 8:46 pmsjohnSubscriber
Hi Rob,
I tried your suggestion but it looks like that is not an acceptable syntax. Here is the error I get after compiling (while my orginal code would compile fine).
Copyright 1987-2024 ANSYS, Inc. All Rights Reserved.Compiler and linker: Clang (builtin)
Compiler path: “C:\PROGRA~1\ANSYSI~1\v241\fluent”\ntbin\clang\bin\clang-cl
Linker path: “C:\PROGRA~1\ANSYSI~1\v241\fluent”\ntbin\clang\bin\lld-link
C sources: [‘simple_reaction_4.c’]
simple_reaction_4.c(18,30): error: subscripted value is not an array, pointer, or vector
real vof_l = C_VOF(c, tp)[0]; /* Fraction of liquid phase */
~~~~~~~~~~~~^~
1 error generated.
scons: *** [simple_reaction_4.obj] Error 1
Instead of 0, I used 2 and got the same error. 2 is the ID of the primary phase in the Multiphase physics GUI. -
January 6, 2025 at 9:33 pmsjohnSubscriber
Got it running once I changed Thread *tp = pt[2] to Thread *tp = pt[0] It ran for a while (which had not hapened before!) then got Floating point error.
2 is the Phase ID in the Phase Interactions GUI but since that phase is the primary phase 0 seems to work.
Since the reaction is contained in the UDF. Should the Reaction under Properties in the Material (for Phase 1 and Phase 2) be set to none or finite-rate. -
January 7, 2025 at 11:26 amRobForum Moderator
OK, UDFs aren't something I use much (I have people to do them for me!) and we don't support at the same level as the main code. pt[2] is the third phase, remember numbering starts from 0.
I think the UDF will overwrite the panel setting, but I'd set to none and check it's still working to be sure.
-
- You must be logged in to reply to this topic.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Fluent fails with Intel MPI protocol on 2 nodes
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Cyclone (Stairmand) simulation using RSM
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- convergence issue for transonic flow
-
1557
-
602
-
599
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.