We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Variable density for solid object

    • Alberto
      Subscriber

      Hi 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

    • Rob
      Forum Moderator

      If 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. 

      • Alberto
        Subscriber

        This 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.

    • Rob
      Forum Moderator

      OK, 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. 

      • Alberto
        Subscriber

        Ok, 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?

      • Alberto
        Subscriber

        in SpaceClaim i’ve set HDPE, then in Fluent aluminium

    • Rob
      Forum Moderator

      The 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. 

      • Alberto
        Subscriber

        Sure, this is what my UDF does, right? But i have two different density values for the same object. 

    • Rob
      Forum Moderator

      What material is it attached to? 

      • Alberto
        Subscriber

        in SpaceClaim i’ve set HDPE, then in Fluent aluminium

    • 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.

       

    • Alberto
      Subscriber

      It 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

    • Rob
      Forum Moderator

      And 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. 

Viewing 7 reply threads
  • The topic ‘Variable density for solid object’ is closed to new replies.