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

initialization of scalar source using volume integral of source cells

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 22, 2013, 08:21
Default initialization of scalar source using volume integral of source cells
  #1
Member
 
Marcus Letzel
Join Date: Sep 2012
Location: Aurich
Posts: 35
Rep Power: 4
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, 11:33
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
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
New Member
 
q
Join Date: May 2015
Posts: 13
Rep Power: 2
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM 24 August 23, 2015 22:41
swak4foam building problem GGerber OpenFOAM Installation 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 18:18
physical boundary error!! kris CD-adapco 2 August 3, 2005 00:32


All times are GMT -4. The time now is 04:41.