TAGGED: capillary-force, fluent
-
-
August 2, 2024 at 7:01 am智敏 徐Subscriber
We currently use porous media to make capillary cores, and UDFs to add capillary force to porous media so that they can be aspirated, but the code we write can be imported normally but crashes as soon as we calculate it
#include "udf.h"#define PARAMETER_P 1.0 // 替换为实际的参数值#define UDS_INDEX 0#define UDM_INDEX 0#define USR_SOURCE_INDEX 0DEFINE_ADJUST(adjust_and_store_gradient, domain){Thread *t;cell_t c;face_t f;real grad[ND_ND]; // 存储梯度的数组domain = Get_Domain(2); // 假设domain_ID为2thread_loop_c(t, domain){begin_c_loop(c, t){C_UDMI(c, t, UDM_INDEX) = 0.0; // 初始化UDMC_UDSI(c, t, UDS_INDEX) = C_VOF(c, t); // 设置UDS为当前体积分数if (C_UDSI(c, t, UDS_INDEX) > 0.0 && C_UDSI(c, t, UDS_INDEX) < 1.0){F_GRAD_CELL_THREAD(c, t, &C_UDSI(c, t, UDS_INDEX), grad);C_UDMI(c, t, UDM_INDEX) = NV_MAG(grad); // 计算梯度的模并存储到UDM}}end_c_loop(c, t)}}DEFINE_SOURCE(apply_momentum_source, c, t_cell, dS, eqn){real p = PARAMETER_P; // 给定的参数preal vol_frac = C_UDSI(c, t_cell, UDS_INDEX); // 体积分数real grad_mag = C_UDMI(c, t_cell, UDM_INDEX); // 体积分数梯度的模real F = 2.0 * p * vol_frac * grad_mag; // 根据公式 F = 2 * p * vol_frac * grad_mag 计算动量源项if (vol_frac > 0.0 && vol_frac < 1.0){dS[2] += F; // 在所有方向上添加动量源项}return 0;} -
August 2, 2024 at 10:49 amRobForum Moderator
There may be a more useful error at the top of the list. Check all macros are valid - where did F_GRAD_CELL_THREAD come from?
-
August 2, 2024 at 12:26 pmALEXANDRE COSTASubscriber
Hi,
I am also interested in this type of "crash".
-
August 2, 2024 at 2:18 pm智敏 徐Subscriber
我该如何修改它?
-
August 2, 2024 at 2:21 pm智敏 徐Subscriber
How can I modify this?
-
August 2, 2024 at 2:23 pm智敏 徐Subscriber
How do you change this UDF?
-
August 5, 2024 at 9:39 amRobForum Moderator
Maybe start by answering my previous question?
-
Viewing 6 reply threads
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Script error Code: 800a000d
- Cyclone (Stairmand) simulation using RSM
- Fluent fails with Intel MPI protocol on 2 nodes
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
Top Contributors
-
1241
-
543
-
523
-
225
-
209
Top Rated Tags
© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.