TAGGED: cell-zone, dpm, udf-fluent
-
-
July 28, 2021 at 5:34 pmHolzmannSubscriber
Hey everybody,
I am working on H2O2-H2O vaporization using the latest Fluent version However, as I am almost at the relative saturation of H2O, the parcels are not evaporating anymore (everything is fine here). However, the system gets filled with parcels and I want to remove them, e.g., at a defined location in the mesh (e.g., @a cell zone). Is something like that possible?
--> If parcel -> cell zone -> escape.
Any ideas? An internal patch might work as well.
Thanks,
Tobi
July 28, 2021 at 7:14 pmHolzmannSubscriberHey everybody, I found the solution:
However, the only non-dynamic thing is that I have the cell-zone-id hard-coded. Is there a way to set it via TUI ?
DEFINE_DPM_SCALAR_UPDATE(parcelRemoval, c, t, initialize, tp)
{
if (initialize)
{
// Fluid domain
Domain *domain = Get_Domain(1);
// Cell zone id
int Cell_Zone_ID = 598;
cell_t cCZ;
Thread *tCZ = Lookup_Thread(domain, Cell_Zone_ID);
// Looping over all cells of the cell zone
begin_c_loop(cCZ, tCZ)
{
// Check if cCZ == c -> parcel inside
if (cCZ == c)
{
MARK_TP(tp, P_FL_REMOVED);
}
}
end_c_loop(cCZ, tCZ)
}
}
July 29, 2021 at 10:42 amRobForum ModeratorThe other option is to add an interior surface when you build the model, with some careful use of the porous jump boundary condition you can remove particles as they hit the surface.
July 29, 2021 at 1:19 pmAmine Ben Hadj AliAnsys EmployeeI guess that was posted elsewhere. You can change the cell zone ID to anything else or make it case dependent. You can get it the Thread of cells of particular cell zone using the macro Lookup_Thread or you use the conditional if (THREAD_ID(t)==yourID ) {
do something
}
July 29, 2021 at 1:27 pmAmine Ben Hadj AliAnsys EmployeeHowever I will rather cell the thread id of the cell the particle is currently in and then terminate its trajectory.
August 2, 2021 at 7:01 amHolzmannSubscriberHey both, thank you for your hints. I did the following for making the cell-zone-id dynamic:
Inside the UDF I have a global variable at the beginning of the source file (int cellZoneId = -1)
I created a new DEFINE_ON_DEMAND function to set the cell zone id
===================================================================================
// Function to set the cell zone id for the removal UDF
DEFINE_ON_DEMAND(setCellZoneIdForParcelRemoval)
{
// Set the cell-zone-id (only called for host and not nodes)
#if !RP_NODE
if (RP_Variable_Exists_P("cell_zone_id_remove_parcels"))
{
cellZoneId = RP_Get_Integer("cell_zone_id_remove_parcels");
}
// TODO check if cell zone exists
Message("cellZoneId is set to >> %i\n", cellZoneId);
#endif
// Communicate the id to the nodes
host_to_node_int_1(cellZoneId);
// Check for the nodes
// Message("DEBUG: Cell_Zone_ID on nodes-> %d\n", cellZoneId);
}
===================================================================================
After loading the UDF, I am creating a new variable using the TUI command:
(make-new-rpvar 'cell_zone_id_remove_parcels'integer #f)
The above code checks if the variable exists and take the ID of the guy. At the end, I redistribute it to the nodes.
However, I found some strange behavior in the code. The removal works as expected but I also get some crazy removal stuff (check out the picture):
At the cell zone (below the drawed plane) all cells get removed (as expected)
For any reason, I also remove some (non understandable) parcels somewhere else:
So something has to be wrong in my code. I have no idea what happens here. Any idea?
August 2, 2021 at 7:12 amHolzmannSubscriberOkay, ... using your approach (which is much nicer) it works out perfectly:
=======================================================================
if (THREAD_ID(t) == cell_zone_id)
{
// Do my stuff
}
=======================================================================
So anything is wrong with that code of piece:
=======================================================================
cell_t cCZ;
Thread *tCZ = Lookup_Thread(domain, Cell_Zone_ID);
// Looping over all cells of the cell zone
begin_c_loop(cCZ, tCZ)
{ }
end_c_loop(cCZ, tCZ)
=======================================================================
However, works now perfectly and nicely
August 2, 2021 at 9:47 amAmine Ben Hadj AliAnsys EmployeeAs expected :)
August 2, 2021 at 11:59 amHolzmannSubscriberAnd why :)
What was wrong with the old guy?
August 2, 2021 at 12:30 pmAmine Ben Hadj AliAnsys EmployeeI did not look into the old guy as you did not post it in complete. Now related to "As expected": because I am using similar approach to remove particles once certain condition is fulfilled or when they fly through a certain zone and some other condition is true.
August 2, 2021 at 1:49 pmHolzmannSubscriberWell, the previous approach is given in my second post. However, here it is again:
Getting the fluid domain
extracting the Thread of the cell zone
Looping over all cell zone cells (probably here I do have the mistake)
Nevertheless, I am fine with your way and it is way less computational expensive.
// Fluid domain
Domain *domain = Get_Domain(1);
// Cell zone id
int Cell_Zone_ID = 598;
cell_t cCZ;
Thread *tCZ = Lookup_Thread(domain, Cell_Zone_ID);
// Looping over all cells of the cell zone
begin_c_loop(cCZ, tCZ)
{
// Check if cCZ == c -> parcel inside
if (cCZ == c)
{
MARK_TP(tp, P_FL_REMOVED);
}
}
end_c_loop(cCZ, tCZ)
Viewing 10 reply threads- The topic ‘Remove parcels at defined cell zone’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Non-Intersected faces found for matching interface periodic-walls
- 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
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- UDF, Fluent: Access count of iterations for “Steady Statistics”
Top Contributors-
1406
-
599
-
591
-
555
-
366
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-