CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to rewrite devolatilization by UDF (http://www.cfd-online.com/Forums/fluent-udf/63902-how-rewrite-devolatilization-udf.html)

studyudf April 23, 2009 04:18

How to rewrite devolatilization by UDF
 
I am going to rewrite devolatilization by DEFINE_DPM_LAW in coal burn model.I will use coal thermogravimetry curve to replace devolatilization model.I know the switch condition of pulverized coal combustion process to be achieved in Switch Law.I don't know how Fluent programs about the weight loss rate of pulverized coal particles in Devolatilization.And I don't know how the loss of quality converts into volatile.Who can help me?

neilduffy1024 November 30, 2010 06:42

Custom law UDF
 
Hi,

I have the same question. I am trying to use custom laws for devolatilization and char oxidation. I understand how to program the fuel weight loss but only where there is a single fuel stream being used (i.e. I don't know know how to do this for cofiring for example). However, I don't understand how Fluent converts weight loss in the discrete phase to a source in the gaseous phase. Is this automatically done when hooked into the custom laws or does the source have to be explicitly coded, maybe using the DEFINE_DPM_SOURCE macro. If this is the case, how is the appropriate species selected?

Any help would be appreciated.

Neil

Allan Walsh December 1, 2010 13:39

Yes, you have to explicity update the source terms.
If you know the change in particle mass, then the source term is the change in mass multiplied by the amount of condensed phase mass represented by that particle.
I have just updated the source terms directly using the variable C_STORAGE_R(cell,thread,SV_DPMS_SPECIES). The ...SPECIES is defined for each combustion stage.
I guess there could be some advantage to using the Define source macro, but I could not think of any when I wrote my code.
Different fuel streams can have different volatiles for modeling co-firing.
It might take a month or two to modify and check a UDF for volatilization so be prepared.

neilduffy1024 December 2, 2010 08:32

Hi Allan,

Thank you very much for the reply, it was very helpful. I am struggling to follow a couple things though:
  1. Source term: I had the mass loss of volatiles (or condensed phase) in the particle = P_MASS0(p)*P_VFF(p)*k (where k is an arrhenius expression). Just like you said I think? But do I need to multiply this by the no. particles in the cell before I update the source term for that cell - if using the C_STORAGE_R macro?
  2. When you say the species is defined for each combustion stage (say CxHyOz for devol and maybe CO2 for char oxidation?), how and where did you define these? For the built in laws you could just select them at the injection display box, but if using custom laws do you have to search for the appropriate species in the UDF? Quite lost here - was trying things like string searches for "materials" within a mixture_species_loop!
Thanks again for your help.

Neil

Allan Walsh December 2, 2010 12:17

1. For the amount of volatiles (or other species defined by that law) to be transferred to the gas phase, you can use an expression like:
(part_mass_last - part_mass_now) * (mass_all_particles_in_injection/part_init_mass).
No need to consider the number of particles, just keep summing the source for each particle to the source in the cell as you calculate the particle mass loss at each particle time step.
2. For the species, you will define a volatilizing species for each type of injection. Say one injection is coal and one is wood. Then for inject_coal, you can specify the volatilizing speces in the law panel in the injection set-up menu. And, do the same thing for the wood injection, inject_wood. Now, the C_STORAGE_R variable is an array with parameters (cell,thread,species_index). Usually for the species index, you would use an expression like .... SV_DPMS_SPECIES_0+devol_species_index, which will automatically set the integer representing the ith species index.
Look in the DPM header files for how the various variables are declared - and be prepared to do lots of checking and reverse engineering.

neilduffy1024 December 10, 2010 12:33

Hi Allan,

Thanks again for the detailed response. Very helpful and much appreciated.

Neil

neilduffy1024 January 6, 2011 10:44

Hi Allan,

About updating the source terms directly. I have since switched to a multiphase application, modelling a fuel bed as a porous zone rather than discrete particles via an injection.

I have calculated the mass source (in kg m^-3 s^-1) for the gaseous phase and I am trying to update it directly as you mentioned before. Since I am not using the DPM I have tried the following variables:

  1. C_STORAGE_R(c,t,SV_MASS_SOURCE)
  2. C_STORAGE_R(c,t,SV_S_MASS_USER)
  3. C_STORAGE_R(c,t,SV_Y_I(i)+SV_Y_0_S-SV_Y_0)
I tried a simple single phase simulation with the first 2 and switched on species transport to try the third. The update was a simple summation within a cell loop:
C_STORAGE_R(c,t,SV_MASS_SOURCE) += Sm; (Sm is the mass source)

The UDF compiles fine and the solution can be initialised, but as soon as the calculation begins I get a ACCESS VIOLATION. It is worth noting that I have included the sg_mem.h header file (and also tried explicitly defining the relevant storage variables) and that the UDF (using a DEFINE_PROFILE for a mass dependent property) works perfectly up until I include the storage variable.

Have you had any similar experience with this or is there something extra that I am missing?

Best regards,

Neil

Allan Walsh January 6, 2011 14:02

Neil,
If you are not using the DP model, I suspect that the C_STORAGE variables are all inactive. Fluent seems to give the Access_violation message anytime you try to access a variable that for what ever reason, you should not have access to. Allan

neilduffy1024 January 6, 2011 15:40

Hi Allan,

Yeah that would explain it alright, but I have seen the C_STORAGE used in non DPM examples within the UDF manual which made me think otherwise. It's quite difficult to know what will work and when from looking at the header files.

By any chance have you directly updated any variables outside a DP simulation? I have pushed on with a DEFINE_SOURCE UDF instead but the computational expense is significant so the direct method would be preferred if possible.

Thanks again,

Neil

Kanarya November 6, 2012 07:40

Quote:

Originally Posted by neilduffy1024 (Post 289519)
Hi Allan,

Yeah that would explain it alright, but I have seen the C_STORAGE used in non DPM examples within the UDF manual which made me think otherwise. It's quite difficult to know what will work and when from looking at the header files.

By any chance have you directly updated any variables outside a DP simulation? I have pushed on with a DEFINE_SOURCE UDF instead but the computational expense is significant so the direct method would be preferred if possible.

Thanks again,

Neil

Hello,

Did you implement Kobayashi model? Can you give me some example with DEFINE_SOURCE for devolatilization.

Thanks in advance!

onlylno July 1, 2013 08:47

Quote:

Originally Posted by Kanarya (Post 390551)
Hello,

Did you implement Kobayashi model? Can you give me some example with DEFINE_SOURCE for devolatilization.

Thanks in advance!

DO you solve you probem?

Kanarya July 1, 2013 09:26

hi
yes, I solve it!
with mass_transfer
Quote:

Originally Posted by onlylno (Post 437067)
DO you solve you probem?


onlylno October 24, 2013 04:04

Quote:

Originally Posted by Kanarya (Post 437074)
hi
yes, I solve it!
with mass_transfer

Can you share some examples? I want to wirte coal devolatilization.
yujiehust@hotmail.com
Thanks in advance!


All times are GMT -4. The time now is 12:36.