Commit 7297ae0e authored by Andrew Heather's avatar Andrew Heather
Browse files
parents 85f11fa7 73ae3ddc
......@@ -208,6 +208,9 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
patch().patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
(void)distMap.schedule();
tmp<scalarField> intFld = patchInternalField();
......@@ -217,7 +220,6 @@ void Foam::solidWallMixedTemperatureCoupledFvPatchScalarField::updateCoeffs()
// to be updated the first time round the iteration (i.e. when
// switching regions) but unfortunately we don't have this information.
const mapDistribute& distMap = mpp.map();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
......
......@@ -9,6 +9,7 @@ EXE_INC = \
EXE_LIBS = \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-ldynamicMesh \
-lmeshTools \
-lincompressibleTransportModels \
......
......@@ -16,5 +16,6 @@ EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools \
-ldynamicFvMesh
-ldynamicFvMesh \
-ltopoChangerFvMesh
......@@ -17,4 +17,5 @@ EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools \
-ldynamicFvMesh
-ldynamicFvMesh \
-ltopoChangerFvMesh
......@@ -203,8 +203,8 @@ int main(int argc, char *argv[])
IOobject
(
"abc", // dummy name
//mesh.time().constant(), // instance
mesh.time().findInstance("triSurface", word::null),// instance
mesh.time().constant(), // instance
//mesh.time().findInstance("triSurface", word::null),// instance
"triSurface", // local
mesh.time(), // registry
IOobject::MUST_READ,
......
......@@ -638,10 +638,10 @@ Foam::Time& Foam::Time::operator+=(const scalar deltaT)
Foam::Time& Foam::Time::operator++()
{
readModifiedObjects();
if (!subCycling_)
{
readModifiedObjects();
if (timeIndex_ == startTimeIndex_)
{
functionObjects_.start();
......
......@@ -225,7 +225,9 @@ Foam::autoHexMeshDriver::autoHexMeshDriver
IOobject
(
"abc", // dummy name
mesh_.time().findInstance("triSurface", word::null),// inst
//mesh_.time().findInstance("triSurface", word::null),
// instance
mesh_.time().constant(), // instance
"triSurface", // local
mesh_.time(), // registry
IOobject::MUST_READ,
......
......@@ -78,8 +78,9 @@ Foam::label Foam::autoRefineDriver::readFeatureEdges
IOobject
(
featFileName, // name
mesh.time().findInstance("triSurface", featFileName),
// instance
//mesh.time().findInstance("triSurface", featFileName),
// // instance
mesh.time().constant(), // instance
"triSurface", // local
mesh.time(), // registry
IOobject::MUST_READ,
......
......@@ -16,16 +16,13 @@ $(enrichedPatch)/enrichedPatchPointPoints.C
$(enrichedPatch)/enrichedPatchCutFaces.C
$(enrichedPatch)/enrichedPatchMasterPoints.C
/* polyTopoChange/polyTopoChange/polyTopoChange.C */
polyTopoChange/polyTopoChange/topoAction/topoActions.C
polyMeshModifier = polyTopoChange/polyMeshModifier
$(polyMeshModifier)/polyMeshModifier.C
$(polyMeshModifier)/newPolyMeshModifier.C
polyTopoChange/polyTopoChange/topoAction/topoActions.C
polyTopoChange/polyTopoChanger/polyTopoChanger.C
/* polyTopoChange/polyTopoChanger/polyTopoChangerChangeMesh.C */
polyTopoChange/polyTopoChange/polyTopoChange.C
polyTopoChange/polyTopoChange/addPatchCellLayer.C
polyTopoChange/polyTopoChange/edgeCollapser.C
......
......@@ -350,6 +350,18 @@ void Foam::hexRef8::modFace
// Bit complex way to determine the unrefined edge length.
Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
{
if (cellLevel_.size() != mesh_.nCells())
{
FatalErrorIn
(
"hexRef8::getLevel0EdgeLength() const"
) << "Number of cells in mesh:" << mesh_.nCells()
<< " does not equal size of cellLevel:" << cellLevel_.size()
<< endl
<< "This might be because of a restart with inconsistent cellLevel."
<< abort(FatalError);
}
// Determine minimum edge length per refinement level
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -114,12 +114,12 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
<< exit(FatalError);
}
// Force calculation of schedule (uses parallel comms)
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
this->patch().patch()
);
(void)mpp.map().schedule();
//// Force calculation of schedule (uses parallel comms)
//const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
//(
// this->patch().patch()
//);
//(void)mpp.map().schedule();
}
......@@ -166,6 +166,10 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
directMappedFixedValueFvPatchField<Type>::patch().patch()
);
const mapDistribute& distMap = mpp.map();
// Force recalculation of schedule
(void)distMap.schedule();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const word& fldName = this->dimensionedInternalField().name();
......
topoChangerFvMesh/topoChangerFvMesh.C
rawTopoChangerFvMesh/rawTopoChangerFvMesh.C
/*
linearValveFvMesh/linearValveFvMesh.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "rawTopoChangerFvMesh.H"
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "linear.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(rawTopoChangerFvMesh, 0);
addToRunTimeSelectionTable
(
topoChangerFvMesh,
rawTopoChangerFvMesh,
IOobject
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io)
:
topoChangerFvMesh(io)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::rawTopoChangerFvMesh::~rawTopoChangerFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::rawTopoChangerFvMesh::update()
{
// Do mesh changes (use inflation - put new points in topoChangeMap)
Info<< "rawTopoChangerFvMesh : Checking for topology changes..."
<< endl;
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(true);
bool hasChanged = topoChangeMap.valid();
if (hasChanged)
{
Info<< "rawTopoChangerFvMesh : Done topology changes..."
<< endl;
// Temporary: fix fields on patch faces created out of nothing
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Two situations:
// - internal faces inflated out of nothing
// - patch faces created out of previously internal faces
// Is face mapped in any way
PackedList<1> mappedFace(nFaces());
const label nOldInternal = topoChangeMap().oldPatchStarts()[0];
const labelList& faceMap = topoChangeMap().faceMap();
for (label faceI = 0; faceI < nInternalFaces(); faceI++)
{
if (faceMap[faceI] >= 0)
{
mappedFace[faceI] = 1;
}
}
for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++)
{
if (faceMap[faceI] >= 0 && faceMap[faceI] >= nOldInternal)
{
mappedFace[faceI] = 1;
}
}
const List<objectMap>& fromFaces = topoChangeMap().facesFromFacesMap();
forAll(fromFaces, i)
{
mappedFace[fromFaces[i].index()] = 1;
}
const List<objectMap>& fromEdges = topoChangeMap().facesFromEdgesMap();
forAll(fromEdges, i)
{
mappedFace[fromEdges[i].index()] = 1;
}
const List<objectMap>& fromPts = topoChangeMap().facesFromPointsMap();
forAll(fromPts, i)
{
mappedFace[fromPts[i].index()] = 1;
}
// Set unmapped faces to zero
Info<< "rawTopoChangerFvMesh : zeroing unmapped boundary values."
<< endl;
zeroUnmappedValues<scalar, fvPatchField, volMesh>(mappedFace);
zeroUnmappedValues<vector, fvPatchField, volMesh>(mappedFace);
zeroUnmappedValues<sphericalTensor, fvPatchField, volMesh>(mappedFace);
zeroUnmappedValues<symmTensor, fvPatchField, volMesh>(mappedFace);
zeroUnmappedValues<tensor, fvPatchField, volMesh>(mappedFace);
// Special handling for phi: set unmapped faces to recreated phi
Info<< "rawTopoChangerFvMesh :"
<< " recreating phi for unmapped boundary values." << endl;
const volVectorField& U = lookupObject<volVectorField>("U");
surfaceScalarField& phi = const_cast<surfaceScalarField&>
(
lookupObject<surfaceScalarField>("phi")
);
setUnmappedValues
(
phi,
mappedFace,
(linearInterpolate(U) & Sf())()
);
if (topoChangeMap().hasMotionPoints())
{
pointField newPoints = topoChangeMap().preMotionPoints();
// Give the meshModifiers opportunity to modify points
Info<< "rawTopoChangerFvMesh :"
<< " calling modifyMotionPoints." << endl;
topoChanger_.modifyMotionPoints(newPoints);
// Actually move points
Info<< "rawTopoChangerFvMesh :"
<< " calling movePoints." << endl;
movePoints(newPoints);
}
}
else
{
//Pout<< "rawTopoChangerFvMesh :"
// << " no topology changes..." << endl;
}
changing(hasChanged);
return hasChanged;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::rawTopoChangerFvMesh
Description
topoChangerFvMesh without any added functionality.
Note: run without FOAM_SETNAN. Temporary has unitialised patch
data when faces get created out of nothing.
SourceFiles
rawTopoChangerFvMesh.C
\*---------------------------------------------------------------------------*/
#ifndef rawTopoChangerFvMesh_H
#define rawTopoChangerFvMesh_H
#include "topoChangerFvMesh.H"
#include "PackedList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class rawTopoChangerFvMesh Declaration
\*---------------------------------------------------------------------------*/
class rawTopoChangerFvMesh
:
public topoChangerFvMesh
{
// Private Member Functions
//- Set unmapped values
template<class Type, template<class> class PatchField, class GeoMesh>
static void setUnmappedValues
(
GeometricField<Type, PatchField, GeoMesh>& fld,
const PackedList<1>& mappedFace,
const GeometricField<Type, PatchField, GeoMesh>& baseFld
);
template<class Type, template<class> class PatchField, class GeoMesh>
void zeroUnmappedValues(const PackedList<1>&) const;
//- Disallow default bitwise copy construct
rawTopoChangerFvMesh(const rawTopoChangerFvMesh&);
//- Disallow default bitwise assignment
void operator=(const rawTopoChangerFvMesh&);
public:
//- Runtime type information
TypeName("rawTopoChangerFvMesh");
// Constructors
//- Construct from database
explicit rawTopoChangerFvMesh(const IOobject& io);
// Destructor
virtual ~rawTopoChangerFvMesh();
// Member Functions
//- Update the mesh for both mesh motion and topology change
virtual bool update();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "rawTopoChangerFvMeshTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "rawTopoChangerFvMesh.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::rawTopoChangerFvMesh::setUnmappedValues
(
GeometricField<Type, PatchField, GeoMesh>& fld,
const PackedList<1>& mappedFace,
const GeometricField<Type, PatchField, GeoMesh>& baseFld
)
{
//Pout<< "Checking field " << fld.name() << endl;
forAll(fld.boundaryField(), patchI)
{
PatchField<Type>& fvp = const_cast<PatchField<Type>&>
(
fld.boundaryField()[patchI]
);
label start = fvp.patch().patch().start();
forAll(fvp, i)
{
if (!mappedFace[start+i])
{
//Pout<< "** Resetting unassigned value on patch "
// << fvp.patch().name()
// << " localface:" << i
// << " to:" << baseFld.boundaryField()[patchI][i] << endl;
fvp[i] = baseFld.boundaryField()[patchI][i];
}
}
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::rawTopoChangerFvMesh::zeroUnmappedValues
(
const PackedList<1>& mappedFace
) const
{
typedef GeometricField<Type, PatchField, GeoMesh> FieldType;
const wordList fldNames(names(FieldType::typeName));
forAll(fldNames, i)
{
//Pout<< "Checking field " << fldNames[i] << endl;
FieldType& fld = const_cast<FieldType&>
(
lookupObject<FieldType>(fldNames[i])
);
setUnmappedValues
(
fld,
mappedFace,
FieldType
(
IOobject
(
"zero",
time().timeName(),
*this,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
*this,
dimensioned<Type>("0", fld.dimensions(), pTraits<Type>::zero)
)
);
}
}
// ************************************************************************* //
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment