Howto addSpraySubModels

From OpenFOAMWiki

Below is a step-by-step instruction of howto add your own breakup model for the Lagrangian spray in OpenFOAM 2.x.y.

Once you have understood how it works it should be straightforward to add any submodel for the Lagrangian class.

The submodels related to the spray are located under src/lagrangian/spray/submodels.

The submodels related to injection, momentum -, heat - and mass transfer are located under src/lagrangian/intermediate/submodels.

1. goto src/lagrangian/spray/submodels/BreakupModel
2. copy the none breakup model, cp -r NoBreakup MyBreakup. (Or the breakup model most close to what you want to do.)
3. cd MyBreakup
4. mv NoBreakup.C MyBreakup.C
5. mv NoBreakup.H MyBreakup.H
6. edit the MyBreakup.C and MyBreakup.H files. Replace every word that says NoBreakup with MyBreakup.
especially look at the line in MyBreakup.H that says TypeName("none"); and replace the word none with your own name.
This will be the name by which you will call the model when you run the code.
Note that we don't modify/write any code at this time, but just add the new model to the library.
Remember to also set the active function to return true, or just simply remove it.
7. cd src/lagrangian/spray/parcels/include
8. open the file makeSprayParcelBreakupModels.H
9. add #include "MyBreakup.H" to the lines of include statements.
add makeBreakupModelType(MyBreakup, CloudType); \ to the lines of makeBreakupModel-statements
10. cd src/lagrangian/spray
11. type wclean and then do a wmake libso. (wmake will not pickup these changes, hence the need to do a wclean first)

Done. Now you just need to actually write the code in MyBreakup.C to have a fully functional own breakup model.

The update function returns false if the breakup model does not add any child-parcel.

If update returns true, the breakup model will add a child parcel and the variables dChild and massChild will be used to set its properties, otherwise these variables can be ignored.

The ReitzKHRT breakup model adds child parcels so please check the code for this model if this is unclear.

--Niklas 13:25, 11 August 2011 (CEST)