diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleContinuityErrors.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleContinuityErrors.H new file mode 100644 index 0000000000..046ca5ec37 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleContinuityErrors.H @@ -0,0 +1,21 @@ +{ + dimensionedScalar totalMass = fvc::domainIntegrate(rho); + + scalar sumLocalContErr = + ( + fvc::domainIntegrate(mag(rho - thermo.rho()))/totalMass + ).value(); + + scalar globalContErr = + ( + fvc::domainIntegrate(rho - thermo.rho())/totalMass + ).value(); + + cumulativeContErr[i] += globalContErr; + + Info<< "time step continuity errors (" << mesh.name() << ")" + << ": sum local = " << sumLocalContErr + << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr[i] + << endl; +} diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H new file mode 100644 index 0000000000..4bdfb84fcb --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/compressibleCourantNo.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 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 + +Description + Calculates and outputs the mean and maximum Courant Numbers for the fluid + regions + +\*---------------------------------------------------------------------------*/ + +#ifndef compressibleCourantNo_H +#define compressibleCourantNo_H + +#include "fvMesh.H" + +namespace Foam +{ + scalar compressibleCourantNo + ( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& rho, + const surfaceScalarField& phi + ); +} + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H new file mode 100644 index 0000000000..1a7f5a3262 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/initContinuityErrs.H @@ -0,0 +1 @@ +List cumulativeContErr(fluidRegions.size(), 0.0); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H new file mode 100644 index 0000000000..bc4590a428 --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -0,0 +1,18 @@ + const fvMesh& mesh = fluidRegions[i]; + + basicThermo& thermo = thermoFluid[i]; + volScalarField& rho = rhoFluid[i]; + volScalarField& K = KFluid[i]; + volVectorField& U = UFluid[i]; + surfaceScalarField phi = phiFluid[i]; + compressible::turbulenceModel& turb = turbulence[i]; + volScalarField& DpDt = DpDtFluid[i]; + const volScalarField& gh = ghFluid[i]; + const surfaceScalarField& ghf = ghfFluid[i]; + volScalarField& pd = pdFluid[i]; + + volScalarField& p = thermo.p(); + const volScalarField& psi = thermo.psi(); + volScalarField& h = thermo.h(); + + const dimensionedScalar massIni("massIni", dimMass, initialMassFluid[i]); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H new file mode 100644 index 0000000000..04c90d2c4c --- /dev/null +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -0,0 +1,6 @@ +// fvMesh& mesh = solidRegions[i]; + + volScalarField& rho = rhos[i]; + volScalarField& cp = cps[i]; + volScalarField& K = Ks[i]; + volScalarField& T = Ts[i]; diff --git a/src/postProcessing/foamCalcFunctions/Make/files b/src/postProcessing/foamCalcFunctions/Make/files index 50dc36be0c..4f4a0ccf6f 100644 --- a/src/postProcessing/foamCalcFunctions/Make/files +++ b/src/postProcessing/foamCalcFunctions/Make/files @@ -7,6 +7,7 @@ field/magSqr/magSqr.C field/magGrad/magGrad.C field/div/div.C field/randomise/randomise.C +field/interpolate/interpolate.C basic/add/add.C diff --git a/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C new file mode 100644 index 0000000000..d9126c6c03 --- /dev/null +++ b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.C @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 "interpolate.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace calcTypes + { + defineTypeNameAndDebug(interpolate, 0); + addToRunTimeSelectionTable(calcType, interpolate, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcTypes::interpolate::interpolate() +: + calcType() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcTypes::interpolate::~interpolate() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcTypes::interpolate::init() +{ + Foam::argList::validArgs.append("interpolate"); + argList::validArgs.append("fieldName1 .. fieldNameN"); +} + + +void Foam::calcTypes::interpolate::preCalc +( + const argList& args, + const Time& runTime, + const fvMesh& mesh +) +{ + if (args.additionalArgs().size() < 2) + { + Info<< nl << "must specify one or more fields" << nl; + args.printUsage(); + FatalError.exit(); + } +} + + +void Foam::calcTypes::interpolate::calc +( + const argList& args, + const Time& runTime, + const fvMesh& mesh +) +{ + const stringList& params = args.additionalArgs(); + + for (label fieldi=1; fieldi(fieldHeader, mesh, processed); + writeInterpolateField(fieldHeader, mesh, processed); + writeInterpolateField + ( + fieldHeader, + mesh, + processed + ); + writeInterpolateField(fieldHeader, mesh, processed); + writeInterpolateField(fieldHeader, mesh, processed); + + if (!processed) + { + FatalError + << "Unable to process " << fieldName << nl + << "No call to interpolate for fields of type " + << fieldHeader.headerClassName() << nl << nl + << exit(FatalError); + } + } + else + { + Info<< " No " << fieldName << endl; + } + } +} + + +// ************************************************************************* // + diff --git a/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.H b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.H new file mode 100644 index 0000000000..156a2c263f --- /dev/null +++ b/src/postProcessing/foamCalcFunctions/field/interpolate/interpolate.H @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + Foam::calcTypes::interpolate + +Description + Interpolates volume fields to surface fields for each time. + +SourceFiles + interpolate.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interpolate_H +#define interpolate_H + +#include "calcType.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace calcTypes +{ + +/*---------------------------------------------------------------------------*\ + Class interpolate Declaration +\*---------------------------------------------------------------------------*/ + +class interpolate +: + public calcType +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + interpolate(const interpolate&); + + //- Disallow default bitwise assignment + void operator=(const interpolate&); + + +protected: + + // Member Functions + + // Calculation routines + + //- Initialise - typically setting static variables, + // e.g. command line arguments + virtual void init(); + + //- Pre-time loop calculations + virtual void preCalc + ( + const argList& args, + const Time& runTime, + const fvMesh& mesh + ); + + //- Time loop calculations + virtual void calc + ( + const argList& args, + const Time& runTime, + const fvMesh& mesh + ); + + + // I-O + + //- Write interpolate fields + template + void writeInterpolateField + ( + const IOobject& header, + const fvMesh& mesh, + bool& processed + ); + + +public: + + //- Runtime type information + TypeName("interpolate"); + + + // Constructors + + //- Construct null + interpolate(); + + + // Destructor + + virtual ~interpolate(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace calcTypes +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "writeInterpolateField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/foamCalcFunctions/field/interpolate/writeInterpolateField.C b/src/postProcessing/foamCalcFunctions/field/interpolate/writeInterpolateField.C new file mode 100644 index 0000000000..88b1a295aa --- /dev/null +++ b/src/postProcessing/foamCalcFunctions/field/interpolate/writeInterpolateField.C @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 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 + +\*---------------------------------------------------------------------------*/ + +template +void Foam::calcTypes::interpolate::writeInterpolateField +( + const IOobject& header, + const fvMesh& mesh, + bool& processed +) +{ + typedef GeometricField fieldType; + typedef GeometricField surfaceFieldType; + + if (header.headerClassName() == fieldType::typeName) + { + Info<< " Reading " << header.name() << endl; + fieldType field(header, mesh); + + Info<< " Calculating interpolate" << header.name() << endl; + surfaceFieldType interpolateField + ( + IOobject + ( + "interpolate" + header.name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ), + fvc::interpolate(field) + ); + interpolateField.write(); + + processed = true; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C b/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C index 0a213f03d3..9822578114 100644 --- a/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModel/radiationModel/newRadiationModel.C @@ -86,7 +86,7 @@ autoPtr radiationModel::New // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End radiation +} // End namespace radiation } // End namespace Foam // ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C index b349d2fbc8..f52646af28 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.C @@ -97,7 +97,7 @@ RASModel::RASModel dimensioned::lookupOrAddToDict ( "E", - wallFunctionDict_ + wallFunctionDict_, 9.0 ) ),