mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -223,7 +223,7 @@ snapControls
|
|||||||
|
|
||||||
//- Highly experimental and wip: number of feature edge snapping
|
//- Highly experimental and wip: number of feature edge snapping
|
||||||
// iterations. Leave out altogether to disable.
|
// iterations. Leave out altogether to disable.
|
||||||
//nFeatureSnapIter 10;
|
//nFeatureSnapIter 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the layer addition.
|
// Settings for the layer addition.
|
||||||
|
|||||||
@ -193,7 +193,7 @@ Foam::label Foam::checkTopology
|
|||||||
if (nOneCells > 0)
|
if (nOneCells > 0)
|
||||||
{
|
{
|
||||||
Info<< " <<Writing " << nOneCells
|
Info<< " <<Writing " << nOneCells
|
||||||
<< " cells with with single non-boundary face to set "
|
<< " cells with with zero or one non-boundary face to set "
|
||||||
<< oneCells.name()
|
<< oneCells.name()
|
||||||
<< endl;
|
<< endl;
|
||||||
oneCells.instance() = mesh.pointsInstance();
|
oneCells.instance() = mesh.pointsInstance();
|
||||||
|
|||||||
@ -119,15 +119,18 @@ sets
|
|||||||
|
|
||||||
somePatchPoints
|
somePatchPoints
|
||||||
{
|
{
|
||||||
// Sample nearest points on selected patches. Use with
|
// Sample nearest points on selected patches. Looks only up to
|
||||||
// interpolations:
|
// maxDistance away. Any sampling point not found will get value
|
||||||
|
// pTraits<Type>::max (usually VGREAT)
|
||||||
|
// Use with interpolations:
|
||||||
// - cell (cell value)
|
// - cell (cell value)
|
||||||
// - cellPatchConstrained (boundary value)
|
// - cellPatchConstrained (boundary value)
|
||||||
// - cellPoint (interpolated boundary value)
|
// - cellPoint (interpolated boundary value)
|
||||||
type patchCloud;
|
type patchCloud;
|
||||||
axis xyz;
|
axis xyz;
|
||||||
points ((0.049 0.099 0.005)(0.051 0.054 0.005));
|
points ((0.049 0.099 0.005)(0.051 0.054 0.005));
|
||||||
patches (".*Wall.*");
|
maxDistance 0.1; // maximum distance to search
|
||||||
|
patches (".*Wall.*");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
52
bin/foamLog
Executable file → Normal file
52
bin/foamLog
Executable file → Normal file
@ -45,6 +45,7 @@ Usage: $Script [OPTIONS] <log>
|
|||||||
-list lists but does not extract
|
-list lists but does not extract
|
||||||
-n create single column files with the extracted data only
|
-n create single column files with the extracted data only
|
||||||
-quiet quiet operation
|
-quiet quiet operation
|
||||||
|
-localDB only use the local database file
|
||||||
-help print the usage
|
-help print the usage
|
||||||
|
|
||||||
$Script - extracts xy files from OpenFOAM logs.
|
$Script - extracts xy files from OpenFOAM logs.
|
||||||
@ -103,7 +104,7 @@ usage
|
|||||||
|
|
||||||
|
|
||||||
timeName=Time
|
timeName=Time
|
||||||
unset listOpt quietOpt
|
unset listOpt quietOpt localDB
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -125,6 +126,10 @@ do
|
|||||||
quietOpt=true
|
quietOpt=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-localDB)
|
||||||
|
localDB=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-*)
|
-*)
|
||||||
usage "unknown option: '$*'"
|
usage "unknown option: '$*'"
|
||||||
;;
|
;;
|
||||||
@ -219,7 +224,7 @@ getSolveQueryList()
|
|||||||
getAllQueries()
|
getAllQueries()
|
||||||
{
|
{
|
||||||
#-- All solved for queries from log file
|
#-- All solved for queries from log file
|
||||||
queries=`getSolveQueryList $2`
|
[ "$localDB" = true ] || queries=`getSolveQueryList $2`
|
||||||
|
|
||||||
#-- Add ones from database, present in log file
|
#-- Add ones from database, present in log file
|
||||||
# Note: just like awk, line selected with regular expression,
|
# Note: just like awk, line selected with regular expression,
|
||||||
@ -369,29 +374,30 @@ AWK_CONTENTS
|
|||||||
#
|
#
|
||||||
# Code for extracting solved for quantities
|
# Code for extracting solved for quantities
|
||||||
#
|
#
|
||||||
cat << AWK_CONTENTS >> $AWKFILE
|
[ "$localDB" = true ] ||
|
||||||
# Extraction of any solved for variable
|
cat << AWK_CONTENTS >> $AWKFILE
|
||||||
/Solving for/ {
|
# Extraction of any solved for variable
|
||||||
extract(\$0, "Solving for ", varNameVal)
|
/Solving for/ {
|
||||||
|
extract(\$0, "Solving for ", varNameVal)
|
||||||
|
|
||||||
varName=varNameVal[1]
|
varName=varNameVal[1]
|
||||||
file=varName "_" subIter[varName]++
|
file=varName "_" subIter[varName]++
|
||||||
file="$outputDir/" file
|
file="$outputDir/" file
|
||||||
extract(\$0, "Initial residual = ", val)
|
extract(\$0, "Initial residual = ", val)
|
||||||
print $timeName "\t" val[1] > file
|
print $timeName "\t" val[1] > file
|
||||||
|
|
||||||
varName=varNameVal[1] "FinalRes"
|
varName=varNameVal[1] "FinalRes"
|
||||||
file=varName "_" subIter[varName]++
|
file=varName "_" subIter[varName]++
|
||||||
file="$outputDir/" file
|
file="$outputDir/" file
|
||||||
extract(\$0, "Final residual = ", val)
|
extract(\$0, "Final residual = ", val)
|
||||||
print $timeName "\t" val[1] > file
|
print $timeName "\t" val[1] > file
|
||||||
|
|
||||||
varName=varNameVal[1] "Iters"
|
varName=varNameVal[1] "Iters"
|
||||||
file=varName "_" subIter[varName]++
|
file=varName "_" subIter[varName]++
|
||||||
file="$outputDir/" file
|
file="$outputDir/" file
|
||||||
extract(\$0, "No Iterations ", val)
|
extract(\$0, "No Iterations ", val)
|
||||||
print $timeName "\t" val[1] > file
|
print $timeName "\t" val[1] > file
|
||||||
}
|
}
|
||||||
|
|
||||||
AWK_CONTENTS
|
AWK_CONTENTS
|
||||||
# ----------
|
# ----------
|
||||||
@ -432,7 +438,7 @@ done
|
|||||||
# Print found
|
# Print found
|
||||||
#-----------------------------
|
#-----------------------------
|
||||||
myEcho "Generated XY files for:"
|
myEcho "Generated XY files for:"
|
||||||
getAllQueries $DBFILE $LOG
|
[ "$quietOpt" = true ] || getAllQueries $DBFILE $LOG
|
||||||
myEcho "End"
|
myEcho "End"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -98,47 +98,25 @@ bool Foam::fileStat::sameINode(const label iNode) const
|
|||||||
|
|
||||||
Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
|
Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
|
||||||
{
|
{
|
||||||
// Read beginning of machine info list
|
FixedList<label, 13> stat(is);
|
||||||
is.readBegin("fileStat");
|
|
||||||
|
|
||||||
label
|
fStat.isValid_ = stat[0];
|
||||||
devMaj, devMin,
|
|
||||||
ino, mode, uid, gid,
|
|
||||||
rdevMaj, rdevMin,
|
|
||||||
size, atime, mtime, ctime;
|
|
||||||
|
|
||||||
is >> fStat.isValid_
|
dev_t st_dev = makedev(stat[1], stat[2]);
|
||||||
>> devMaj
|
|
||||||
>> devMin
|
|
||||||
>> ino
|
|
||||||
>> mode
|
|
||||||
>> uid
|
|
||||||
>> gid
|
|
||||||
>> rdevMaj
|
|
||||||
>> rdevMin
|
|
||||||
>> size
|
|
||||||
>> atime
|
|
||||||
>> mtime
|
|
||||||
>> ctime;
|
|
||||||
|
|
||||||
dev_t st_dev = makedev(devMaj, devMin);
|
|
||||||
fStat.status_.st_dev = st_dev;
|
fStat.status_.st_dev = st_dev;
|
||||||
|
|
||||||
fStat.status_.st_ino = ino;
|
fStat.status_.st_ino = stat[3];
|
||||||
fStat.status_.st_mode = mode;
|
fStat.status_.st_mode = stat[4];
|
||||||
fStat.status_.st_uid = uid;
|
fStat.status_.st_uid = stat[5];
|
||||||
fStat.status_.st_gid = gid;
|
fStat.status_.st_gid = stat[6];
|
||||||
|
|
||||||
dev_t st_rdev = makedev(rdevMaj, rdevMin);
|
dev_t st_rdev = makedev(stat[7], stat[8]);
|
||||||
fStat.status_.st_rdev = st_rdev;
|
fStat.status_.st_rdev = st_rdev;
|
||||||
|
|
||||||
fStat.status_.st_size = size;
|
fStat.status_.st_size = stat[9];
|
||||||
fStat.status_.st_atime = atime;
|
fStat.status_.st_atime = stat[10];
|
||||||
fStat.status_.st_mtime = mtime;
|
fStat.status_.st_mtime = stat[11];
|
||||||
fStat.status_.st_ctime = ctime;
|
fStat.status_.st_ctime = stat[12];
|
||||||
|
|
||||||
// Read end of machine info list
|
|
||||||
is.readEnd("fileStat");
|
|
||||||
|
|
||||||
// Check state of Istream
|
// Check state of Istream
|
||||||
is.check("Istream& operator>>(Istream&, fileStat&)");
|
is.check("Istream& operator>>(Istream&, fileStat&)");
|
||||||
@ -149,28 +127,23 @@ Foam::Istream& Foam::operator>>(Istream& is, fileStat& fStat)
|
|||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const fileStat& fStat)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const fileStat& fStat)
|
||||||
{
|
{
|
||||||
// Set precision so 32bit unsigned int can be printed
|
FixedList<label, 13> stat;
|
||||||
// int oldPrecision = os.precision();
|
|
||||||
int oldPrecision = 0;
|
|
||||||
os.precision(10);
|
|
||||||
|
|
||||||
os << token::BEGIN_LIST << fStat.isValid_
|
stat[0] = label(fStat.isValid_);
|
||||||
<< token::SPACE << label(major(fStat.status_.st_dev))
|
stat[1] = label(major(fStat.status_.st_dev));
|
||||||
<< token::SPACE << label(minor(fStat.status_.st_dev))
|
stat[2] = label(minor(fStat.status_.st_dev));
|
||||||
<< token::SPACE << label(fStat.status_.st_ino)
|
stat[3] = label(fStat.status_.st_ino);
|
||||||
<< token::SPACE << label(fStat.status_.st_mode)
|
stat[4] = label(fStat.status_.st_mode);
|
||||||
<< token::SPACE << label(fStat.status_.st_uid)
|
stat[5] = label(fStat.status_.st_uid);
|
||||||
<< token::SPACE << label(fStat.status_.st_gid)
|
stat[6] = label(fStat.status_.st_gid);
|
||||||
<< token::SPACE << label(major(fStat.status_.st_rdev))
|
stat[7] = label(major(fStat.status_.st_rdev));
|
||||||
<< token::SPACE << label(minor(fStat.status_.st_rdev))
|
stat[8] = label(minor(fStat.status_.st_rdev));
|
||||||
<< token::SPACE << label(fStat.status_.st_size)
|
stat[9] = label(fStat.status_.st_size);
|
||||||
<< token::SPACE << label(fStat.status_.st_atime)
|
stat[10] = label(fStat.status_.st_atime);
|
||||||
<< token::SPACE << label(fStat.status_.st_mtime)
|
stat[11] = label(fStat.status_.st_mtime);
|
||||||
<< token::SPACE << label(fStat.status_.st_ctime)
|
stat[12] = label(fStat.status_.st_ctime);
|
||||||
<< token::END_LIST;
|
|
||||||
|
|
||||||
os.precision(oldPrecision);
|
return os << stat;
|
||||||
return os;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -60,12 +60,26 @@ void Foam::polyMesh::initMesh()
|
|||||||
|
|
||||||
forAll(owner_, facei)
|
forAll(owner_, facei)
|
||||||
{
|
{
|
||||||
|
if (owner_[facei] < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("polyMesh::initMesh()")
|
||||||
|
<< "Illegal cell label " << owner_[facei]
|
||||||
|
<< " in neighbour addressing for face " << facei
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
nCells = max(nCells, owner_[facei]);
|
nCells = max(nCells, owner_[facei]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The neighbour array may or may not be the same length as the owner
|
// The neighbour array may or may not be the same length as the owner
|
||||||
forAll(neighbour_, facei)
|
forAll(neighbour_, facei)
|
||||||
{
|
{
|
||||||
|
if (neighbour_[facei] < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("polyMesh::initMesh()")
|
||||||
|
<< "Illegal cell label " << neighbour_[facei]
|
||||||
|
<< " in neighbour addressing for face " << facei
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
nCells = max(nCells, neighbour_[facei]);
|
nCells = max(nCells, neighbour_[facei]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +127,14 @@ void Foam::polyMesh::initMesh(cellList& c)
|
|||||||
|
|
||||||
forAll(cellfaces, faceI)
|
forAll(cellfaces, faceI)
|
||||||
{
|
{
|
||||||
|
if (cellfaces[faceI] < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("polyMesh::initMesh(cellList&)")
|
||||||
|
<< "Illegal face label " << cellfaces[faceI]
|
||||||
|
<< " in cell " << cellI
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
if (!markedFaces[cellfaces[faceI]])
|
if (!markedFaces[cellfaces[faceI]])
|
||||||
{
|
{
|
||||||
// First visit: owner
|
// First visit: owner
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,9 +35,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
jumpCyclicFvPatchField<Type>(p, iF),
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
f_(0),
|
f_(0)
|
||||||
jump_(this->size(), 0.0)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -50,9 +49,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
const fvPatchFieldMapper& mapper
|
const fvPatchFieldMapper& mapper
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
|
fixedJumpFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
f_(ptf.f_),
|
f_(ptf.f_)
|
||||||
jump_(ptf.jump_, mapper)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -64,9 +62,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
jumpCyclicFvPatchField<Type>(p, iF),
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
f_(),
|
f_()
|
||||||
jump_(this->size(), 0.0)
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
Istream& is = dict.lookup("f");
|
Istream& is = dict.lookup("f");
|
||||||
@ -97,9 +94,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
cyclicLduInterfaceField(),
|
cyclicLduInterfaceField(),
|
||||||
jumpCyclicFvPatchField<Type>(ptf),
|
fixedJumpFvPatchField<Type>(ptf),
|
||||||
f_(ptf.f_),
|
f_(ptf.f_)
|
||||||
jump_(ptf.jump_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -110,45 +106,19 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
const DimensionedField<Type, volMesh>& iF
|
const DimensionedField<Type, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
jumpCyclicFvPatchField<Type>(ptf, iF),
|
fixedJumpFvPatchField<Type>(ptf, iF),
|
||||||
f_(ptf.f_),
|
f_(ptf.f_)
|
||||||
jump_(ptf.jump_)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fanFvPatchField<Type>::autoMap
|
|
||||||
(
|
|
||||||
const fvPatchFieldMapper& m
|
|
||||||
)
|
|
||||||
{
|
|
||||||
jumpCyclicFvPatchField<Type>::autoMap(m);
|
|
||||||
jump_.autoMap(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::fanFvPatchField<Type>::rmap
|
|
||||||
(
|
|
||||||
const fvPatchField<Type>& ptf,
|
|
||||||
const labelList& addr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
|
|
||||||
|
|
||||||
const fanFvPatchField<Type>& tiptf =
|
|
||||||
refCast<const fanFvPatchField<Type> >(ptf);
|
|
||||||
jump_.rmap(tiptf.jump_, addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
|
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchField<Type>::write(os);
|
|
||||||
os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
|
fixedJumpFvPatchField<Type>::write(os);
|
||||||
|
|
||||||
IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
|
IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
|
||||||
os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;
|
os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -35,7 +35,7 @@ SourceFiles
|
|||||||
#ifndef fanFvPatchField_H
|
#ifndef fanFvPatchField_H
|
||||||
#define fanFvPatchField_H
|
#define fanFvPatchField_H
|
||||||
|
|
||||||
#include "jumpCyclicFvPatchField.H"
|
#include "fixedJumpFvPatchField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -49,16 +49,13 @@ namespace Foam
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class fanFvPatchField
|
class fanFvPatchField
|
||||||
:
|
:
|
||||||
public jumpCyclicFvPatchField<Type>
|
public fixedJumpFvPatchField<Type>
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Fan pressure rise polynomial coefficients
|
//- Fan pressure rise polynomial coefficients
|
||||||
List<scalar> f_;
|
List<scalar> f_;
|
||||||
|
|
||||||
//- "jump" field
|
|
||||||
Field<Type> jump_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -137,37 +134,6 @@ public:
|
|||||||
return f_;
|
return f_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the "jump" across the patch.
|
|
||||||
virtual tmp<Field<Type> > jump() const
|
|
||||||
{
|
|
||||||
if (this->cyclicPatch().owner())
|
|
||||||
{
|
|
||||||
return jump_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return refCast<const fanFvPatchField<Type> >
|
|
||||||
(
|
|
||||||
this->neighbourPatchField()
|
|
||||||
).jump();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Mapping functions
|
|
||||||
|
|
||||||
//- Map (and resize as needed) from self given a mapping object
|
|
||||||
virtual void autoMap
|
|
||||||
(
|
|
||||||
const fvPatchFieldMapper&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Reverse map the given fvPatchField onto this fvPatchField
|
|
||||||
virtual void rmap
|
|
||||||
(
|
|
||||||
const fvPatchField<Type>&,
|
|
||||||
const labelList&
|
|
||||||
);
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,130 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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 "fixedJumpFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
jumpCyclicFvPatchField<Type>(p, iF),
|
||||||
|
jump_(this->size(), pTraits<Type>::zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
jump_(ptf.jump_, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
jumpCyclicFvPatchField<Type>(p, iF),
|
||||||
|
jump_("jump", dict, p.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicLduInterfaceField(),
|
||||||
|
jumpCyclicFvPatchField<Type>(ptf),
|
||||||
|
jump_(ptf.jump_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
jumpCyclicFvPatchField<Type>(ptf, iF),
|
||||||
|
jump_(ptf.jump_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fixedJumpFvPatchField<Type>::autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
jumpCyclicFvPatchField<Type>::autoMap(m);
|
||||||
|
jump_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fixedJumpFvPatchField<Type>::rmap
|
||||||
|
(
|
||||||
|
const fvPatchField<Type>& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
|
||||||
|
|
||||||
|
const fixedJumpFvPatchField<Type>& tiptf =
|
||||||
|
refCast<const fixedJumpFvPatchField<Type> >(ptf);
|
||||||
|
jump_.rmap(tiptf.jump_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
|
||||||
|
jump_.writeEntry("jump", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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::fixedJumpFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Base class for "jump" of a field<type>
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fixedJumpFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedJumpFvPatchField_H
|
||||||
|
#define fixedJumpFvPatchField_H
|
||||||
|
|
||||||
|
#include "jumpCyclicFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fixedJumpFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class fixedJumpFvPatchField
|
||||||
|
:
|
||||||
|
public jumpCyclicFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- "jump" field
|
||||||
|
Field<Type> jump_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given fixedJumpFvPatchField onto a
|
||||||
|
// new patch
|
||||||
|
fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedJumpFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
fixedJumpFvPatchField
|
||||||
|
(
|
||||||
|
const fixedJumpFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new fixedJumpFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return the "jump" across the patch.
|
||||||
|
virtual tmp<Field<Type> > jump() const
|
||||||
|
{
|
||||||
|
if (this->cyclicPatch().owner())
|
||||||
|
{
|
||||||
|
return jump_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return refCast<const fixedJumpFvPatchField<Type> >
|
||||||
|
(
|
||||||
|
this->neighbourPatchField()
|
||||||
|
).jump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
virtual void autoMap
|
||||||
|
(
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse map the given fvPatchField onto this fvPatchField
|
||||||
|
virtual void rmap
|
||||||
|
(
|
||||||
|
const fvPatchField<Type>&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "fixedJumpFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -153,240 +153,6 @@ Foam::labelList Foam::decompositionMethod::decompose
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Return the minimum face between two cells. Only relevant for
|
|
||||||
// cells with multiple faces inbetween.
|
|
||||||
Foam::label Foam::decompositionMethod::masterFace
|
|
||||||
(
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const label own,
|
|
||||||
const label nei
|
|
||||||
)
|
|
||||||
{
|
|
||||||
label minFaceI = labelMax;
|
|
||||||
|
|
||||||
// Count multiple faces between own and nei only once
|
|
||||||
const cell& ownFaces = mesh.cells()[own];
|
|
||||||
forAll(ownFaces, i)
|
|
||||||
{
|
|
||||||
label otherFaceI = ownFaces[i];
|
|
||||||
|
|
||||||
if (mesh.isInternalFace(otherFaceI))
|
|
||||||
{
|
|
||||||
label nbrCellI =
|
|
||||||
(
|
|
||||||
mesh.faceNeighbour()[otherFaceI] != own
|
|
||||||
? mesh.faceNeighbour()[otherFaceI]
|
|
||||||
: mesh.faceOwner()[otherFaceI]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (nbrCellI == nei)
|
|
||||||
{
|
|
||||||
minFaceI = min(minFaceI, otherFaceI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return minFaceI;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//void Foam::decompositionMethod::calcCSR
|
|
||||||
//(
|
|
||||||
// const polyMesh& mesh,
|
|
||||||
// List<int>& adjncy,
|
|
||||||
// List<int>& xadj
|
|
||||||
//)
|
|
||||||
//{
|
|
||||||
// const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
|
||||||
//
|
|
||||||
// // Make Metis CSR (Compressed Storage Format) storage
|
|
||||||
// // adjncy : contains neighbours (= edges in graph)
|
|
||||||
// // xadj(celli) : start of information in adjncy for celli
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Count unique faces between cells
|
|
||||||
// // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
//
|
|
||||||
// labelList nFacesPerCell(mesh.nCells(), 0);
|
|
||||||
//
|
|
||||||
// // Internal faces
|
|
||||||
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
|
||||||
// {
|
|
||||||
// label own = mesh.faceOwner()[faceI];
|
|
||||||
// label nei = mesh.faceNeighbour()[faceI];
|
|
||||||
//
|
|
||||||
// if (faceI == masterFace(mesh, own, nei))
|
|
||||||
// {
|
|
||||||
// nFacesPerCell[own]++;
|
|
||||||
// nFacesPerCell[nei]++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Coupled faces. Only cyclics done.
|
|
||||||
// HashSet<edge, Hash<edge> > cellPair(mesh.nFaces()-mesh.nInternalFaces());
|
|
||||||
//
|
|
||||||
// forAll(pbm, patchI)
|
|
||||||
// {
|
|
||||||
// if
|
|
||||||
// (
|
|
||||||
// isA<cyclicPolyPatch>(pbm[patchI])
|
|
||||||
// && refCast<const cyclicPolyPatch>(pbm[patchI]).owner()
|
|
||||||
// )
|
|
||||||
// {
|
|
||||||
// const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>
|
|
||||||
// (
|
|
||||||
// pbm[patchI]
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// const labelUList& faceCells = cycPatch.faceCells();
|
|
||||||
// const labelUList& nbrCells =
|
|
||||||
// cycPatch.neighbPatch().faceCells();
|
|
||||||
//
|
|
||||||
// forAll(faceCells, facei)
|
|
||||||
// {
|
|
||||||
// label own = faceCells[facei];
|
|
||||||
// label nei = nbrCells[facei];
|
|
||||||
//
|
|
||||||
// if (cellPair.insert(edge(own, nei)))
|
|
||||||
// {
|
|
||||||
// nFacesPerCell[own]++;
|
|
||||||
// nFacesPerCell[nei]++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Size tables
|
|
||||||
// // ~~~~~~~~~~~
|
|
||||||
//
|
|
||||||
// // Sum nFacesPerCell
|
|
||||||
// xadj.setSize(mesh.nCells()+1);
|
|
||||||
//
|
|
||||||
// label nConnections = 0;
|
|
||||||
//
|
|
||||||
// for (label cellI = 0; cellI < mesh.nCells(); cellI++)
|
|
||||||
// {
|
|
||||||
// xadj[cellI] = nConnections;
|
|
||||||
// nConnections += nFacesPerCell[cellI];
|
|
||||||
// }
|
|
||||||
// xadj[mesh.nCells()] = nConnections;
|
|
||||||
// adjncy.setSize(nConnections);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Fill tables
|
|
||||||
// // ~~~~~~~~~~~
|
|
||||||
//
|
|
||||||
// nFacesPerCell = 0;
|
|
||||||
//
|
|
||||||
// // Internal faces
|
|
||||||
// for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
|
||||||
// {
|
|
||||||
// label own = mesh.faceOwner()[faceI];
|
|
||||||
// label nei = mesh.faceNeighbour()[faceI];
|
|
||||||
//
|
|
||||||
// if (faceI == masterFace(mesh, own, nei))
|
|
||||||
// {
|
|
||||||
// adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
|
||||||
// adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Coupled faces. Only cyclics done.
|
|
||||||
// cellPair.clear();
|
|
||||||
// forAll(pbm, patchI)
|
|
||||||
// {
|
|
||||||
// if
|
|
||||||
// (
|
|
||||||
// isA<cyclicPolyPatch>(pbm[patchI])
|
|
||||||
// && refCast<const cyclicPolyPatch>(pbm[patchI]).owner()
|
|
||||||
// )
|
|
||||||
// {
|
|
||||||
// const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>
|
|
||||||
// (
|
|
||||||
// pbm[patchI]
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// const labelUList& faceCells = cycPatch.faceCells();
|
|
||||||
// const labelUList& nbrCells =
|
|
||||||
// cycPatch.neighbPatch().faceCells();
|
|
||||||
//
|
|
||||||
// forAll(faceCells, facei)
|
|
||||||
// {
|
|
||||||
// label own = faceCells[facei];
|
|
||||||
// label nei = nbrCells[facei];
|
|
||||||
//
|
|
||||||
// if (cellPair.insert(edge(own, nei)))
|
|
||||||
// {
|
|
||||||
// adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
|
|
||||||
// adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//// From cell-cell connections to Metis format (like CompactListList)
|
|
||||||
//void Foam::decompositionMethod::calcCSR
|
|
||||||
//(
|
|
||||||
// const labelListList& cellCells,
|
|
||||||
// List<int>& adjncy,
|
|
||||||
// List<int>& xadj
|
|
||||||
//)
|
|
||||||
//{
|
|
||||||
// labelHashSet nbrCells;
|
|
||||||
//
|
|
||||||
// // Count number of internal faces
|
|
||||||
// label nConnections = 0;
|
|
||||||
//
|
|
||||||
// forAll(cellCells, coarseI)
|
|
||||||
// {
|
|
||||||
// nbrCells.clear();
|
|
||||||
//
|
|
||||||
// const labelList& cCells = cellCells[coarseI];
|
|
||||||
//
|
|
||||||
// forAll(cCells, i)
|
|
||||||
// {
|
|
||||||
// if (nbrCells.insert(cCells[i]))
|
|
||||||
// {
|
|
||||||
// nConnections++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Create the adjncy array as twice the size of the total number of
|
|
||||||
// // internal faces
|
|
||||||
// adjncy.setSize(nConnections);
|
|
||||||
//
|
|
||||||
// xadj.setSize(cellCells.size()+1);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // Fill in xadj
|
|
||||||
// // ~~~~~~~~~~~~
|
|
||||||
// label freeAdj = 0;
|
|
||||||
//
|
|
||||||
// forAll(cellCells, coarseI)
|
|
||||||
// {
|
|
||||||
// xadj[coarseI] = freeAdj;
|
|
||||||
//
|
|
||||||
// nbrCells.clear();
|
|
||||||
//
|
|
||||||
// const labelList& cCells = cellCells[coarseI];
|
|
||||||
//
|
|
||||||
// forAll(cCells, i)
|
|
||||||
// {
|
|
||||||
// if (nbrCells.insert(cCells[i]))
|
|
||||||
// {
|
|
||||||
// adjncy[freeAdj++] = cCells[i];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// xadj[cellCells.size()] = freeAdj;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::decompositionMethod::calcCellCells
|
void Foam::decompositionMethod::calcCellCells
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -395,25 +161,17 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create global cell numbers
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
label nAgglom;
|
|
||||||
if (agglom.size())
|
|
||||||
{
|
|
||||||
nAgglom = max(agglom)+1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nAgglom = 0;
|
|
||||||
}
|
|
||||||
globalIndex globalAgglom(nAgglom);
|
|
||||||
|
|
||||||
const labelList& faceOwner = mesh.faceOwner();
|
const labelList& faceOwner = mesh.faceOwner();
|
||||||
const labelList& faceNeighbour = mesh.faceNeighbour();
|
const labelList& faceNeighbour = mesh.faceNeighbour();
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
|
|
||||||
|
// Create global cell numbers
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
globalIndex globalAgglom(nCoarse);
|
||||||
|
|
||||||
|
|
||||||
// Get agglomerate owner on other side of coupled faces
|
// Get agglomerate owner on other side of coupled faces
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -445,6 +203,77 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
syncTools::swapBoundaryFaceList(mesh, globalNeighbour);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//// Determine the cellCells (in agglomeration numbering) on coupled faces
|
||||||
|
//// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
//
|
||||||
|
//labelListList globalCellCells(mesh.nFaces()-mesh.nInternalFaces());
|
||||||
|
//
|
||||||
|
//// Current set of face neighbours for the current cell
|
||||||
|
//labelHashSet cCells;
|
||||||
|
//
|
||||||
|
//forAll(patches, patchI)
|
||||||
|
//{
|
||||||
|
// const polyPatch& pp = patches[patchI];
|
||||||
|
//
|
||||||
|
// if (pp.coupled())
|
||||||
|
// {
|
||||||
|
// label faceI = pp.start();
|
||||||
|
// label bFaceI = pp.start() - mesh.nInternalFaces();
|
||||||
|
//
|
||||||
|
// forAll(pp, i)
|
||||||
|
// {
|
||||||
|
// label cellI = faceOwner[faceI];
|
||||||
|
// label globalCellI = globalAgglom.toGlobal(agglom[cellI]);
|
||||||
|
//
|
||||||
|
// // First check if agglomerated across coupled patches at all
|
||||||
|
// // so we don't use memory if not needed
|
||||||
|
// if (globalNeighbour[bFaceI] == globalCellI)
|
||||||
|
// {
|
||||||
|
// cCells.clear();
|
||||||
|
//
|
||||||
|
// const cell& cFaces = mesh.cells()[cellI];
|
||||||
|
//
|
||||||
|
// forAll(cFaces, i)
|
||||||
|
// {
|
||||||
|
// if (mesh.isInternalFace(cFaces[i]))
|
||||||
|
// {
|
||||||
|
// label otherCellI = faceOwner[cFaces[i]];
|
||||||
|
// if (otherCellI == cellI)
|
||||||
|
// {
|
||||||
|
// otherCellI = faceNeighbour[cFaces[i]];
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// cCells.insert
|
||||||
|
// (
|
||||||
|
// globalAgglom.toGlobal
|
||||||
|
// (
|
||||||
|
// agglom[otherCellI]
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// globalCellCells[bFaceI] = cCells.toc();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// bFaceI++;
|
||||||
|
// faceI++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//// Get the cell on the other side of coupled patches
|
||||||
|
//syncTools::syncBoundaryFaceList
|
||||||
|
//(
|
||||||
|
// mesh,
|
||||||
|
// globalCellCells,
|
||||||
|
// eqOp<labelList>(),
|
||||||
|
// dummyTransform()
|
||||||
|
//);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Count number of faces (internal + coupled)
|
// Count number of faces (internal + coupled)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -460,14 +289,6 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
nFacesPerCell[nei]++;
|
nFacesPerCell[nei]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle coupled faces. In case of agglomeration you might end up
|
|
||||||
// with multiple connections ('faces') between the same two agglomerations.
|
|
||||||
// This is illegal so mark.
|
|
||||||
HashSet<labelPair, Hash<labelPair> > cellPair
|
|
||||||
(
|
|
||||||
mesh.nFaces()-mesh.nInternalFaces()
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
@ -480,15 +301,29 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
label own = agglom[faceOwner[faceI]];
|
label own = agglom[faceOwner[faceI]];
|
||||||
|
|
||||||
|
//const labelList& cCells = globalCellCells[bFaceI];
|
||||||
|
//
|
||||||
|
//forAll(cCells, i)
|
||||||
|
//{
|
||||||
|
// label globalNei = cCells[i];
|
||||||
|
//
|
||||||
|
// // Allow only processor-local agglomeration
|
||||||
|
// if (globalAgglom.isLocal(globalNei))
|
||||||
|
// {
|
||||||
|
// nFacesPerCell[own]++;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
label globalNei = globalNeighbour[bFaceI];
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
globalAgglom.toGlobal(own) != globalNei
|
globalAgglom.isLocal(globalNei)
|
||||||
&& cellPair.insert(labelPair(own, globalNei))
|
&& globalAgglom.toLocal(globalNei) != own
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
nFacesPerCell[own]++;
|
nFacesPerCell[own]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
faceI++;
|
faceI++;
|
||||||
bFaceI++;
|
bFaceI++;
|
||||||
}
|
}
|
||||||
@ -517,7 +352,6 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For boundary faces is offsetted coupled neighbour
|
// For boundary faces is offsetted coupled neighbour
|
||||||
cellPair.clear();
|
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchI];
|
const polyPatch& pp = patches[patchI];
|
||||||
@ -530,11 +364,29 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
forAll(pp, i)
|
forAll(pp, i)
|
||||||
{
|
{
|
||||||
label own = agglom[faceOwner[faceI]];
|
label own = agglom[faceOwner[faceI]];
|
||||||
|
|
||||||
|
//const labelList& cCells = globalCellCells[bFaceI];
|
||||||
|
//
|
||||||
|
//forAll(cCells, i)
|
||||||
|
//{
|
||||||
|
// label globalNei = cCells[i];
|
||||||
|
//
|
||||||
|
// // Allow only processor-local agglomeration
|
||||||
|
// if (globalAgglom.isLocal(globalNei))
|
||||||
|
// {
|
||||||
|
// m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
label globalNei = globalNeighbour[bFaceI];
|
label globalNei = globalNeighbour[bFaceI];
|
||||||
if (cellPair.insert(labelPair(own, globalNei)))
|
if
|
||||||
|
(
|
||||||
|
globalAgglom.isLocal(globalNei)
|
||||||
|
&& globalAgglom.toLocal(globalNei) != own
|
||||||
|
)
|
||||||
{
|
{
|
||||||
m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
m[offsets[own] + nFacesPerCell[own]++] = globalNei;
|
||||||
}
|
}
|
||||||
|
|
||||||
faceI++;
|
faceI++;
|
||||||
bFaceI++;
|
bFaceI++;
|
||||||
}
|
}
|
||||||
@ -542,8 +394,9 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check for duplicates connections between cells as a postprocessing step
|
// Check for duplicates connections between cells
|
||||||
// (since quite rare)
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// Done as postprocessing step since we now have cellCells.
|
||||||
label startIndex = 0;
|
label startIndex = 0;
|
||||||
label newIndex = 0;
|
label newIndex = 0;
|
||||||
labelHashSet nbrCells;
|
labelHashSet nbrCells;
|
||||||
@ -564,6 +417,19 @@ void Foam::decompositionMethod::calcCellCells
|
|||||||
startIndex = endIndex;
|
startIndex = endIndex;
|
||||||
endIndex = newIndex;
|
endIndex = newIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cellCells.m().setSize(newIndex);
|
||||||
|
|
||||||
|
|
||||||
|
//forAll(cellCells, cellI)
|
||||||
|
//{
|
||||||
|
// const labelUList cCells = cellCells[cellI];
|
||||||
|
// Pout<< "Compacted: Coarse cell " << cellI << endl;
|
||||||
|
// forAll(cCells, i)
|
||||||
|
// {
|
||||||
|
// Pout<< " nbr:" << cCells[i] << endl;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -66,10 +66,6 @@ protected:
|
|||||||
CompactListList<label>& cellCells
|
CompactListList<label>& cellCells
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Calculate the minimum face between two neighbouring cells
|
|
||||||
// (usually there is only one)
|
|
||||||
static label masterFace(const polyMesh&, const label, const label);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|||||||
@ -581,9 +581,9 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"scotchDecomp::decompose(const pointField&, const scalarField&)"
|
"scotchDecomp::decompose(const polyMesh&, const pointField&"
|
||||||
)
|
", const scalarField&)"
|
||||||
<< "Can use this decomposition method only for the whole mesh"
|
) << "Can use this decomposition method only for the whole mesh"
|
||||||
<< endl
|
<< endl
|
||||||
<< "and supply one coordinate (cellCentre) for every cell." << endl
|
<< "and supply one coordinate (cellCentre) for every cell." << endl
|
||||||
<< "The number of coordinates " << points.size() << endl
|
<< "The number of coordinates " << points.size() << endl
|
||||||
@ -628,7 +628,9 @@ Foam::labelList Foam::scotchDecomp::decompose
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"scotchDecomp::decompose(const labelList&, const pointField&)"
|
"scotchDecomp::decompose"
|
||||||
|
"(const polyMesh&, const labelList&, const pointField&"
|
||||||
|
", const scalarField&)"
|
||||||
) << "Size of cell-to-coarse map " << agglom.size()
|
) << "Size of cell-to-coarse map " << agglom.size()
|
||||||
<< " differs from number of cells in mesh " << mesh.nCells()
|
<< " differs from number of cells in mesh " << mesh.nCells()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|||||||
@ -26,13 +26,12 @@ License
|
|||||||
#include "patchCloudSet.H"
|
#include "patchCloudSet.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "pointIndexHit.H"
|
|
||||||
#include "Tuple2.H"
|
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "indexedOctree.H"
|
|
||||||
#include "treeDataFace.H"
|
#include "treeDataFace.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
|
// For 'nearInfo' helper class only
|
||||||
|
#include "directMappedPatchBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -40,35 +39,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
defineTypeNameAndDebug(patchCloudSet, 0);
|
defineTypeNameAndDebug(patchCloudSet, 0);
|
||||||
addToRunTimeSelectionTable(sampledSet, patchCloudSet, word);
|
addToRunTimeSelectionTable(sampledSet, patchCloudSet, word);
|
||||||
|
|
||||||
|
|
||||||
//- Helper class for finding nearest
|
|
||||||
// Nearest:
|
|
||||||
// - point+local index
|
|
||||||
// - sqr(distance)
|
|
||||||
// - processor
|
|
||||||
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
|
|
||||||
|
|
||||||
class nearestEqOp
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void operator()(nearInfo& x, const nearInfo& y) const
|
|
||||||
{
|
|
||||||
if (y.first().hit())
|
|
||||||
{
|
|
||||||
if (!x.first().hit())
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
else if (y.second().first() < x.second().first())
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +84,8 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
patchFaces[sz++] = pp.start()+i;
|
patchFaces[sz++] = pp.start()+i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boundBox patchBb(pp.points(), pp.meshPoints());
|
// Do not do reduction.
|
||||||
|
const boundBox patchBb(pp.points(), pp.meshPoints(), false);
|
||||||
|
|
||||||
bb.min() = min(bb.min(), patchBb.min());
|
bb.min() = min(bb.min(), patchBb.min());
|
||||||
bb.max() = max(bb.max(), patchBb.max());
|
bb.max() = max(bb.max(), patchBb.max());
|
||||||
@ -125,6 +96,7 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
// Make bb asymetric just to avoid problems on symmetric meshes
|
// Make bb asymetric just to avoid problems on symmetric meshes
|
||||||
bb = bb.extend(rndGen, 1E-4);
|
bb = bb.extend(rndGen, 1E-4);
|
||||||
|
|
||||||
|
// Make sure bb is 3D.
|
||||||
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
bb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
bb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
@ -146,7 +118,7 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
|
|
||||||
|
|
||||||
// All the info for nearest. Construct to miss
|
// All the info for nearest. Construct to miss
|
||||||
List<nearInfo> nearest(sampleCoords_.size());
|
List<directMappedPatchBase::nearInfo> nearest(sampleCoords_.size());
|
||||||
|
|
||||||
forAll(sampleCoords_, sampleI)
|
forAll(sampleCoords_, sampleI)
|
||||||
{
|
{
|
||||||
@ -155,7 +127,15 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
pointIndexHit& nearInfo = nearest[sampleI].first();
|
pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||||
|
|
||||||
// Find the nearest locally
|
// Find the nearest locally
|
||||||
nearInfo = patchTree.findNearest(sample, magSqr(bb.span()));
|
if (patchFaces.size())
|
||||||
|
{
|
||||||
|
nearInfo = patchTree.findNearest(sample, sqr(searchDist_));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nearInfo.setMiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fill in the distance field and the processor field
|
// Fill in the distance field and the processor field
|
||||||
if (!nearInfo.hit())
|
if (!nearInfo.hit())
|
||||||
@ -179,7 +159,7 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
|
|
||||||
|
|
||||||
// Find nearest.
|
// Find nearest.
|
||||||
Pstream::listCombineGather(nearest, nearestEqOp());
|
Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp());
|
||||||
Pstream::listCombineScatter(nearest);
|
Pstream::listCombineScatter(nearest);
|
||||||
|
|
||||||
|
|
||||||
@ -198,11 +178,14 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
|
|
||||||
forAll(nearest, i)
|
forAll(nearest, i)
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(str, sampleCoords_[i]);
|
if (nearest[i].first().hit())
|
||||||
vertI++;
|
{
|
||||||
meshTools::writeOBJ(str, nearest[i].first().hitPoint());
|
meshTools::writeOBJ(str, sampleCoords_[i]);
|
||||||
vertI++;
|
vertI++;
|
||||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
meshTools::writeOBJ(str, nearest[i].first().hitPoint());
|
||||||
|
vertI++;
|
||||||
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,17 +193,33 @@ void Foam::patchCloudSet::calcSamples
|
|||||||
// Store the sampling locations on the nearest processor
|
// Store the sampling locations on the nearest processor
|
||||||
forAll(nearest, sampleI)
|
forAll(nearest, sampleI)
|
||||||
{
|
{
|
||||||
if (nearest[sampleI].second().second() == Pstream::myProcNo())
|
const pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||||
|
|
||||||
|
if (nearInfo.hit())
|
||||||
{
|
{
|
||||||
const pointIndexHit& nearInfo = nearest[sampleI].first();
|
if (nearest[sampleI].second().second() == Pstream::myProcNo())
|
||||||
|
{
|
||||||
|
label faceI = nearInfo.index();
|
||||||
|
|
||||||
label faceI = nearInfo.index();
|
samplingPts.append(nearInfo.hitPoint());
|
||||||
|
samplingCells.append(mesh().faceOwner()[faceI]);
|
||||||
samplingPts.append(nearInfo.hitPoint());
|
samplingFaces.append(faceI);
|
||||||
samplingCells.append(mesh().faceOwner()[faceI]);
|
samplingSegments.append(0);
|
||||||
samplingFaces.append(faceI);
|
samplingCurveDist.append(1.0 * sampleI);
|
||||||
samplingSegments.append(0);
|
}
|
||||||
samplingCurveDist.append(1.0 * sampleI);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No processor found point near enough. Mark with special value
|
||||||
|
// which is intercepted when interpolating
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
samplingPts.append(sampleCoords_[sampleI]);
|
||||||
|
samplingCells.append(-1);
|
||||||
|
samplingFaces.append(-1);
|
||||||
|
samplingSegments.append(0);
|
||||||
|
samplingCurveDist.append(1.0 * sampleI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,12 +269,14 @@ Foam::patchCloudSet::patchCloudSet
|
|||||||
meshSearch& searchEngine,
|
meshSearch& searchEngine,
|
||||||
const word& axis,
|
const word& axis,
|
||||||
const List<point>& sampleCoords,
|
const List<point>& sampleCoords,
|
||||||
const labelHashSet& patchSet
|
const labelHashSet& patchSet,
|
||||||
|
const scalar searchDist
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
sampledSet(name, mesh, searchEngine, axis),
|
sampledSet(name, mesh, searchEngine, axis),
|
||||||
sampleCoords_(sampleCoords),
|
sampleCoords_(sampleCoords),
|
||||||
patchSet_(patchSet)
|
patchSet_(patchSet),
|
||||||
|
searchDist_(searchDist)
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
|
|
||||||
@ -302,7 +303,8 @@ Foam::patchCloudSet::patchCloudSet
|
|||||||
(
|
(
|
||||||
wordReList(dict.lookup("patches"))
|
wordReList(dict.lookup("patches"))
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
searchDist_(readScalar(dict.lookup("maxDistance")))
|
||||||
{
|
{
|
||||||
genSamples();
|
genSamples();
|
||||||
|
|
||||||
|
|||||||
@ -56,10 +56,14 @@ class patchCloudSet
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Sampling points
|
//- Sampling points
|
||||||
List<point> sampleCoords_;
|
const List<point> sampleCoords_;
|
||||||
|
|
||||||
//- Patches to sample
|
//- Patches to sample
|
||||||
labelHashSet patchSet_;
|
const labelHashSet patchSet_;
|
||||||
|
|
||||||
|
//- Maximum distance to look for nearest
|
||||||
|
const scalar searchDist_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -93,7 +97,8 @@ public:
|
|||||||
meshSearch& searchEngine,
|
meshSearch& searchEngine,
|
||||||
const word& axis,
|
const word& axis,
|
||||||
const List<point>& sampleCoords,
|
const List<point>& sampleCoords,
|
||||||
const labelHashSet& patchSet
|
const labelHashSet& patchSet,
|
||||||
|
const scalar searchDist
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
|
|||||||
@ -2,7 +2,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) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -51,18 +51,26 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
|
|||||||
const sampledSet& samples = samplers[setI];
|
const sampledSet& samples = samplers[setI];
|
||||||
|
|
||||||
values.setSize(samples.size());
|
values.setSize(samples.size());
|
||||||
forAll(samples, samplei)
|
forAll(samples, sampleI)
|
||||||
{
|
{
|
||||||
const point& samplePt = samples[samplei];
|
const point& samplePt = samples[sampleI];
|
||||||
label celli = samples.cells()[samplei];
|
label cellI = samples.cells()[sampleI];
|
||||||
label facei = samples.faces()[samplei];
|
label faceI = samples.faces()[sampleI];
|
||||||
|
|
||||||
values[samplei] = interpolator().interpolate
|
if (cellI == -1 && faceI == -1)
|
||||||
(
|
{
|
||||||
samplePt,
|
// Special condition for illegal sampling points
|
||||||
celli,
|
values[sampleI] = pTraits<Type>::max;
|
||||||
facei
|
}
|
||||||
);
|
else
|
||||||
|
{
|
||||||
|
values[sampleI] = interpolator().interpolate
|
||||||
|
(
|
||||||
|
samplePt,
|
||||||
|
cellI,
|
||||||
|
faceI
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,9 +92,18 @@ Foam::sampledSets::volFieldSampler<Type>::volFieldSampler
|
|||||||
const sampledSet& samples = samplers[setI];
|
const sampledSet& samples = samplers[setI];
|
||||||
|
|
||||||
values.setSize(samples.size());
|
values.setSize(samples.size());
|
||||||
forAll(samples, samplei)
|
forAll(samples, sampleI)
|
||||||
{
|
{
|
||||||
values[samplei] = field[samples.cells()[samplei]];
|
label cellI = samples.cells()[sampleI];
|
||||||
|
|
||||||
|
if (cellI ==-1)
|
||||||
|
{
|
||||||
|
values[sampleI] = pTraits<Type>::max;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
values[sampleI] = field[cellI];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd ${0%/*} || exit 1 # run from this directory
|
cd ${0%/*} || exit 1 # run from this directory
|
||||||
|
makeType=${1:-libso}
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
LES/Allwmake $*
|
LES/Allwmake $*
|
||||||
incompressible/Allwmake $*
|
incompressible/Allwmake $*
|
||||||
compressible/Allwmake $*
|
compressible/Allwmake $*
|
||||||
|
wmake $makeType derivedFvPatchFields
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
3
src/turbulenceModels/derivedFvPatchFields/Make/files
Normal file
3
src/turbulenceModels/derivedFvPatchFields/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
porousBafflePressure/porousBafflePressureFvPatchFields.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libturbulenceDerivedFvPatchFields
|
||||||
16
src/turbulenceModels/derivedFvPatchFields/Make/options
Normal file
16
src/turbulenceModels/derivedFvPatchFields/Make/options
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
|
-I$(LIB_SRC)/transportModels \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lspecie \
|
||||||
|
-lmeshTools \
|
||||||
|
-lcompressibleTurbulenceModel \
|
||||||
|
-lincompressibleTurbulenceModel
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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 "porousBafflePressureFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
|
D_(0),
|
||||||
|
I_(0),
|
||||||
|
length_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
D_(ptf.D_),
|
||||||
|
I_(ptf.I_),
|
||||||
|
length_(ptf.length_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchField<Type>(p, iF),
|
||||||
|
D_(readScalar(dict.lookup("D"))),
|
||||||
|
I_(readScalar(dict.lookup("I"))),
|
||||||
|
length_(readScalar(dict.lookup("length")))
|
||||||
|
{
|
||||||
|
if (dict.found("value"))
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::operator=
|
||||||
|
(
|
||||||
|
Field<Type>("value", dict, p.size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->evaluate(Pstream::blocking);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicLduInterfaceField(),
|
||||||
|
fixedJumpFvPatchField<Type>(ptf),
|
||||||
|
D_(ptf.D_),
|
||||||
|
I_(ptf.I_),
|
||||||
|
length_(ptf.length_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedJumpFvPatchField<Type>(ptf, iF),
|
||||||
|
D_(ptf.D_),
|
||||||
|
I_(ptf.I_),
|
||||||
|
length_(ptf.length_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::porousBafflePressureFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
|
||||||
|
fixedJumpFvPatchField<Type>::write(os);
|
||||||
|
|
||||||
|
os.writeKeyword("D") << D_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("I") << I_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("length") << length_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,177 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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::porousBafflePressureFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::porousBafflePressureFvPatchField
|
||||||
|
the porous baffle operates on a cyclic patch and introduce a jump on the p
|
||||||
|
field as follow:
|
||||||
|
|
||||||
|
deltaP = -(I*mu*U + 0.5*D*rho*magSqr(U)*L)
|
||||||
|
|
||||||
|
where:
|
||||||
|
|
||||||
|
I is the inertial coefficient
|
||||||
|
D is the darcy coeafficient
|
||||||
|
L is the porous media lenght in the flow direction
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
porousBafflePressureFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef porousBafflePressureFvPatchField_H
|
||||||
|
#define porousBafflePressureFvPatchField_H
|
||||||
|
|
||||||
|
#include "fixedJumpFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class porousBafflePressureFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class porousBafflePressureFvPatchField
|
||||||
|
:
|
||||||
|
public fixedJumpFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Darcy pressure lost coefficient
|
||||||
|
scalar D_;
|
||||||
|
|
||||||
|
//- Inertia pressure lost coefficient
|
||||||
|
scalar I_;
|
||||||
|
|
||||||
|
//- Porous media length
|
||||||
|
scalar length_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("porousBafflePressure");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given porousBafflePressureFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new porousBafflePressureFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
porousBafflePressureFvPatchField
|
||||||
|
(
|
||||||
|
const porousBafflePressureFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new porousBafflePressureFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Specialisation of the jump-condition for the pressure
|
||||||
|
template<>
|
||||||
|
void porousBafflePressureFvPatchField<scalar>::updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "porousBafflePressureFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef porousBafflePressureFvPatchFieldsFwd_H
|
||||||
|
#define porousBafflePressureFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class porousBafflePressureFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(porousBafflePressure);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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 "porousBafflePressureFvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
|
||||||
|
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||||
|
#include "incompressible/turbulenceModel/turbulenceModel.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeTemplatePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchScalarField,
|
||||||
|
porousBafflePressureFvPatchScalarField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//- Specialisation of the jump-condition for the pressure
|
||||||
|
template<>
|
||||||
|
void Foam::porousBafflePressureFvPatchField<Foam::scalar>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
|
const surfaceScalarField& phi =
|
||||||
|
db().lookupObject<surfaceScalarField>("phi");
|
||||||
|
|
||||||
|
const fvsPatchField<scalar>& phip =
|
||||||
|
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||||
|
|
||||||
|
scalarField Un(phip/patch().magSf());
|
||||||
|
|
||||||
|
if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
|
||||||
|
{
|
||||||
|
const incompressible::turbulenceModel& model =
|
||||||
|
db().lookupObject<incompressible::turbulenceModel>
|
||||||
|
(
|
||||||
|
"turbulenceModel"
|
||||||
|
);
|
||||||
|
|
||||||
|
const scalarField nuEffw = model.nuEff()().boundaryField()[patchI];
|
||||||
|
|
||||||
|
jump_ = -(I_*nuEffw*mag(Un) + D_*0.5*magSqr(Un)*length_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const compressible::turbulenceModel& model =
|
||||||
|
db().lookupObject<compressible::turbulenceModel>
|
||||||
|
(
|
||||||
|
"turbulenceModel"
|
||||||
|
);
|
||||||
|
|
||||||
|
const scalarField muEffw = model.muEff()().boundaryField()[patchI];
|
||||||
|
|
||||||
|
const scalarField rhow =
|
||||||
|
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||||
|
|
||||||
|
Un /= rhow;
|
||||||
|
|
||||||
|
jump_ = -(I_*muEffw*mag(Un) + D_*0.5*rhow*magSqr(Un)*length_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
scalar avePressureJump = gAverage(jump_);
|
||||||
|
scalar aveVelocity = gAverage(mag(Un));
|
||||||
|
|
||||||
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
|
<< patch().name() << ':'
|
||||||
|
<< " Average pressure drop :" << avePressureJump
|
||||||
|
<< " Average velocity :" << aveVelocity
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
jumpCyclicFvPatchField<scalar>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011-2011 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef porousBafflePressureFvPatchFields_H
|
||||||
|
#define porousBafflePressureFvPatchFields_H
|
||||||
|
|
||||||
|
#include "porousBafflePressureFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(porousBafflePressure);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -22,6 +22,9 @@ runParallel snappyHexMesh 2 -overwrite
|
|||||||
runParallel changeDictionary 2 -literalRE -enableFunctionEntries
|
runParallel changeDictionary 2 -literalRE -enableFunctionEntries
|
||||||
|
|
||||||
cp system/decomposeParDict-4proc system/decomposeParDict
|
cp system/decomposeParDict-4proc system/decomposeParDict
|
||||||
|
# Unset floating point trapping since creating processor directories
|
||||||
|
unset FOAM_SIGFPE
|
||||||
|
unset FOAM_SETNAN
|
||||||
runParallel redistributeMeshPar 4 -overwrite
|
runParallel redistributeMeshPar 4 -overwrite
|
||||||
runParallel renumberMesh 4 -overwrite
|
runParallel renumberMesh 4 -overwrite
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user