# Set cell volume integrated field values to preserve integral

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 30, 2018, 10:01 Set cell volume integrated field values to preserve integral #1 Member   Andrea Di Ronco Join Date: Nov 2016 Location: Milano, Italy Posts: 57 Rep Power: 9 Hello to everyone! What I'm doing is basically scalar transport with a custom solver which I wrote by adding a scalar transport equation to simpleFoam. Since for the moment I'm simulating point sources, I created a source volScalarField Qc which is set to zero everywhere except for a single cell, using setFields: Code: defaultFieldValues ( volScalarFieldValue Qc 0 ); regions ( nearestToCell { points ((0.02 0.015 0)); fieldValues ( volScalarFieldValue Qc 1 ); } ); The cell is selected with nearestToCell, which looks for the nearest cell to a specified cartesian point. I would like to impose the total scalar source rate (e.g. in kg/s) located at the specific point, but setFields obviously sets the volume field, meaning that the value I set in setFieldsDict (1 in the above example) would be the "volume averaged" one, so that the volume integral of the source field would depend on the volume of the specific cell. At the beginning I was using a simple geometry and a structured mesh, so that I could knew the cell volume in advance. Now I need to use an unstructured mesh and to move the position of the source from one simulation to another. Is there any simple way to set the volume-integral value instead of the volume-average one to the cell (or, equivalently, to know the specific cell volume)? Thanks in advance, Andrea EDIT: another way of putting it would be to get the volume of the cellSet in which the source is defined. I'm no expert with OpenFOAM, but maybe it would be easier to manipulate a "cellSet entity" rather than a "cell" itself. The cellSet can be easily created with topoSet, and being able to calculate its volume would be a more general procedure (like in the case of non-point source). Unfortunately I've been reasoning about this possibility, but I couldn't find anything on this forum Last edited by Diro7; April 30, 2018 at 12:12.

 June 3, 2018, 00:47 #2 Senior Member     Fumiya Nozaki Join Date: Jun 2010 Location: Yokohama, Japan Posts: 266 Blog Entries: 1 Rep Power: 19 You can use the SemiImplicitSource fvOption to specify your mass source. There is the volumeMode entry and you can choose absolute option. https://github.com/OpenFOAM/OpenFOAM...plicitSource.H __________________ [Personal]Blog: https://caefn.com/ Twitter: https://twitter.com/FumiyaNozaki SlideShare: http://www.slideshare.net/fumiyanozaki96

June 3, 2018, 10:44
#3
Member

Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 57
Rep Power: 9
Quote:
 Originally Posted by fumiya You can use the SemiImplicitSource fvOption to specify your mass source. There is the volumeMode entry and you can choose absolute option. https://github.com/OpenFOAM/OpenFOAM...plicitSource.H

Hi fumiya,

thank you very much for your reply. I'm not expert with using fvOptions, but it seems very useful so I'll definitely go and see what I can do with it.

Regarding my initial problem, I solved it by writing a slightly modified version of setFields which computes the total volume of the cell set and divides the source intensity by it before setting the field.

Thank you again!

Andrea

 Tags cell volume, setfields, source terms

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Ganesh FLUENT 15 November 18, 2020 06:09 nwpukaka OpenFOAM Community Contributions 6 August 12, 2014 06:34 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 14:38 SSL FLUENT 2 January 26, 2008 11:55

All times are GMT -4. The time now is 02:19.