Merge branch 'master' of ssh://hunt/home/hunt2/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2008-09-25 18:15:20 +01:00
186 changed files with 7721 additions and 1953 deletions

View File

@ -1,5 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso BCs
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -77,13 +77,13 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
:
mixedFvPatchScalarField(p, iF),
accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))),
Twall_("Twall", dict, p.size())
Twall_("Twall", dict, p.size()),
gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4))
{
if
(
mag(accommodationCoeff_) < SMALL
||
mag(accommodationCoeff_) > 2.0
|| mag(accommodationCoeff_) > 2.0
)
{
FatalIOErrorIn
@ -96,8 +96,8 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
" const dictionary&"
")",
dict
) << "unphysical accommodationCoeff_ specified"
<< "(0 < accommodationCoeff_ <= 1)" << endl
) << "unphysical accommodationCoeff specified"
<< "(0 < accommodationCoeff <= 1)" << endl
<< exit(FatalError);
}
@ -113,15 +113,6 @@ smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
fvPatchField<scalar>::operator=(patchInternalField());
}
if (dict.found("gamma"))
{
gamma_ = readScalar(dict.lookup("gamma"));
}
else
{
gamma_ = 1.4;
}
refValue() = *this;
refGrad() = 0.0;
valueFraction() = 0.0;

View File

@ -1,5 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso BCs
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -26,8 +26,8 @@ Application
boundaryFoam
Description
Steady-state solver for 1D turbulent flow, typically to generate boundary
layer conditions at an inlet, for use in a simulation.
Steady-state solver for 1D turbulent flow, typically to generate boundary
layer conditions at an inlet, for use in a simulation.
Boundary layer code to calculate the U, k and epsilon distributions.
Used to create inlet boundary conditions for experimental comparisons
@ -82,11 +82,14 @@ int main(int argc, char *argv[])
U += (Ubar - UbarStar);
gradP += (Ubar - UbarStar)/(1.0/UEqn.A())().weightedAverage(mesh.V());
label id = y.size() - 1;
scalar wallShearStress =
flowDirection & turbulence->R()()[0] & wallNormal;
flowDirection & turbulence->R()()[id] & wallNormal;
scalar yplusWall
= ::sqrt(mag(wallShearStress))*y[0]/laminarTransport.nu()()[0];
// = ::sqrt(mag(wallShearStress))*y[id]/laminarTransport.nu()()[id];
= ::sqrt(mag(wallShearStress))*y[id]/turbulence->nuEff()()[id];
Info<< "Uncorrected Ubar = " << (flowDirection & UbarStar.value())<< tab
<< "pressure gradient = " << (flowDirection & gradP.value()) << tab

View File

@ -7,5 +7,4 @@ EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools \
/* $(LIB_WM_OPTIONS_DIR)/libfbsdmalloc.o */
-lmeshTools

View File

@ -1,7 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso phaseModel
wmake libso interfacialModels
wmake libso kineticTheoryModels
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -2,7 +2,6 @@
#
# Build optional components (eg, may depend on third-party libraries)
# -----------------------------------------------------------------------------
cd ${0%/*} || exit 1 # run from this directory
set -x
@ -18,4 +17,4 @@ then
wmake ccm26ToFoam
fi
# end
# ----------------------------------------------------------------- end-of-file

View File

@ -1,6 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso extrudeModel
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
READLINE=0
if [ -f /usr/include/readline/readline.h ]; then
@ -9,3 +10,5 @@ if [ -f /usr/include/readline/readline.h ]; then
fi
export READLINE
wmake
# ----------------------------------------------------------------- end-of-file

View File

@ -17,3 +17,5 @@ then
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
@ -16,3 +17,5 @@ then
;;
esac
fi
# ----------------------------------------------------------------- end-of-file

View File

@ -1,2 +1,6 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
wmake libso
# ----------------------------------------------------------------- end-of-file

View File

@ -75,7 +75,7 @@ int main(int argc, char *argv[])
}
// Give patch area
Info<< " Patch area = " << sum(mesh.Sf()) << endl;
Info<< " Patch area = " << sum(mesh.Sf().boundaryField()[patchi]) << endl;
if (fieldHeader.headerClassName() == "volScalarField")
{

View File

@ -0,0 +1,3 @@
applyWallFunctionBounaryConditions.C
EXE = $(FOAM_APPBIN)/applyWallFunctionBounaryConditions

View File

@ -0,0 +1,6 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume

View File

@ -0,0 +1,279 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
applyWallFunctionBounaryConditions
Description
Updates OpenFOAM RAS cases to use the new wall function framework
Attempts to determine whether case is compressible or incompressible, or
can be supplied with -compressible command line argument
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "wallPolyPatch.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool caseIsCompressible(const fvMesh& mesh)
{
// Attempt flux field
IOobject phiHeader
(
"phi",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (phiHeader.headerOk())
{
surfaceScalarField phi(phiHeader, mesh);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
return true;
}
}
// Attempt density field
IOobject rhoHeader
(
"rho",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (rhoHeader.headerOk())
{
volScalarField rho(rhoHeader, mesh);
if (rho.dimensions() == dimDensity)
{
return true;
}
}
// Attempt pressure field
IOobject pHeader
(
"p",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (pHeader.headerOk())
{
volScalarField p(pHeader, mesh);
if (p.dimensions() == dimMass/sqr(dimTime)/dimLength)
{
return true;
}
}
// Attempt hydrostatic pressure field
IOobject pdHeader
(
"pd",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (pdHeader.headerOk())
{
volScalarField pd(pdHeader, mesh);
if (pd.dimensions() == dimMass/sqr(dimTime)/dimLength)
{
return true;
}
}
// If none of the above are true, assume that the case is incompressible
return false;
}
void createVolScalarField
(
const fvMesh& mesh,
const word& fieldName,
const dimensionSet& dims
)
{
IOobject fieldHeader
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (!fieldHeader.headerOk())
{
Info<< "Creating field " << fieldName << nl << endl;
volScalarField field
(
IOobject
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dims, 0.0)
);
field.write();
}
}
void replaceBoundaryType
(
const fvMesh& mesh,
const word& fieldName,
const word& boundaryType,
const string& boundaryValue
)
{
IOobject header
(
fieldName,
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (!header.headerOk())
{
return;
}
Info<< "Updating boundary types for field " << header.name() << endl;
const word oldTypeName = IOdictionary::typeName;
const_cast<word&>(IOdictionary::typeName) = word::null;
IOdictionary dict(header);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
const_cast<word&>(dict.type()) = dict.headerClassName();
// Make a backup of the old field
word backupName(dict.name() + ".old");
Info<< " copying " << dict.name() << " to "
<< backupName << endl;
IOdictionary dictOld = dict;
dictOld.rename(backupName);
dictOld.regIOobject::write();
// Loop through boundary patches and update
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
dictionary& boundaryDict = dict.subDict("boundaryField");
forAll(bMesh, patchI)
{
if (isType<wallPolyPatch>(bMesh[patchI]))
{
word patchName = bMesh[patchI].name();
dictionary& oldPatch = boundaryDict.subDict(patchName);
dictionary newPatch(dictionary::null);
newPatch.add("type", boundaryType);
newPatch.add("value", ("uniform " + boundaryValue).c_str());
oldPatch = newPatch;
}
}
Info<< " writing updated " << dict.name() << nl << endl;
dict.regIOobject::write();
}
int main(int argc, char *argv[])
{
# include "addTimeOptions.H"
argList::validOptions.insert("compressible", "");
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
bool compressible = args.options().found("compressible");
Info<< "Updating turbulence fields to operate using new run time "
<< "selectable" << nl << "wall functions"
<< nl << endl;
if (compressible || caseIsCompressible(mesh))
{
Info<< "Case treated as compressible" << nl << endl;
createVolScalarField
(
mesh,
"mut",
dimArea/dimTime*dimDensity
);
replaceBoundaryType(mesh, "mut", "mutWallFunction", "0");
}
else
{
Info<< "Case treated as incompressible" << nl << endl;
createVolScalarField(mesh, "nut", dimArea/dimTime);
replaceBoundaryType(mesh, "nut", "nutWallFunction", "0");
}
replaceBoundaryType(mesh, "epsilon", "epsilonWallFunction", "0");
replaceBoundaryType(mesh, "omega", "omegaWallFunction", "0");
replaceBoundaryType(mesh, "k", "kQRWallFunction", "0");
replaceBoundaryType(mesh, "q", "kQRWallFunction", "0");
replaceBoundaryType(mesh, "R", "kQRWallFunction", "(0 0 0 0 0 0)");
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
umask 22

View File

@ -82,7 +82,10 @@ switch ("$WM_COMPILER_INST")
case OpenFOAM:
switch ("$WM_COMPILER")
case Gcc:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
#setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.3/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw
case Gcc42:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH
@ -105,13 +108,8 @@ case OpenFOAM:
endsw
if ($?WM_COMPILER_BIN) then
set path=($WM_COMPILER_BIN $path)
if ($?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH ${WM_COMPILER_LIB}:${LD_LIBRARY_PATH}
else
setenv LD_LIBRARY_PATH ${WM_COMPILER_LIB}
endif
_foamAddPath $WM_COMPILER_BIN
_foamAddLib $WM_COMPILER_LIB
endif
unset WM_COMPILER_BIN

View File

@ -99,7 +99,10 @@ case "$WM_COMPILER_INST" in
OpenFOAM)
case "$WM_COMPILER" in
Gcc)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
#export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.3/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
;;
Gcc42)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH
@ -123,8 +126,8 @@ OpenFOAM)
esac
if [ -d "$WM_COMPILER_BIN" ]; then
export PATH=$WM_COMPILER_BIN:$PATH
export LD_LIBRARY_PATH=$WM_COMPILER_LIB:$LD_LIBRARY_PATH
_foamAddPath $WM_COMPILER_BIN
_foamAddLib $WM_COMPILER_LIB
fi
unset WM_COMPILER_BIN WM_COMPILER_LIB

View File

@ -26,7 +26,7 @@ Class
Foam::DynamicList
Description
A 1D vector of objects of type \<T\> which resizes itself as necessary to
A 1D vector of objects of type \<T\> that resizes itself as necessary to
accept the new objects.
Internal storage is a compact array and the list can be shrunk to compact
@ -136,7 +136,7 @@ public:
//- Transfer the contents of the argument List into this List
// and annull the argument list. Is same as List::transfer except
// checks that you're not changing the underlying list to something
// smaller than nextFree_.
// smaller than allocSize_.
inline void transfer(List<T>&);
//- Transfer the contents of the argument DynamicList into this
@ -149,7 +149,7 @@ public:
//- Append an element at the end of the list
inline void append(const T& e);
//- Return and remove the top element
//- Remove and return the top element
inline T remove();
//- Return non-const access to an element,
@ -159,15 +159,9 @@ public:
//- Assignment of all entries to the given value
inline void operator=(const T&);
//- Assignment from List<T>
//- Assignment from List<T>. Also handles assignment from DynamicList.
inline void operator=(const List<T>&);
//- Assignment from DynamicList<T>
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators

View File

@ -85,8 +85,10 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
}
else
{
label nextFree = List<T>::size();
allocSize_ = s;
List<T>::setSize(allocSize_);
List<T>::size() = nextFree;
}
}
@ -104,8 +106,10 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
}
else
{
label nextFree = List<T>::size();
allocSize_ = s;
List<T>::setSize(allocSize_, t);
List<T>::size() = nextFree;
}
}
@ -120,7 +124,6 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clear()
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clearStorage()
{
List<T>::size() = allocSize_; // make List<T> consistent
List<T>::clear();
allocSize_ = 0;
}
@ -166,8 +169,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
)
{
allocSize_ = l.allocSize();
List<T>::transfer(l); // take over storage
l.allocSize_ = 0;
List<T>::transfer(l); // take over storage. Null l.
}
@ -189,9 +191,9 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append(const T& e)
List<T>::setSize(allocSize_);
}
this->operator[](nextFree - 1) = e;
List<T>::size() = nextFree;
this->operator[](nextFree - 1) = e;
}
@ -202,11 +204,17 @@ inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
{
FatalErrorIn
(
"void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()"
"Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()"
) << "List is empty" << abort(FatalError);
}
return List<T>::operator[](--List<T>::size());
label nextFree = List<T>::size()-1;
const T& val = List<T>::operator[](nextFree);
List<T>::size() = nextFree;
return val;
}
@ -224,7 +232,7 @@ inline T& Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator()
if (nextFree > allocSize_)
{
allocSize_ = max
allocSize_ = max
(
nextFree,
label(SizeMult*allocSize_/SizeDiv + SizeInc)
@ -260,15 +268,4 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>& l
)
{
List<T>::operator=(l);
allocSize_ = l.allocSize();
}
// ************************************************************************* //

View File

@ -38,14 +38,11 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
// Construct with length specified
template<class T>
List<T>::List(const label s)
Foam::List<T>::List(const label s)
:
UList<T>(NULL, s)
{
@ -69,7 +66,7 @@ List<T>::List(const label s)
// Construct with length and single value specified
template<class T>
List<T>::List(const label s, const T& a)
Foam::List<T>::List(const label s, const T& a)
:
UList<T>(NULL, s)
{
@ -98,7 +95,7 @@ List<T>::List(const label s, const T& a)
// Construct as copy
template<class T>
List<T>::List(const List<T>& a)
Foam::List<T>::List(const List<T>& a)
:
UList<T>(NULL, a.size_)
{
@ -130,7 +127,7 @@ List<T>::List(const List<T>& a)
// Construct as copy or re-use as specified.
template<class T>
List<T>::List(List<T>& a, bool reUse)
Foam::List<T>::List(List<T>& a, bool reUse)
:
UList<T>(NULL, a.size_)
{
@ -166,10 +163,10 @@ List<T>::List(List<T>& a, bool reUse)
}
// Construct given size and start and end iterators.
// Construct given start and end iterators.
template<class T>
template<class InputIterator>
List<T>::List(InputIterator first, InputIterator last)
Foam::List<T>::List(InputIterator first, InputIterator last)
{
label s = 0;
for
@ -200,8 +197,8 @@ List<T>::List(InputIterator first, InputIterator last)
// Construct as copy of FixedList<T, Size>
template<class T>
template<label Size>
List<T>::List(const FixedList<T, Size>& fl)
template<Foam::label Size>
Foam::List<T>::List(const FixedList<T, Size>& fl)
:
UList<T>(NULL, Size)
{
@ -223,7 +220,7 @@ List<T>::List(const FixedList<T, Size>& fl)
// Construct as copy of PtrList<T>
template<class T>
List<T>::List(const PtrList<T>& sptrl)
Foam::List<T>::List(const PtrList<T>& sptrl)
:
UList<T>(NULL, sptrl.size())
{
@ -245,7 +242,7 @@ List<T>::List(const PtrList<T>& sptrl)
// Construct as copy of SLList<T>
template<class T>
List<T>::List(const SLList<T>& sll)
Foam::List<T>::List(const SLList<T>& sll)
:
UList<T>(NULL, sll.size())
{
@ -273,7 +270,7 @@ List<T>::List(const SLList<T>& sll)
// Construct as copy of IndirectList<T>
template<class T>
List<T>::List(const IndirectList<T>& idl)
Foam::List<T>::List(const IndirectList<T>& idl)
:
UList<T>(NULL, idl.size())
{
@ -295,7 +292,7 @@ List<T>::List(const IndirectList<T>& idl)
// Construct as copy of BiIndirectList<T>
template<class T>
List<T>::List(const BiIndirectList<T>& idl)
Foam::List<T>::List(const BiIndirectList<T>& idl)
:
UList<T>(NULL, idl.size())
{
@ -319,7 +316,7 @@ List<T>::List(const BiIndirectList<T>& idl)
// Destroy list elements
template<class T>
List<T>::~List()
Foam::List<T>::~List()
{
if (this->v_) delete[] this->v_;
}
@ -328,7 +325,7 @@ List<T>::~List()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
const List<T>& List<T>::null()
const Foam::List<T>& Foam::List<T>::null()
{
List<T>* nullPtr = reinterpret_cast<List<T>*>(NULL);
return *nullPtr;
@ -336,7 +333,7 @@ const List<T>& List<T>::null()
template<class T>
void List<T>::setSize(const label newSize)
void Foam::List<T>::setSize(const label newSize)
{
if (newSize < 0)
{
@ -382,7 +379,7 @@ void List<T>::setSize(const label newSize)
template<class T>
void List<T>::setSize(const label newSize, const T& a)
void Foam::List<T>::setSize(const label newSize, const T& a)
{
label oldSize = this->size_;
this->setSize(newSize);
@ -397,7 +394,7 @@ void List<T>::setSize(const label newSize, const T& a)
template<class T>
void List<T>::clear()
void Foam::List<T>::clear()
{
if (this->v_) delete[] this->v_;
this->size_ = 0;
@ -408,10 +405,9 @@ void List<T>::clear()
// Transfer the contents of the argument List into this List
// and anull the argument list
template<class T>
void List<T>::transfer(List<T>& a)
void Foam::List<T>::transfer(List<T>& a)
{
if (this->v_) delete[] this->v_;
this->size_ = a.size_;
this->v_ = a.v_;
@ -424,42 +420,41 @@ void List<T>::transfer(List<T>& a)
// and anull the argument list
template<class T>
template<unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
void List<T>::transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>& a)
void Foam::List<T>::transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>& a)
{
if (this->v_) delete[] this->v_;
this->size_ = a.size_;
this->v_ = a.v_;
a.size_ = 0;
a.allocSize_ = 0;
a.v_ = 0;
a.allocSize_ = 0;
}
template<class T>
void sort(List<T>& a)
void Foam::sort(List<T>& a)
{
std::sort(a.begin(), a.end());
}
template<class T, class Cmp>
void sort(List<T>& a, const Cmp& cmp)
void Foam::sort(List<T>& a, const Cmp& cmp)
{
std::sort(a.begin(), a.end(), cmp);
}
template<class T>
void stableSort(List<T>& a)
void Foam::stableSort(List<T>& a)
{
std::stable_sort(a.begin(), a.end());
}
template<class T, class Cmp>
void stableSort(List<T>& a, const Cmp& cmp)
void Foam::stableSort(List<T>& a, const Cmp& cmp)
{
std::stable_sort(a.begin(), a.end(), cmp);
}
@ -469,7 +464,7 @@ void stableSort(List<T>& a, const Cmp& cmp)
// Assignment to UList operator. Takes linear time.
template<class T>
void List<T>::operator=(const UList<T>& a)
void Foam::List<T>::operator=(const UList<T>& a)
{
if (a.size_ != this->size_)
{
@ -501,7 +496,7 @@ void List<T>::operator=(const UList<T>& a)
// Assignment operator. Takes linear time.
template<class T>
void List<T>::operator=(const List<T>& a)
void Foam::List<T>::operator=(const List<T>& a)
{
if (this == &a)
{
@ -516,7 +511,7 @@ void List<T>::operator=(const List<T>& a)
// Assignment operator. Takes linear time.
template<class T>
void List<T>::operator=(const SLList<T>& sll)
void Foam::List<T>::operator=(const SLList<T>& sll)
{
if (sll.size() != this->size_)
{
@ -544,7 +539,7 @@ void List<T>::operator=(const SLList<T>& sll)
// Assignment operator. Takes linear time.
template<class T>
void List<T>::operator=(const IndirectList<T>& idl)
void Foam::List<T>::operator=(const IndirectList<T>& idl)
{
if (idl.size() != this->size_)
{
@ -566,7 +561,7 @@ void List<T>::operator=(const IndirectList<T>& idl)
// Assignment operator. Takes linear time.
template<class T>
void List<T>::operator=(const BiIndirectList<T>& idl)
void Foam::List<T>::operator=(const BiIndirectList<T>& idl)
{
if (idl.size() != this->size_)
{
@ -585,11 +580,6 @@ void List<T>::operator=(const BiIndirectList<T>& idl)
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
#include "ListIO.C"

View File

@ -96,7 +96,7 @@ public:
//- Construct as copy or re-use as specified.
List(List<T>&, bool reUse);
//- Construct given size and start and end iterators.
//- Construct given start and end iterators.
template<class InputIterator>
List(InputIterator first, InputIterator last);
@ -142,6 +142,9 @@ public:
//- Return the number of elements in the UList.
inline label size() const;
//- Override size to be inconsistent with allocated storage.
// Use with care.
inline label& size();
// Edit
@ -166,11 +169,6 @@ public:
//- Return subscript-checked element of UList.
inline T& newElmt(const label);
//- Override size to be inconsistent with allocated storage.
// Use with care.
inline label& size();
// Member operators
//- Assignment from UList operator. Takes linear time.

View File

@ -30,16 +30,11 @@ License
#include "SLList.H"
#include "contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// Construct from Istream
template<class T>
List<T>::List(Istream& is)
Foam::List<T>::List(Istream& is)
:
UList<T>(NULL, 0)
{
@ -48,7 +43,7 @@ List<T>::List(Istream& is)
template<class T>
Istream& operator>>(Istream& is, List<T>& L)
Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
{
// Anull list
L.setSize(0);
@ -161,9 +156,4 @@ Istream& operator>>(Istream& is, List<T>& L)
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -241,7 +241,7 @@ void Foam::mapDistribute::distribute
Pstream::nonBlocking,
domain,
reinterpret_cast<const char*>(subField.begin()),
subField.size()
subField.size()*sizeof(T)
);
}
}
@ -262,7 +262,7 @@ void Foam::mapDistribute::distribute
Pstream::nonBlocking,
domain,
reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()
recvFields[domain].size()*sizeof(T)
);
}
}

View File

@ -62,7 +62,7 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
const labelList& fEdges = faceEs[faceI];
forAllfEdges, i)
forAll(fEdges, i)
{
label edgeI = fEdges[i];
@ -102,8 +102,7 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
break;
}
// New dynamiclist: can leave dynamicList unshrunk
//changedFaces.transfer(newChangedFaces.shrink());
// New dynamicList: can leave dynamicList unshrunk
changedFaces.transfer(newChangedFaces);
}
}

View File

@ -66,7 +66,6 @@ primitiveMesh::primitiveMesh()
ppPtr_(NULL),
cpPtr_(NULL),
allocSize_(0),
labels_(0),
cellCentresPtr_(NULL),
@ -109,7 +108,6 @@ primitiveMesh::primitiveMesh
ppPtr_(NULL),
cpPtr_(NULL),
allocSize_(0),
labels_(0),
cellCentresPtr_(NULL),

View File

@ -54,6 +54,7 @@ SourceFiles
#ifndef primitiveMesh_H
#define primitiveMesh_H
#include "DynamicList.H"
#include "edgeList.H"
#include "pointField.H"
#include "SubField.H"
@ -157,10 +158,8 @@ class primitiveMesh
// On-the-fly edge addresing storage
//- Temporary storage for addressing. allocSize is the real size
// of the labelList.
mutable label allocSize_;
mutable labelList labels_;
//- Temporary storage for addressing.
mutable DynamicList<label> labels_;
//- Temporary storage for addressing
mutable labelHashSet labelSet_;
@ -705,31 +704,80 @@ public:
// On-the-fly addressing calculation. These functions return either
// a reference to the full addressing (if already calculated) or
// a reference to member data labels_ so be careful when not storing
// a reference to the supplied storage. The one-argument ones
// use member DynamicList labels_ so be careful when not storing
// result.
//- cellCells using cells
//- cellCells using cells.
const labelList& cellCells
(
const label cellI,
DynamicList<label>&
) const;
const labelList& cellCells(const label cellI) const;
//- cellPoints using cells
const labelList& cellPoints
(
const label cellI,
DynamicList<label>&
) const;
const labelList& cellPoints(const label cellI) const;
//- pointCells using pointFaces
const labelList& pointCells
(
const label pointI,
DynamicList<label>&
) const;
const labelList& pointCells(const label pointI) const;
//- pointPoints using edges, pointEdges
const labelList& pointPoints
(
const label pointI,
DynamicList<label>&
) const;
const labelList& pointPoints(const label pointI) const;
//- faceEdges using pointFaces, edges, pointEdges
const labelList& faceEdges
(
const label faceI,
DynamicList<label>&
) const;
const labelList& faceEdges(const label faceI) const;
//- edgeFaces using pointFaces, edges, pointEdges
const labelList& edgeFaces
(
const label edgeI,
DynamicList<label>&
) const;
const labelList& edgeFaces(const label edgeI) const;
//- edgeCells using pointFaces, edges, pointEdges
const labelList& edgeCells
(
const label edgeI,
DynamicList<label>&
) const;
const labelList& edgeCells(const label edgeI) const;
//- cellEdges using cells, pointFaces, edges, pointEdges
const labelList& cellEdges
(
const label cellI,
DynamicList<label>&
) const;
const labelList& cellEdges(const label cellI) const;

View File

@ -41,6 +41,14 @@ void primitiveMesh::calcCellCells() const
{
Pout<< "primitiveMesh::calcCellCells() : calculating cellCells"
<< endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::calcCellCells()")
<< abort(FatalError);
}
}
// It is an error to attempt to recalculate cellCells
@ -105,7 +113,11 @@ const labelListList& primitiveMesh::cellCells() const
}
const labelList& primitiveMesh::cellCells(const label cellI) const
const labelList& primitiveMesh::cellCells
(
const label cellI,
DynamicList<label>& storage
) const
{
if (hasCellCells())
{
@ -117,16 +129,7 @@ const labelList& primitiveMesh::cellCells(const label cellI) const
const labelList& nei = faceNeighbour();
const cell& cFaces = cells()[cellI];
labels_.size() = allocSize_;
if (cFaces.size() > allocSize_)
{
labels_.clear();
allocSize_ = cFaces.size();
labels_.setSize(allocSize_);
}
label n = 0;
storage.clear();
forAll(cFaces, i)
{
@ -136,22 +139,26 @@ const labelList& primitiveMesh::cellCells(const label cellI) const
{
if (own[faceI] == cellI)
{
labels_[n++] = nei[faceI];
storage.append(nei[faceI]);
}
else
{
labels_[n++] = own[faceI];
storage.append(own[faceI]);
}
}
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::cellCells(const label cellI) const
{
return cellCells(cellI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -40,6 +40,14 @@ void Foam::primitiveMesh::calcCellEdges() const
Pout<< "primitiveMesh::calcCellEdges() : "
<< "calculating cellEdges"
<< endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::calcCellEdges()")
<< abort(FatalError);
}
}
// It is an error to attempt to recalculate cellEdges

View File

@ -42,6 +42,14 @@ const labelListList& primitiveMesh::cellPoints() const
{
Pout<< "primitiveMesh::cellPoints() : "
<< "calculating cellPoints" << endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::cellPoints()")
<< abort(FatalError);
}
}
// Invert pointCells
@ -53,7 +61,11 @@ const labelListList& primitiveMesh::cellPoints() const
}
const labelList& primitiveMesh::cellPoints(const label cellI) const
const labelList& primitiveMesh::cellPoints
(
const label cellI,
DynamicList<label>& storage
) const
{
if (hasCellPoints())
{
@ -76,29 +88,28 @@ const labelList& primitiveMesh::cellPoints(const label cellI) const
}
}
labels_.size() = allocSize_;
if (labelSet_.size() > allocSize_)
storage.clear();
if (labelSet_.size() > storage.allocSize())
{
labels_.clear();
allocSize_ = labelSet_.size();
labels_.setSize(allocSize_);
storage.setSize(labelSet_.size());
}
label n = 0;
forAllConstIter(labelHashSet, labelSet_, iter)
{
labels_[n++] = iter.key();
storage.append(iter.key());
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::cellPoints(const label cellI) const
{
return cellPoints(cellI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -41,6 +41,14 @@ const labelListList& primitiveMesh::edgeCells() const
if (debug)
{
Pout<< "primitiveMesh::edgeCells() : calculating edgeCells" << endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::edgeCells()")
<< abort(FatalError);
}
}
// Invert cellEdges
ecPtr_ = new labelListList(nEdges());
@ -51,7 +59,11 @@ const labelListList& primitiveMesh::edgeCells() const
}
const labelList& primitiveMesh::edgeCells(const label edgeI) const
const labelList& primitiveMesh::edgeCells
(
const label edgeI,
DynamicList<label>& storage
) const
{
if (hasEdgeCells())
{
@ -62,24 +74,11 @@ const labelList& primitiveMesh::edgeCells(const label edgeI) const
const labelList& own = faceOwner();
const labelList& nei = faceNeighbour();
// edge faces can either return labels_ or reference in edgeLabels.
labelList labelsCopy;
if (!hasEdgeFaces())
{
labelsCopy = edgeFaces(edgeI);
}
// Construct edgeFaces
DynamicList<label> eFacesStorage;
const labelList& eFaces = edgeFaces(edgeI, eFacesStorage);
const labelList& eFaces =
(
hasEdgeFaces()
? edgeFaces()[edgeI]
: labelsCopy
);
labels_.size() = allocSize_;
// labels_ should certainly be big enough for edge cells.
label n = 0;
storage.clear();
// Do quadratic insertion.
forAll(eFaces, i)
@ -89,10 +88,10 @@ const labelList& primitiveMesh::edgeCells(const label edgeI) const
{
label ownCellI = own[faceI];
// Check if not already in labels_
for (label j = 0; j < n; j++)
// Check if not already in storage
forAll(storage, j)
{
if (labels_[j] == ownCellI)
if (storage[j] == ownCellI)
{
ownCellI = -1;
break;
@ -101,7 +100,7 @@ const labelList& primitiveMesh::edgeCells(const label edgeI) const
if (ownCellI != -1)
{
labels_[n++] = ownCellI;
storage.append(ownCellI);
}
}
@ -109,9 +108,9 @@ const labelList& primitiveMesh::edgeCells(const label edgeI) const
{
label neiCellI = nei[faceI];
for (label j = 0; j < n; j++)
forAll(storage, j)
{
if (labels_[j] == neiCellI)
if (storage[j] == neiCellI)
{
neiCellI = -1;
break;
@ -120,18 +119,22 @@ const labelList& primitiveMesh::edgeCells(const label edgeI) const
if (neiCellI != -1)
{
labels_[n++] = neiCellI;
storage.append(neiCellI);
}
}
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::edgeCells(const label edgeI) const
{
return edgeCells(edgeI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -41,6 +41,14 @@ const labelListList& primitiveMesh::edgeFaces() const
if (debug)
{
Pout<< "primitiveMesh::edgeFaces() : calculating edgeFaces" << endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::edgeFaces()")
<< abort(FatalError);
}
}
// Invert faceEdges
@ -52,7 +60,11 @@ const labelListList& primitiveMesh::edgeFaces() const
}
const labelList& primitiveMesh::edgeFaces(const label edgeI) const
const labelList& primitiveMesh::edgeFaces
(
const label edgeI,
DynamicList<label>& storage
) const
{
if (hasEdgeFaces())
{
@ -67,9 +79,8 @@ const labelList& primitiveMesh::edgeFaces(const label edgeI) const
label i0 = 0;
label i1 = 0;
label n = 0;
labels_.size() = allocSize_;
storage.clear();
while (i0 < pFaces0.size() && i1 < pFaces1.size())
{
@ -84,26 +95,23 @@ const labelList& primitiveMesh::edgeFaces(const label edgeI) const
else
{
// Equal. Append.
if (n == allocSize_)
{
// Have setSize copy contents so far
labels_.size() = n;
allocSize_ = allocSize_*2 + 1;
labels_.setSize(allocSize_);
}
labels_[n++] = pFaces0[i0];
storage.append(pFaces0[i0]);
++i0;
++i1;
}
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::edgeFaces(const label edgeI) const
{
return edgeFaces(edgeI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -582,11 +582,15 @@ void primitiveMesh::clearOutEdges()
deleteDemandDrivenData(pePtr_);
deleteDemandDrivenData(fePtr_);
labels_.clear();
allocSize_ = 0;
labelSet_.clear();
}
const labelList& primitiveMesh::faceEdges(const label faceI) const
const labelList& primitiveMesh::faceEdges
(
const label faceI,
DynamicList<label>& storage
) const
{
if (hasFaceEdges())
{
@ -597,34 +601,40 @@ const labelList& primitiveMesh::faceEdges(const label faceI) const
const labelListList& pointEs = pointEdges();
const face& f = faces()[faceI];
labels_.size() = allocSize_;
if (f.size() > allocSize_)
storage.clear();
if (f.size() > storage.allocSize())
{
labels_.clear();
allocSize_ = f.size();
labels_.setSize(allocSize_);
storage.setSize(f.size());
}
label n = 0;
forAll(f, fp)
{
labels_[n++] = findFirstCommonElementFromSortedLists
storage.append
(
pointEs[f[fp]],
pointEs[f.nextLabel(fp)]
findFirstCommonElementFromSortedLists
(
pointEs[f[fp]],
pointEs[f.nextLabel(fp)]
)
);
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::cellEdges(const label cellI) const
const labelList& primitiveMesh::faceEdges(const label faceI) const
{
return faceEdges(faceI, labels_);
}
const labelList& primitiveMesh::cellEdges
(
const label cellI,
DynamicList<label>& storage
) const
{
if (hasCellEdges())
{
@ -646,29 +656,29 @@ const labelList& primitiveMesh::cellEdges(const label cellI) const
}
}
labels_.size() = allocSize_;
storage.clear();
if (labelSet_.size() > allocSize_)
if (labelSet_.size() > storage.allocSize())
{
labels_.clear();
allocSize_ = labelSet_.size();
labels_.setSize(allocSize_);
storage.setSize(labelSet_.size());
}
label n =0;
forAllConstIter(labelHashSet, labelSet_, iter)
{
labels_[n++] = iter.key();
storage.append(iter.key());
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::cellEdges(const label cellI) const
{
return cellEdges(cellI, labels_);;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -43,6 +43,14 @@ void primitiveMesh::calcPointCells() const
Pout<< "primitiveMesh::calcPointCells() : "
<< "calculating pointCells"
<< endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::calcPointCells()")
<< abort(FatalError);
}
}
// It is an error to attempt to recalculate pointCells
@ -114,7 +122,11 @@ const labelListList& primitiveMesh::pointCells() const
}
const labelList& primitiveMesh::pointCells(const label pointI) const
const labelList& primitiveMesh::pointCells
(
const label pointI,
DynamicList<label>& storage
) const
{
if (hasPointCells())
{
@ -126,58 +138,48 @@ const labelList& primitiveMesh::pointCells(const label pointI) const
const labelList& nei = faceNeighbour();
const labelList& pFaces = pointFaces()[pointI];
labels_.size() = allocSize_;
label n = 0;
storage.clear();
forAll(pFaces, i)
{
const label faceI = pFaces[i];
// Append owner
if (n == allocSize_)
{
labels_.size() = n;
allocSize_ = allocSize_*2 + 1;
labels_.setSize(allocSize_);
}
labels_[n++] = own[faceI];
storage.append(own[faceI]);
// Append neighbour
if (faceI < nInternalFaces())
{
if (n == allocSize_)
{
labels_.size() = n;
allocSize_ = allocSize_*2 + 1;
labels_.setSize(allocSize_);
}
labels_[n++] = nei[faceI];
storage.append(nei[faceI]);
}
}
labels_.size() = n;
// Filter duplicates
sort(labels_);
sort(storage);
n = 1;
label n = 1;
for (label i = 1; i < labels_.size(); i++)
for (label i = 1; i < storage.size(); i++)
{
if (labels_[i] != labels_[i-1])
if (storage[i] != storage[i-1])
{
labels_[n++] = labels_[i];
storage[n++] = storage[i];
}
}
labels_.size() = n;
storage.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::pointCells(const label pointI) const
{
return pointCells(pointI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -40,6 +40,14 @@ void primitiveMesh::calcPointPoints() const
Pout<< "primitiveMesh::calcPointPoints() : "
<< "calculating pointPoints"
<< endl;
if (debug == -1)
{
// For checking calls:abort so we can quickly hunt down
// origin of call
FatalErrorIn("primitiveMesh::calcPointPoints()")
<< abort(FatalError);
}
}
// It is an error to attempt to recalculate pointPoints
@ -97,7 +105,11 @@ const labelListList& primitiveMesh::pointPoints() const
}
const labelList& primitiveMesh::pointPoints(const label pointI) const
const labelList& primitiveMesh::pointPoints
(
const label pointI,
DynamicList<label>& storage
) const
{
if (hasPointPoints())
{
@ -108,30 +120,29 @@ const labelList& primitiveMesh::pointPoints(const label pointI) const
const edgeList& edges = this->edges();
const labelList& pEdges = pointEdges()[pointI];
labels_.size() = allocSize_;
storage.clear();
if (pEdges.size() > allocSize_)
if (pEdges.size() > storage.allocSize())
{
// Set size() so memory allocation behaves as normal.
labels_.clear();
allocSize_ = pEdges.size();
labels_.setSize(allocSize_);
storage.setSize(pEdges.size());
}
label n = 0;
forAll(pEdges, i)
{
labels_[n++] = edges[pEdges[i]].otherVertex(pointI);
storage.append(edges[pEdges[i]].otherVertex(pointI));
}
labels_.size() = n;
return labels_;
return storage;
}
}
const labelList& primitiveMesh::pointPoints(const label pointI) const
{
return pointPoints(pointI, labels_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso dummy
@ -18,3 +19,4 @@ GAMMA)
;;
esac
# ----------------------------------------------------------------- end-of-file

View File

@ -1059,6 +1059,8 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
// Surfaces with zone information
const wordList& faceZoneNames = surfaces.faceZoneNames();
scalarField minSnapDist(snapDist);
forAll(zonedSurfaces, i)
{
label zoneSurfI = zonedSurfaces[i];
@ -1075,31 +1077,33 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
)
);
pointField zonePoints(zonePointIndices.size());
forAll(zonePointIndices, i)
{
zonePoints[i] = localPoints[zonePointIndices[i]];
}
// Find nearest for points both on faceZone and pp.
List<pointIndexHit> hitInfo;
labelList hitSurface;
surfaces.findNearest
(
labelList(1, zoneSurfI),
zonePoints,
sqr(4*snapDist),
pointField(localPoints, zonePointIndices),
sqr(4*scalarField(minSnapDist, zonePointIndices)),
hitSurface,
hitInfo
);
forAll(hitInfo, pointI)
forAll(hitInfo, i)
{
if (hitInfo[pointI].hit())
label pointI = zonePointIndices[i];
if (hitInfo[i].hit())
{
patchDisp[pointI] =
hitInfo[pointI].hitPoint()
hitInfo[i].hitPoint()
- localPoints[pointI];
minSnapDist[pointI] = min
(
minSnapDist[pointI],
mag(patchDisp[pointI])
);
}
else
{
@ -1107,7 +1111,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
<< "For point:" << pointI
<< " coordinate:" << localPoints[pointI]
<< " did not find any surface within:"
<< 4*snapDist[pointI]
<< 4*minSnapDist[pointI]
<< " meter." << endl;
}
}

View File

@ -514,7 +514,7 @@ void Foam::meshRefinement::markBoundaryFace
{
isBoundaryFace[faceI] = true;
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI);
forAll(fEdges, fp)
{
@ -623,12 +623,16 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// If so what is the remaining non-boundary anchor point?
labelHashSet nonBoundaryAnchors(mesh_.nCells()/10000);
// On-the-fly addressing storage.
DynamicList<label> dynFEdges;
DynamicList<label> dynCPoints;
// Count of faces marked for baffling
label nBaffleFaces = 0;
forAll(cellLevel, cellI)
{
const labelList cPoints(meshCutter_.cellPoints(cellI));
const labelList& cPoints = mesh_.cellPoints(cellI, dynCPoints);
// Get number of anchor points (pointLevel == cellLevel)
@ -714,11 +718,14 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
// Loop over all points. If a point is connected to 4 or more cells
// with 7 anchor points on the boundary set those cell's non-boundary faces
// to baffles
DynamicList<label> dynPCells;
forAllConstIter(labelHashSet, nonBoundaryAnchors, iter)
{
label pointI = iter.key();
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI, dynPCells);
// Count number of 'hasSevenBoundaryAnchorPoints' cells.
label n = 0;
@ -806,7 +813,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{
if (facePatch[faceI] == -1)
{
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI, dynFEdges);
label nFaceBoundaryEdges = 0;
forAll(fEdges, fe)
@ -840,7 +847,7 @@ Foam::labelList Foam::meshRefinement::markFacesOnProblemCells
{
if (facePatch[faceI] == -1)
{
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI, dynFEdges);
label nFaceBoundaryEdges = 0;
forAll(fEdges, fe)
@ -1239,6 +1246,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::filterDuplicateFaces
labelList nBafflesPerEdge(mesh_.nEdges(), 0);
// Count number of boundary faces per edge
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1255,7 +1263,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::filterDuplicateFaces
forAll(pp, i)
{
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI);
forAll(fEdges, fEdgeI)
{
@ -1267,19 +1275,23 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::filterDuplicateFaces
}
DynamicList<label> fe0;
DynamicList<label> fe1;
// Count number of duplicate boundary faces per edge
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(couples, i)
{
const labelList& fEdges0 = mesh_.faceEdges()[couples[i].first()];
const labelList& fEdges0 = mesh_.faceEdges(couples[i].first(), fe0);
forAll(fEdges0, fEdgeI)
{
nBafflesPerEdge[fEdges0[fEdgeI]] += 1000000;
}
const labelList& fEdges1 = mesh_.faceEdges()[couples[i].second()];
const labelList& fEdges1 = mesh_.faceEdges(couples[i].second(), fe1);
forAll(fEdges1, fEdgeI)
{
@ -1314,7 +1326,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::filterDuplicateFaces
== patches.whichPatch(couple.second())
)
{
const labelList& fEdges = mesh_.faceEdges()[couples[i].first()];
const labelList& fEdges = mesh_.faceEdges(couples[i].first());
forAll(fEdges, fEdgeI)
{

View File

@ -1,4 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso
# ----------------------------------------------------------------- end-of-file

View File

@ -79,10 +79,15 @@ Foam::Map<Foam::word> Foam::boundaryRegion::names() const
forAllConstIter(Map<dictionary>, *this, iter)
{
word value = "boundaryRegion_" + Foam::name(iter.key());
iter().readIfPresent("Label", value);
lookup.insert(iter.key(), value);
lookup.insert
(
iter.key(),
iter().lookupOrDefault<word>
(
"Label",
"boundaryRegion_" + Foam::name(iter.key())
)
);
}
return lookup;
@ -95,9 +100,11 @@ Foam::Map<Foam::word> Foam::boundaryRegion::boundaryTypes() const
forAllConstIter(Map<dictionary>, *this, iter)
{
word value = "patch";
iter().readIfPresent("BoundaryType", value);
lookup.insert(iter.key(), value);
lookup.insert
(
iter.key(),
iter().lookupOrDefault<word>("BoundaryType", "patch")
);
}
return lookup;
@ -106,15 +113,16 @@ Foam::Map<Foam::word> Foam::boundaryRegion::boundaryTypes() const
Foam::label Foam::boundaryRegion::findIndex(const word& name) const
{
if (!name.size())
{
return -1;
}
forAllConstIter(Map<dictionary>, *this, iter)
{
word theName;
if (iter().readIfPresent("Label", theName))
if (iter().lookupOrDefault<word>("Label", word::null) == name)
{
if (theName == name)
{
return iter.key();
}
return iter.key();
}
}
@ -124,13 +132,12 @@ Foam::label Foam::boundaryRegion::findIndex(const word& name) const
Foam::word Foam::boundaryRegion::boundaryType(const word& name) const
{
word bndType = "patch";
word bndType("patch");
label id = this->findIndex(name);
if (id >= 0)
{
const dictionary& dict = operator[](id);
dict.readIfPresent("BoundaryType", bndType);
operator[](id).readIfPresent<word>("BoundaryType", bndType);
}
return bndType;
@ -192,7 +199,8 @@ void Foam::boundaryRegion::writeDict
)
);
ioObj.note() = "persistent data for thirdParty mesh <-> OpenFOAM translation";
ioObj.note() =
"persistent data for thirdParty mesh <-> OpenFOAM translation";
Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
@ -218,16 +226,19 @@ void Foam::boundaryRegion::operator=(const Map<dictionary>& rhs)
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
void Foam::boundaryRegion::rename(const dictionary& dict)
void Foam::boundaryRegion::rename(const dictionary& mapDict)
{
if (!dict.size())
if (!mapDict.size())
{
return;
}
Map<word> mapping;
// Use 1st pass to collect all the regions to be changed
// and 2nd pass to relabel regions.
// This avoid re-matching any renamed regions
forAllConstIter(dictionary, dict, iter)
Map<word> mapping;
forAllConstIter(dictionary, mapDict, iter)
{
word oldName(iter().stream());
@ -238,21 +249,14 @@ void Foam::boundaryRegion::rename(const dictionary& dict)
}
}
if (mapping.size())
forAllConstIter(Map<word>, mapping, iter)
{
forAllConstIter(Map<word>, mapping, iter)
{
label id = iter.key();
word oldName(operator[](id).lookup("Label"));
word newName(iter());
dictionary& dict = operator[](iter.key());
dictionary newDict(operator[](id));
newDict.remove("Label");
newDict.add("Label", newName);
Info<< "rename patch: " << iter()
<< " <- " << word(dict.lookup("Label")) << nl;
this->set(id, newDict);
Info<< "rename patch: " << newName << " <- " << oldName << endl;
}
dict.set("Label", iter());
}
}

View File

@ -37,26 +37,17 @@ const char* const Foam::cellTable::defaultMaterial_ = "fluid";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::labelList Foam::cellTable::zoneMap() const
Foam::Map<Foam::label> Foam::cellTable::zoneMap() const
{
label maxId = 0;
forAllConstIter(Map<dictionary>, *this, iter)
{
if (maxId < iter.key())
{
maxId = iter.key();
}
}
Map<label> lookup;
label zoneI = 0;
labelList list(maxId+1, -1);
forAllConstIter(Map<dictionary>, *this, iter)
{
list[iter.key()] = zoneI++;
lookup.insert(iter.key(), zoneI++);
}
return list;
return lookup;
}
@ -65,14 +56,12 @@ Foam::wordList Foam::cellTable::namesList() const
Map<word> lookup = names();
wordList lst(lookup.size());
label n = 0;
label zoneI = 0;
forAllConstIter(Map<word>, lookup, iter)
{
lst[n] = iter();
lst[zoneI++] = iter();
}
lst.setSize(n);
return lst;
}
@ -162,11 +151,15 @@ Foam::Map<Foam::word> Foam::cellTable::names() const
forAllConstIter(Map<dictionary>, *this, iter)
{
word theName = "cellTable_" + Foam::name(iter.key());
iter().readIfPresent("Label", theName);
lookup.insert(iter.key(), theName);
lookup.insert
(
iter.key(),
iter().lookupOrDefault<word>
(
"Label",
"cellTable_" + Foam::name(iter.key())
)
);
}
return lookup;
@ -175,9 +168,9 @@ Foam::Map<Foam::word> Foam::cellTable::names() const
Foam::word Foam::cellTable::name(const label& id) const
{
const_iterator iter = find(id);
word theName("cellTable_" + Foam::name(id));
word theName = "cellTable_" + Foam::name(id);
const_iterator iter = find(id);
if (iter != end())
{
iter().readIfPresent("Label", theName);
@ -189,15 +182,16 @@ Foam::word Foam::cellTable::name(const label& id) const
Foam::label Foam::cellTable::findIndex(const word& name) const
{
if (!name.size())
{
return -1;
}
forAllConstIter(Map<dictionary>, *this, iter)
{
word theName;
if (iter().readIfPresent("Label", theName))
if (iter().lookupOrDefault<word>("Label", word::null) == name)
{
if (theName == name)
{
return iter.key();
}
return iter.key();
}
}
@ -205,26 +199,44 @@ Foam::label Foam::cellTable::findIndex(const word& name) const
}
Foam::Map<Foam::word> Foam::cellTable::selectType
(
const word& materialType
) const
Foam::Map<Foam::word> Foam::cellTable::materialTypes() const
{
Map<word> lookup;
forAllConstIter(Map<dictionary>, *this, iter)
{
word matl(defaultMaterial_);
lookup.insert
(
iter.key(),
iter().lookupOrDefault<word>("MaterialType", defaultMaterial_)
);
}
iter().readIfPresent("MaterialType", matl);
return lookup;
}
if (matl == materialType)
Foam::Map<Foam::word> Foam::cellTable::selectType(const word& matl) const
{
Map<word> lookup;
forAllConstIter(Map<dictionary>, *this, iter)
{
if
(
matl
== iter().lookupOrDefault<word>("MaterialType", defaultMaterial_)
)
{
word theName = "cellTable_" + Foam::name(iter.key());
iter().readIfPresent("Label", theName);
lookup.insert(iter.key(), theName);
lookup.insert
(
iter.key(),
iter().lookupOrDefault<word>
(
"Label",
"cellTable_" + Foam::name(iter.key())
)
);
}
}
@ -250,22 +262,6 @@ Foam::Map<Foam::word> Foam::cellTable::shells() const
}
Foam::Map<Foam::word> Foam::cellTable::materialTypes() const
{
Map<word> lookup;
forAllConstIter(Map<dictionary>, *this, iter)
{
word matlType(defaultMaterial_);
iter().readIfPresent("MaterialType", matlType);
lookup.insert(iter.key(), matlType);
}
return lookup;
}
void Foam::cellTable::setMaterial(const label& id, const word& matlType)
{
@ -346,7 +342,8 @@ void Foam::cellTable::writeDict
)
);
ioObj.note() = "persistent data for thirdParty mesh <-> OpenFOAM translation";
ioObj.note() =
"persistent data for thirdParty mesh <-> OpenFOAM translation";
Info<< "Writing " << ioObj.name() << " to " << ioObj.objectPath() << endl;
@ -406,10 +403,7 @@ void Foam::cellTable::operator=(const polyMesh& mesh)
zoneDict.insert
(
unZonedType,
dictionary
(
IStringStream("Label cells;")()
)
dictionary(IStringStream("Label cells;")())
);
}
@ -426,22 +420,21 @@ void Foam::cellTable::addCellZones
const labelList& tableIds
) const
{
labelList typeToZone = zoneMap();
wordList zoneNames = namesList();
Map<label> typeToZone = zoneMap();
List<DynamicList<label> > zoneCells(size());
forAll(tableIds, cellI)
{
label zoneI = typeToZone[tableIds[cellI]];
if (zoneI >= 0)
Map<label>::const_iterator iter = typeToZone.find(tableIds[cellI]);
if (iter != typeToZone.end())
{
zoneCells[zoneI].append(cellI);
zoneCells[iter()].append(cellI);
}
}
// avoid empty zones
// track which zones were actually used
labelList zoneUsed(zoneCells.size());
wordList zoneNames(namesList());
label nZone = 0;
forAll(zoneCells, zoneI)
@ -454,23 +447,25 @@ void Foam::cellTable::addCellZones
}
zoneUsed.setSize(nZone);
mesh.cellZones().clear();
cellZoneMesh& czMesh = mesh.cellZones();
czMesh.clear();
if (nZone <= 1)
{
Info<< "cellZones not used" << endl;
return;
}
mesh.cellZones().setSize(nZone);
czMesh.setSize(nZone);
forAll(zoneUsed, zoneI)
{
const label origZoneI = zoneUsed[zoneI];
Info<< "cellZone " << zoneI
<< " (size: " << zoneCells[origZoneI].size() << ") name: "
<< zoneNames[origZoneI] << endl;
<< " (size: " << zoneCells[origZoneI].size()
<< ") name: " << zoneNames[origZoneI] << endl;
mesh.cellZones().set
czMesh.set
(
zoneI,
new cellZone
@ -478,17 +473,17 @@ void Foam::cellTable::addCellZones
zoneNames[origZoneI],
zoneCells[origZoneI],
zoneI,
mesh.cellZones()
czMesh
)
);
}
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
czMesh.writeOpt() = IOobject::AUTO_WRITE;
}
void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds)
void Foam::cellTable::combine(const dictionary& mapDict, labelList& tableIds)
{
if (!dict.size())
if (!mapDict.size())
{
return;
}
@ -496,13 +491,13 @@ void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds)
bool remap = false;
labelList mapping(identity(max(this->toc()) + 1));
forAllConstIter (dictionary, dict, iter)
forAllConstIter (dictionary, mapDict, iter)
{
wordList zoneNames(iter().stream());
labelList zoneIndex(zoneNames.size());
label nElem = 0;
forAll (zoneNames, zoneI)
forAll(zoneNames, zoneI)
{
zoneIndex[nElem] = this->findIndex(zoneNames[zoneI]);
if (zoneIndex[nElem] >= 0)
@ -532,7 +527,7 @@ void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds)
{
Info<< " = (";
}
forAll (zoneNames, zoneI)
forAll(zoneNames, zoneI)
{
Info<< " " << zoneNames[zoneI];
}
@ -542,14 +537,10 @@ void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds)
if (targetId < 0)
{
targetId = min(zoneIndex);
dictionary newDict(operator[](targetId));
newDict.remove("Label");
newDict.add("Label", iter().keyword());
this->set(targetId, newDict);
operator[](targetId).set("Label", iter().keyword());
}
forAll (zoneIndex, zoneI)
forAll(zoneIndex, zoneI)
{
label idx = zoneIndex[zoneI];
if (idx != targetId && idx >= 0)
@ -567,5 +558,4 @@ void Foam::cellTable::combine(const dictionary& dict, labelList& tableIds)
}
}
// ************************************************************************* //

View File

@ -86,8 +86,8 @@ class cellTable
// Private Member Functions
//- Map from cellTable ID => zone number (unmapped = -1)
labelList zoneMap() const;
//- Map from cellTable ID => zone number
Map<label> zoneMap() const;
//- A contiguous list of cellTable names
List<word> namesList() const;

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso decompositionMethods

View File

@ -343,7 +343,7 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
forAllConstIter(pointSet, nbrPoints, iter)
{
const labelList& pCells = mesh_.pointCells()[iter.key()];
const labelList& pCells = mesh_.pointCells(iter.key());
forAll(pCells, pCellI)
{

View File

@ -330,15 +330,14 @@ Foam::label Foam::addPatchCellLayer::addSideFace
const label meshEdgeI, // corresponding mesh edge
const label layerI, // layer
const label numEdgeFaces, // number of layers for edge
const labelList& meshFaces, // precalculated edgeFaces
polyTopoChange& meshMod
) const
{
// Edge to 'inflate' from
label inflateEdgeI = -1;
// Mesh faces using edge
const labelList& meshFaces = mesh_.edgeFaces()[meshEdgeI];
// Check mesh faces using edge
forAll(meshFaces, i)
{
if (mesh_.isInternalFace(meshFaces[i]))
@ -620,6 +619,9 @@ void Foam::addPatchCellLayer::setRefinement
const labelList& meshPoints = pp.meshPoints();
// Some storage for edge-face-addressing.
DynamicList<label> ef;
// Precalculate mesh edges for pp.edges.
labelList meshEdges(calcMeshEdges(mesh_, pp));
@ -777,7 +779,9 @@ void Foam::addPatchCellLayer::setRefinement
label meshEdgeI = meshEdges[edgeI];
// Mesh faces using edge
const labelList& meshFaces = mesh_.edgeFaces()[meshEdgeI];
// Mesh faces using edge
const labelList& meshFaces = mesh_.edgeFaces(meshEdgeI, ef);
// Check that there is only one patchface using edge.
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -1353,6 +1357,12 @@ void Foam::addPatchCellLayer::setRefinement
patchFaceI
);
const labelList& meshFaces = mesh_.edgeFaces
(
meshEdgeI,
ef
);
addSideFace
(
pp,
@ -1365,6 +1375,7 @@ void Foam::addPatchCellLayer::setRefinement
meshEdgeI, // corresponding mesh edge
i,
numEdgeSideFaces,
meshFaces,
meshMod
);
}

View File

@ -232,6 +232,7 @@ class addPatchCellLayer
const label meshEdgeI,
const label layerI,
const label numEdgeFaces,
const labelList& meshFaces,
polyTopoChange&
) const;

View File

@ -125,11 +125,11 @@ void Foam::combineFaces::regioniseFaces
(
const scalar minCos,
const label cellI,
const labelList& cEdges,
Map<label>& faceRegion
) const
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const labelList& cEdges = mesh_.cellEdges()[cellI];
forAll(cEdges, i)
{
@ -220,9 +220,10 @@ bool Foam::combineFaces::faceNeighboursValid
return true;
}
const labelListList& faceEdges = mesh_.faceEdges();
const cell& cFaces = mesh_.cells()[cellI];
DynamicList<label> storage;
// Test for face collapsing to edge since too many neighbours merged.
forAll(cFaces, cFaceI)
{
@ -230,7 +231,7 @@ bool Foam::combineFaces::faceNeighboursValid
if (!faceRegion.found(faceI))
{
const labelList& fEdges = faceEdges[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI, storage);
// Count number of remaining faces neighbouring faceI. This has
// to be 3 or more.
@ -299,6 +300,8 @@ Foam::labelListList Foam::combineFaces::getMergeSets
{
// Lists of faces that can be merged.
DynamicList<labelList> allFaceSets(boundaryCells.size() / 10);
// Storage for on-the-fly cell-edge addressing.
DynamicList<label> storage;
// On all cells regionise the faces
forAllConstIter(labelHashSet, boundaryCells, iter)
@ -307,9 +310,11 @@ Foam::labelListList Foam::combineFaces::getMergeSets
const cell& cFaces = mesh_.cells()[cellI];
const labelList& cEdges = mesh_.cellEdges(cellI, storage);
// Region per face
Map<label> faceRegion(cFaces.size());
regioniseFaces(featureCos, cellI, faceRegion);
regioniseFaces(featureCos, cellI, cEdges, faceRegion);
// Now we have in faceRegion for every face the region with planar
// face sharing the same region. We now check whether the resulting

View File

@ -103,6 +103,7 @@ class combineFaces
(
const scalar minCos,
const label cellI,
const labelList& cEdges,
Map<label>& faceRegion
) const;

View File

@ -372,7 +372,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
{
const label cLevel = cellLevel_[cellI];
const labelList& cEdges = mesh_.cellEdges()[cellI];
const labelList& cEdges = mesh_.cellEdges(cellI);
forAll(cEdges, i)
{
@ -447,7 +447,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
{
const label cLevel = cellLevel_[cellI];
const labelList& cEdges = mesh_.cellEdges()[cellI];
const labelList& cEdges = mesh_.cellEdges(cellI);
forAll(cEdges, i)
{
@ -1190,6 +1190,10 @@ void Foam::hexRef8::createInternalFaces
// From edge mid to face mids
Map<edge> midPointToFaceMids(24);
// Storage for on-the-fly addressing
DynamicList<label> storage;
// Running count of number of internal faces added so far.
label nFacesAdded = 0;
@ -1198,7 +1202,7 @@ void Foam::hexRef8::createInternalFaces
label faceI = cFaces[i];
const face& f = mesh_.faces()[faceI];
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI, storage);
// We are on the cellI side of face f. The face will have 1 or 4
// cLevel points and lots of higher numbered ones.
@ -1299,7 +1303,7 @@ void Foam::hexRef8::createInternalFaces
{
dumpCell(cellI);
const labelList cPoints(cellPoints(cellI));
const labelList& cPoints = mesh_.cellPoints(cellI);
FatalErrorIn("createInternalFaces(..)")
<< "cell:" << cellI << " cLevel:" << cLevel
@ -1372,7 +1376,7 @@ void Foam::hexRef8::createInternalFaces
{
dumpCell(cellI);
const labelList cPoints(cellPoints(cellI));
const labelList& cPoints = mesh_.cellPoints(cellI);
FatalErrorIn("createInternalFaces(..)")
<< "cell:" << cellI << " cLevel:" << cLevel
@ -1454,7 +1458,7 @@ void Foam::hexRef8::walkFaceToMid
) const
{
const face& f = mesh_.faces()[faceI];
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI);
label fp = startFp;
@ -1503,7 +1507,7 @@ void Foam::hexRef8::walkFaceFromMid
) const
{
const face& f = mesh_.faces()[faceI];
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI);
label fp = f.rcIndex(startFp);
@ -2013,27 +2017,6 @@ Foam::hexRef8::hexRef8
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//- Get points of a cell (without using cellPoints addressing)
Foam::labelList Foam::hexRef8::cellPoints(const label cellI) const
{
// Pick up points of the cell
const cell& cFaces = mesh_.cells()[cellI];
labelHashSet cPoints(4*cFaces.size());
forAll(cFaces, i)
{
const face& f = mesh_.faces()[cFaces[i]];
forAll(f, fp)
{
cPoints.insert(f[fp]);
}
}
return cPoints.toc();
}
Foam::labelList Foam::hexRef8::consistentRefinement
(
const labelList& cellsToRefine,
@ -2358,13 +2341,11 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
// as cell level purely for ease)
labelList maxPointCount(mesh_.nPoints(), 0);
const labelListList& pointCells = mesh_.pointCells();
forAll(pointCells, pointI)
forAll(maxPointCount, pointI)
{
label& pLevel = maxPointCount[pointI];
const labelList& pCells = pointCells[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, i)
{
@ -2395,7 +2376,7 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement
// Loop over all cells using the point and check whether their
// refinement level is much less than the maximum.
const labelList& pCells = pointCells[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, pCellI)
{
@ -3121,7 +3102,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
{
if (cellMidPoint[cellI] >= 0)
{
const labelList& cEdges = mesh_.cellEdges()[cellI];
const labelList& cEdges = mesh_.cellEdges(cellI);
forAll(cEdges, i)
{
@ -3458,7 +3439,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
forAll(pointLevel_, pointI)
{
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, pCellI)
{
@ -3498,7 +3479,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
{
dumpCell(cellI);
const labelList cPoints(cellPoints(cellI));
const labelList& cPoints = mesh_.cellPoints(cellI);
FatalErrorIn
(
@ -3610,7 +3591,7 @@ Foam::labelListList Foam::hexRef8::setRefinement
{
if (edgeMidPoint[edgeI] >= 0)
{
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
const labelList& eFaces = mesh_.edgeFaces(edgeI);
forAll(eFaces, i)
{
@ -3768,13 +3749,16 @@ Foam::labelListList Foam::hexRef8::setRefinement
<< endl;
}
DynamicList<label> eFacesStorage;
DynamicList<label> fEdgesStorage;
forAll(edgeMidPoint, edgeI)
{
if (edgeMidPoint[edgeI] >= 0)
{
// Split edge. Check that face not already handled above.
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
const labelList& eFaces = mesh_.edgeFaces(edgeI, eFacesStorage);
forAll(eFaces, i)
{
@ -3785,7 +3769,11 @@ Foam::labelListList Foam::hexRef8::setRefinement
// Unsplit face. Add edge splits to face.
const face& f = mesh_.faces()[faceI];
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges
(
faceI,
fEdgesStorage
);
DynamicList<label> newFaceVerts(f.size());
@ -4715,14 +4703,12 @@ void Foam::hexRef8::checkRefinementLevels
// Check 2:1 across points (instead of faces)
if (maxPointDiff != -1)
{
const labelListList& pointCells = mesh_.pointCells();
// Determine per point the max cell level.
labelList maxPointLevel(mesh_.nPoints(), 0);
forAll(pointCells, pointI)
forAll(maxPointLevel, pointI)
{
const labelList& pCells = pointCells[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
label& pLevel = maxPointLevel[pointI];
@ -4747,7 +4733,7 @@ void Foam::hexRef8::checkRefinementLevels
{
label pointI = pointsToCheck[i];
const labelList& pCells = pointCells[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, i)
{
@ -4881,11 +4867,11 @@ Foam::labelList Foam::hexRef8::getSplitPoints() const
labelList splitMasterLevel(mesh_.nPoints(), 0);
// Unmark all with not 8 cells
const labelListList& pointCells = mesh_.pointCells();
//const labelListList& pointCells = mesh_.pointCells();
forAll(pointCells, pointI)
for (label pointI = 0; pointI < mesh_.nPoints(); pointI++)
{
const labelList& pCells = pointCells[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
if (pCells.size() != 8)
{
@ -4898,8 +4884,7 @@ Foam::labelList Foam::hexRef8::getSplitPoints() const
forAll(visibleCells, cellI)
{
//const labelList& cPoints = mesh_.cellPoints()[cellI];
const labelList cPoints(cellPoints(cellI));
const labelList& cPoints = mesh_.cellPoints(cellI);
if (visibleCells[cellI] != -1 && history_.parentIndex(cellI) >= 0)
{
@ -5104,7 +5089,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
{
if (unrefinePoint.get(pointI) == 1)
{
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, j)
{
@ -5244,7 +5229,7 @@ Foam::labelList Foam::hexRef8::consistentUnrefinement
{
if (unrefinePoint.get(pointI) == 1)
{
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
forAll(pCells, j)
{
@ -5329,7 +5314,7 @@ void Foam::hexRef8::setUnrefinement
forAll(splitPointLabels, i)
{
const labelList& pCells = mesh_.pointCells()[splitPointLabels[i]];
const labelList& pCells = mesh_.pointCells(splitPointLabels[i]);
forAll(pCells, j)
{
@ -5395,7 +5380,7 @@ void Foam::hexRef8::setUnrefinement
// Get original cell label
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
// Check
if (pCells.size() != 8)
@ -5463,7 +5448,7 @@ void Foam::hexRef8::setUnrefinement
{
label pointI = splitPointLabels[i];
const labelList& pCells = mesh_.pointCells()[pointI];
const labelList& pCells = mesh_.pointCells(pointI);
label masterCellI = min(pCells);

View File

@ -370,9 +370,6 @@ public:
// Refinement
//- Helper:get points of a cell without using cellPoints addressing
labelList cellPoints(const label cellI) const;
//- Given valid mesh and current cell level and proposed
// cells to refine calculate any clashes (due to 2:1) and return
// ok list of cells to refine.

View File

@ -83,6 +83,7 @@ Foam::label Foam::removeFaces::changeFaceRegion
const labelList& nFacesPerEdge,
const label faceI,
const label newRegion,
const labelList& fEdges,
labelList& faceRegion
) const
{
@ -94,27 +95,33 @@ Foam::label Foam::removeFaces::changeFaceRegion
nChanged = 1;
// Storage for on-the-fly addressing
DynamicList<label> fe;
DynamicList<label> ef;
// Step to neighbouring faces across edges that will get removed
const labelList& fEdges = mesh_.faceEdges()[faceI];
forAll(fEdges, i)
{
label edgeI = fEdges[i];
if (nFacesPerEdge[edgeI] >= 0 && nFacesPerEdge[edgeI] <= 2)
{
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
const labelList& eFaces = mesh_.edgeFaces(edgeI, ef);
forAll(eFaces, j)
{
label nbrFaceI = eFaces[j];
const labelList& fEdges1 = mesh_.faceEdges(nbrFaceI, fe);
nChanged += changeFaceRegion
(
cellRegion,
removedFace,
nFacesPerEdge,
eFaces[j],
nbrFaceI,
newRegion,
fEdges1,
faceRegion
);
}
@ -166,7 +173,7 @@ Foam::boolList Foam::removeFaces::getFacesAffected
// Mark faces affected by removal of edges
forAllConstIter(labelHashSet, edgesToRemove, iter)
{
const labelList& eFaces = mesh_.edgeFaces()[iter.key()];
const labelList& eFaces = mesh_.edgeFaces(iter.key());
forAll(eFaces, eFaceI)
{
@ -814,6 +821,10 @@ void Foam::removeFaces::setRefinement
// Number of connected face regions
label nRegions = 0;
// Storage for on-the-fly addressing
DynamicList<label> fe;
DynamicList<label> ef;
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
@ -827,7 +838,7 @@ void Foam::removeFaces::setRefinement
{
label faceI = faceLabels[i];
const labelList& fEdges = mesh_.faceEdges()[faceI];
const labelList& fEdges = mesh_.faceEdges(faceI, fe);
forAll(fEdges, i)
{
@ -835,8 +846,7 @@ void Foam::removeFaces::setRefinement
if (nFacesPerEdge[edgeI] == -1)
{
nFacesPerEdge[edgeI] =
mesh_.edgeFaces()[edgeI].size()-1;
nFacesPerEdge[edgeI] = mesh_.edgeFaces(edgeI, ef).size()-1;
}
else
{
@ -849,16 +859,15 @@ void Foam::removeFaces::setRefinement
// Note that this only needs to be done for possibly coupled edges
// so we could choose to loop only over boundary faces and use faceEdges
// of those.
const labelListList& edgeFaces = mesh_.edgeFaces();
forAll(edgeFaces, edgeI)
forAll(mesh_.edges(), edgeI)
{
if (nFacesPerEdge[edgeI] == -1)
{
// Edge not yet handled in loop above so is not used by any
// face to be removed.
const labelList& eFaces = edgeFaces[edgeI];
const labelList& eFaces = mesh_.edgeFaces(edgeI, ef);
if (eFaces.size() > 2)
{
@ -922,7 +931,7 @@ void Foam::removeFaces::setRefinement
label f0 = -1;
label f1 = -1;
const labelList& eFaces = mesh_.edgeFaces()[edgeI];
const labelList& eFaces = mesh_.edgeFaces(edgeI, ef);
forAll(eFaces, i)
{
@ -1152,6 +1161,7 @@ void Foam::removeFaces::setRefinement
nFacesPerEdge,
startFaceI,
nRegions,
mesh_.faceEdges(startFaceI, fe),
faceRegion
);

View File

@ -93,6 +93,7 @@ class removeFaces
const labelList& nFacesPerEdge,
const label faceI,
const label newRegion,
const labelList& fEdges,
labelList& faceRegion
) const;

View File

@ -73,6 +73,7 @@ $(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityF
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/fixedFluxBuoyantPressure/fixedFluxBuoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/freestream/freestreamFvPatchFields.C

View File

@ -3,20 +3,11 @@
int nOuterCorr(readInt(pimple.lookup("nOuterCorrectors")));
int nCorr(readInt(pimple.lookup("nCorrectors")));
int nNonOrthCorr = 0;
if (pimple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(pimple.lookup("nNonOrthogonalCorrectors"));
}
int nNonOrthCorr =
pimple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor = true;
if (pimple.found("momentumPredictor"))
{
momentumPredictor = Switch(pimple.lookup("momentumPredictor"));
}
bool momentumPredictor =
pimple.lookupOrDefault<Switch>("momentumPredictor", true);
bool transonic = false;
if (pimple.found("transonic"))
{
transonic = Switch(pimple.lookup("transonic"));
}
bool transonic =
pimple.lookupOrDefault<Switch>("transonic", false);

View File

@ -2,32 +2,18 @@
int nCorr(readInt(piso.lookup("nCorrectors")));
int nNonOrthCorr = 0;
if (piso.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(piso.lookup("nNonOrthogonalCorrectors"));
}
int nNonOrthCorr =
piso.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor = true;
if (piso.found("momentumPredictor"))
{
momentumPredictor = Switch(piso.lookup("momentumPredictor"));
}
bool momentumPredictor =
piso.lookupOrDefault<Switch>("momentumPredictor", true);
bool transonic = false;
if (piso.found("transonic"))
{
transonic = Switch(piso.lookup("transonic"));
}
bool transonic =
piso.lookupOrDefault<Switch>("transonic", false);
int nOuterCorr = 1;
if (piso.found("nOuterCorrectors"))
{
nOuterCorr = readInt(piso.lookup("nOuterCorrectors"));
}
int nOuterCorr =
piso.lookupOrDefault<int>("nOuterCorrectors", 1);
bool ddtPhiCorr =
piso.lookupOrDefault<Switch>("ddtPhiCorr", false);
bool ddtPhiCorr = false;
if (piso.found("ddtPhiCorr"))
{
ddtPhiCorr = Switch(piso.lookup("ddtPhiCorr"));
}

View File

@ -1,25 +1,14 @@
dictionary simple = mesh.solutionDict().subDict("SIMPLE");
int nNonOrthCorr = 0;
if (simple.found("nNonOrthogonalCorrectors"))
{
nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors"));
}
int nNonOrthCorr =
simple.lookupOrDefault<int>("nNonOrthogonalCorrectors", 0);
bool momentumPredictor = true;
if (simple.found("momentumPredictor"))
{
momentumPredictor = Switch(simple.lookup("momentumPredictor"));
}
bool momentumPredictor =
simple.lookupOrDefault<Switch>("momentumPredictor", true);
bool fluxGradp = false;
if (simple.found("fluxGradp"))
{
fluxGradp = Switch(simple.lookup("fluxGradp"));
}
bool fluxGradp =
simple.lookupOrDefault<Switch>("fluxGradp", false);
bool transonic =
simple.lookupOrDefault<Switch>("transonic", false);
bool transonic = false;
if (simple.found("transonic"))
{
transonic = Switch(simple.lookup("transonic"));
}

View File

@ -40,11 +40,7 @@ scalar maxCo
readScalar(runTime.controlDict().lookup("maxCo"))
);
scalar maxDeltaT = GREAT;
if (runTime.controlDict().found("maxDeltaT"))
(
maxDeltaT = readScalar(runTime.controlDict().lookup("maxDeltaT"))
);
scalar maxDeltaT =
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);
// ************************************************************************* //

View File

@ -47,8 +47,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
)
:
mixedFvPatchField<Type>(p, iF),
phiName_("Undefined"),
rhoName_("Undefined"),
phiName_("phi"),
rhoName_("rho"),
fieldInf_(pTraits<Type>::zero),
lInf_(0.0)
{
@ -84,8 +84,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
)
:
mixedFvPatchField<Type>(p, iF),
phiName_(dict.lookup("phi")),
rhoName_("Undefined"),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
fieldInf_(pTraits<Type>::zero),
lInf_(0.0)
{
@ -105,15 +105,9 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 0.0;
if (dict.found("rho"))
{
dict.lookup("rho") >> rhoName_;
}
if (dict.found("lInf"))
if (dict.readIfPresent("lInf", lInf_))
{
dict.lookup("fieldInf") >> fieldInf_;
dict.lookup("lInf") >> lInf_;
if (lInf_ < 0.0)
{
@ -123,8 +117,8 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
"advectiveFvPatchField"
"(const fvPatch&, const Field<Type>&, const dictionary&)",
dict
) << "unphysical lInf_ specified (lInf_ < 0)"
<< "\n on patch " << this->patch().name()
) << "unphysical lInf specified (lInf < 0)\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
@ -167,7 +161,7 @@ advectiveFvPatchField<Type>::advectiveFvPatchField
template<class Type>
tmp<scalarField> advectiveFvPatchField<Type>::advectionSpeed() const
{
const surfaceScalarField& phi =
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip = this->patch().lookupPatchField
@ -210,7 +204,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
);
scalar deltaT = this->db().time().deltaT().value();
const GeometricField<Type, fvPatchField, volMesh>& field =
const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry::
lookupObject<GeometricField<Type, fvPatchField, volMesh> >
(
@ -239,7 +233,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
|| ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName
)
{
this->refValue() =
this->refValue() =
(
field.oldTime().boundaryField()[patchi] + k*fieldInf_
)/(1.0 + k);
@ -314,9 +308,12 @@ template<class Type>
void advectiveFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
if (rhoName_ != "Undefined")
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
@ -324,9 +321,9 @@ void advectiveFvPatchField<Type>::write(Ostream& os) const
if (lInf_ > SMALL)
{
os.writeKeyword("fieldInf") << fieldInf_
<< token::END_STATEMENT << endl;
<< token::END_STATEMENT << nl;
os.writeKeyword("lInf") << lInf_
<< token::END_STATEMENT << endl;
<< token::END_STATEMENT << nl;
}
this->writeEntry("value", os);

View File

@ -238,11 +238,11 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
const word& fieldName = dimensionedInternalField().name();
const volVectorField& UField = db().lookupObject<volVectorField>(fieldName);
surfaceScalarField& phiField =
const_cast<surfaceScalarField&>
(
db().lookupObject<surfaceScalarField>(phiName_)
);
surfaceScalarField& phiField = const_cast<surfaceScalarField&>
(
db().lookupObject<surfaceScalarField>(phiName_)
);
switch (mpp.mode())
{

View File

@ -52,11 +52,9 @@ void fanFvPatchField<scalar>::updateCoeffs()
if (f_.size() > 1)
{
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
(
"phi"
);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -30,28 +30,23 @@ License
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_("Undefined"),
phiName_("Undefined"),
rhoName_("Undefined"),
UName_("U"),
phiName_("phi"),
rhoName_("rho"),
adjoint_(false)
{}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
(
const fixedFluxPressureFvPatchScalarField& ptf,
const fvPatch& p,
@ -67,7 +62,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
{}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -75,9 +70,9 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_(dict.lookup("U")),
phiName_(dict.lookup("phi")),
rhoName_(dict.lookup("rho")),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
adjoint_(dict.lookup("adjoint"))
{
if (dict.found("gradient"))
@ -94,7 +89,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
(
const fixedFluxPressureFvPatchScalarField& wbppsf
)
@ -107,7 +102,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
{}
fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
(
const fixedFluxPressureFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
@ -123,7 +118,7 @@ fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fixedFluxPressureFvPatchScalarField::updateCoeffs()
void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -133,8 +128,9 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs()
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);
const surfaceScalarField& phi =
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip =
patch().patchField<surfaceScalarField, scalar>(phi);
@ -162,12 +158,21 @@ void fixedFluxPressureFvPatchScalarField::updateCoeffs()
}
void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
gradient().writeEntry("gradient", os);
}
@ -175,10 +180,13 @@ void fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, fixedFluxPressureFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
fixedFluxPressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "fixedInternalValueFvPatchField.H"
#include "fvPatchFieldMapper.H"
#include "fvMatrix.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
zeroGradientFvPatchField<Type>(p, iF)
{}
template<class Type>
Foam::fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
zeroGradientFvPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
Foam::fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
zeroGradientFvPatchField<Type>(p, iF, dict)
{
fvPatchField<Type>::operator=(this->patchInternalField());
}
template<class Type>
Foam::fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField& fivpf
)
:
zeroGradientFvPatchField<Type>(fivpf)
{}
template<class Type>
Foam::fixedInternalValueFvPatchField<Type>::fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField& fivpf,
const DimensionedField<Type, volMesh>& iF
)
:
zeroGradientFvPatchField<Type>(fivpf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fixedInternalValueFvPatchField<Type>::manipulateMatrix
(
fvMatrix<Type>& matrix
)
{
// Apply the patch internal field as a constraint in the matrix
matrix.setValues(this->patch().faceCells(), this->patchInternalField());
}
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::fixedInternalValueFvPatchField
Description
Boundary condition providing mechanism to set boundary (cell) values
directly into a matrix, i.e. to set a constraint condition. Default
behaviour is to act as a zero gradient condition.
SourceFiles
fixedInternalValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef fixedInternalValueFvPatchField_H
#define fixedInternalValueFvPatchField_H
#include "zeroGradientFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fixedInternalValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class fixedInternalValueFvPatchField
:
public zeroGradientFvPatchField<Type>
{
public:
//- Runtime type information
TypeName("fixedInternalValue");
// Constructors
//- Construct from patch and internal field
fixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
fixedInternalValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping the given fixedInternalValueFvPatchField<Type>
// onto a new patch
fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new fixedInternalValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
fixedInternalValueFvPatchField
(
const fixedInternalValueFvPatchField<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 fixedInternalValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//-Manipulate a matrix
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "fixedInternalValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,16 +24,22 @@ License
\*---------------------------------------------------------------------------*/
#include "checkLock.H"
#include "fixedInternalValueFvPatchFields.H"
#include "fvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
globalCheckLock incompressibleTurbulenceModelsLock
(
"incompressibleTurbulenceModels"
);
}
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(fixedInternalValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef fixedInternalValueFvPatchFields_H
#define fixedInternalValueFvPatchFields_H
#include "fixedInternalValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(fixedInternalValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -75,19 +75,9 @@ flowRateInletVelocityFvPatchVectorField
:
fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(readScalar(dict.lookup("flowRate"))),
phiName_("phi"),
rhoName_("rho")
{
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("rho"))
{
dict.lookup("rho") >> rhoName_;
}
}
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{}
Foam::
@ -133,10 +123,8 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
vectorField n = patch().nf();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
(
phiName_
);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVelocity*dimArea)
{
@ -170,20 +158,15 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
void Foam::flowRateInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_
<< token::END_STATEMENT << nl;
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os);
}

View File

@ -32,12 +32,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fluxCorrectedVelocityFvPatchVectorField::
Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField
(
const fvPatch& p,
@ -50,7 +47,7 @@ fluxCorrectedVelocityFvPatchVectorField
{}
fluxCorrectedVelocityFvPatchVectorField::
Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField
(
const fluxCorrectedVelocityFvPatchVectorField& ptf,
@ -65,7 +62,7 @@ fluxCorrectedVelocityFvPatchVectorField
{}
fluxCorrectedVelocityFvPatchVectorField::
Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField
(
const fvPatch& p,
@ -81,7 +78,7 @@ fluxCorrectedVelocityFvPatchVectorField
}
fluxCorrectedVelocityFvPatchVectorField::
Foam::fluxCorrectedVelocityFvPatchVectorField::
fluxCorrectedVelocityFvPatchVectorField
(
const fluxCorrectedVelocityFvPatchVectorField& fcvpvf,
@ -96,7 +93,7 @@ fluxCorrectedVelocityFvPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fluxCorrectedVelocityFvPatchVectorField::evaluate
void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
(
const Pstream::commsTypes
)
@ -130,9 +127,12 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate
}
else
{
FatalErrorIn("fluxCorrectedVelocityFvPatchVectorField::evaluate()")
<< "dimensions of phi are not correct"
<< "\n on patch " << this->patch().name()
FatalErrorIn
(
"fluxCorrectedVelocityFvPatchVectorField::evaluate()"
)
<< "dimensions of phi are incorrect\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
@ -140,25 +140,30 @@ void fluxCorrectedVelocityFvPatchVectorField::evaluate
}
void fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const
void Foam::fluxCorrectedVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchVectorField,
fluxCorrectedVelocityFvPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
fluxCorrectedVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -72,7 +72,7 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
)
:
mixedFvPatchField<Type>(p, iF),
phiName_("phi")
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
this->refValue() = Field<Type>("inletValue", dict, p.size());
@ -90,11 +90,6 @@ inletOutletFvPatchField<Type>::inletOutletFvPatchField
this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 0.0;
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
}
@ -150,8 +145,7 @@ void inletOutletFvPatchField<Type>::write(Ostream& os) const
fvPatchField<Type>::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi")
<< phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
this->refValue().writeEntry("inletValue", os);
this->writeEntry("value", os);

View File

@ -32,12 +32,9 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inletOutletTotalTemperatureFvPatchScalarField::
Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField
(
const fvPatch& p,
@ -45,9 +42,9 @@ inletOutletTotalTemperatureFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
UName_(),
phiName_(),
psiName_(),
UName_("U"),
phiName_("phi"),
psiName_("psi"),
gamma_(0.0),
T0_(p.size(), 0.0)
{
@ -57,7 +54,7 @@ inletOutletTotalTemperatureFvPatchScalarField
}
inletOutletTotalTemperatureFvPatchScalarField::
Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField
(
const inletOutletTotalTemperatureFvPatchScalarField& ptf,
@ -75,7 +72,7 @@ inletOutletTotalTemperatureFvPatchScalarField
{}
inletOutletTotalTemperatureFvPatchScalarField::
Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField
(
const fvPatch& p,
@ -84,9 +81,9 @@ inletOutletTotalTemperatureFvPatchScalarField
)
:
mixedFvPatchScalarField(p, iF),
UName_(dict.lookup("U")),
phiName_(dict.lookup("phi")),
psiName_(dict.lookup("psi")),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size())
{
@ -108,7 +105,7 @@ inletOutletTotalTemperatureFvPatchScalarField
}
inletOutletTotalTemperatureFvPatchScalarField::
Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField
(
const inletOutletTotalTemperatureFvPatchScalarField& tppsf
@ -123,7 +120,7 @@ inletOutletTotalTemperatureFvPatchScalarField
{}
inletOutletTotalTemperatureFvPatchScalarField::
Foam::inletOutletTotalTemperatureFvPatchScalarField::
inletOutletTotalTemperatureFvPatchScalarField
(
const inletOutletTotalTemperatureFvPatchScalarField& tppsf,
@ -141,7 +138,7 @@ inletOutletTotalTemperatureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void inletOutletTotalTemperatureFvPatchScalarField::autoMap
void Foam::inletOutletTotalTemperatureFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
@ -151,7 +148,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::autoMap
}
void inletOutletTotalTemperatureFvPatchScalarField::rmap
void Foam::inletOutletTotalTemperatureFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
@ -166,7 +163,7 @@ void inletOutletTotalTemperatureFvPatchScalarField::rmap
}
void inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -192,13 +189,22 @@ void inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
}
void inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const
void Foam::inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);
writeEntry("value", os);
}
@ -206,14 +212,13 @@ void inletOutletTotalTemperatureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
inletOutletTotalTemperatureFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
inletOutletTotalTemperatureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -115,7 +115,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
const volVectorField& U = db().lookupObject<volVectorField>("U");
scalarField phip =
scalarField phip =
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
vectorField n = p.nf();

View File

@ -196,8 +196,14 @@ void pressureDirectedInletOutletVelocityFvPatchVectorField::
write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}

View File

@ -184,8 +184,14 @@ void pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
void pressureDirectedInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
inletDir_.writeEntry("inletDirection", os);
writeEntry("value", os);
}

View File

@ -80,15 +80,10 @@ pressureInletOutletVelocityFvPatchVectorField
)
:
directionMixedFvPatchVectorField(p, iF),
phiName_("phi")
phiName_(dict.lookupOrDefault<word>("phi", "phi"))
{
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
if (dict.found("phi"))
{
dict.lookup("phi") >> phiName_;
}
if (dict.found("tangentialVelocity"))
{
setTangentialVelocity
@ -193,7 +188,10 @@ void pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletOutletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (tangentialVelocity_.size())
{
tangentialVelocity_.writeEntry("tangentialVelocity", os);

View File

@ -109,10 +109,8 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs()
return;
}
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
(
phiName_
);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
@ -148,8 +146,14 @@ void pressureInletVelocityFvPatchVectorField::updateCoeffs()
void pressureInletVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (rhoName_ != "rho")
{
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
}
writeEntry("value", os);
}

View File

@ -123,7 +123,7 @@ void pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -198,10 +198,8 @@ void syringePressureFvPatchScalarField::updateCoeffs()
scalar t = db().time().value();
scalar deltaT = db().time().deltaT().value();
const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>
(
"phi"
);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);

View File

@ -95,7 +95,7 @@ timeVaryingMappedFixedValueFvPatchField
{
if (debug)
{
Pout<< "timeVarying<appedFixedValue"
Pout<< "timeVaryingMappedFixedValue"
<< " : construct from mappedFixedValue and mapper" << endl;
}
}

View File

@ -40,13 +40,13 @@ timeVaryingUniformTotalPressureFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("undefined"),
phiName_("undefined"),
rhoName_("undefined"),
psiName_("undefined"),
UName_("U"),
phiName_("phi"),
rhoName_("none"),
psiName_("none"),
gamma_(0.0),
p0_(0.0),
totalPressureTimeSeries_()
timeSeries_()
{}
@ -59,13 +59,13 @@ timeVaryingUniformTotalPressureFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")),
phiName_(dict.lookup("phi")),
rhoName_(dict.lookup("rho")),
psiName_(dict.lookup("psi")),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none")),
psiName_(dict.lookupOrDefault<word>("psi", "none")),
gamma_(readScalar(dict.lookup("gamma"))),
p0_(readScalar(dict.lookup("p0"))),
totalPressureTimeSeries_(dict)
timeSeries_(dict)
{
if (dict.found("value"))
{
@ -97,7 +97,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(ptf.psiName_),
gamma_(ptf.gamma_),
p0_(ptf.p0_),
totalPressureTimeSeries_(ptf.totalPressureTimeSeries_)
timeSeries_(ptf.timeSeries_)
{}
@ -114,7 +114,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
p0_(tppsf.p0_),
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_)
timeSeries_(tppsf.timeSeries_)
{}
@ -132,7 +132,7 @@ timeVaryingUniformTotalPressureFvPatchScalarField
psiName_(tppsf.psiName_),
gamma_(tppsf.gamma_),
p0_(tppsf.p0_),
totalPressureTimeSeries_(tppsf.totalPressureTimeSeries_)
timeSeries_(tppsf.timeSeries_)
{}
@ -148,7 +148,7 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
return;
}
p0_ = totalPressureTimeSeries_(this->db().time().timeOutputValue());
p0_ = timeSeries_(this->db().time().timeOutputValue());
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
@ -194,11 +194,11 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs
(
"timeVaryingUniformTotalPressureFvPatchScalarField::updateCoeffs()"
) << " rho or psi set inconsitently, rho = " << rhoName_
<< ", psi = " << psiName_ << '.' << nl
<< ", psi = " << psiName_ << ".\n"
<< " Set either rho or psi or neither depending on the "
"definition of total pressure." << nl
<< " Set the unused variables to 'none'."
<< "\n on patch " << this->patch().name()
"definition of total pressure.\n"
<< " Set the unused variables to 'none'.\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
@ -218,13 +218,19 @@ void Foam::timeVaryingUniformTotalPressureFvPatchScalarField::
write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
os.writeKeyword("p0") << p0_ << token::END_STATEMENT << endl;
totalPressureTimeSeries_.write(os);
os.writeKeyword("p0") << p0_ << token::END_STATEMENT << nl;
timeSeries_.write(os);
writeEntry("value", os);
}

View File

@ -77,8 +77,8 @@ class timeVaryingUniformTotalPressureFvPatchScalarField
//- Total pressure
scalar p0_;
//- Table of time vs total pressure
interpolationTable<scalar> totalPressureTimeSeries_;
//- Table of time vs total pressure, including the bounding treatment
interpolationTable<scalar> timeSeries_;
public:
@ -192,7 +192,7 @@ public:
//- Return the time series used
const interpolationTable<scalar>& totalPressureTimeSeries() const
{
return totalPressureTimeSeries_;
return timeSeries_;
}

View File

@ -32,28 +32,25 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("undefined"),
phiName_("undefined"),
rhoName_("undefined"),
psiName_("undefined"),
UName_("U"),
phiName_("phi"),
rhoName_("none"),
psiName_("none"),
gamma_(0.0),
p0_(p.size(), 0.0)
{}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -61,10 +58,10 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")),
phiName_(dict.lookup("phi")),
rhoName_(dict.lookup("rho")),
psiName_(dict.lookup("psi")),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none")),
psiName_(dict.lookupOrDefault<word>("psi", "none")),
gamma_(readScalar(dict.lookup("gamma"))),
p0_("p0", dict, p.size())
{
@ -82,7 +79,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
(
const totalPressureFvPatchScalarField& ptf,
const fvPatch& p,
@ -100,7 +97,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
{}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
(
const totalPressureFvPatchScalarField& tppsf
)
@ -115,7 +112,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
{}
totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
(
const totalPressureFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
@ -133,7 +130,7 @@ totalPressureFvPatchScalarField::totalPressureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void totalPressureFvPatchScalarField::autoMap
void Foam::totalPressureFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
@ -143,7 +140,7 @@ void totalPressureFvPatchScalarField::autoMap
}
void totalPressureFvPatchScalarField::rmap
void Foam::totalPressureFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
@ -158,7 +155,7 @@ void totalPressureFvPatchScalarField::rmap
}
void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
void Foam::totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
{
if (updated())
{
@ -208,12 +205,12 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
FatalErrorIn
(
"totalPressureFvPatchScalarField::updateCoeffs()"
) << " rho or psi set inconsitently, rho = " << rhoName_
<< ", psi = " << psiName_ << '.' << nl
) << " rho or psi set inconsistently, rho = " << rhoName_
<< ", psi = " << psiName_ << ".\n"
<< " Set either rho or psi or neither depending on the "
"definition of total pressure." << nl
<< " Set the unused variables to 'none'."
<< "\n on patch " << this->patch().name()
<< " Set the unused variable(s) to 'none'.\n"
<< " on patch " << this->patch().name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
@ -223,20 +220,26 @@ void totalPressureFvPatchScalarField::updateCoeffs(const vectorField& Up)
}
void totalPressureFvPatchScalarField::updateCoeffs()
void Foam::totalPressureFvPatchScalarField::updateCoeffs()
{
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_));
}
void totalPressureFvPatchScalarField::write(Ostream& os) const
void Foam::totalPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
p0_.writeEntry("p0", os);
writeEntry("value", os);
}
@ -244,10 +247,13 @@ void totalPressureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, totalPressureFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
totalPressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -32,27 +32,24 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
UName_("Undefined"),
phiName_("Undefined"),
psiName_("Undefined"),
UName_("U"),
phiName_("phi"),
psiName_("psi"),
gamma_(0.0),
T0_(p.size(), 0.0)
{}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
(
const totalTemperatureFvPatchScalarField& ptf,
const fvPatch& p,
@ -69,7 +66,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
{}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -77,9 +74,9 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
)
:
fixedValueFvPatchScalarField(p, iF),
UName_(dict.lookup("U")),
phiName_(dict.lookup("phi")),
psiName_(dict.lookup("psi")),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size())
{
@ -97,7 +94,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
(
const totalTemperatureFvPatchScalarField& tppsf
)
@ -111,7 +108,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
{}
totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
(
const totalTemperatureFvPatchScalarField& tppsf,
const DimensionedField<scalar, volMesh>& iF
@ -128,7 +125,7 @@ totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void totalTemperatureFvPatchScalarField::autoMap
void Foam::totalTemperatureFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
@ -138,7 +135,7 @@ void totalTemperatureFvPatchScalarField::autoMap
}
void totalTemperatureFvPatchScalarField::rmap
void Foam::totalTemperatureFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
@ -153,7 +150,7 @@ void totalTemperatureFvPatchScalarField::rmap
}
void totalTemperatureFvPatchScalarField::updateCoeffs()
void Foam::totalTemperatureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
@ -180,13 +177,22 @@ void totalTemperatureFvPatchScalarField::updateCoeffs()
}
void totalTemperatureFvPatchScalarField::write(Ostream& os) const
void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
if (UName_ != "U")
{
os.writeKeyword("U") << UName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
if (phiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
T0_.writeEntry("T0", os);
writeEntry("value", os);
}
@ -194,10 +200,13 @@ void totalTemperatureFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, totalTemperatureFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
totalTemperatureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -30,14 +30,9 @@ License
#include "surfaceFields.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField
(
const fvPatch& p,
@ -48,7 +43,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(0.05)
{}
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField
(
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf,
@ -61,7 +56,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(ptf.intensity_)
{}
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField
(
const fvPatch& p,
@ -90,7 +85,7 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
}
}
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField
(
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf
@ -100,7 +95,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
intensity_(ptf.intensity_)
{}
turbulentIntensityKineticEnergyInletFvPatchScalarField::
Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
turbulentIntensityKineticEnergyInletFvPatchScalarField
(
const turbulentIntensityKineticEnergyInletFvPatchScalarField& ptf,
@ -114,7 +110,8 @@ turbulentIntensityKineticEnergyInletFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs()
void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::
updateCoeffs()
{
if (updated())
{
@ -130,7 +127,7 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::updateCoeffs()
}
void turbulentIntensityKineticEnergyInletFvPatchScalarField::write
void Foam::turbulentIntensityKineticEnergyInletFvPatchScalarField::write
(
Ostream& os
) const
@ -143,15 +140,13 @@ void turbulentIntensityKineticEnergyInletFvPatchScalarField::write
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
turbulentIntensityKineticEnergyInletFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
turbulentIntensityKineticEnergyInletFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
)
:
advectiveFvPatchField<Type>(p, iF),
psiName_("Undefined"),
psiName_("psi"),
gamma_(0.0)
{}
@ -76,7 +76,7 @@ waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField
)
:
advectiveFvPatchField<Type>(p, iF, dict),
psiName_(dict.lookup("psi")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
gamma_(readScalar(dict.lookup("gamma")))
{}
@ -119,7 +119,7 @@ tmp<scalarField> waveTransmissiveFvPatchField<Type>::advectionSpeed() const
reinterpret_cast<const scalar*>(NULL)
);
const surfaceScalarField& phi =
const surfaceScalarField& phi =
this->db().objectRegistry::lookupObject<surfaceScalarField>
(this->phiName_);
@ -153,22 +153,27 @@ template<class Type>
void waveTransmissiveFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
if (this->rhoName_ != "Undefined")
if (this->phiName_ != "phi")
{
os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl;
}
if (this->rhoName_ != "rho")
{
os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << endl;
if (psiName_ != "psi")
{
os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl;
if (this->lInf_ > SMALL)
{
os.writeKeyword("fieldInf") << this->fieldInf_
<< token::END_STATEMENT << endl;
os.writeKeyword("lInf") << this->lInf_
<< token::END_STATEMENT << endl;
<< token::END_STATEMENT << nl;
os.writeKeyword("lInf") << this->lInf_
<< token::END_STATEMENT << nl;
}
this->writeEntry("value", os);

View File

@ -28,6 +28,7 @@ License
#include "dictionary.H"
#include "fvMesh.H"
#include "fvPatchFieldMapper.H"
//#include "fvMatrices.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -223,6 +224,13 @@ void Foam::fvPatchField<Type>::evaluate(const Pstream::commsTypes)
}
template<class Type>
void Foam::fvPatchField<Type>::manipulateMatrix(fvMatrix<Type>& matrix)
{
// do nothing
}
template<class Type>
void Foam::fvPatchField<Type>::write(Ostream& os) const
{

View File

@ -27,12 +27,12 @@ Class
Description
Abstract base class with a fat-interface to all derived classes
covering all possible ways in which they might be used.
covering all possible ways in which they might be used.
The first level of derivation is to basic patchFields which cover
zero-gradient, fixed-gradient, fixed-value and mixed conditions.
The next level of derivation covers all the specialised typed with
The next level of derivation covers all the specialised types with
specific evaluation proceedures, particularly with respect to specific
fields.
@ -66,6 +66,9 @@ class volMesh;
template<class Type>
class fvPatchField;
template<class Type>
class fvMatrix;
template<class Type>
Ostream& operator<<(Ostream&, const fvPatchField<Type>&);
@ -407,6 +410,10 @@ public:
}
//- Manipulate matrix
virtual void manipulateMatrix(fvMatrix<Type>& matrix);
//- Write
virtual void write(Ostream&) const;

View File

@ -592,6 +592,20 @@ void Foam::fvMatrix<Type>::relax()
}
template<class Type>
void Foam::fvMatrix<Type>::boundaryManipulate
(
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& bFields
)
{
forAll(bFields, patchI)
{
bFields[patchI].manipulateMatrix(*this);
}
}
template<class Type>
Foam::tmp<Foam::scalarField> Foam::fvMatrix<Type>::D() const
{

View File

@ -351,6 +351,13 @@ public:
// alpha is read from controlDict
void relax();
//- Manipulate based on a boundary field
void boundaryManipulate
(
typename GeometricField<Type, fvPatchField, volMesh>::
GeometricBoundaryField& values
);
//- Construct and return the solver
// Solver controls read from Istream
autoPtr<fvSolver> solver(Istream&);
@ -387,7 +394,7 @@ public:
//- Return the face-flux field from the matrix
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
flux() const;
flux() const;
// Member operators

View File

@ -83,11 +83,11 @@ void Foam::wallDistData<TransferType>::correct()
labelHashSet wallPatchIDs(getPatchIDs(wallPolyPatch::typeName));
// Collect pointers to data on patches
List<Field<Type>*> patchData(mesh.boundaryMesh().size());
UPtrList<Field<Type> > patchData(mesh.boundaryMesh().size());
forAll(field_.boundaryField(), patchI)
{
patchData[patchI] = &(field_.boundaryField()[patchI]);
patchData.set(patchI, &field_.boundaryField()[patchI]);
}
// Do mesh wave

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso basic
@ -8,3 +9,4 @@ wmake libso dieselSpray
(cd molecularDynamics && wmake libso potential)
(cd molecularDynamics && wmake libso molecule)
# ----------------------------------------------------------------- end-of-file

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "patchDataWave.H"
@ -50,8 +48,7 @@ void Foam::patchDataWave<TransferType>::setChangedFaces
{
const polyPatch& patch = mesh.boundaryMesh()[patchI];
const Field<Type>& patchField =
*initialPatchValuePtrs_[patchI];
const Field<Type>& patchField = initialPatchValuePtrs_[patchI];
forAll(patch.faceCentres(), patchFaceI)
{
@ -176,7 +173,7 @@ Foam::patchDataWave<TransferType>::patchDataWave
(
const polyMesh& mesh,
const labelHashSet& patchIDs,
const List<Field<Type>*>& initialPatchValuePtrs,
const UPtrList<Field<Type> >& initialPatchValuePtrs,
const bool correctWalls
)
:

View File

@ -45,7 +45,7 @@ SourceFiles
#include "cellDistFuncs.H"
#include "FieldField.H"
#include "UPtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,7 +78,7 @@ private:
labelHashSet patchIDs_;
//- Reference to initial extra data at patch faces
const List<Field<Type>*>& initialPatchValuePtrs_;
const UPtrList<Field<Type> >& initialPatchValuePtrs_;
//- Do accurate distance calculation for near-wall cells.
bool correctWalls_;
@ -129,7 +129,7 @@ public:
(
const polyMesh& mesh,
const labelHashSet& patchIDs,
const List<Field<Type>*>& initialPatchValuePtrs,
const UPtrList<Field<Type> >& initialPatchValuePtrs,
bool correctWalls = true
);

View File

@ -133,18 +133,12 @@ Foam::EulerCoordinateRotation::EulerCoordinateRotation
{
vector rotation(dict.lookup("rotation"));
bool inDegrees = true;
if (dict.found("degrees"))
{
inDegrees = Switch(dict.lookup("degrees"));
}
calcTransform
(
rotation.component(vector::X),
rotation.component(vector::Y),
rotation.component(vector::Z),
inDegrees
dict.lookupOrDefault<Switch>("degrees", true)
);
}

View File

@ -134,18 +134,12 @@ Foam::STARCDCoordinateRotation::STARCDCoordinateRotation
{
vector rotation(dict.lookup("rotation"));
bool inDegrees = true;
if (dict.found("degrees"))
{
inDegrees = Switch(dict.lookup("degrees"));
}
calcTransform
(
rotation.component(vector::X),
rotation.component(vector::Y),
rotation.component(vector::Z),
inDegrees
dict.lookupOrDefault<Switch>("degrees", true)
);
}

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libo postCalc
@ -6,4 +7,4 @@ wmake libso forces
wmake libso fieldAverage
wmake libso foamCalcFunctions
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso specie
@ -16,3 +17,4 @@ wmake libso pdfs
wmake libso radiation
wmake libso barotropicCompressibilityModel
# ----------------------------------------------------------------- end-of-file

View File

@ -105,6 +105,23 @@ private:
//- Disallow default bitwise assignment
void operator=(const chemistryModel&);
protected:
// Protected Member Functions
//- Write access to chemical source terms
// (eg, for multi-chemistry model)
PtrList<scalarField>& RR()
{
return RR_;
}
//- Return the latest estimation of integration step
// (eg, for multi-chemistry model)
scalarField& deltaTChem()
{
return deltaTChem_;
}
public:

View File

@ -1,6 +1,9 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso incompressible
wmake libso interfaceProperties
#wmake libso compressible
# wmake libso compressible
# ----------------------------------------------------------------- end-of-file

View File

@ -1,5 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
( cd RAS && ./Allwmake )
( cd LES && ./Allwmake )
# ----------------------------------------------------------------- end-of-file

View File

@ -1,4 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso LESfilters
@ -6,3 +7,5 @@ wmakeLnInclude incompressible
wmake libso LESdeltas
wmake libso incompressible
wmake libso compressible
# ----------------------------------------------------------------- end-of-file

Some files were not shown because too many files have changed in this diff Show More