TAGGED: energy-source-term, mass-source, perforated-plate, udf
-
-
October 14, 2024 at 8:11 pmmarco.adornoSubscriber
Hi,Â
I want to simulate a transpiration cooling problem, and I need to model a boundary as a wall, but at the same time, it has to inject a gas (coolant) in a hot gas main flow.Â
I've found the "perforated wall" to be a very interesting possibility to solve this problem, since it allows to model injection of mass flow with a certain temperature on a wall. Nevertheless, this BC does not allow (afaik) to apply a profile for these quantities. I would need it because the injected mass and temperature change locally are crucial for my simulation. Do you know if there is a way to implement it with perforated walls? I'm using ANSYS 2023 R1 version. Is it possible that newer versions allow you to set the profile, while the one I'm using donìt allow it?Â
The only other possibility I see to do such a thing is to use a UDF for source terms of mass and energy, but I'm not sure how I should do it. Regarding mass I'm 90% sure how it work, but regarding how to set the temperature at which that mass is injected, I'm not so sure. I know I should have a UDF for a source term also in the energy equation, do you know exactly how should I specify it? Maybe you can point me to one example of the implementation, it would be highly beneficial.Â
Thank you so much!
Marco
-
October 15, 2024 at 9:25 amRobForum Moderator
You can adjust the hole spacing, but it sounds like you don't want cooler gas to pass through the wall, but rather to add cooler gas at locations?
-
October 15, 2024 at 9:57 ammarco.adornoSubscriber
Ideally I want to apply a continuous profile of mass flow injection (with a profile of temperature) on the wall. I need to keep the boundary as a wall because I'm interested in the wall heat fluxes, y+ and shear stresses.
The main problem is that the perforated wall allows me only to specify a uniform mass flow and temperature on the wall.
-
October 15, 2024 at 10:26 amRobForum Moderator
You can mess with the hole distribution but, yes, temperature is more difficult. A source term sounds a better option, and you can link temperature to location easily enough. Mass added to the domain should enter at 298.15K so you need to add (or remove) energy to reach the desired temperature. Check that as I can't remember where it's specified in the manual.Â
-
October 15, 2024 at 10:51 ammarco.adornoSubscriber
Do you have any suggestions on how I could implement it with UDFs for mass and energy sources?
A quite big issue I'm having right now is that even with a well defined UDF, how can I specify the cells that need to be considered as injection cells? For the source terms I can only apply them to a fluid zone, but I would need to apply them only to some cells within that zone. How can I do that?
I tried by using a DEFINE_ADJUST macro in which by giving the boundary of the subvolume in which I want to apply the sources it loops over all the cells in the zone and check if the centroid coordinates fall within this box. If so, it check the cell with C_UDMI(c, t, 0) = 1.0.Â
Is this the right approach?
Â
#include "udf.h"#include "surf.h"#include "dpm.h"/*********************************************************** Define the total mass flow for the region and mark the cells. **********************************************************/real total_mass_flow = 3e-5;  /* Total mass flow [kg/s] */int num_marked_cells = 0;    /* Number of cells in the specified region */real mass_per_cell = 0.0;    /* Mass flow per cell *//* Define the coordinates that limit the mass source region */real X_MIN = 0.200;real X_MAX = 0.261;real Y_MIN = 0.0;real Y_MAX = 0.00001;real Z_MIN = 0.0;real Z_MAX = 0.001;/**********************************************************1. Mark cells within the specified region and calculate mass per cell.**********************************************************/DEFINE_ADJUST(mark_cells_and_calculate_mass, d){  Thread *t;  cell_t c;  real c_centroid[ND_ND]; /* Cell centroid */  num_marked_cells = 0;  /* Reset the number of marked cells */  /* Loop over all cell threads */  thread_loop_c(t, d)  {    begin_c_loop(c, t)  /* Loop over all cells in the thread */    {      /* Get the cell centroid */      C_CENTROID(c_centroid, c, t);      /* Check if the cell is within the specified region */      if (c_centroid[0] >= X_MIN && c_centroid[0] <= X_MAX &&        c_centroid[1] >= Y_MIN && c_centroid[1] <= Y_MAX &&        c_centroid[2] >= Z_MIN && c_centroid[2] <= Z_MAX)      {        /* Mark the cell by storing 1 in UDMI (User-Defined Memory Index) */        C_UDMI(c, t, 0) = 1.0;        num_marked_cells++;  /* Count the marked cell */      }      else      {        /* Unmark cells outside the region */        C_UDMI(c, t, 0) = 0.0;      }    }    end_c_loop(c, t)  }  /* Calculate the mass flow per cell */  if (num_marked_cells > 0)  {    mass_per_cell = total_mass_flow / num_marked_cells;  }  else  {    mass_per_cell = 0.0;  /* No cells marked, no mass flow */  }}/**********************************************************2. Apply the mass source only to the marked cells**********************************************************/DEFINE_SOURCE(mass_source_2, c, t, dS, eqn){  real mass_source = 0.0;  /* Check if the cell is marked */  if (C_UDMI(c, t, 0) == 1.0)  {    real c_volume = C_VOLUME(c, t);           /* Get the volume of the cell */    mass_source = mass_per_cell / c_volume;    /* Apply the mass source per unit volume */    dS[eqn] = 0;                            /* No derivative with respect to any transport variable */  }  else  {    mass_source = 0.0;    dS[eqn] = 0;  }  return mass_source;               /* Return the mass source */} -
October 15, 2024 at 12:16 pmRobForum Moderator
I've not looked too closely at the UDF. Have a look for the near wall cell macros: ie tag the cell(s) that touch the wall and assign the source that way. Or split a layer or two of cells out of the main domain using Registers and the Mesh Split functions.Â
-
- You must be logged in to reply to this topic.
- Non-Intersected faces found for matching interface periodic-walls
- Script error Code: 800a000d
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
-
1301
-
591
-
544
-
524
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.