mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
@ -48,7 +48,6 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "PstreamReduceOps.H"
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyTopoChange.H"
|
#include "polyTopoChange.H"
|
||||||
@ -62,6 +61,7 @@ Description
|
|||||||
#include "motionSmoother.H"
|
#include "motionSmoother.H"
|
||||||
#include "topoSet.H"
|
#include "topoSet.H"
|
||||||
#include "processorMeshes.H"
|
#include "processorMeshes.H"
|
||||||
|
#include "PstreamReduceOps.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
|
|||||||
@ -42,15 +42,6 @@ case ThirdParty:
|
|||||||
case Gcc48:
|
case Gcc48:
|
||||||
set gcc_version=gcc-4.8.5
|
set gcc_version=gcc-4.8.5
|
||||||
breaksw
|
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:
|
case Gcc49:
|
||||||
set gcc_version=gcc-4.9.3
|
set gcc_version=gcc-4.9.3
|
||||||
breaksw
|
breaksw
|
||||||
@ -69,6 +60,9 @@ case ThirdParty:
|
|||||||
case Gcc61:
|
case Gcc61:
|
||||||
set gcc_version=gcc-6.1.0
|
set gcc_version=gcc-6.1.0
|
||||||
breaksw
|
breaksw
|
||||||
|
case Gcc62:
|
||||||
|
set gcc_version=gcc-6.2.0
|
||||||
|
breaksw
|
||||||
case Clang:
|
case Clang:
|
||||||
set clang_version=llvm-3.7.0
|
set clang_version=llvm-3.7.0
|
||||||
# set clang_version=llvm-3.8.0
|
# set clang_version=llvm-3.8.0
|
||||||
|
|||||||
@ -53,15 +53,15 @@ ThirdParty)
|
|||||||
Gcc53)
|
Gcc53)
|
||||||
gcc_version=gcc-5.3.0
|
gcc_version=gcc-5.3.0
|
||||||
;;
|
;;
|
||||||
Gcc61)
|
|
||||||
gcc_version=gcc-6.1.0
|
|
||||||
;;
|
|
||||||
Gcc54)
|
Gcc54)
|
||||||
gcc_version=gcc-5.4.0
|
gcc_version=gcc-5.4.0
|
||||||
;;
|
;;
|
||||||
Gcc61)
|
Gcc61)
|
||||||
gcc_version=gcc-6.1.0
|
gcc_version=gcc-6.1.0
|
||||||
;;
|
;;
|
||||||
|
Gcc62)
|
||||||
|
gcc_version=gcc-6.2.0
|
||||||
|
;;
|
||||||
Clang)
|
Clang)
|
||||||
clang_version=llvm-3.7.0
|
clang_version=llvm-3.7.0
|
||||||
# clang_version=llvm-3.8.0
|
# clang_version=llvm-3.8.0
|
||||||
|
|||||||
@ -62,6 +62,15 @@ OptimisationSwitches
|
|||||||
floatTransfer 0;
|
floatTransfer 0;
|
||||||
nProcsSimpleSum 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)
|
// Force dumping (at next timestep) upon signal (-1 to disable)
|
||||||
writeNowSignal -1; // 10;
|
writeNowSignal -1; // 10;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# 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' | \
|
setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | \
|
||||||
sed 's%/'$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 $HOME/$WM_PROJECT
|
||||||
# setenv FOAM_INST_DIR ~$WM_PROJECT
|
# setenv FOAM_INST_DIR ~$WM_PROJECT
|
||||||
# setenv FOAM_INST_DIR /opt/$WM_PROJECT
|
# setenv FOAM_INST_DIR /opt/$WM_PROJECT
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,6 +55,37 @@ class Pstream
|
|||||||
:
|
:
|
||||||
public UPstream
|
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:
|
protected:
|
||||||
|
|
||||||
@ -63,6 +94,7 @@ protected:
|
|||||||
//- Transfer buffer
|
//- Transfer buffer
|
||||||
DynamicList<char> buf_;
|
DynamicList<char> buf_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Declare name of the class and its debug switch
|
// Declare name of the class and its debug switch
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -32,7 +32,6 @@ Description
|
|||||||
#ifndef PstreamReduceOps_H
|
#ifndef PstreamReduceOps_H
|
||||||
#define PstreamReduceOps_H
|
#define PstreamReduceOps_H
|
||||||
|
|
||||||
#include "Pstream.H"
|
|
||||||
#include "ops.H"
|
#include "ops.H"
|
||||||
#include "vector2D.H"
|
#include "vector2D.H"
|
||||||
|
|
||||||
|
|||||||
@ -464,4 +464,16 @@ registerOptSwitch
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
int Foam::UPstream::maxCommsSize
|
||||||
|
(
|
||||||
|
Foam::debug::optimisationSwitch("maxCommsSize", 0)
|
||||||
|
);
|
||||||
|
registerOptSwitch
|
||||||
|
(
|
||||||
|
"maxCommsSize",
|
||||||
|
int,
|
||||||
|
Foam::UPstream::maxCommsSize
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -269,6 +269,9 @@ public:
|
|||||||
//- Number of polling cycles in processor updates
|
//- Number of polling cycles in processor updates
|
||||||
static int nPollProcInterfaces;
|
static int nPollProcInterfaces;
|
||||||
|
|
||||||
|
//- Optional maximum message size (bytes)
|
||||||
|
static int maxCommsSize;
|
||||||
|
|
||||||
//- Default communicator (all processors)
|
//- Default communicator (all processors)
|
||||||
static label worldComm;
|
static label worldComm;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,11 +28,157 @@ Description
|
|||||||
|
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
#include "contiguous.H"
|
#include "contiguous.H"
|
||||||
#include "PstreamCombineReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "UPstream.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Container, class T>
|
||||||
|
void Foam::Pstream::exchangeContainer
|
||||||
|
(
|
||||||
|
const UList<Container>& sendBufs,
|
||||||
|
const labelUList& recvSizes,
|
||||||
|
List<Container>& 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,
|
||||||
|
reinterpret_cast<char*>(recvBufs[proci].begin()),
|
||||||
|
recvSizes[proci]*sizeof(T),
|
||||||
|
tag,
|
||||||
|
comm
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set up sends
|
||||||
|
// ~~~~~~~~~~~~
|
||||||
|
|
||||||
|
forAll(sendBufs, proci)
|
||||||
|
{
|
||||||
|
if (proci != Pstream::myProcNo(comm) && sendBufs[proci].size() > 0)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!UOPstream::write
|
||||||
|
(
|
||||||
|
UPstream::nonBlocking,
|
||||||
|
proci,
|
||||||
|
reinterpret_cast<const char*>(sendBufs[proci].begin()),
|
||||||
|
sendBufs[proci].size()*sizeof(T),
|
||||||
|
tag,
|
||||||
|
comm
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Cannot send outgoing message. "
|
||||||
|
<< "to:" << proci << " nBytes:"
|
||||||
|
<< label(sendBufs[proci].size()*sizeof(T))
|
||||||
|
<< Foam::abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Wait for all to finish
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
|
Pstream::waitRequests(startOfRequests);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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>
|
template<class Container, class T>
|
||||||
void Foam::Pstream::exchange
|
void Foam::Pstream::exchange
|
||||||
(
|
(
|
||||||
@ -63,11 +209,7 @@ void Foam::Pstream::exchange
|
|||||||
|
|
||||||
if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
|
if (UPstream::parRun() && UPstream::nProcs(comm) > 1)
|
||||||
{
|
{
|
||||||
label startOfRequests = Pstream::nRequests();
|
// Presize all receive buffers
|
||||||
|
|
||||||
// Set up receives
|
|
||||||
// ~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
forAll(recvSizes, proci)
|
forAll(recvSizes, proci)
|
||||||
{
|
{
|
||||||
label nRecv = recvSizes[proci];
|
label nRecv = recvSizes[proci];
|
||||||
@ -75,55 +217,121 @@ void Foam::Pstream::exchange
|
|||||||
if (proci != Pstream::myProcNo(comm) && nRecv > 0)
|
if (proci != Pstream::myProcNo(comm) && nRecv > 0)
|
||||||
{
|
{
|
||||||
recvBufs[proci].setSize(nRecv);
|
recvBufs[proci].setSize(nRecv);
|
||||||
UIPstream::read
|
|
||||||
(
|
|
||||||
UPstream::nonBlocking,
|
|
||||||
proci,
|
|
||||||
reinterpret_cast<char*>(recvBufs[proci].begin()),
|
|
||||||
nRecv*sizeof(T),
|
|
||||||
tag,
|
|
||||||
comm
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Pstream::maxCommsSize <= 0)
|
||||||
// Set up sends
|
|
||||||
// ~~~~~~~~~~~~
|
|
||||||
|
|
||||||
forAll(sendBufs, proci)
|
|
||||||
{
|
{
|
||||||
if (proci != Pstream::myProcNo(comm) && sendBufs[proci].size() > 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
|
if (proci != Pstream::myProcNo(comm))
|
||||||
(
|
|
||||||
!UOPstream::write
|
|
||||||
(
|
|
||||||
UPstream::nonBlocking,
|
|
||||||
proci,
|
|
||||||
reinterpret_cast<const char*>(sendBufs[proci].begin()),
|
|
||||||
sendBufs[proci].size()*sizeof(T),
|
|
||||||
tag,
|
|
||||||
comm
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
maxNSend = max(maxNSend, sendBufs[proci].size());
|
||||||
<< "Cannot send outgoing message. "
|
|
||||||
<< "to:" << proci << " nBytes:"
|
|
||||||
<< label(sendBufs[proci].size()*sizeof(T))
|
|
||||||
<< Foam::abort(FatalError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
// Wait for all to finish
|
List<const char*> charSendBufs(sendBufs.size());
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
List<char*> charRecvBufs(sendBufs.size());
|
||||||
|
|
||||||
if (block)
|
labelList nRecv(sendBufs.size());
|
||||||
{
|
labelList startRecv(sendBufs.size(), 0);
|
||||||
Pstream::waitRequests(startOfRequests);
|
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];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -439,7 +439,7 @@ void Foam::Time::readModifiedObjects()
|
|||||||
|
|
||||||
bool Foam::Time::writeTimeDict() const
|
bool Foam::Time::writeTimeDict() const
|
||||||
{
|
{
|
||||||
addProfiling(writing, "objectRegistry::writeObject");
|
addProfiling(writing, "objectRegistry::writeObject");
|
||||||
|
|
||||||
const word tmName(timeName());
|
const word tmName(timeName());
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "dynamicCode.H"
|
#include "dynamicCode.H"
|
||||||
#include "dynamicCodeContext.H"
|
#include "dynamicCodeContext.H"
|
||||||
#include "dlLibraryTable.H"
|
#include "dlLibraryTable.H"
|
||||||
|
#include "Pstream.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "Ostream.H"
|
#include "Ostream.H"
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "UPstream.H"
|
#include "Pstream.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "UPstream.H"
|
#include "Pstream.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "PstreamGlobals.H"
|
#include "PstreamGlobals.H"
|
||||||
|
|||||||
@ -2,6 +2,7 @@ fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
|
|||||||
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C
|
fvMotionSolvers/displacement/surfaceAlignedSBRStress/surfaceAlignedSBRStressFvMotionSolver.C
|
||||||
|
fvMotionSolvers/displacement/solidBodyDisplacementLaplacian/solidBodyDisplacementLaplacianFvMotionSolver.C
|
||||||
|
|
||||||
fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
|
fvMotionSolvers/componentDisplacement/componentLaplacian/displacementComponentLaplacianFvMotionSolver.C
|
||||||
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
||||||
|
|||||||
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -227,8 +227,8 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
|||||||
reduce(sumMagPhi, sumOp<scalar>());
|
reduce(sumMagPhi, sumOp<scalar>());
|
||||||
reduce(primaryInletTfMean, sumOp<scalar>());
|
reduce(primaryInletTfMean, sumOp<scalar>());
|
||||||
|
|
||||||
primaryInletTfMean /= sumMagPhi;
|
primaryInletTfMean /= sumMagPhi + ROOTVSMALL;
|
||||||
CpfMean /= sumMagPhi;
|
CpfMean /= sumMagPhi + ROOTVSMALL;
|
||||||
|
|
||||||
scalar primaryInletT = primaryInletT_;
|
scalar primaryInletT = primaryInletT_;
|
||||||
if (!userPrimaryInletT_)
|
if (!userPrimaryInletT_)
|
||||||
@ -285,18 +285,18 @@ void Foam::fv::effectivenessHeatExchangerSource::addSup
|
|||||||
{
|
{
|
||||||
label celli = cells_[i];
|
label celli = cells_[i];
|
||||||
heSource[celli] -=
|
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<< type() << ": " << name() << nl << incrIndent
|
||||||
{
|
<< indent << "Net mass flux [Kg/s] : " << sumPhi << nl
|
||||||
Info<< indent << "Net mass flux [Kg/s] : " << sumPhi << nl;
|
<< indent << "Total energy exchange [W] : " << Qt << nl
|
||||||
Info<< indent << "Total energy exchange [W] : " << Qt << nl;
|
<< indent << "Tref [K] : " << Tref << nl
|
||||||
Info<< indent << "Tref [K] : " << Tref << nl;
|
<< indent << "Effectiveness : "
|
||||||
Info<< indent << "Efficiency : "
|
<< eTable_()(mag(sumPhi), secondaryMassFlowRate_) << decrIndent
|
||||||
<< eTable_()(mag(sumPhi), secondaryMassFlowRate_) << endl;
|
<< nl << endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
restore0Dir
|
restore0Dir
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
runApplication $(getApplication) -withFunctionObjects -writePhi -writep
|
runApplication $(getApplication) -withFunctionObjects -writePhi -writep
|
||||||
runApplication streamFunction
|
runApplication postProcess -func streamFunction
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
application rhpPimpleFoam;
|
application rhoPimpleFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom startTime;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -29,34 +29,10 @@ addLayers false;
|
|||||||
// - to 'snap' the mesh boundary to the surface
|
// - to 'snap' the mesh boundary to the surface
|
||||||
geometry
|
geometry
|
||||||
{
|
{
|
||||||
bottomAir.stl
|
geom.stl
|
||||||
{
|
{
|
||||||
type triSurfaceMesh;
|
type triSurfaceMesh;
|
||||||
name bottomAir;
|
name geom;
|
||||||
}
|
|
||||||
|
|
||||||
topAir.stl
|
|
||||||
{
|
|
||||||
type triSurfaceMesh;
|
|
||||||
name topAir;
|
|
||||||
}
|
|
||||||
|
|
||||||
leftSolid.stl
|
|
||||||
{
|
|
||||||
type triSurfaceMesh;
|
|
||||||
name leftSolid;
|
|
||||||
}
|
|
||||||
|
|
||||||
rightSolid.stl
|
|
||||||
{
|
|
||||||
type triSurfaceMesh;
|
|
||||||
name rightSolid;
|
|
||||||
}
|
|
||||||
|
|
||||||
heater.stl
|
|
||||||
{
|
|
||||||
type triSurfaceMesh;
|
|
||||||
name heater;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -103,23 +79,7 @@ castellatedMeshControls
|
|||||||
features
|
features
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
file "bottomAir.eMesh";
|
file "geom.extendedFeatureEdgeMesh"; //"geom.eMesh";
|
||||||
level 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
file "heater.eMesh";
|
|
||||||
level 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
file "leftSolid.eMesh";
|
|
||||||
level 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
file "rightSolid.eMesh";
|
|
||||||
level 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
file "topAir.eMesh";
|
|
||||||
level 1;
|
level 1;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -137,54 +97,10 @@ castellatedMeshControls
|
|||||||
|
|
||||||
refinementSurfaces
|
refinementSurfaces
|
||||||
{
|
{
|
||||||
bottomAir
|
geom
|
||||||
{
|
{
|
||||||
// Surface-wise min and max refinement level
|
// Surface-wise min and max refinement level
|
||||||
level (1 1);
|
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.
|
// section reachable from the locationInMesh is kept.
|
||||||
// NOTE: This point should never be on a face, always inside a cell, even
|
// NOTE: This point should never be on a face, always inside a cell, even
|
||||||
// after refinement.
|
// 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)
|
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||||
|
|||||||
@ -14,71 +14,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bottomAir.stl
|
geom.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
|
|
||||||
{
|
{
|
||||||
extractionMethod extractFromSurface;
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
@ -93,6 +29,8 @@ topAir.stl
|
|||||||
|
|
||||||
// Write options
|
// Write options
|
||||||
writeFeatureEdgeMesh yes;
|
writeFeatureEdgeMesh yes;
|
||||||
|
// Write features to obj format for postprocessing
|
||||||
|
writeObj yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ Executing $Script is equivalent to
|
|||||||
wmake -all [OPTIONS]
|
wmake -all [OPTIONS]
|
||||||
|
|
||||||
With these additional options:
|
With these additional options:
|
||||||
-l | -log
|
-l | -log | -log=name
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
|
|
||||||
@ -78,7 +78,12 @@ do
|
|||||||
fromWmake=true
|
fromWmake=true
|
||||||
;;
|
;;
|
||||||
-l | -log)
|
-l | -log)
|
||||||
optLog=true
|
optLog="log.Allwmake"
|
||||||
|
continue # Permanently remove arg
|
||||||
|
;;
|
||||||
|
-log=*)
|
||||||
|
optLog="${arg##*=}"
|
||||||
|
[ -n "$optLog" ] || optLog="log.Allwmake"
|
||||||
continue # Permanently remove arg
|
continue # Permanently remove arg
|
||||||
;;
|
;;
|
||||||
-q | -queue)
|
-q | -queue)
|
||||||
@ -106,8 +111,8 @@ then
|
|||||||
then
|
then
|
||||||
exec wmake -all $optQueue $*
|
exec wmake -all $optQueue $*
|
||||||
else
|
else
|
||||||
echo "logging wmake -all output to 'log.Allwmake'" 1>&2
|
echo "logging wmake -all output to '$optLog'" 1>&2
|
||||||
exec wmake -all $optQueue $* 2>&1 | tee log.Allwmake
|
exec wmake -all $optQueue $* 2>&1 | tee $optLog
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user