CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

initialization of scalar source using volume integral of source cells

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2013, 07:21
Default initialization of scalar source using volume integral of source cells
  #1
Member
 
Marcus Letzel
Join Date: Sep 2012
Location: Bremen
Posts: 35
Rep Power: 13
letzel is on a distinguished road
Dear All,

my modified pisoFoam solver includes a passive scalar transport equation for LES:
Code:
...
        turbulence->correct();

        solve
        (
            fvm::ddt(s1)
          + fvm::div(phi, s1)
          - fvm::laplacian(turbulence->nut(), s1)
          ==
          s1Source
        );

        runTime.write();
...
In createFields.H, both s1 and s1Source are defined per Volume (m^-3):
Code:
    volScalarField s1
    (
        IOobject
        (
            "s1",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("s1", dimensionSet(1,-3,0,0,0,0,0), scalar(0))
    );

    Info<< "Reading field s1Source\n" << endl;
    volScalarField s1Source
    (
        IOobject
        (
            "s1Source",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("s1Source", dimensionSet(1,-3,-1,0,0,0,0), scalar(0))
    );
My practical scenario is an air pollution simulation where I know the source volume and its (total) emission rate in kg/s.

So far, I initialize s1Source using a region in setFieldsDict:
Code:
    boxToCell
    {
        box (35.75 0.0 27.5) (36.25 0.5 28.5);

        fieldValues
        (
            volScalarFieldValue s1Source 0.001
        );
    };
In my current mesh, setFields finds and sets two cells, and the total emission rate depends on the size of these cells. This is not what I want.

Instead, I need an algorithm that sets s1Source in these cells to values so that the volume integral of s1Source over these cells matches a prescribed total emission rate.

Can this be achieved using setFields, or perhaps funkySetFields? If not, how and in which file could it be coded?

Best regards,
Marcus
letzel is offline   Reply With Quote

Old   March 24, 2013, 10:33
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by letzel View Post
Dear All,

my modified pisoFoam solver includes a passive scalar transport equation for LES:

My practical scenario is an air pollution simulation where I know the source volume and its (total) emission rate in kg/s.

So far, I initialize s1Source using a region in setFieldsDict:

In my current mesh, setFields finds and sets two cells, and the total emission rate depends on the size of these cells. This is not what I want.

Instead, I need an algorithm that sets s1Source in these cells to values so that the volume integral of s1Source over these cells matches a prescribed total emission rate.

Can this be achieved using setFields, or perhaps funkySetFields? If not, how and in which file could it be coded?
Somewhere between funkySetFields, coded and your solution: swak4Foam has something called expressionSource (search for that on the forum and you'll find an explanation how to integrate that) that you insert into your solver (at the place where you insert the field). That evaluates a funkySetFields-like expression and adds it as a source term. Built on that swak offers you child classes to basicSource (in OF up to 2.1) and fvOption (since 2.1) which you could add to your solver similarly. With that your solver doesn't need swak, but it can choose to use it via runtime selection.

If you don't want to change the solver anymore there is always the possibility to modify the s1-field with the modifyField-functionObject
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   May 13, 2015, 03:58
Default
  #3
Member
 
Yan Wang
Join Date: May 2015
Location: Beijing
Posts: 41
Rep Power: 10
wayne14 is on a distinguished road
Quote:
Originally Posted by letzel View Post
Dear All,

my modified pisoFoam solver includes a passive scalar transport equation for LES:
Code:
...
        turbulence->correct();

        solve
        (
            fvm::ddt(s1)
          + fvm::div(phi, s1)
          - fvm::laplacian(turbulence->nut(), s1)
          ==
          s1Source
        );

        runTime.write();
...
In createFields.H, both s1 and s1Source are defined per Volume (m^-3):
Code:
    volScalarField s1
    (
        IOobject
        (
            "s1",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("s1", dimensionSet(1,-3,0,0,0,0,0), scalar(0))
    );

    Info<< "Reading field s1Source\n" << endl;
    volScalarField s1Source
    (
        IOobject
        (
            "s1Source",
            runTime.timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        mesh,
        dimensionedScalar("s1Source", dimensionSet(1,-3,-1,0,0,0,0), scalar(0))
    );
My practical scenario is an air pollution simulation where I know the source volume and its (total) emission rate in kg/s.

So far, I initialize s1Source using a region in setFieldsDict:
Code:
    boxToCell
    {
        box (35.75 0.0 27.5) (36.25 0.5 28.5);

        fieldValues
        (
            volScalarFieldValue s1Source 0.001
        );
    };
In my current mesh, setFields finds and sets two cells, and the total emission rate depends on the size of these cells. This is not what I want.

Instead, I need an algorithm that sets s1Source in these cells to values so that the volume integral of s1Source over these cells matches a prescribed total emission rate.

Can this be achieved using setFields, or perhaps funkySetFields? If not, how and in which file could it be coded?

Best regards,
Marcus
Hi Marcus,

I met the same problem. Did you find any solution?

Thank you!
wayne14 is offline   Reply With Quote

Reply


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
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 10:03
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
physical boundary error!! kris Siemens 2 August 3, 2005 00:32


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