CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   writing radiation source term in fireFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/128335-writing-radiation-source-term-firefoam.html)

Marshak January 9, 2014 08:00

writing radiation source term in fireFoam
 
In fireFoam solver, the radiation source term is included in hs equation ..file YhsEqn.H as follows:

fvScalarMatrix hsEqn
(
fvm::ddt(rho, hs)
+ mvConvection->fvmDiv(phi, hs)
- fvm::laplacian(turbulence->alphaEff(), hs)
==
DpDt
+ dQ
+ radiation->Shs(thermo)
+ parcels.Sh(hs)
+ surfaceFilm.Sh()
);

I want to write out the radiation source term 'radiation->Shs(thermo)'. Can someone tell what changes should I make in the fireFoam solver to write the radiation source term.

jherb January 9, 2014 18:03

You have to add a new field (probably in createFields.H) which is written every timestep. Then copy radiotion-Shs(thermo) to this field before the timestep is finished.

zqlhzx January 13, 2014 17:49

Hi Marshak,
I have the some problem with you!I also want to write out the radiation source term 'radiation->Shs(thermo)'.Have you solved it?If it is solved,could tell how to do it?Thanks in advance!

Marshak January 13, 2014 18:49

'jhreb' I tried with createfields.H but it is not working...

jherb January 14, 2014 04:39

Here is what I did in a comparable case:
Add a new field to createFields.H
Code:

    volScalarField Shs(
        IOobject
        (
            "Shs",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE // this tells OpenFOAM to store the field after each timestep
        ),
        dimensionedScalar("zero", dimensionSet(0, 0, 1, 0, 0), 0.0) // here you have to set the correct dimensions of your field
    );

Then in YhsEqn.H, either after hsEqn.solve() or thermo.correct() add the following:
Code:

if (pimple.finalIter())
        {
            Shs = radiation->Shs(thermo);
        }

The whole code is not tested. But it should be a starting point.

dzi January 16, 2014 06:19

related question in another thread
 
Hello,
fyi I put a related radiation question to another thread
http://www.cfd-online.com/Forums/ope...blem-5.html#99
thanks dirk

Marshak January 16, 2014 09:51

Shs() in radiation::radiationModel is defined as fvScalarMatrix. How can a fvScalarmatrix be written as a volScalarField?

jherb January 17, 2014 11:03

You are right. I my case what I really used was something like
Code:

rHS1 = fvc::reconstruct
            (
                (
                  - ghf*fvc::snGrad(rho)
                ) * mesh.magSf()
            );

But here there is a quite simple solution (OpenFOAM version 2.2.2):
Code:

    if (pimple.finalIter())
    {
        Info<< radiation->Sh(thermo);
    }

I guess in your version its ->Shs(thermo). This will output the coefficients of the matrix. If there are only diagonal elements (as it looks like), then you can add ->D() to the command.

I didn't test it, but it is probably possible to assign these diagonal elements to an volume scalar field, which could be written to disk and then loaded into Paraview.

Quote:

Originally Posted by Marshak (Post 470325)
Shs() in radiation::radiationModel is defined as fvScalarMatrix. How can a fvScalarmatrix be written as a volScalarField?


davidbarreiro March 13, 2018 06:02

Hi everyone!

I've got a similar problem with a modification of the kinematicSingleLayer model for reactingParcelFilFoam. I added a pressure term to model the surface tension and it's working quite well. The problem is that I want to visualize this term and I'm not being able to save it. I've tried to modify the original NO_WRITE for AUTO_WRITE but it doesn't work. Any idea??

Code:

tmp<volScalarField> myKinematicSingleLayer::pu()
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                typeName + ":pu",
                time_.timeName(),
                regionMesh(),
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            pPrimary_                  // pressure (mapped from primary region)
          - pSp_                          // accumulated particle impingement
          - fvc::laplacian(sigma_, delta_) // surface tension
          - sigma_/hDisj_*(cos(theta_/180*3.141593)-1)*exp(-delta_/hDisj_) //Disjoining pressure
        )
    );
}

Thank you in advance,

David

Madeleine C March 23, 2019 06:23

Quote:

Originally Posted by davidbarreiro (Post 684990)
Hi everyone!

I've got a similar problem with a modification of the kinematicSingleLayer model for reactingParcelFilFoam. I added a pressure term to model the surface tension and it's working quite well. The problem is that I want to visualize this term and I'm not being able to save it. I've tried to modify the original NO_WRITE for AUTO_WRITE but it doesn't work. Any idea??

Code:

tmp<volScalarField> myKinematicSingleLayer::pu()
{
    return tmp<volScalarField>
    (
        new volScalarField
        (
            IOobject
            (
                typeName + ":pu",
                time_.timeName(),
                regionMesh(),
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            pPrimary_                  // pressure (mapped from primary region)
          - pSp_                          // accumulated particle impingement
          - fvc::laplacian(sigma_, delta_) // surface tension
          - sigma_/hDisj_*(cos(theta_/180*3.141593)-1)*exp(-delta_/hDisj_) //Disjoining pressure
        )
    );
}

Thank you in advance,

David


Dear David,
Did you find a solution to this?
I am attempting to write out a source term and got stuck.


All times are GMT -4. The time now is 17:51.