CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Distributed Heat Source - fvOptions (chtMultiRegionFoam) (https://www.cfd-online.com/Forums/openfoam-solving/236784-distributed-heat-source-fvoptions-chtmultiregionfoam.html)

Ste07 June 15, 2021 10:19

Distributed Heat Source - fvOptions (chtMultiRegionFoam)
 
Good morning,
I'm pretty new to the OpenFOAM stuff and I'm currently facing the following problem. I would like to solve a multi-region problem (solver: chtMultiRegionFoam) with solid and fluid, some of the solid regions should produce power (different per each region). This has been set with the following fvOptions file
Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    | Website:  https://openfoam.org
    \\  /    A nd          | Version:  6
    \\/    M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

heat_dwn
{
    type          scalarCodedSource;

    active          true;
   
    name    sourceTime;

 

    scalarCodedSourceCoeffs
    {
        selectionMode  cellZone;
        cellZone        heat_dwn;
            fields      (h);

        codeInclude
        #{

        #};

        codeCorrect
        #{
        #};

        codeAddSup
        #{
            const Time& time = mesh().time();
                const scalarField& V = mesh_.V();
                scalarField& heSource = eqn.source();

                const labelList& cellIDs = cells();

                forAll(cellIDs, i)
                {
                    label cellI = cellIDs[i];
                    heSource[cellI] = -1305525.64*V[cellI]; // net power 1 kW
                }
        #};

        codeSetValue
        #{
        #};

        // Dummy entry. Make dependent on above to trigger recompilation
        code
        #{
            $codeInclude
            $codeCorrect
            $codeAddSup
            $codeSetValue
        #};
    }

    sourceTimeCoeffs
    {
        $scalarCodedSourceCoeffs;
    }
}




// ************************************************************************* //

The names of the heat regions are heat_dwn, heat_dx and heat_sx and the power they should produce is not the same. I write 3 fvOptions file (one per each region) with the specified value, but when running the case the solver uses only the input from heat_dwn (which is the one read first) ignoring the others.
For instance the previous value of 1305525.64, will be set per each region.

Has anyone ever faced this kind of issue?

Thanks in advance
Regards


All times are GMT -4. The time now is 08:37.