-
-
January 26, 2024 at 10:46 am
Alberto
SubscriberHi community, I would ask a question about density distribution with UDF file.
I'm trying to simulate the falling descent of a solid body in air with overset mesh and 6-dof solver. Everithing is well setted up and if i use a constant value for the solid density in fluent no problems occurs.
 I would like to consider a body with different density distribution, for example rho = 40 if the cell thickness is below a threshold and rho =430 if it is above. I've write the following UDF and fluent allow to compile and assign to the material density, but when i look at the density contours in CFD post the value on the solid body is uniform and equal to 1.225 (air density). How can I check the real density of the solid ?Â
UDF:
#include "udf.h"
DEFINE_PROPERTY(density, c, t)
{
  real ro;
  real x[ND_ND];
  real thickness;
  int isWallObject;
  Domain* domain;  /* Ottieni il dominio */
  domain = Get_Domain(1);  /* Verifica se la faccia è associata alla name selection "wall-object" */
  isWallObject = (C_FACE_THREAD(c, t) == Lookup_Thread(domain, "wall-object")) ? 1 : 0;  if (isWallObject)
  {
    C_CENTROID(x, c, t);
    thickness = C_VOLUME(c, t) / C_FACE_AREA(c, t);    if (thickness < 0.000353)
      ro = 40;
    else
      ro = 430;
  }
  else
  {
    ro = 1.225;
  }  return ro;
}Â
Many thanks
-
January 29, 2024 at 12:16 pm
Rob
Forum ModeratorIf you're setting a material property why do you need to also set that property to 1.225 kg/m3? I can understand some compression effect on a wall, so 40 or 430, but not the reason for the second IF.Â
-
January 29, 2024 at 1:42 pm
Alberto
SubscriberThis is becouse if the cell is not in "wall-object", then set the fluid density which is 1.225. I can also remove that but the results dont change.
-
-
January 29, 2024 at 1:51 pm
Rob
Forum ModeratorOK, but you're setting a material property. For a solid (or wall) that's the solid material type, default is aluminium. So if the solid zone is of a certain thickness there's no need for the gas property.Â
-
January 29, 2024 at 1:54 pm
Alberto
SubscriberOk, but i don't have the aluminium as material, i've load this udf file and fluent accept it as material property. I want density = 40 when i'm moving over the object surface where the cell are susbatially 2D, then i want 430 when their 3D. This is the way I'm trying to set material properties. Does it work?
-
January 29, 2024 at 6:30 pm
Alberto
Subscriberin SpaceClaim i’ve set HDPE, then in Fluent aluminium
-
-
January 29, 2024 at 2:19 pm
Rob
Forum ModeratorThe wall must be a solid material, and the flowing volumes are fluid. So, the UDF will hook to the solid material and then the solid is assigned to the wall.Â
-
January 29, 2024 at 2:37 pm
Alberto
SubscriberSure, this is what my UDF does, right? But i have two different density values for the same object.Â
-
-
January 29, 2024 at 3:22 pm
Rob
Forum ModeratorWhat material is it attached to?Â
-
January 29, 2024 at 6:36 pm
Alberto
Subscriberin SpaceClaim i’ve set HDPE, then in Fluent aluminium
-
-
January 30, 2024 at 10:26 am
Rob
Forum ModeratorÂ
OK, and you attached the UDF to the aluminium? Is the region you're setting a wall or a solid zone? A wall doesn't see the neighbouring cell volume unless you tell it to: there's a bit in the UDF manual on adjacent face/cell/node syntax.
Â
-
January 30, 2024 at 10:49 am
Alberto
SubscriberIt is a solid zone, obtained through a boolean subtraction where the tool is the solid and the target the fluid volume.
Yes it is attached to the aluminium material as user-defined input
-
January 30, 2024 at 11:41 am
Rob
Forum ModeratorAnd the solid zone isn't a wall. You may need to loop over the cells and adjacent wall thread (or the other way round) to get the thickness for your material definition.Â
-
- The topic ‘Variable density for solid object’ is closed to new replies.
- How do I get my hands on Ansys Rocky DEM
- Script Error
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- convergence issue for transonic flow
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- Point exception in erosion calculation
- Errors with multi-connected bodies using AQWA
- Script Error Ansys
-
2407
-
930
-
599
-
591
-
569
© 2025 Copyright ANSYS, Inc. All rights reserved.