Commit 51d3d783 authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

New application - conjugate heat transfer

parent a0b7498f
regionProperties/regionProperties.C
coupleManager/coupleManager.C
derivedFvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C
derivedFvPatchFields/solidWallHeatFluxTemperatureCoupled/solidWallHeatFluxTemperatureCoupledFvPatchScalarField.C
derivedFvPatchFields/solidWallTemperatureCoupled/solidWallTemperatureCoupledFvPatchScalarField.C
chtMultiRegionFoam.C
EXE = $(FOAM_APPBIN)/chtMultiRegionFoam
EXE_INC = \
-Ifluid \
-Isolid \
-IregionProperties \
-IcoupleManager \
-IderivedFvPatchFields/solidWallTemperatureCoupled \
-IderivedFvPatchFields/solidWallHeatFluxTemperatureCoupled \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels
EXE_LIBS = \
-lfiniteVolume \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModels
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
chtMultiRegionFoam
Description
Combination of heatConductionFoam and buoyantFoam for conjugate heat
transfer between a solid region and fluid region
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicThermo.H"
#include "compressible/turbulenceModel/turbulenceModel.H"
#include "fixedGradientFvPatchFields.H"
#include "regionProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "solveContinuityEquation.C"
#include "solveMomentumEquation.C"
#include "compressibleContinuityErrors.C"
#include "solvePressureDifferenceEquation.C"
#include "solveEnthalpyEquation.C"
#include "compressibleCourantNo.C"
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
regionProperties rp(runTime);
# include "createFluidMeshes.H"
# include "createSolidMeshes.H"
# include "createFluidFields.H"
# include "createSolidFields.H"
# include "initContinuityErrs.H"
# include "readTimeControls.H"
if (fluidRegions.size())
{
# include "compressibleMultiRegionCourantNo.H"
# include "setInitialDeltaT.H"
}
while(runTime.run())
{
# include "readTimeControls.H"
if (fluidRegions.size())
{
# include "compressibleMultiRegionCourantNo.H"
# include "setDeltaT.H"
}
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
# include "readFluidMultiRegionPISOControls.H"
# include "solveFluid.H"
}
forAll(solidRegions, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
# include "readSolidMultiRegionPISOControls.H"
# include "solveSolid.H"
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info << "End\n" << endl;
return(0);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coupleManager.H"
#include "OFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coupleManager::coupleManager(const fvPatch& patch)
:
patch_(patch),
neighbourRegionName_("undefined-neighbourRegionName"),
neighbourPatchName_("undefined-neighbourPatchName"),
neighbourFieldName_("undefined-neighbourFieldName"),
localRegion_(patch_.boundaryMesh().mesh())
{}
Foam::coupleManager::coupleManager
(
const fvPatch& patch,
const dictionary& dict
)
:
patch_(patch),
neighbourRegionName_(dict.lookup("neighbourRegionName")),
neighbourPatchName_(dict.lookup("neighbourPatchName")),
neighbourFieldName_(dict.lookup("neighbourFieldName")),
localRegion_(patch_.boundaryMesh().mesh())
{}
Foam::coupleManager::coupleManager
(
const coupleManager& cm
)
:
patch_(cm.patch()),
neighbourRegionName_(cm.neighbourRegionName()),
neighbourPatchName_(cm.neighbourPatchName()),
neighbourFieldName_(cm.neighbourFieldName()),
localRegion_(patch_.boundaryMesh().mesh())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coupleManager::~coupleManager()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::coupleManager::checkCouple() const
{
Info<< "neighbourRegionName_ = " << neighbourRegionName_ << endl;
Info<< "neighbourPatchName_ = " << neighbourPatchName_ << endl;
Info<< "neighbourFieldName_ = " << neighbourFieldName_ << endl;
const fvPatch& nPatch = neighbourPatch();
if (patch_.size() != nPatch.size())
{
FatalErrorIn("Foam::coupleManager::checkCouple()")
<< "Unequal patch sizes:" << nl
<< " patch name (size) = " << patch_.name()
<< "(" << patch_.size() << ")" << nl
<< " neighbour patch name (size) = "
<< nPatch.name() << "(" << patch_.size() << ")" << nl
<< abort(FatalError);
}
}
void Foam::coupleManager::coupleToObj() const
{
const fvPatch& nPatch = neighbourPatch();
OFstream obj
(
patch_.name() + "_to_" + nPatch.name() + "_couple.obj"
);
const vectorField& c1 = patch_.Cf();
const vectorField& c2 = neighbourPatch().Cf();
if (c1.size() != c2.size())
{
FatalErrorIn("coupleManager::coupleToObj() const")
<< "Coupled patches are of unequal size:" << nl
<< " patch0 = " << patch_.name()
<< "(" << patch_.size() << ")" << nl
<< " patch1 = " << nPatch.name()
<< "(" << nPatch.size() << ")" << nl
<< abort(FatalError);
}
forAll(c1, i)
{
obj << "v " << c1[i].x() << " " << c1[i].y() << " " << c1[i].z() << nl
<< "v " << c2[i].x() << " " << c2[i].y() << " " << c2[i].z() << nl
<< "l " << (2*i + 1) << " " << (2*i + 2) << endl;
}
}
void Foam::coupleManager::writeEntries(Ostream& os) const
{
os.writeKeyword("neighbourRegionName");
os << neighbourRegionName_ << token::END_STATEMENT << nl;
os.writeKeyword("neighbourPatchName");
os << neighbourPatchName_ << token::END_STATEMENT << nl;
os.writeKeyword("neighbourFieldName");
os << neighbourFieldName_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
coupleManager
Description
Object to handle the coupling of region patches. It can be queried to
return the neighbour information.
SourceFiles
coupleManager.C
\*---------------------------------------------------------------------------*/
#ifndef coupleManager_H
#define coupleManager_H
#include "Ostream.H"
#include "dictionary.H"
#include "fvPatch.H"
#include "fvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class coupleManager Declaration
\*---------------------------------------------------------------------------*/
class coupleManager
{
// Private data
//- Reference to the local fvPatch
const fvPatch& patch_;
//- Name of neighbour region
word neighbourRegionName_;
//- Name of patch on the neighbour region
word neighbourPatchName_;
//- Name of field on the neighbour region
word neighbourFieldName_;
//- Reference to the local region
const fvMesh& localRegion_;
// Private Member Functions
//- Disallow default bitwise copy construct
// coupleManager(const coupleManager&);
//- Disallow default bitwise assignment
void operator=(const coupleManager&);
public:
// Constructors
//- Construct from fvPatch
coupleManager(const fvPatch& patch);
//- Construct from fvPatch and dictionary
coupleManager(const fvPatch& patch, const dictionary& dict);
//- Copy constructor
coupleManager(const coupleManager& cm);
// Destructor
~coupleManager();
// Member Functions
// Access
//- Return a reference to the local patch
inline const fvPatch& patch() const;
//- Return the name of the neighbour region
inline const word& neighbourRegionName() const;
//- Return the name of the patch on the neighbour region
inline const word& neighbourPatchName() const;
//- Return the name of the field on the neighbour region
inline const word& neighbourFieldName() const;
//- Return a reference to the neighbour mesh
inline const fvMesh& neighbourRegion() const;
//- Return the neighbour patch ID
inline const label neighbourPatchID() const;
//- Return a reference to the neighbour patch
inline const fvPatch& neighbourPatch() const;
//- Return a reference to the neighbour patch field
template<class Type>
inline const fvPatchField<Type>& neighbourPatchField() const;
//- Check that the couple is valid
void checkCouple() const;
// Edit
//- Return the name of the neighbour region
word& neighbourRegionName();
//- Return the name of the patch on the neighbour region
word& neighbourPatchName();
//- Return the name of the field on the neighbour region
word& neighbourFieldName();
// Write
//- Write couple to obj file
void coupleToObj() const;
//- Write entries for patches
void writeEntries(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "coupleManagerI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
inline const Foam::fvPatch& Foam::coupleManager::patch() const
{
return patch_;
};
inline const Foam::word& Foam::coupleManager::neighbourRegionName() const
{
return neighbourRegionName_;
};
inline const Foam::word& Foam::coupleManager::neighbourPatchName() const
{
return neighbourPatchName_;
};
inline const Foam::word& Foam::coupleManager::neighbourFieldName() const
{
return neighbourFieldName_;
};
inline const Foam::fvMesh& Foam::coupleManager::neighbourRegion() const
{
return localRegion_.objectRegistry::parent()
.lookupObject<fvMesh>(neighbourRegionName_);
}
inline const Foam::label Foam::coupleManager::neighbourPatchID() const
{
return neighbourRegion().boundaryMesh().findPatchID(neighbourPatchName_);
}
inline const Foam::fvPatch& Foam::coupleManager::neighbourPatch() const
{
return neighbourRegion().boundary()[neighbourPatchID()];
}
template<class Type>
inline const Foam::fvPatchField<Type>&
Foam::coupleManager::neighbourPatchField() const
{
return neighbourPatch().lookupPatchField
<GeometricField<Type, fvPatchField, volMesh>, Type>
(neighbourFieldName_);
}
inline Foam::word& Foam::coupleManager::neighbourRegionName()
{
return neighbourRegionName_;
};
inline Foam::word& Foam::coupleManager::neighbourPatchName()
{
return neighbourPatchName_;
};
inline Foam::word& Foam::coupleManager::neighbourFieldName()
{
return neighbourFieldName_;
};
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/