Commit 2088364c authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents ba308083 45ca32a7
......@@ -7,6 +7,11 @@ if (pimple.nCorr() <= 1)
phi = (fvc::interpolate(U) & mesh.Sf());
if (ddtPhiCorr)
{
phi += fvc::ddtPhiCorr(rAU, U, phi);
}
if (p.needReference())
{
fvc::makeRelative(phi, U);
......
......@@ -8,3 +8,5 @@
const bool checkMeshCourantNo =
pimpleDict.lookupOrDefault("checkMeshCourantNo", false);
const bool ddtPhiCorr =
pimpleDict.lookupOrDefault("ddtPhiCorr", true);
......@@ -58,6 +58,9 @@ int main(int argc, char *argv[])
#include "CourantNo.H"
#include "setInitialDeltaT.H"
surfaceScalarField phiAbs("phiAbs", phi);
fvc::makeAbsolute(phiAbs, U);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
......@@ -67,9 +70,6 @@ int main(int argc, char *argv[])
#include "alphaCourantNo.H"
#include "CourantNo.H"
// Make the fluxes absolute
fvc::makeAbsolute(phi, U);
#include "setDeltaT.H"
runTime++;
......@@ -78,8 +78,18 @@ int main(int argc, char *argv[])
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
// Do any mesh changes
mesh.update();
{
// Calculate the relative velocity used to map the relative flux phi
volVectorField Urel("Urel", U);
if (mesh.moving())
{
Urel -= fvc::reconstruct(fvc::meshPhi(U));
}
// Do any mesh changes
mesh.update();
}
if (mesh.changing())
{
......@@ -96,9 +106,6 @@ int main(int argc, char *argv[])
#include "correctPhi.H"
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
......
......@@ -3,16 +3,19 @@
surfaceScalarField rAUf(fvc::interpolate(rAU));
U = rAU*UEqn.H();
surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf()));
phiAbs =
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs);
if (p_rgh.needReference())
{
fvc::makeRelative(phiU, U);
adjustPhi(phiU, U, p_rgh);
fvc::makeAbsolute(phiU, U);
fvc::makeRelative(phiAbs, U);
adjustPhi(phiAbs, U, p_rgh);
fvc::makeAbsolute(phiAbs, U);
}
phi = phiU +
phi = phiAbs +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
......@@ -38,11 +41,13 @@
}
}
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U += rAU*fvc::reconstruct((phi - phiAbs)/rAUf);
U.correctBoundaryConditions();
#include "continuityErrs.H"
phiAbs = phi;
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
......
......@@ -936,12 +936,6 @@ int main(int argc, char *argv[])
const word dictName
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE;
if (args.optionFound("AMI"))
{
sampleMode = mappedPatchBase::NEARESTPATCHFACEAMI;
}
IOdictionary dict
(
IOobject
......@@ -966,6 +960,9 @@ int main(int argc, char *argv[])
dict.lookup("faceZonesShadow") >> zoneShadowNames;
}
mappedPatchBase::sampleMode sampleMode =
mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")];
const Switch oneD(dict.lookup("oneD"));
const Switch adaptMesh(dict.lookup("adaptMesh"));
......
......@@ -15,10 +15,10 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Name of region to create
region liquidFilm;
region liquidFilm;
// FaceZones to extrude
faceZones (f0);
faceZones (f0);
// FaceZone shadow
//faceZonesShadow (fBaffleShadow);
......@@ -30,10 +30,13 @@ faceZones (f0);
// - extruding boundary faces: repatched to be on mapped patches
// If false: leave original mesh intact. Extruded mesh will still have
// mapped patch which might need to be adapted.
adaptMesh true;
adaptMesh true;
// Sample mode for inter-region communication
sampleMode nearestPatchFace;
// Extrude 1D-columns of cells?
oneD false;
oneD false;
// If oneD is true. Specify which boundary is wanted between the layers
//oneDPolyPatchType emptyPolyPatch; //wedgePolyPatch
......@@ -42,23 +45,23 @@ oneD false;
//- Extrusion model to use. The only logical choice is linearNormal?
//- Linear extrusion in normal direction
extrudeModel linearNormal;
extrudeModel linearNormal;
//- Linear extrusion in specified direction
//extrudeModel linearDirection;
// extrudeModel linearDirection;
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
// extrudeModel wedge;
// extrudeModel wedge;
//- Extrudes into sphere around (0 0 0)
//extrudeModel linearRadial;
// extrudeModel linearRadial;
//- Extrudes into sphere with grading according to pressure (atmospherics)
//extrudeModel sigmaRadial;
// extrudeModel sigmaRadial;
nLayers 10;
nLayers 10;
expansionRatio 0.9;
expansionRatio 0.9;
linearNormalCoeffs
{
......
......@@ -40,7 +40,7 @@ Foam::Field<Type> Foam::interpolateSplineXY
forAll(xNew, i)
{
yNew[i] = interpolateSmoothXY(xNew[i], xOld, yOld);
yNew[i] = interpolateSplineXY(xNew[i], xOld, yOld);
}
return yNew;
......
......@@ -107,7 +107,7 @@ bool Foam::adjustPhi
{
massCorr = (massIn - fixedMassOut)/adjustableMassOut;
}
else if (mag(fixedMassOut - massIn)/totalFlux > 1e-10)
else if (mag(fixedMassOut - massIn)/totalFlux > 1e-8)
{
FatalErrorIn
(
......
......@@ -114,20 +114,67 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(this->patch().patch());
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
Field<Type> nbrIntFld;
// Retrieve the neighbour field
const fvPatchField<Type>& nbrField =
nbrPatch.template lookupPatchField<FieldType, Type>
(
this->dimensionedInternalField().name()
);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField());
mpp.distribute(nbrIntFld);
switch (mpp.mode())
{
case mappedPatchBase::NEARESTCELL:
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
) << "Cannot apply "
<< mappedPatchBase::sampleModeNames_
[
mappedPatchBase::NEARESTCELL
]
<< " mapping mode for patch " << this->patch().name()
<< exit(FatalError);
break;
}
case mappedPatchBase::NEARESTPATCHFACE:
{
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatchField<Type>& nbrPatchField =
this->sampleField().boundaryField()[samplePatchI];
nbrIntFld = nbrPatchField.patchInternalField();
mpp.distribute(nbrIntFld);
break;
}
case mappedPatchBase::NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const FieldType& nbrField = this->sampleField();
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf = nbrField.boundaryField()[patchI];
const Field<Type> pif(pf.patchInternalField());
label faceStart = pf.patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pif[faceI];
}
}
mpp.distribute(allValues);
nbrIntFld.transfer(allValues);
break;
}
default:
{
FatalErrorIn("mappedFixedValueFvPatchField<Type>::updateCoeffs()")
<< "Unknown sampling mode: " << mpp.mode()
<< abort(FatalError);
}
}
// Restore tag
UPstream::msgType() = oldTag;
......
......@@ -71,7 +71,10 @@ class mappedFixedValueFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private data
protected:
// Protected data
//- Name of field to sample - defaults to field associated with this
// patchField if not specified
......@@ -90,7 +93,7 @@ class mappedFixedValueFvPatchField
mutable autoPtr<interpolation<Type> > interpolator_;
// Private Member Functions
// Protected Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
......
......@@ -146,9 +146,9 @@ public:
};
private:
protected:
// Private data
// Protected data
//- Patch to sample
const polyPatch& patch_;
......@@ -199,7 +199,7 @@ private:
dictionary surfDict_;
// Private Member Functions
// Protected Member Functions
//- Collect single list of samples and originating processor+face.
void collectSamples
......
......@@ -3,9 +3,10 @@ sinclude $(RULES)/mplib$(WM_MPLIB)
EXE_INC = \
$(PFLAGS) $(PINC) \
-I$(SCOTCH_ROOT)/include \
-I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
-I/usr/include/scotch \
-I../decompositionMethods/lnInclude
LIB_LIBS = \
-L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt
-L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt
......@@ -7,9 +7,10 @@ sinclude $(RULES)/mplib$(WM_MPLIB)
EXE_INC = \
$(PFLAGS) $(PINC) \
-I$(SCOTCH_ROOT)/include \
-I$(SCOTCH_ARCH_PATH)/include \
-I/usr/include/scotch \
-I../decompositionMethods/lnInclude
LIB_LIBS = \
-L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
-L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN) -lscotch -lscotcherrexit -lrt
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void kinematicSingleLayer::constrainFilmField
(
Type& field,
const typename Type::cmptType& value
)
{
forAll(intCoupledPatchIDs_, i)
{
label patchI = intCoupledPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
forAll(passivePatchIDs_, i)
{
label patchI = passivePatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace Foam
} // end namespace regionModels
} // end namespace surfaceFilmModels
// ************************************************************************* //
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace regionModels
{
namespace surfaceFilmModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void kinematicSingleLayer::constrainFilmField
(
Type& field,
const typename Type::cmptType& value
)
{
forAll(intCoupledPatchIDs_, i)
{
label patchI = intCoupledPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
forAll(passivePatchIDs_, i)
{
label patchI = passivePatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // end namespace Foam
} // end namespace regionModels
} // end namespace surfaceFilmModels
// ************************************************************************* //
......@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "nuSgsUSpaldingWallFunctionFvPatchScalarField.H"
#include "LESModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
......@@ -47,8 +48,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("U"),
nuName_("nu"),
kappa_(0.41),
E_(9.8)
{}
......@@ -64,8 +63,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
nuName_(ptf.nuName_),
kappa_(ptf.kappa_),
E_(ptf.E_)
{}
......@@ -80,8 +77,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF, dict),
UName_(dict.lookupOrDefault<word>("U", "U")),
nuName_(dict.lookupOrDefault<word>("nu", "nu")),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8))
{}
......@@ -94,8 +89,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(nwfpsf),
UName_(nwfpsf.UName_),
nuName_(nwfpsf.nuName_),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
......@@ -109,8 +102,6 @@ nuSgsUSpaldingWallFunctionFvPatchScalarField
)
:
fixedValueFvPatchScalarField(nwfpsf, iF),
UName_(nwfpsf.UName_),
nuName_(nwfpsf.nuName_),
kappa_(nwfpsf.kappa_),
E_(nwfpsf.E_)
{}
......@@ -123,16 +114,15 @@ void nuSgsUSpaldingWallFunctionFvPatchScalarField::evaluate
const Pstream::commsTypes
)
{
const scalarField& ry = patch().deltaCoeffs();
const LESModel& lesModel = db().lookupObject<LESModel>("LESProperties");
const label patchi = patch().index();
const fvPatchVectorField& U = lesModel.U().boundaryField()[patchi];
const scalarField nuw = lesModel.nu()().boundaryField()[patchi];
const fvPatchVectorField& U =
patch().lookupPatchField<volVectorField, vector>(UName_);