|
[Sponsors] |
January 14, 2016, 13:07 |
Energy Source Term for Sub-Region
|
#1 |
New Member
Join Date: Jan 2016
Posts: 3
Rep Power: 10 |
Hello, I'm using ANSYS v15. for my masters thesis and I have the following problem:
My thesis is about the Multiphase-Euler-Approach to simulate granular flows under different conditions (yeah, I know DEM would be more efficient but that is what my prof wanted me to do). I have already finished most of my workload but I simply cannot complete my last problem: A box is filled with the 2 granular phases as shown in the little paint picture I attached (vf means volume fraction). I want to set the energy source term to be in a very specific area that is heated - so NOT for all the cells inside a certain phase, in fact the area of the energy source term should not be linked to the phases at all. I should be able to fill my box however I want to and the area of the box where I want to modify the energy source term should not be affected by it. I have already tried everything I know. I simply cannot get the energy source term to be set ONLY for that area and to remain unchanged for everything else. I'm NOT asking you to solve my problem, but i just want to know if what I want to do is even doable? Can the energy source term be changed only for a certain area or is it always globally? Like it was with my previous simulations where I changed the gravity for the second phase globally. Is it possible to have a little area where the energy source term is changed? How should I construct the UDF? Because nothing I try is working. Thanks in advance, I hope I was able to explain my problem properly Last edited by Solmyr89; January 14, 2016 at 16:18. |
|
January 14, 2016, 17:37 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Including an energy source term dependent on location should be straightforward using the DEFINE_SOURCE macro. Have a read of the section in the UDF manual (there's a description, example and steps on hooking the macro to your cell zone).
The DEFINE_SOURCE macro is called for each cell and therefore you could use a conditional statement to apply a local energy source. For example: Code:
#include "udf.h" // UDFs require this header file DEFINE_SOURCE(local_energy_source,c,t,dS,eqn) { real x[ND_ND]; // array of cell coordinates real source = 0.; // default the source term to zero C_CENTROID(x,c,t); // retrieves the cell coordinates dS[eqn] = 0.; // derivative of source term if (x[0] > 0.5) // only if this cell belongs in the domain where x > 0.5 m { source = 1.; // non-zero source [generation-rate/volume e.g. W/m^3] } return source; // source is returned to solver } |
|
January 15, 2016, 05:09 |
|
#3 |
New Member
Join Date: Jan 2016
Posts: 3
Rep Power: 10 |
Thank you e for your code ,
I already tried that but what happens is this: Fluent goes into the if statement, looks if there are cells with x coordinates >0.5 and then applies the source term to ALL cells, not only to the cells with x coordinates above 0.5. This is why I was asking, because I can't find the solution to my problem. It seems like the source term can only be applied globally ... or am I just very stupid and doing something very wrong? |
|
January 15, 2016, 18:29 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
As I mentioned above, the source term is applied on a cell-by-cell basis. The DEFINE_SOURCE macro is called for each cell and returns a source term for that specific cell (with the cell index c).
Try the UDF I posted above and set the local source term to a very high value to make the temperature field peak in this local region (you may need to modify the conditional statement for your domain). |
|
January 16, 2016, 05:31 |
|
#5 |
New Member
Join Date: Jan 2016
Posts: 3
Rep Power: 10 |
Thank you very much for your patience. I just figured out my mistake.
When I used UDFs before this last problem, I modified the viscosity and gravity of each phase and I was used to working with absolute values. But as you pointed out the expression should be in W/m³ so I just divided the source term by the volume of each cell .... it works just fine now. Thank you =) |
|
Tags |
energy, fluent, locally, source, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Source Term due to evaporation in energy transport equation | styleworker | OpenFOAM Programming & Development | 3 | September 7, 2022 04:09 |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 22:53 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
UDF Scalar Code: HT 1 | Greg Perkins | FLUENT | 8 | October 20, 2000 13:40 |
UDFs for Scalar Eqn - Fluid/Solid HT | Greg Perkins | FLUENT | 0 | October 14, 2000 00:03 |