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/)
-   -   chtMultiRegion: adding a source (https://www.cfd-online.com/Forums/openfoam-programming-development/103609-chtmultiregion-adding-source.html)

samiam1000 June 21, 2012 08:54

chtMultiRegion: adding a source
 
Dear all,

I am trying to add a source to the chtMultiRegionFoam solver.

I modified the createSolidFields.H like this:
Code:

    // Initialise solid field pointer lists
    PtrList<basicSolidThermo> thermos(solidRegions.size());
        PtrList<volScalarField> QSolid(solidRegions.size());

    // Populate solid field pointer lists
    forAll(solidRegions, i)
    {

        QSolid.set
        (
            i,
            new volScalarField
            (
                IOobject
                (
                    "Q",
                    runTime.timeName(),
                    solidRegions[i],
                    IOobject::MUST_READ,
                    IOobject::AUTO_WRITE
                ),
                solidRegions[i]
            )
        );


        Info<< "*** Reading solid mesh thermophysical properties for region "
            << solidRegions[i].name() << nl << endl;

        Info<< "    Adding to thermos\n" << endl;
        thermos.set(i, basicSolidThermo::New(solidRegions[i]));
    }

and the solveSolid.H like this:
Code:

if (finalIter)
{
    mesh.data::add("finalIteration", true);
}

{
    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
        tmp<fvScalarMatrix> TEqn
        (
            fvm::ddt(rho*cp, T)
          - fvm::laplacian(kappa, T)
          - Q
        );
        TEqn().relax();
        TEqn().solve(mesh.solver(T.select(finalIter)));
    }

    Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
}

thermo.correct();

if (finalIter)
{
    mesh.data::remove("finalIteration");
}if (finalIter)
{
    mesh.data::add("finalIteration", true);
}

{
    for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
    {
        tmp<fvScalarMatrix> TEqn
        (
            fvm::ddt(rho*cp, T)
          - fvm::laplacian(kappa, T)
          - Q
        );
        TEqn().relax();
        TEqn().solve(mesh.solver(T.select(finalIter)));
    }

    Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
}

thermo.correct();

if (finalIter)
{
    mesh.data::remove("finalIteration");
}

.

The point is that when I try to compile the solver, I get this error:
Code:

lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/chtMultiRegionFoam_Epta$ wmake
Making dependency list for source file fluid/compressibleCourantNo.C
Making dependency list for source file solid/solidRegionDiffNo.C
Making dependency list for source file chtMultiRegionFoam_Epta.C
SOURCE=fluid/compressibleCourantNo.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -Ifluid -Isolid -Iinclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basicSolidThermo/lnInclude -I/opt/openfoam210/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/openfoam210/src/thermophysicalModels/radiationModels/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/compressibleCourantNo.o
SOURCE=solid/solidRegionDiffNo.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -Ifluid -Isolid -Iinclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basicSolidThermo/lnInclude -I/opt/openfoam210/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/openfoam210/src/thermophysicalModels/radiationModels/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/solidRegionDiffNo.o
SOURCE=chtMultiRegionFoam_Epta.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -Ifluid -Isolid -Iinclude -I/opt/openfoam210/src/meshTools/lnInclude -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam210/src/thermophysicalModels/basicSolidThermo/lnInclude -I/opt/openfoam210/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/opt/openfoam210/src/thermophysicalModels/radiationModels/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linux64GccDPOpt/chtMultiRegionFoam_Epta.o
In file included from chtMultiRegionFoam_Epta.C:65:
solid/setRegionSolidFields.H: In function ‘int main(int, char**)’:
solid/setRegionSolidFields.H:1: warning: unused variable ‘mesh’
solid/setRegionSolidFields.H:15: warning: unused variable ‘T’
In file included from chtMultiRegionFoam_Epta.C:77:
solid/setRegionSolidFields.H:1: warning: unused variable ‘mesh’
solid/setRegionSolidFields.H:15: warning: unused variable ‘T’
fluid/setRegionFluidFields.H:1: warning: unused variable ‘mesh’
fluid/setRegionFluidFields.H:5: warning: unused variable ‘kappa’
fluid/setRegionFluidFields.H:6: warning: unused variable ‘U’
fluid/setRegionFluidFields.H:7: warning: unused variable ‘phi’
fluid/setRegionFluidFields.H:9: warning: unused variable ‘turb’
fluid/setRegionFluidFields.H:10: warning: unused variable ‘K’
fluid/setRegionFluidFields.H:11: warning: unused variable ‘dpdt’
fluid/setRegionFluidFields.H:13: warning: unused variable ‘p’
fluid/setRegionFluidFields.H:14: warning: unused variable ‘psi’
fluid/setRegionFluidFields.H:15: warning: unused variable ‘h’
fluid/setRegionFluidFields.H:18: warning: unused variable ‘gh’
fluid/setRegionFluidFields.H:19: warning: unused variable ‘ghf’
fluid/setRegionFluidFields.H:21: warning: unused variable ‘rad’
In file included from chtMultiRegionFoam_Epta.C:114:
solid/solveSolid.H:13: error: ‘Q’ was not declared in this scope
make: *** [Make/linux64GccDPOpt/chtMultiRegionFoam_Epta.o] Error 1

Could anyone help?

Thanks a lot,
Samuele

PS: I'd like to do the same in the fluid regions. Is there a similar way to do this?

Linse June 22, 2012 05:44

Hi Samuele!

I don't know for sure if it is the same case for you. But I think when I first tried to include an additional field within chtMultiRegionFoam, I had to adapt also the setRegionSolidFields.H in the solid region...

Maybe it is the same for you?

Hope that helps a bit...

Cheers,
Bernhard

samiam1000 June 22, 2012 05:56

Thanks Bernhard,

yeah, maybe it is the same.

I'll worlk on it.

BTW, first of all I'd like to ask you if you have an idea about how to add a source to the buoyantPimpleFoam solver. I succeded in editing the buoyantSimpleFoam, but when I work on the buoyantPimpleFoam I get an error.

Could you have a look here?

Thanks,
Samuele


All times are GMT -4. The time now is 10:59.