TAGGED: define_grid_motion, dynamic-mesh, mass-balance
-
-
July 2, 2025 at 5:49 pm
srath9
SubscriberHello,
I am trying to simuate a simple case with GRID_MOTION UDF. The main issue I am facing is mass imbalance (not conserved).Â
2D Geometry: x (0,150 mm) and y (0,20 mm)Â
Case:Â
- Single phase: Air (ideal gas)
- Dynamic mesh:Â
- Right wall - stationary
- Left wall - Deforming
- Top wall - Deforming
- Bottom wall - UDF
- Time step ~ Have even tried 1e-5s
Predicted motion of part of bottom wall using UDF:
Actual motion (as predicted):
At t=0;
At some time point (motion defined by UDF):
At t =0.5s;ÂÂUDF used:#include "udf.h"#include "dynamesh_tools.h"#define amplitude 0.01// Cycles is defined for periodic motion#define cycles 30.0Â Â ÂÂ// Function to define the motion based on the time tDEFINE_GRID_MOTION(trap, domain, dt, time, dtime){Â Â Thread *tf = DT_THREAD(dt);Â Â face_t f;Â Â Node *v;Â Â real x, y,z;Â Â real new_z;Â Â real periodicity = (60/cycles)/2;ÂÂ Â int n;Â Â real t = CURRENT_TIME; // Get the current timeÂÂ Â SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));ÂÂ Â begin_f_loop(f, tf)Â Â {Â Â Â Â f_node_loop(f, tf, n)Â Â Â Â {Â Â Â Â Â Â v = F_NODE(f, tf, n);ÂÂ Â Â Â Â Â if (NODE_X(v) > 0.050 && NODE_X(v) < 0.090 && NODE_POS_NEED_UPDATE(v))Â Â Â Â Â Â {Â Â Â Â Â Â Â Â NODE_POS_UPDATED(v);Â Â Â Â Â Â Â Â x = NODE_X(v);Â Â Â Â Â Â Â Â y = NODE_Y(v);z = NODE_Z(v);ÂÂ Â Â Â Â Â Â Â // Update the coordinatesÂÂ Â Â Â Â Â Â Â NODE_Y(v) = (amplitude/M_PI) * (asin(sin(M_PI*t/periodicity)) + acos(cos(M_PI*t/periodicity)));ÂNODE_X(v) = x;Â Â Â Â Â Â }Â Â Â Â }Â Â }Â Â end_f_loop(f, tf);}Mass imbalance:
Â
Please share any info that might help. Thank you!!
-
July 7, 2025 at 2:08 pm
Federico
Ansys EmployeeHello,Â
the way your interior mesh is deforming is compromising mesh quality. I would recommend that you remesh this model using tetrahedral cells and use Remeshing in Fluent. This will help preserve mesh quality and should reduce any mass imbalance from highly skewed cells or faces.
-
- You must be logged in to reply to this topic.
-
3492
-
1057
-
1051
-
965
-
942
© 2025 Copyright ANSYS, Inc. All rights reserved.