|
[Sponsors] |
UDF for store separation 6DOF not working properly |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 2, 2024, 15:54 |
UDF for store separation 6DOF not working properly
|
#1 |
New Member
Matthew Campbell
Join Date: Mar 2024
Posts: 2
Rep Power: 0 |
Hello,
I am using a UDF for a simple store separation case, where external forces should be applied to the CG while it is less than a certain Z displacement (0.1m). The reference frame is oriented at the CG, with axes consistent with the body frame orientation (Z down, X Fwd). From what I can tell, the UDF I am using (which is from the udf guide) is not applying these external forces but is applying the physical properties (Ixx, Iyy, Izz) to the body which then experiences a gravity drop. I was hoping someone could look at this UDF and provide insight into why the external forces are not being applied. My time step is 0.01. It appears that the Z displacement that I want the external forces to be acting before is not met until appx. 9 time steps. Below is a copy of the UDF I am trying to use: /************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" DEFINE_SDOF_PROPERTIES(delta_missile, prop, dt, time, dtime) { prop[SDOF_MASS] = 907.185; prop[SDOF_IXX] = 27.116; prop[SDOF_IYY] = 488.094; prop[SDOF_IZZ] = 488.094; /* add injector forces, moments */ { register real dfront = fabs (DT_CG (dt)[2] - (0.179832*DT_THETA (dt)[1])); register real dback = fabs (DT_CG (dt)[2] + (0.329184*DT_THETA (dt)[1])); if (dfront <= 0.100584) { prop[SDOF_LOAD_F_Z] = 10676.0; prop[SDOF_LOAD_M_Y] = -1920.0; } if (dback <= 0.100584) { prop[SDOF_LOAD_F_Z] += 42703.0; prop[SDOF_LOAD_M_Y] += 14057.0; } } printf ("\ndelta_missile: updated 6DOF properties"); } The print line does not appear with each timestep, but prints the line about 30 times midway through the simulation. I'd appreciate any insight! It seems to be compiling properly (using vs C compiler, launching fluent in the env, etc), so I am unsure of what to do. -Matt |
|
November 9, 2024, 10:45 |
Solution
|
#2 |
New Member
Matthew Campbell
Join Date: Mar 2024
Posts: 2
Rep Power: 0 |
I wanted to post my solution for anyone else who has to endure this pain:
#include "udf.h" /* Define constants for ejector forces and moment thresholds */ #define FRONT_EJECTOR_FORCE -10676.0 #define FRONT_EJECTOR_MOMENT 1920.0 #define BACK_EJECTOR_FORCE -42703.0 #define BACK_EJECTOR_MOMENT -14057.0 #define Y_DISPLACEMENT_THRESHOLD (3.302995 - 0.100584) // Absolute y-position threshold. 3.3 is where the CG y loc is @ time step 0 /* Debugging flag: Set to 1 to enable debugging prints */ #define DEBUG_MODE 1 /* Function to print debugging information if DEBUG_MODE is enabled */ void print_debug_info(real time, real y_displacement) { if (DEBUG_MODE) { printf("Time: %f, y_displacement: %f\n", time, y_displacement); printf("Ejector force condition: %s\n", (y_displacement >= Y_DISPLACEMENT_THRESHOLD) ? "Active" : "Inactive"); } } /* Main UDF to apply ejector forces based on y-position of CG */ DEFINE_SDOF_PROPERTIES(delta_missile, prop, dt, time, dtime) { /* Basic Properties */ prop[SDOF_MASS] = 907.185; prop[SDOF_IXX] = 27.116; prop[SDOF_IYY] = 488.094; prop[SDOF_IZZ] = 488.094; /* Reset forces and moments to avoid unintended accumulation */ prop[SDOF_LOAD_F_Y] = 0.0; // Reset vertical force prop[SDOF_LOAD_M_Z] = 0.0; // Reset moment about y-axis /* Get the current y-position of the CG */ real y_displacement = DT_CG(dt)[1]; /* Print debug information */ print_debug_info(time, y_displacement); /* Apply ejector forces and moments if y-position exceeds the threshold */ if (y_displacement >= Y_DISPLACEMENT_THRESHOLD) { prop[SDOF_LOAD_F_Y] += FRONT_EJECTOR_FORCE + BACK_EJECTOR_FORCE; prop[SDOF_LOAD_M_Z] += FRONT_EJECTOR_MOMENT + BACK_EJECTOR_MOMENT; if (DEBUG_MODE) printf("Ejector forces and moments applied.\n"); } /* Final debug print to confirm property updates */ if (DEBUG_MODE) { printf("delta_missile: 6DOF properties updated: Force Y = %f, Moment Y = %f\n", prop[SDOF_LOAD_F_Y], prop[SDOF_LOAD_M_Z]); } } Something you need to look out for when working on the store-separation UDF: (1) make sure you identify the correct coordinate system for your problem. Fluent is Z up, X aft. In my simulation I kept it in Y up, X aft. Thus Z and Y were effectively swapped. (2) I simplified the problem by taking the small angle approximation in my code. Rotation by the ejector forces < 5 deg, so this is an ok application of small angle appx. (3) Properly define the displacement threshold. If you want to monitor the distance the CG translates in one dimension (ejector stroke length), you must account for the starting point. My CG was not at 0,0,0 so that was causing me trouble. In hindsight the UDF is not nearly as bad as I thought it was. There's not a ton of information out there though, so I wanted to contribute my solution. -mscaero |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
unable to run dynamic mesh(6dof) and wave UDF | shedo | Fluent UDF and Scheme Programming | 0 | July 1, 2022 18:22 |
udf not working properly | Ravi palla | Fluent UDF and Scheme Programming | 1 | June 19, 2022 10:24 |
Need help regarding 6DOF udf with face loop | burhanibrar | Fluent UDF and Scheme Programming | 20 | July 28, 2021 05:48 |
mass transfer udf not working | Anshs | Fluent UDF and Scheme Programming | 12 | July 30, 2020 22:43 |
parallel implementation of DEFINE_INIT UDF not working | eml51 | Fluent UDF and Scheme Programming | 1 | January 28, 2019 22:26 |