Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2016-12-14 07:37:06 -08:00
29 changed files with 10314 additions and 38726 deletions

View File

@ -48,7 +48,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "PstreamReduceOps.H"
#include "argList.H"
#include "Time.H"
#include "polyTopoChange.H"
@ -62,6 +61,7 @@ Description
#include "motionSmoother.H"
#include "topoSet.H"
#include "processorMeshes.H"
#include "PstreamReduceOps.H"
using namespace Foam;

View File

@ -42,15 +42,6 @@ case ThirdParty:
case Gcc48:
set gcc_version=gcc-4.8.5
breaksw
case Gcc45:
set gcc_version=gcc-4.5.4
breaksw
case Gcc46:
set gcc_version=gcc-4.6.4
breaksw
case Gcc47:
set gcc_version=gcc-4.7.4
breaksw
case Gcc49:
set gcc_version=gcc-4.9.3
breaksw
@ -69,6 +60,9 @@ case ThirdParty:
case Gcc61:
set gcc_version=gcc-6.1.0
breaksw
case Gcc62:
set gcc_version=gcc-6.2.0
breaksw
case Clang:
set clang_version=llvm-3.7.0
# set clang_version=llvm-3.8.0

View File

@ -53,15 +53,15 @@ ThirdParty)
Gcc53)
gcc_version=gcc-5.3.0
;;
Gcc61)
gcc_version=gcc-6.1.0
;;
Gcc54)
gcc_version=gcc-5.4.0
;;
Gcc61)
gcc_version=gcc-6.1.0
;;
Gcc62)
gcc_version=gcc-6.2.0
;;
Clang)
clang_version=llvm-3.7.0
# clang_version=llvm-3.8.0

View File

@ -62,6 +62,15 @@ OptimisationSwitches
floatTransfer 0;
nProcsSimpleSum 0;
// Optional max size (bytes) for unstructured data exchanges. In some
// phases of OpenFOAM it can send over very large data chunks
// (e.g. in parallel load balancing) and some Pstream implementations have
// problems with this. Setting this variable > 0 indicates that the
// data exchange needs to be done in multiple passes, each of maxCommsSize.
// This is not switched on by default since it requires an additional
// global reduction, even if multi-pass is not needed)
maxCommsSize 0;
// Force dumping (at next timestep) upon signal (-1 to disable)
writeNowSignal -1; // 10;

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -43,7 +43,6 @@ setenv WM_PROJECT_VERSION plus
#
setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | \
sed 's%/'$WM_PROJECT'[^/]*/etc/cshrc%%'`
echo $FOAM_INST_DIR
# setenv FOAM_INST_DIR $HOME/$WM_PROJECT
# setenv FOAM_INST_DIR ~$WM_PROJECT
# setenv FOAM_INST_DIR /opt/$WM_PROJECT

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,6 +55,37 @@ class Pstream
:
public UPstream
{
// Private Static Functions
//- Exchange contiguous data. Sends sendData, receives into
// recvData. If block=true will wait for all transfers to finish.
// Data provided and received as container.
template<class Container, class T>
static void exchangeContainer
(
const UList<Container>& sendBufs,
const labelUList& recvSizes,
List<Container>& recvBufs,
const int tag,
const label comm,
const bool block
);
//- Exchange contiguous data. Sends sendData, receives into
// recvData. If block=true will wait for all transfers to finish.
// Data provided and received as pointers.
template<class T>
static void exchangeBuf
(
const labelUList& sendSizes, // number of T, not number of char
const UList<const char*>& sendBufs,
const labelUList& recvSizes, // number of T, not number of char
List<char*>& recvBufs,
const int tag,
const label comm,
const bool block
);
protected:
@ -63,6 +94,7 @@ protected:
//- Transfer buffer
DynamicList<char> buf_;
public:
// Declare name of the class and its debug switch

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +32,6 @@ Description
#ifndef PstreamReduceOps_H
#define PstreamReduceOps_H
#include "Pstream.H"
#include "ops.H"
#include "vector2D.H"

View File

@ -464,4 +464,16 @@ registerOptSwitch
);
int Foam::UPstream::maxCommsSize
(
Foam::debug::optimisationSwitch("maxCommsSize", 0)
);
registerOptSwitch
(
"maxCommsSize",
int,
Foam::UPstream::maxCommsSize
);
// ************************************************************************* //

View File

@ -269,6 +269,9 @@ public:
//- Number of polling cycles in processor updates
static int nPollProcInterfaces;
//- Optional maximum message size (bytes)
static int maxCommsSize;
//- Default communicator (all processors)
static label worldComm;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,13 +28,12 @@ Description
#include "Pstream.H"
#include "contiguous.H"
#include "PstreamCombineReduceOps.H"
#include "UPstream.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Container, class T>
void Foam::Pstream::exchange
void Foam::Pstream::exchangeContainer
(
const UList<Container>& sendBufs,
const labelUList& recvSizes,
@ -43,25 +42,6 @@ void Foam::Pstream::exchange
const label comm,
const bool block
)
{
if (!contiguous<T>())
{
FatalErrorInFunction
<< "Continuous data only." << sizeof(T) << Foam::abort(FatalError);
}
if (sendBufs.size() != UPstream::nProcs(comm))
{
FatalErrorInFunction
<< "Size of list " << sendBufs.size()
<< " does not equal the number of processors "
<< UPstream::nProcs(comm)
<< Foam::abort(FatalError);
}
recvBufs.setSize(sendBufs.size());
if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
{
label startOfRequests = Pstream::nRequests();
@ -70,17 +50,14 @@ void Foam::Pstream::exchange
forAll(recvSizes, proci)
{
label nRecv = recvSizes[proci];
if (proci != Pstream::myProcNo(comm) && nRecv > 0)
if (proci != Pstream::myProcNo(comm) && recvSizes[proci] > 0)
{
recvBufs[proci].setSize(nRecv);
UIPstream::read
(
UPstream::nonBlocking,
proci,
reinterpret_cast<char*>(recvBufs[proci].begin()),
nRecv*sizeof(T),
recvSizes[proci]*sizeof(T),
tag,
comm
);
@ -127,6 +104,237 @@ void Foam::Pstream::exchange
}
}
template<class T>
void Foam::Pstream::exchangeBuf
(
const labelUList& sendSizes,
const UList<const char*>& sendBufs,
const labelUList& recvSizes,
List<char*>& recvBufs,
const int tag,
const label comm,
const bool block
)
{
label startOfRequests = Pstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
forAll(recvSizes, proci)
{
if (proci != Pstream::myProcNo(comm) && recvSizes[proci] > 0)
{
UIPstream::read
(
UPstream::nonBlocking,
proci,
recvBufs[proci],
recvSizes[proci]*sizeof(T),
tag,
comm
);
}
}
// Set up sends
// ~~~~~~~~~~~~
forAll(sendBufs, proci)
{
if (proci != Pstream::myProcNo(comm) && sendSizes[proci] > 0)
{
if
(
!UOPstream::write
(
UPstream::nonBlocking,
proci,
sendBufs[proci],
sendSizes[proci]*sizeof(T),
tag,
comm
)
)
{
FatalErrorInFunction
<< "Cannot send outgoing message. "
<< "to:" << proci << " nBytes:"
<< label(sendSizes[proci]*sizeof(T))
<< Foam::abort(FatalError);
}
}
}
// Wait for all to finish
// ~~~~~~~~~~~~~~~~~~~~~~
if (block)
{
Pstream::waitRequests(startOfRequests);
}
}
template<class Container, class T>
void Foam::Pstream::exchange
(
const UList<Container>& sendBufs,
const labelUList& recvSizes,
List<Container>& recvBufs,
const int tag,
const label comm,
const bool block
)
{
if (!contiguous<T>())
{
FatalErrorInFunction
<< "Continuous data only." << sizeof(T) << Foam::abort(FatalError);
}
if (sendBufs.size() != UPstream::nProcs(comm))
{
FatalErrorInFunction
<< "Size of list " << sendBufs.size()
<< " does not equal the number of processors "
<< UPstream::nProcs(comm)
<< Foam::abort(FatalError);
}
recvBufs.setSize(sendBufs.size());
if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
{
// Presize all receive buffers
forAll(recvSizes, proci)
{
label nRecv = recvSizes[proci];
if (proci != Pstream::myProcNo(comm) && nRecv > 0)
{
recvBufs[proci].setSize(nRecv);
}
}
if (Pstream::maxCommsSize <= 0)
{
// Do the exchanging in one go
exchangeContainer<Container, T>
(
sendBufs,
recvSizes,
recvBufs,
tag,
comm,
block
);
}
else
{
// Determine the number of chunks to send. Note that we
// only have to look at the sending data since we are
// guaranteed that some processor's sending size is some other
// processor's receive size. Also we can ignore any local comms.
label maxNSend = 0;
forAll(sendBufs, proci)
{
if (proci != Pstream::myProcNo(comm))
{
maxNSend = max(maxNSend, sendBufs[proci].size());
}
}
const label maxNBytes = sizeof(T)*maxNSend;
// We need to send maxNBytes bytes so the number of iterations:
// maxNBytes iterations
// --------- ----------
// 0 0
// 1..maxCommsSize 1
// maxCommsSize+1..2*maxCommsSize 2
// etc.
label nIter;
if (maxNBytes == 0)
{
nIter = 0;
}
else
{
nIter = (maxNBytes-1)/Pstream::maxCommsSize+1;
}
reduce(nIter, maxOp<label>(), tag, comm);
List<const char*> charSendBufs(sendBufs.size());
List<char*> charRecvBufs(sendBufs.size());
labelList nRecv(sendBufs.size());
labelList startRecv(sendBufs.size(), 0);
labelList nSend(sendBufs.size());
labelList startSend(sendBufs.size(), 0);
for (label iter = 0; iter < nIter; iter++)
{
forAll(sendBufs, proci)
{
nSend[proci] = min
(
Pstream::maxCommsSize,
sendBufs[proci].size()-startSend[proci]
);
charSendBufs[proci] =
(
nSend[proci] > 0
? reinterpret_cast<const char*>
(
&(sendBufs[proci][startSend[proci]])
)
: nullptr
);
nRecv[proci] = min
(
Pstream::maxCommsSize,
recvBufs[proci].size()-startRecv[proci]
);
charRecvBufs[proci] =
(
nRecv[proci] > 0
? reinterpret_cast<char*>
(
&(recvBufs[proci][startRecv[proci]])
)
: nullptr
);
}
exchangeBuf<T>
(
nSend,
charSendBufs,
nRecv,
charRecvBufs,
tag,
comm,
block
);
forAll(nSend, proci)
{
startSend[proci] += nSend[proci];
startRecv[proci] += nRecv[proci];
}
}
}
}
// Do myself
recvBufs[Pstream::myProcNo(comm)] = sendBufs[Pstream::myProcNo(comm)];
}

View File

@ -28,6 +28,7 @@ License
#include "dynamicCode.H"
#include "dynamicCodeContext.H"
#include "dlLibraryTable.H"
#include "Pstream.H"
#include "PstreamReduceOps.H"
#include "OSspecific.H"
#include "Ostream.H"

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "UPstream.H"
#include "Pstream.H"
#include "PstreamReduceOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -23,7 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "UPstream.H"
#include "Pstream.H"
#include "PstreamReduceOps.H"
#include "OSspecific.H"
#include "PstreamGlobals.H"

View File

@ -2,6 +2,7 @@ fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C
fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C
fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C

View File

@ -0,0 +1,371 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 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 "solidBodyDisplacementLaplacianFvMotionSolver.H"
#include "motionInterpolation.H"
#include "motionDiffusivity.H"
#include "fvmLaplacian.H"
#include "addToRunTimeSelectionTable.H"
#include "OFstream.H"
#include "meshTools.H"
#include "mapPolyMesh.H"
#include "solidBodyMotionFunction.H"
#include "transformField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(solidBodyDisplacementLaplacianFvMotionSolver, 0);
addToRunTimeSelectionTable
(
motionSolver,
solidBodyDisplacementLaplacianFvMotionSolver,
dictionary
);
addToRunTimeSelectionTable
(
displacementMotionSolver,
solidBodyDisplacementLaplacianFvMotionSolver,
displacement
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyDisplacementLaplacianFvMotionSolver::
solidBodyDisplacementLaplacianFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict
)
:
displacementMotionSolver(mesh, dict, typeName),
fvMotionSolver(mesh),
SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time())),
cellDisplacement_
(
IOobject
(
"cellDisplacement",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellDisplacement",
pointDisplacement_.dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
),
pointLocation_(nullptr),
interpolationPtr_
(
coeffDict().found("interpolation")
? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
: motionInterpolation::New(fvMesh_)
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
),
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
: -1
)
{
IOobject io
(
"pointLocation",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (debug)
{
Info<< "solidBodyDisplacementLaplacianFvMotionSolver:" << nl
<< " diffusivity : " << diffusivityPtr_().type() << nl
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
}
if (io.typeHeaderOk<pointVectorField>(true))
{
pointLocation_.reset
(
new pointVectorField
(
io,
pointMesh::New(fvMesh_)
)
);
if (debug)
{
Info<< "solidBodyDisplacementLaplacianFvMotionSolver :"
<< " Read pointVectorField "
<< io.name()
<< " to be used for boundary conditions on points."
<< nl
<< "Boundary conditions:"
<< pointLocation_().boundaryField().types() << endl;
}
}
}
Foam::solidBodyDisplacementLaplacianFvMotionSolver::
solidBodyDisplacementLaplacianFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const pointVectorField& pointDisplacement,
const pointIOField& points0
)
:
displacementMotionSolver(mesh, dict, pointDisplacement, points0, typeName),
fvMotionSolver(mesh),
SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time())),
cellDisplacement_
(
IOobject
(
"cellDisplacement",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvMesh_,
dimensionedVector
(
"cellDisplacement",
pointDisplacement_.dimensions(),
Zero
),
cellMotionBoundaryTypes<vector>(pointDisplacement_.boundaryField())
),
pointLocation_(nullptr),
interpolationPtr_
(
coeffDict().found("interpolation")
? motionInterpolation::New(fvMesh_, coeffDict().lookup("interpolation"))
: motionInterpolation::New(fvMesh_)
),
diffusivityPtr_
(
motionDiffusivity::New(fvMesh_, coeffDict().lookup("diffusivity"))
),
frozenPointsZone_
(
coeffDict().found("frozenPointsZone")
? fvMesh_.pointZones().findZoneID(coeffDict().lookup("frozenPointsZone"))
: -1
)
{
IOobject io
(
"pointLocation",
fvMesh_.time().timeName(),
fvMesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (debug)
{
Info<< "solidBodyDisplacementLaplacianFvMotionSolver:" << nl
<< " diffusivity : " << diffusivityPtr_().type() << nl
<< " frozenPoints zone : " << frozenPointsZone_ << endl;
}
if (io.typeHeaderOk<pointVectorField>(true))
{
pointLocation_.reset
(
new pointVectorField
(
io,
pointMesh::New(fvMesh_)
)
);
if (debug)
{
Info<< "solidBodyDisplacementLaplacianFvMotionSolver :"
<< " Read pointVectorField "
<< io.name()
<< " to be used for boundary conditions on points."
<< nl
<< "Boundary conditions:"
<< pointLocation_().boundaryField().types() << endl;
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::solidBodyDisplacementLaplacianFvMotionSolver::
~solidBodyDisplacementLaplacianFvMotionSolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::motionDiffusivity&
Foam::solidBodyDisplacementLaplacianFvMotionSolver::diffusivity()
{
if (!diffusivityPtr_.valid())
{
diffusivityPtr_ = motionDiffusivity::New
(
fvMesh_,
coeffDict().lookup("diffusivity")
);
}
return diffusivityPtr_();
}
Foam::tmp<Foam::pointField>
Foam::solidBodyDisplacementLaplacianFvMotionSolver::curPoints() const
{
interpolationPtr_->interpolate
(
cellDisplacement_,
pointDisplacement_
);
tmp<pointField> tnewPoints
(
transformPoints(SBMFPtr_().transformation(), points0())
);
const pointField& newPoints = tnewPoints();
if (pointLocation_.valid())
{
if (debug)
{
Info<< "solidBodyDisplacementLaplacianFvMotionSolver : applying "
<< " boundary conditions on " << pointLocation_().name()
<< " to new point location."
<< endl;
}
pointLocation_().primitiveFieldRef() =
newPoints
+ pointDisplacement_.internalField();
pointLocation_().correctBoundaryConditions();
// Implement frozen points
if (frozenPointsZone_ != -1)
{
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
forAll(pz, i)
{
pointLocation_()[pz[i]] = newPoints[pz[i]];
}
}
twoDCorrectPoints(pointLocation_().primitiveFieldRef());
return tmp<pointField>(pointLocation_().primitiveField());
}
else
{
tmp<pointField> tcurPoints
(
newPoints + pointDisplacement_.primitiveField()
);
pointField& curPoints = tcurPoints.ref();
// Implement frozen points
if (frozenPointsZone_ != -1)
{
const pointZone& pz = fvMesh_.pointZones()[frozenPointsZone_];
forAll(pz, i)
{
curPoints[pz[i]] = newPoints[pz[i]];
}
}
twoDCorrectPoints(curPoints);
return tcurPoints;
}
}
void Foam::solidBodyDisplacementLaplacianFvMotionSolver::solve()
{
// The points have moved so before interpolation update
// the motionSolver accordingly
movePoints(fvMesh_.points());
diffusivity().correct();
pointDisplacement_.boundaryFieldRef().updateCoeffs();
Foam::solve
(
fvm::laplacian
(
diffusivity().operator()(),
cellDisplacement_,
"laplacian(diffusivity,cellDisplacement)"
)
);
}
void Foam::solidBodyDisplacementLaplacianFvMotionSolver::updateMesh
(
const mapPolyMesh& mpm
)
{
displacementMotionSolver::updateMesh(mpm);
// Update diffusivity. Note two stage to make sure old one is de-registered
// before creating/registering new one.
diffusivityPtr_.clear();
}
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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 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/>.
Class
Foam::solidBodyDisplacementLaplacianFvMotionSolver
Group
grpMeshMotionSolvers
Description
Applies Laplacian displacement solving on top of a transformation of
the initial points using a solid-body motion.
See also
Foam::displacementLaplacian
SourceFiles
solidBodyDisplacementLaplacianFvMotionSolver.C
\*---------------------------------------------------------------------------*/
#ifndef solidBodyDisplacementLaplacianFvMotionSolver_H
#define solidBodyDisplacementLaplacianFvMotionSolver_H
#include "displacementMotionSolver.H"
#include "fvMotionSolver.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward class declarations
class motionInterpolation;
class motionDiffusivity;
class solidBodyMotionFunction;
/*---------------------------------------------------------------------------*\
Class solidBodyDisplacementLaplacianFvMotionSolver Declaration
\*---------------------------------------------------------------------------*/
class solidBodyDisplacementLaplacianFvMotionSolver
:
public displacementMotionSolver,
public fvMotionSolver
{
// Private data
//- Motion function
autoPtr<solidBodyMotionFunction> SBMFPtr_;
//- Cell-centre motion field
mutable volVectorField cellDisplacement_;
//- Optionally read point-position field. Used only for position
// boundary conditions.
mutable autoPtr<pointVectorField> pointLocation_;
//- Interpolation used to transfer cell displacement to the points
autoPtr<motionInterpolation> interpolationPtr_;
//- Diffusivity used to control the motion
autoPtr<motionDiffusivity> diffusivityPtr_;
//- Frozen points (that are not on patches). -1 or points that are
// fixed to be at points0_ location
label frozenPointsZone_;
// Private Member Functions
//- Disallow default bitwise copy construct
solidBodyDisplacementLaplacianFvMotionSolver
(
const solidBodyDisplacementLaplacianFvMotionSolver&
);
//- Disallow default bitwise assignment
void operator=(const solidBodyDisplacementLaplacianFvMotionSolver&);
public:
//- Runtime type information
TypeName("solidBodyDisplacementLaplacian");
// Constructors
//- Construct from polyMesh and IOdictionary
solidBodyDisplacementLaplacianFvMotionSolver
(
const polyMesh&,
const IOdictionary&
);
//- Construct from components
solidBodyDisplacementLaplacianFvMotionSolver
(
const polyMesh& mesh,
const IOdictionary& dict,
const pointVectorField& pointDisplacement,
const pointIOField& points0
);
//- Destructor
~solidBodyDisplacementLaplacianFvMotionSolver();
// Member Functions
//- Return reference to the diffusivity field
motionDiffusivity& diffusivity();
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- Solve for motion
virtual void solve();
//- Update topology
virtual void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -227,8 +227,8 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
reduce(sumMagPhi, sumOp<scalar>());
reduce(primaryInletTfMean, sumOp<scalar>());
primaryInletTfMean /= sumMagPhi;
CpfMean /= sumMagPhi;
primaryInletTfMean /= sumMagPhi + ROOTVSMALL;
CpfMean /= sumMagPhi + ROOTVSMALL;
scalar primaryInletT = primaryInletT_;
if (!userPrimaryInletT_)
@ -285,18 +285,18 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
{
label celli = cells_[i];
heSource[celli] -=
Qt*V[celli]*mag(U[celli])*deltaTCells[i]/sumWeight;
Qt*V[celli]*mag(U[celli])*deltaTCells[i]
/(sumWeight + ROOTVSMALL);
}
}
if (debug && Pstream::master())
{
Info<< indent << "Net mass flux [Kg/s] : " << sumPhi << nl;
Info<< indent << "Total energy exchange [W] : " << Qt << nl;
Info<< indent << "Tref [K] : " << Tref << nl;
Info<< indent << "Efficiency : "
<< eTable_()(mag(sumPhi), secondaryMassFlowRate_) << endl;
}
Info<< type() << ": " << name() << nl << incrIndent
<< indent << "Net mass flux [Kg/s] : " << sumPhi << nl
<< indent << "Total energy exchange [W] : " << Qt << nl
<< indent << "Tref [K] : " << Tref << nl
<< indent << "Effectiveness : "
<< eTable_()(mag(sumPhi), secondaryMassFlowRate_) << decrIndent
<< nl << endl;
}

View File

@ -7,6 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
restore0Dir
runApplication blockMesh
runApplication $(getApplication) -withFunctionObjects -writePhi -writep
runApplication streamFunction
runApplication postProcess -func streamFunction
#------------------------------------------------------------------------------

View File

@ -15,7 +15,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application rhpPimpleFoam;
application rhoPimpleFoam;
startFrom startTime;

View File

@ -29,34 +29,10 @@ addLayers false;
// - to 'snap' the mesh boundary to the surface
geometry
{
bottomAir.stl
geom.stl
{
type triSurfaceMesh;
name bottomAir;
}
topAir.stl
{
type triSurfaceMesh;
name topAir;
}
leftSolid.stl
{
type triSurfaceMesh;
name leftSolid;
}
rightSolid.stl
{
type triSurfaceMesh;
name rightSolid;
}
heater.stl
{
type triSurfaceMesh;
name heater;
name geom;
}
};
@ -103,23 +79,7 @@ castellatedMeshControls
features
(
{
file "bottomAir.eMesh";
level 1;
}
{
file "heater.eMesh";
level 1;
}
{
file "leftSolid.eMesh";
level 1;
}
{
file "rightSolid.eMesh";
level 1;
}
{
file "topAir.eMesh";
file "geom.extendedFeatureEdgeMesh"; //"geom.eMesh";
level 1;
}
);
@ -137,54 +97,10 @@ castellatedMeshControls
refinementSurfaces
{
bottomAir
geom
{
// Surface-wise min and max refinement level
level (1 1);
faceZone bottomAir;
cellZone bottomAir;
cellZoneInside inside;
}
topAir
{
// Surface-wise min and max refinement level
level (1 1);
faceZone topAir;
cellZone topAir;
cellZoneInside inside;
}
heater
{
// Surface-wise min and max refinement level
level (0 0);
faceZone heater;
cellZone heater;
cellZoneInside inside;
}
leftSolid
{
// Surface-wise min and max refinement level
level (1 1);
faceZone leftSolid;
cellZone leftSolid;
cellZoneInside inside;
}
rightSolid
{
// Surface-wise min and max refinement level
level (1 1);
faceZone rightSolid;
cellZone rightSolid;
cellZoneInside inside;
}
}
@ -223,7 +139,14 @@ castellatedMeshControls
// section reachable from the locationInMesh is kept.
// NOTE: This point should never be on a face, always inside a cell, even
// after refinement.
locationInMesh (0.01 0.01 0.01);
locationsInMesh
(
(( 0.005 0.005 0.005) heater)
(( 0.05 0.005 0.005) rightSolid)
((-0.05 0.005 0.005) leftSolid)
((-0.05 0.015 0.005) topAir)
((-0.05 -0.015 0.005) bottomAir)
);
// Whether any faceZones (as specified in the refinementSurfaces)

View File

@ -14,71 +14,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bottomAir.stl
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
heater.stl
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
leftSolid.stl
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
rightSolid.stl
{
extractionMethod extractFromSurface;
extractFromSurfaceCoeffs
{
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 150;
}
// Write options
writeFeatureEdgeMesh yes;
}
topAir.stl
geom.stl
{
extractionMethod extractFromSurface;
@ -93,6 +29,8 @@ topAir.stl
// Write options
writeFeatureEdgeMesh yes;
// Write features to obj format for postprocessing
writeObj yes;
}

View File

@ -48,7 +48,7 @@ Executing $Script is equivalent to
wmake -all [OPTIONS]
With these additional options:
-l | -log
-l | -log | -log=name
USAGE
@ -78,7 +78,12 @@ do
fromWmake=true
;;
-l | -log)
optLog=true
optLog="log.Allwmake"
continue # Permanently remove arg
;;
-log=*)
optLog="${arg##*=}"
[ -n "$optLog" ] || optLog="log.Allwmake"
continue # Permanently remove arg
;;
-q | -queue)
@ -106,8 +111,8 @@ then
then
exec wmake -all $optQueue $*
else
echo "logging wmake -all output to 'log.Allwmake'" 1>&2
exec wmake -all $optQueue $* 2>&1 | tee log.Allwmake
echo "logging wmake -all output to '$optLog'" 1>&2
exec wmake -all $optQueue $* 2>&1 | tee $optLog
fi
fi