CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Set cell volume integrated field values to preserve integral

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2018, 10:01
Default Set cell volume integrated field values to preserve integral
  #1
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 55
Rep Power: 9
Diro7 is on a distinguished road
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.
Diro7 is offline   Reply With Quote

Old   June 3, 2018, 00:47
Default
  #2
Senior Member
 
fumiya's Avatar
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 266
Blog Entries: 1
Rep Power: 18
fumiya is on a distinguished road
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]
fumiya is offline   Reply With Quote

Old   June 3, 2018, 10:44
Default
  #3
Member
 
Andrea Di Ronco
Join Date: Nov 2016
Location: Milano, Italy
Posts: 55
Rep Power: 9
Diro7 is on a distinguished road
Quote:
Originally Posted by fumiya View Post
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
Diro7 is offline   Reply With Quote

Reply

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
[swak4Foam] About groovyBC to set distributed fixedGradient values for each cell boundary patch nwpukaka OpenFOAM Community Contributions 6 August 12, 2014 06:34
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 14:38
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 11:55


All times are GMT -4. The time now is 20:29.