mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop
This commit is contained in:
3
applications/test/objectRegistry/Make/files
Normal file
3
applications/test/objectRegistry/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-objectRegistry.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-objectRegistry
|
||||
2
applications/test/objectRegistry/Make/options
Normal file
2
applications/test/objectRegistry/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = -I$(LIB_SRC)/cfdTools/include */
|
||||
/* EXE_LIBS = -lfiniteVolume */
|
||||
278
applications/test/objectRegistry/Test-objectRegistry.C
Normal file
278
applications/test/objectRegistry/Test-objectRegistry.C
Normal file
@ -0,0 +1,278 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-objectRegistry
|
||||
|
||||
Description
|
||||
Simple test of objectRegistry functionality.
|
||||
Particular focus on the behaviour of subRegistry.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IOstreams.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "hashedWordList.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// file variable, needed for switching the default in lookupObject etc.
|
||||
bool recursive = false;
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& printList(Foam::Ostream& os, const UList<Type>& list)
|
||||
{
|
||||
// list with out any linebreaks
|
||||
os << '(';
|
||||
forAll(list, i)
|
||||
{
|
||||
if (i) os << ' ';
|
||||
os << list[i];
|
||||
}
|
||||
os << ')';
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
void printRegistry
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::objectRegistry& obr,
|
||||
Foam::label indent = 4
|
||||
);
|
||||
|
||||
|
||||
void printRegistry
|
||||
(
|
||||
Foam::Ostream& os,
|
||||
const Foam::objectRegistry& obr,
|
||||
Foam::label indent
|
||||
)
|
||||
{
|
||||
hashedWordList regs = obr.names<objectRegistry>();
|
||||
regs.sort();
|
||||
wordList names = obr.sortedNames();
|
||||
|
||||
std::string prefix;
|
||||
for (label i=indent; i; --i)
|
||||
{
|
||||
prefix += ' ';
|
||||
}
|
||||
|
||||
os << '#' << prefix.c_str() << obr.name()
|
||||
<< " parent:" << obr.parent().name() << nl;
|
||||
|
||||
// all names
|
||||
{
|
||||
os << ' ' << prefix.c_str() << "objects: ";
|
||||
printList(os, names) << nl;
|
||||
}
|
||||
|
||||
// sub-registry names
|
||||
{
|
||||
os << ' ' << prefix.c_str() << "registries: ";
|
||||
printList(os, regs) << nl;
|
||||
}
|
||||
|
||||
// Print, but skip expansion of sub-registries for now
|
||||
forAll(names, i)
|
||||
{
|
||||
const word& name = names[i];
|
||||
|
||||
os << (regs.found(name) ? '-' : ' ')
|
||||
<< prefix.c_str() << name << " => " << obr[name]->type() << nl;
|
||||
}
|
||||
for (label i=indent; i; --i)
|
||||
{
|
||||
os << '-'; // divider
|
||||
}
|
||||
os << '\n';
|
||||
|
||||
// Now descend into the sub-registries
|
||||
forAll(regs, i)
|
||||
{
|
||||
const word& name = regs[i];
|
||||
const objectRegistry& next = obr.lookupObject<objectRegistry>
|
||||
(
|
||||
name
|
||||
);
|
||||
|
||||
os << prefix.c_str()
|
||||
<< "current:" << obr.name() << " next:"
|
||||
<< next.name() << " next-parent:" << next.parent().name() << nl;
|
||||
|
||||
os << prefix.c_str() << name << " => " << obr[name]->type();
|
||||
|
||||
if ("dictionary" == obr[name]->type())
|
||||
{
|
||||
os << " (skip dictionary)" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << nl;
|
||||
printRegistry(os, next, indent + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::addBoolOption
|
||||
(
|
||||
"mesh",
|
||||
"test with polyMesh objectRegistry instead of runTime"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"skip",
|
||||
"skip some parts"
|
||||
);
|
||||
// argList::validArgs.append("recursive (true|false)");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
// recursive = Switch(args[1]);
|
||||
|
||||
const bool optMesh = args.optionFound("mesh");
|
||||
const bool optSkip = args.optionFound("skip");
|
||||
const objectRegistry& db = (optMesh ? mesh.thisDb() : runTime);
|
||||
|
||||
Info<<"## start ##" << nl;
|
||||
printRegistry(Info, db);
|
||||
Info<< nl;
|
||||
|
||||
const label nRegs = 3;
|
||||
|
||||
// Add some items
|
||||
for (label j = 0; j < 3; ++j)
|
||||
{
|
||||
word entryName = "entry" + name(j);
|
||||
db.subRegistry
|
||||
(
|
||||
entryName,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
Info<<"## initally populated ##" << nl;
|
||||
printRegistry(Info, db);
|
||||
Info<< nl;
|
||||
|
||||
|
||||
// create a few sub-registries
|
||||
for (label i = 0; i < nRegs; ++i)
|
||||
{
|
||||
word regName = "subreg" + name(i);
|
||||
|
||||
const objectRegistry& subreg = db.subRegistry
|
||||
(
|
||||
regName,
|
||||
true
|
||||
);
|
||||
|
||||
for (label j = 0; j < 3; ++j)
|
||||
{
|
||||
word entryName = "entry" + name(j);
|
||||
|
||||
subreg.subRegistry
|
||||
(
|
||||
entryName,
|
||||
true
|
||||
);
|
||||
subreg.subRegistry
|
||||
(
|
||||
"$" + entryName, // qualified to avoid collisions
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Info<<"## after adding sub-registries" << nl;
|
||||
printRegistry(Info, db);
|
||||
Info<< nl;
|
||||
|
||||
// Add further items into top-level
|
||||
for (label j = 0; j < 6; ++j)
|
||||
{
|
||||
word entryName = "entry" + name(j);
|
||||
db.subRegistry
|
||||
(
|
||||
entryName,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "after adding some entries, top-level now contains: ";
|
||||
printList(Info, db.names()) << endl;
|
||||
|
||||
Info<<"## Now attempt to add a few more entries ##" << nl;
|
||||
|
||||
// Try adding the same items into sub registry
|
||||
// create a few sub-registries
|
||||
for (label i = 0; i < nRegs; ++i)
|
||||
{
|
||||
word regName = "subreg" + name(i);
|
||||
|
||||
const objectRegistry& subreg = db.subRegistry
|
||||
(
|
||||
regName,
|
||||
false
|
||||
);
|
||||
|
||||
if (!optSkip)
|
||||
{
|
||||
for (label j = 0; j < 6; ++j)
|
||||
{
|
||||
word entryName = "entry" + name(j);
|
||||
|
||||
subreg.subRegistry
|
||||
(
|
||||
entryName,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<<"## Complete picture ##" << nl;
|
||||
printRegistry(Info, db);
|
||||
Info<< nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -148,6 +148,15 @@ int main(int argc, char *argv[])
|
||||
dictPath =
|
||||
runTime.constant()
|
||||
/regionPath/polyMesh::meshSubDir/dictName;
|
||||
|
||||
// Warn that constant/polyMesh/blockMesh was selected instead of
|
||||
// system/blockMesh
|
||||
WarningIn(args[0])
|
||||
<< "Using the old blockMeshDict location: "
|
||||
<< dictPath << nl
|
||||
<< " instead of the default location: "
|
||||
<< runTime.system()/regionPath/dictName << nl
|
||||
<< endl;
|
||||
}
|
||||
// Otherwise assume the dictionary is present in the system directory
|
||||
else
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
wclean libso vtkPVReaders
|
||||
PVblockMeshReader/Allwclean
|
||||
|
||||
@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
# deal with client/server vs combined plugins
|
||||
rm -f $FOAM_LIBBIN/libPVFoamReader* 2>/dev/null
|
||||
|
||||
@ -7,29 +7,49 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
# Ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
set -x
|
||||
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
|
||||
|
||||
# CMake into objectsDir,
|
||||
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
|
||||
doCmake()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
|
||||
findObjectDir $sourceDir # Where are generated files stored?
|
||||
test -f "$objectsDir/CMakeCache.txt"
|
||||
retry=$? # CMakeCache.txt exists, but sources may have moved
|
||||
|
||||
mkdir -p $objectsDir && \
|
||||
(
|
||||
cd $objectsDir || exit 1
|
||||
|
||||
cmake $sourceDir || {
|
||||
if [ $retry -eq 0 ]
|
||||
then
|
||||
echo "Removing CMakeCache.txt and attempt again"
|
||||
rm -f CMakeCache.txt
|
||||
cmake $sourceDir
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
} && make
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if [ -d "$ParaView_DIR" ]
|
||||
then
|
||||
wmake $targetType vtkPVFoam
|
||||
|
||||
if [ "$targetType" != "objects" ]
|
||||
if [ "$targetType" != objects ]
|
||||
then
|
||||
sourceDir=$PWD/PVFoamReader
|
||||
|
||||
# Where are any generated files stored?
|
||||
findObjectDir $sourceDir
|
||||
(
|
||||
mkdir -p $objectsDir \
|
||||
&& cd $objectsDir \
|
||||
&& cmake $sourceDir \
|
||||
&& make
|
||||
) || {
|
||||
doCmake $PWD/PVFoamReader || {
|
||||
echo
|
||||
echo " WARNING: incomplete build of ParaView OpenFOAM plugin"
|
||||
echo
|
||||
echo "WARNING: incomplete build of ParaView OpenFOAM plugin"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
${c++LESSWARN} \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
|
||||
@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
set -x
|
||||
#set -x
|
||||
|
||||
# deal with client/server vs combined plugins
|
||||
rm -f $FOAM_LIBBIN/libPVblockMeshReader* 2>/dev/null
|
||||
|
||||
@ -11,25 +11,45 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
set -x
|
||||
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
|
||||
|
||||
# CMake into objectsDir,
|
||||
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
|
||||
doCmake()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
|
||||
findObjectDir $sourceDir # Where are generated files stored?
|
||||
test -f "$objectsDir/CMakeCache.txt"
|
||||
retry=$? # CMakeCache.txt exists, but sources may have moved
|
||||
|
||||
mkdir -p $objectsDir && \
|
||||
(
|
||||
cd $objectsDir || exit 1
|
||||
|
||||
cmake $sourceDir || {
|
||||
if [ $retry -eq 0 ]
|
||||
then
|
||||
echo "Removing CMakeCache.txt and attempt again"
|
||||
rm -f CMakeCache.txt
|
||||
cmake $sourceDir
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
} && make
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if [ -d "$ParaView_DIR" ]
|
||||
then
|
||||
wmake $targetType vtkPVblockMesh
|
||||
|
||||
if [ "$targetType" != "objects" ]
|
||||
if [ "$targetType" != objects ]
|
||||
then
|
||||
sourceDir=$PWD/PVblockMeshReader
|
||||
|
||||
# Where are any generated files stored?
|
||||
findObjectDir $sourceDir
|
||||
(
|
||||
mkdir -p $objectsDir \
|
||||
&& cd $objectsDir \
|
||||
&& cmake $sourceDir \
|
||||
&& make
|
||||
) || {
|
||||
doCmake $PWD/PVblockMeshReader || {
|
||||
echo
|
||||
echo " WARNING: incomplete build of ParaView BlockMesh plugin"
|
||||
echo
|
||||
echo "WARNING: incomplete build of ParaView BlockMesh plugin"
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
${c++LESSWARN} \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
EXE_INC = \
|
||||
${c++LESSWARN} \
|
||||
-I$(ParaView_INCLUDE_DIR) \
|
||||
-I$(ParaView_INCLUDE_DIR)/vtkkwiml
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Use other (shipped) paraview.csh with a different ParaView_VERSION
|
||||
# Use other (shipped) paraview with a different ParaView_VERSION
|
||||
#
|
||||
|
||||
set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config.csh/paraview`
|
||||
|
||||
@ -60,6 +60,12 @@ case OPENMPI:
|
||||
# Tell OpenMPI where to find its install directory
|
||||
setenv OPAL_PREFIX $MPI_ARCH_PATH
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "Using OPENMPI:"
|
||||
echo " OPAL_PREFIX : $OPAL_PREFIX"
|
||||
echo " FOAM_MPI : $FOAM_MPI"
|
||||
endif
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin
|
||||
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
_foamAddMan $MPI_ARCH_PATH/share/man
|
||||
@ -111,8 +117,8 @@ case SYSTEMMPI:
|
||||
|
||||
case MPICH:
|
||||
setenv FOAM_MPI mpich2-1.1.1p1
|
||||
setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
|
||||
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
|
||||
setenv MPI_HOME $MPI_ARCH_PATH
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin
|
||||
|
||||
|
||||
@ -41,17 +41,17 @@
|
||||
# If using a central installation not located under ThirdParty, you will
|
||||
# need to set some environment values directly. For example,
|
||||
#
|
||||
# setenv ParaView_DIR /opt/paraview/paraview-5.2.0
|
||||
# setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-5.2
|
||||
# setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-5.2
|
||||
# setenv ParaView_DIR /opt/paraview/paraview-5.0.1
|
||||
# setenv ParaView_INCLUDE_DIR $ParaView_DIR/include/paraview-5.0
|
||||
# setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-5.0
|
||||
#
|
||||
# setenv PATH ${ParaView_DIR}/bin:${PATH}
|
||||
# setenv LD_LIBRARY_PATH ${ParaView_DIR}/lib/paraview-5.2:${LD_LIBRARY_PATH}
|
||||
# setenv LD_LIBRARY_PATH ${ParaView_DIR}/lib/paraview-5.0:${LD_LIBRARY_PATH}
|
||||
# unsetenv ParaView_VERSION # avoid using ThirdParty settings
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
setenv ParaView_VERSION 5.2.0
|
||||
setenv ParaView_VERSION 5.0.1
|
||||
setenv ParaView_MAJOR detect # Automatically determine major version
|
||||
|
||||
set cmake_version=cmake-system
|
||||
@ -66,7 +66,8 @@ if ( $status == 0 ) setenv PATH $cleaned
|
||||
# ThirdParty cmake
|
||||
set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version
|
||||
if ( -r $cmake/bin/cmake ) then
|
||||
_foamAddPath $cmake/bin
|
||||
# _foamAddPath not available when foamPV alias is used
|
||||
setenv PATH $cmake/bin:${PATH}
|
||||
endif
|
||||
|
||||
# Evaluate command-line parameters for ParaView
|
||||
@ -101,12 +102,11 @@ if ( $?ParaView_VERSION ) then
|
||||
|
||||
set pvName=ParaView-$ParaView_VERSION
|
||||
set pvMajor=paraview-$ParaView_MAJOR
|
||||
set pvSrcDir=$WM_THIRD_PARTY_DIR/$pvName
|
||||
|
||||
setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$pvName
|
||||
|
||||
# Set paths if binaries or source are present
|
||||
if ( -r $ParaView_DIR || -r $pvSrcDir ) then
|
||||
# Set paths if binaries are present
|
||||
if ( -r $ParaView_DIR ) then
|
||||
set pvLibDir=${ParaView_DIR}/lib/$pvMajor
|
||||
set pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
|
||||
@ -132,13 +132,18 @@ if ( $?ParaView_VERSION ) then
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
|
||||
endif
|
||||
else
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "No paraview found"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
endif
|
||||
|
||||
unsetenv ParaView_INCLUDE_DIR PV_PLUGIN_PATH
|
||||
setenv ParaView_DIR # Defined but empty (used by foamPV alias)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
unset cleaned cmake cmake_version pvName pvMajor pvSrcDir pvLibDir pvPython
|
||||
unsetenv ParaView_VERSION ParaView_MAJOR
|
||||
unset cleaned cmake cmake_version pvName pvMajor pvLibDir pvPython
|
||||
unsetenv ParaView_MAJOR ParaView_VERSION
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -63,6 +63,13 @@ OPENMPI)
|
||||
# Tell OpenMPI where to find its install directory
|
||||
export OPAL_PREFIX=$MPI_ARCH_PATH
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "Using OPENMPI:" 1>&2
|
||||
echo " OPAL_PREFIX : $OPAL_PREFIX" 1>&2
|
||||
echo " FOAM_MPI : $FOAM_MPI" 1>&2
|
||||
fi
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin
|
||||
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
_foamAddMan $MPI_ARCH_PATH/share/man
|
||||
@ -118,8 +125,8 @@ SYSTEMMPI)
|
||||
|
||||
MPICH)
|
||||
export FOAM_MPI=mpich2-1.1.1p1
|
||||
export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
|
||||
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
|
||||
export MPI_HOME=$MPI_ARCH_PATH
|
||||
|
||||
_foamAddPath $MPI_ARCH_PATH/bin
|
||||
|
||||
|
||||
@ -41,17 +41,20 @@
|
||||
# If using a central installation not located under ThirdParty, you will
|
||||
# need to set some environment values directly. For example,
|
||||
#
|
||||
# export ParaView_DIR=/opt/paraview/paraview-5.2.0
|
||||
# export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-5.2
|
||||
# export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-5.2
|
||||
# export ParaView_DIR=/opt/paraview/paraview-5.0.1
|
||||
# export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-5.0
|
||||
# export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-5.0
|
||||
#
|
||||
# export PATH=$ParaView_DIR/bin:$PATH
|
||||
# export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-5.2:$LD_LIBRARY_PATH
|
||||
# export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-5.0:$LD_LIBRARY_PATH
|
||||
# unset ParaView_VERSION # avoid using ThirdParty settings
|
||||
#
|
||||
# Note
|
||||
# When _foamAddLib is unset (eg, called from makeParaView or from foamPV):
|
||||
# - the ParaView_VERSION variable is retained.
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
ParaView_VERSION=5.2.0
|
||||
ParaView_VERSION=5.0.1
|
||||
ParaView_MAJOR=detect # Automatically determine major version
|
||||
|
||||
cmake_version=cmake-system
|
||||
@ -70,7 +73,8 @@ cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \
|
||||
cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake_version
|
||||
if [ -r $cmake/bin/cmake ]
|
||||
then
|
||||
_foamAddPath $cmake/bin
|
||||
# _foamAddPath not available when foamPV function is used
|
||||
PATH=$cmake/bin:$PATH
|
||||
fi
|
||||
|
||||
# Evaluate command-line parameters for ParaView
|
||||
@ -112,12 +116,11 @@ then
|
||||
|
||||
pvName=ParaView-$ParaView_VERSION
|
||||
pvMajor=paraview-$ParaView_MAJOR
|
||||
pvSrcDir=$WM_THIRD_PARTY_DIR/$pvName
|
||||
|
||||
export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$pvName
|
||||
|
||||
# Set paths if binaries or source are present
|
||||
if [ -r $ParaView_DIR -o -r $pvSrcDir ]
|
||||
if [ -r $ParaView_DIR ]
|
||||
then
|
||||
pvLibDir=$ParaView_DIR/lib/$pvMajor
|
||||
pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
||||
@ -147,13 +150,24 @@ then
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
|
||||
fi
|
||||
else
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "No paraview found"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
fi
|
||||
|
||||
unset ParaView_DIR ParaView_INCLUDE_DIR PV_PLUGIN_PATH
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
unset -f _foamParaviewEval
|
||||
unset cleaned cmake cmake_version pvName pvMajor pvSrcDir pvLibDir pvPython
|
||||
unset ParaView_VERSION ParaView_MAJOR
|
||||
unset cleaned cmake cmake_version pvName pvMajor pvLibDir pvPython
|
||||
unset ParaView_MAJOR
|
||||
|
||||
if type _foamAddLib > /dev/null 2>&1 # normal sourcing
|
||||
then
|
||||
unset ParaView_VERSION
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -76,8 +76,6 @@ template<class T> class IndirectList;
|
||||
template<class T> class UIndirectList;
|
||||
template<class T> class BiIndirectList;
|
||||
|
||||
typedef UList<label> unallocLabelList;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class List Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -77,7 +77,8 @@ Foam::functionObjects::timeControl::timeControl
|
||||
),
|
||||
executeControl_(t, dict, "execute"),
|
||||
writeControl_(t, dict, "write"),
|
||||
foPtr_(functionObject::New(name, t, dict_))
|
||||
foPtr_(functionObject::New(name, t, dict_)),
|
||||
executeTimeIndex_(-1)
|
||||
{
|
||||
readControls();
|
||||
}
|
||||
@ -89,6 +90,7 @@ bool Foam::functionObjects::timeControl::execute()
|
||||
{
|
||||
if (active() && (postProcess || executeControl_.execute()))
|
||||
{
|
||||
executeTimeIndex_ = time_.timeIndex();
|
||||
foPtr_->execute();
|
||||
}
|
||||
|
||||
@ -100,6 +102,13 @@ bool Foam::functionObjects::timeControl::write()
|
||||
{
|
||||
if (active() && (postProcess || writeControl_.execute()))
|
||||
{
|
||||
// Ensure written results reflect the current state
|
||||
if (executeTimeIndex_ != time_.timeIndex())
|
||||
{
|
||||
executeTimeIndex_ = time_.timeIndex();
|
||||
foPtr_->execute();
|
||||
}
|
||||
|
||||
foPtr_->write();
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +99,9 @@ class timeControl
|
||||
//- The functionObject to execute
|
||||
autoPtr<functionObject> foPtr_;
|
||||
|
||||
//- Time index of the last execute call
|
||||
label executeTimeIndex_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ void Foam::LduMatrix<Type, DType, LUType>::sumA
|
||||
{
|
||||
if (interfaces_.set(patchi))
|
||||
{
|
||||
const unallocLabelList& pa = lduAddr().patchAddr(patchi);
|
||||
const labelUList& pa = lduAddr().patchAddr(patchi);
|
||||
const Field<LUType>& pCoeffs = interfacesUpper_[patchi];
|
||||
|
||||
forAll(pa, face)
|
||||
|
||||
@ -34,8 +34,8 @@ void Foam::LduMatrix<Type, DType, LUType>::sumDiag()
|
||||
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
|
||||
Field<DType>& Diag = diag();
|
||||
|
||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||
const unallocLabelList& u = lduAddr().upperAddr();
|
||||
const labelUList& l = lduAddr().lowerAddr();
|
||||
const labelUList& u = lduAddr().upperAddr();
|
||||
|
||||
for (label face=0; face<l.size(); face++)
|
||||
{
|
||||
@ -52,8 +52,8 @@ void Foam::LduMatrix<Type, DType, LUType>::negSumDiag()
|
||||
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
|
||||
Field<DType>& Diag = diag();
|
||||
|
||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||
const unallocLabelList& u = lduAddr().upperAddr();
|
||||
const labelUList& l = lduAddr().lowerAddr();
|
||||
const labelUList& u = lduAddr().upperAddr();
|
||||
|
||||
for (label face=0; face<l.size(); face++)
|
||||
{
|
||||
@ -72,8 +72,8 @@ void Foam::LduMatrix<Type, DType, LUType>::sumMagOffDiag
|
||||
const Field<LUType>& Lower = const_cast<const LduMatrix&>(*this).lower();
|
||||
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
|
||||
|
||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||
const unallocLabelList& u = lduAddr().upperAddr();
|
||||
const labelUList& l = lduAddr().lowerAddr();
|
||||
const labelUList& u = lduAddr().upperAddr();
|
||||
|
||||
for (label face = 0; face < l.size(); face++)
|
||||
{
|
||||
@ -135,9 +135,9 @@ Foam::LduMatrix<Type, DType, LUType>::faceH(const Field<Type>& psi) const
|
||||
const Field<LUType>& Lower = const_cast<const LduMatrix&>(*this).lower();
|
||||
const Field<LUType>& Upper = const_cast<const LduMatrix&>(*this).upper();
|
||||
|
||||
// Take refereces to addressing
|
||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||
const unallocLabelList& u = lduAddr().upperAddr();
|
||||
// Take references to addressing
|
||||
const labelUList& l = lduAddr().lowerAddr();
|
||||
const labelUList& u = lduAddr().upperAddr();
|
||||
|
||||
tmp<Field<Type>> tfaceHpsi(new Field<Type> (Lower.size()));
|
||||
Field<Type> & faceHpsi = tfaceHpsi();
|
||||
@ -413,8 +413,8 @@ void Foam::LduMatrix<Type, DType, LUType>::operator*=
|
||||
Field<LUType>& upper = this->upper();
|
||||
Field<LUType>& lower = this->lower();
|
||||
|
||||
const unallocLabelList& l = lduAddr().lowerAddr();
|
||||
const unallocLabelList& u = lduAddr().upperAddr();
|
||||
const labelUList& l = lduAddr().lowerAddr();
|
||||
const labelUList& u = lduAddr().upperAddr();
|
||||
|
||||
for (label face=0; face<upper.size(); face++)
|
||||
{
|
||||
|
||||
@ -113,9 +113,6 @@ protected:
|
||||
//- Build primitive patch
|
||||
void calcFaceZonePatch() const;
|
||||
|
||||
//- Return map of local face indices
|
||||
const Map<label>& faceLookupMap() const;
|
||||
|
||||
//- Calculate master and slave face layer
|
||||
void calcCellLayers() const;
|
||||
|
||||
|
||||
@ -204,7 +204,8 @@ Foam::Function1Types::CSV<Type>::CSV
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const word& ext
|
||||
const word& ext,
|
||||
const fileName& fName
|
||||
)
|
||||
:
|
||||
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
|
||||
@ -214,7 +215,7 @@ Foam::Function1Types::CSV<Type>::CSV
|
||||
componentColumns_(coeffs_.lookup("componentColumns")),
|
||||
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
||||
mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))),
|
||||
fName_(coeffs_.lookup("fileName"))
|
||||
fName_(fName != fileName::null ? fName : coeffs_.lookup("fileName"))
|
||||
{
|
||||
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||
{
|
||||
|
||||
@ -122,7 +122,8 @@ public:
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict,
|
||||
const word& ext = "Coeffs"
|
||||
const word& ext = "Coeffs",
|
||||
const fileName& fName = fileName::null
|
||||
);
|
||||
|
||||
//- Copy constructor
|
||||
|
||||
@ -258,9 +258,9 @@ void Foam::ensightMesh::correct()
|
||||
Foam::sort(selectZones);
|
||||
|
||||
// Count face types in each selected faceZone
|
||||
forAll(selectZones, zoneI)
|
||||
forAll(selectZones, zonei)
|
||||
{
|
||||
const word& zoneName = selectZones[zoneI];
|
||||
const word& zoneName = selectZones[zonei];
|
||||
const label zoneID = mesh_.faceZones().findZoneID(zoneName);
|
||||
const faceZone& fz = mesh_.faceZones()[zoneID];
|
||||
|
||||
@ -342,12 +342,12 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
(
|
||||
pp.meshPoints(),
|
||||
pp.meshPointMap(),
|
||||
pointToGlobal,
|
||||
uniqueMeshPointLabels
|
||||
pointToGlobal, // local patch point to unique global index
|
||||
uniqueMeshPointLabels // unique global points
|
||||
);
|
||||
|
||||
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
|
||||
// Renumber the patch faces
|
||||
// Renumber the patch faces,
|
||||
// from local patch indexing to unique global index
|
||||
faceList patchFaces(pp.localFaces());
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
@ -359,7 +359,7 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
ensFaces.index(),
|
||||
patchName,
|
||||
globalPointsPtr().size(),
|
||||
uniquePoints,
|
||||
pointField(mesh_.points(), uniqueMeshPointLabels),
|
||||
os
|
||||
);
|
||||
|
||||
@ -391,30 +391,28 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
uniqueMeshPointLabels
|
||||
);
|
||||
|
||||
pointField uniquePoints(mesh_.points(), uniqueMeshPointLabels);
|
||||
|
||||
primitiveFacePatch facePatch
|
||||
// Make a copy in the proper order
|
||||
primitiveFacePatch pp
|
||||
(
|
||||
faceList(mesh_.faces(), ensFaces.faceIds()),
|
||||
mesh_.points()
|
||||
);
|
||||
|
||||
const boolList& flip = ensFaces.flipMap();
|
||||
forAll(facePatch[faceI], faceI)
|
||||
forAll(pp, facei)
|
||||
{
|
||||
if (flip[faceI])
|
||||
if (flip[facei])
|
||||
{
|
||||
facePatch[faceI].flip();
|
||||
pp[facei].flip();
|
||||
}
|
||||
}
|
||||
|
||||
// Faces belonging to the faceZone, in local numbering
|
||||
faceList localFaces(facePatch.localFaces());
|
||||
|
||||
// Renumber the faceZone master faces
|
||||
forAll(localFaces, i)
|
||||
// Renumber the faces belonging to the faceZone,
|
||||
// from local numbering to unique global index
|
||||
faceList patchFaces(pp.localFaces());
|
||||
forAll(patchFaces, i)
|
||||
{
|
||||
inplaceRenumber(pointToGlobal, localFaces[i]);
|
||||
inplaceRenumber(pointToGlobal, patchFaces[i]);
|
||||
}
|
||||
|
||||
writeAllPoints
|
||||
@ -422,11 +420,11 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const
|
||||
ensFaces.index(),
|
||||
zoneName,
|
||||
globalPointsPtr().size(),
|
||||
uniquePoints,
|
||||
pointField(mesh_.points(), uniqueMeshPointLabels),
|
||||
os
|
||||
);
|
||||
|
||||
writeFaceConnectivity(ensFaces, localFaces, os, true);
|
||||
writeFaceConnectivity(ensFaces, patchFaces, os, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,27 +55,42 @@ class ensightOutput
|
||||
{
|
||||
// Private Methods
|
||||
|
||||
template<class Type>
|
||||
static void writeField
|
||||
//- Write field content (component-wise) for the given ensight element type
|
||||
template<template<typename> class FieldContainer, class Type>
|
||||
static void writeFieldContent
|
||||
(
|
||||
const char* key,
|
||||
const FieldContainer<Type>& fld,
|
||||
ensightFile& os
|
||||
);
|
||||
|
||||
//- Write a field of faces values as an indirect list,
|
||||
// using the face ids from ensightFaces
|
||||
template<class Type>
|
||||
static bool writeFaceField
|
||||
(
|
||||
const Field<Type>& fld,
|
||||
const ensightFaces&,
|
||||
ensightFile& os
|
||||
);
|
||||
|
||||
//- Write a field of faces values as a sublist,
|
||||
// using the sublist sizes ensightFaces
|
||||
template<class Type>
|
||||
static bool writePatchField
|
||||
static bool writeFaceSubField
|
||||
(
|
||||
const Field<Type>& pf,
|
||||
const ensightFaces& ensFaces,
|
||||
const Field<Type>& fld,
|
||||
const ensightFaces&,
|
||||
ensightFile& os
|
||||
);
|
||||
|
||||
//- Write a field of cell values as an indirect list,
|
||||
// using the cell ids from ensightCells
|
||||
template<class Type>
|
||||
static bool writeVolField
|
||||
static bool writeCellField
|
||||
(
|
||||
const Field<Type>& vf,
|
||||
const ensightCells& ensCells,
|
||||
const Field<Type>& fld,
|
||||
const ensightCells&,
|
||||
ensightFile& os,
|
||||
const bool deprecatedOrder = false
|
||||
);
|
||||
|
||||
@ -41,11 +41,11 @@ License
|
||||
|
||||
// * * * * * * * * * * Static Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::ensightOutput::writeField
|
||||
template<template<typename> class FieldContainer, class Type>
|
||||
void Foam::ensightOutput::writeFieldContent
|
||||
(
|
||||
const char* key,
|
||||
const Field<Type>& fld,
|
||||
const FieldContainer<Type>& fld,
|
||||
ensightFile& os
|
||||
)
|
||||
{
|
||||
@ -85,7 +85,7 @@ void Foam::ensightOutput::writeField
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::ensightOutput::writePatchField
|
||||
bool Foam::ensightOutput::writeFaceField
|
||||
(
|
||||
const Field<Type>& pf,
|
||||
const ensightFaces& ensFaces,
|
||||
@ -99,14 +99,11 @@ bool Foam::ensightOutput::writePatchField
|
||||
os.beginPart(ensFaces.index());
|
||||
}
|
||||
|
||||
const List<ensightFaces::elemType> enums =
|
||||
ensightFaces::elemEnum.enums();
|
||||
|
||||
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
|
||||
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
|
||||
{
|
||||
const ensightFaces::elemType& what = *iter;
|
||||
const ensightFaces::elemType what = ensightFaces::elemType(typei);
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
ensightFaces::key(what),
|
||||
Field<Type>(pf, ensFaces.faceIds(what)),
|
||||
@ -124,7 +121,47 @@ bool Foam::ensightOutput::writePatchField
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::ensightOutput::writeVolField
|
||||
bool Foam::ensightOutput::writeFaceSubField
|
||||
(
|
||||
const Field<Type>& pf,
|
||||
const ensightFaces& ensFaces,
|
||||
Foam::ensightFile& os
|
||||
)
|
||||
{
|
||||
if (ensFaces.total())
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
os.beginPart(ensFaces.index());
|
||||
}
|
||||
|
||||
label start = 0; // start of sublist
|
||||
for (label typei = 0; typei < ensightFaces::nTypes; ++typei)
|
||||
{
|
||||
const ensightFaces::elemType what = ensightFaces::elemType(typei);
|
||||
const label size = ensFaces.faceIds(what).size();
|
||||
|
||||
writeFieldContent
|
||||
(
|
||||
ensightFaces::key(what),
|
||||
SubField<Type>(pf, size, start),
|
||||
os
|
||||
);
|
||||
|
||||
start += size; // start of next sublist
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
bool Foam::ensightOutput::writeCellField
|
||||
(
|
||||
const Field<Type>& vf,
|
||||
const ensightCells& ensCells,
|
||||
@ -151,34 +188,30 @@ bool Foam::ensightOutput::writeVolField
|
||||
ensightCells::NFACED
|
||||
};
|
||||
|
||||
for (int i=0; i < 5; ++i)
|
||||
for (label typei=0; typei < ensightCells::nTypes; ++typei)
|
||||
{
|
||||
const ensightCells::elemType& what = oldOrder[i];
|
||||
const ensightCells::elemType& what = oldOrder[typei];
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
ensightCells::key(what),
|
||||
Field<Type>(vf, ensCells.cellIds(what)),
|
||||
os
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
for (label typei=0; typei < ensightCells::nTypes; ++typei)
|
||||
{
|
||||
const List<ensightCells::elemType> enums =
|
||||
ensightCells::elemEnum.enums();
|
||||
const ensightCells::elemType what = ensightCells::elemType(typei);
|
||||
|
||||
forAllConstIter(List<ensightCells::elemType>, enums, iter)
|
||||
{
|
||||
const ensightCells::elemType& what = *iter;
|
||||
|
||||
writeField
|
||||
(
|
||||
ensightCells::key(what),
|
||||
Field<Type>(vf, ensCells.cellIds(what)),
|
||||
os
|
||||
);
|
||||
}
|
||||
writeFieldContent
|
||||
(
|
||||
ensightCells::key(what),
|
||||
Field<Type>(vf, ensCells.cellIds(what)),
|
||||
os
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -209,7 +242,7 @@ bool Foam::ensightOutput::writeField
|
||||
//
|
||||
if (ensMesh.useInternalMesh())
|
||||
{
|
||||
writeVolField(vf, meshCells, os, ensMesh.deprecatedOrder());
|
||||
writeCellField(vf, meshCells, os, ensMesh.deprecatedOrder());
|
||||
}
|
||||
|
||||
//
|
||||
@ -223,7 +256,7 @@ bool Foam::ensightOutput::writeField
|
||||
const word& patchName = patchLookup[listi];
|
||||
const ensightFaces& ensFaces = patchFaces[patchName];
|
||||
|
||||
writePatchField
|
||||
writeFaceField
|
||||
(
|
||||
vf.boundaryField()[patchId],
|
||||
ensFaces,
|
||||
@ -303,7 +336,9 @@ bool Foam::ensightOutput::writeField
|
||||
);
|
||||
}
|
||||
|
||||
writePatchField(values, ensFaces, os);
|
||||
// The field is already copied in the proper order
|
||||
// - just need its corresponding sub-fields
|
||||
writeFaceSubField(values, ensFaces, os);
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,7 +370,7 @@ bool Foam::ensightOutput::ensightPointField
|
||||
os.beginPart(0); // 0 = internalMesh
|
||||
}
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), ensMesh.uniquePointMap()),
|
||||
@ -373,7 +408,7 @@ bool Foam::ensightOutput::ensightPointField
|
||||
os.beginPart(ensFaces.index());
|
||||
}
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
|
||||
@ -417,7 +452,7 @@ bool Foam::ensightOutput::ensightPointField
|
||||
os.beginPart(ensFaces.index());
|
||||
}
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
"coordinates",
|
||||
Field<Type>(pf.internalField(), uniqueMeshPointLabels),
|
||||
|
||||
@ -55,12 +55,12 @@ class ensightSerialOutput
|
||||
{
|
||||
// Private Methods
|
||||
|
||||
//- Write field component-wise
|
||||
template<class Type>
|
||||
static void writeField
|
||||
//- Write field content (component-wise) for the given ensight element type
|
||||
template<template<typename> class FieldContainer, class Type>
|
||||
static void writeFieldContent
|
||||
(
|
||||
const word& key,
|
||||
const Field<Type>& field,
|
||||
const FieldContainer<Type>& fld,
|
||||
ensightFile& os
|
||||
);
|
||||
|
||||
|
||||
@ -31,11 +31,11 @@ License
|
||||
|
||||
// * * * * * * * * * * Static Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::ensightSerialOutput::writeField
|
||||
template<template<typename> class FieldContainer, class Type>
|
||||
void Foam::ensightSerialOutput::writeFieldContent
|
||||
(
|
||||
const word& key,
|
||||
const Field<Type>& fld,
|
||||
const FieldContainer<Type>& fld,
|
||||
ensightFile& os
|
||||
)
|
||||
{
|
||||
@ -82,14 +82,11 @@ bool Foam::ensightSerialOutput::writeField
|
||||
{
|
||||
os.beginPart(part.index());
|
||||
|
||||
const List<ensightFaces::elemType> enums =
|
||||
ensightFaces::elemEnum.enums();
|
||||
|
||||
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
|
||||
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
|
||||
{
|
||||
const ensightFaces::elemType what = *iter;
|
||||
const ensightFaces::elemType what = ensightFaces::elemType(typei);
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
ensightFaces::key(what),
|
||||
Field<Type>(fld, part.faceIds(what)),
|
||||
@ -115,14 +112,11 @@ bool Foam::ensightSerialOutput::writeField
|
||||
{
|
||||
os.beginPart(part.index());
|
||||
|
||||
const List<ensightCells::elemType> enums =
|
||||
ensightCells::elemEnum.enums();
|
||||
|
||||
forAllConstIter(List<ensightCells::elemType>, enums, iter)
|
||||
for (label typei=0; typei < ensightCells::nTypes; ++typei)
|
||||
{
|
||||
const ensightCells::elemType what = *iter;
|
||||
const ensightCells::elemType what = ensightCells::elemType(typei);
|
||||
|
||||
writeField
|
||||
writeFieldContent
|
||||
(
|
||||
ensightCells::key(what),
|
||||
Field<Type>(fld, part.cellIds(what)),
|
||||
|
||||
@ -48,10 +48,10 @@ Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const
|
||||
labelList& usedPoints = ptList.list;
|
||||
label nPoints = 0;
|
||||
|
||||
// add all points from faces
|
||||
// Add all points from faces
|
||||
const labelUList& idList = this->faceIds();
|
||||
|
||||
// add all points from faces
|
||||
// Add all points from faces
|
||||
forAll(idList, i)
|
||||
{
|
||||
const label id = idList[i] + start_;
|
||||
@ -67,7 +67,7 @@ Foam::ensightPart::localPoints Foam::ensightPartFaces::calcLocalPoints() const
|
||||
}
|
||||
|
||||
|
||||
// this is not absolutely necessary, but renumber anyhow
|
||||
// This is not absolutely necessary, but renumber anyhow
|
||||
nPoints = 0;
|
||||
forAll(usedPoints, ptI)
|
||||
{
|
||||
@ -101,7 +101,7 @@ Foam::ensightPartFaces::ensightPartFaces
|
||||
points_(points),
|
||||
contiguousPoints_(contiguousPoints)
|
||||
{
|
||||
// classify the face shapes
|
||||
// Classify the face shapes
|
||||
classify(faces);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ Foam::ensightPartFaces::ensightPartFaces
|
||||
points_(mesh.points()),
|
||||
contiguousPoints_(false)
|
||||
{
|
||||
// classify the face shapes
|
||||
// Classify the face shapes
|
||||
classify(patch);
|
||||
}
|
||||
|
||||
@ -149,10 +149,10 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
os.write(idList.size());
|
||||
os.newline();
|
||||
|
||||
// write (polygon) face sizes
|
||||
// Write (polygon) face sizes
|
||||
if (key == "nsided")
|
||||
{
|
||||
// write the number of points per face
|
||||
// Write the number of points per face
|
||||
forAll(idList, i)
|
||||
{
|
||||
const label id = idList[i] + start_;
|
||||
@ -163,13 +163,13 @@ void Foam::ensightPartFaces::writeConnectivity
|
||||
}
|
||||
}
|
||||
|
||||
// write the points describing the face
|
||||
// Write the points describing the face
|
||||
forAll(idList, i)
|
||||
{
|
||||
const label id = idList[i] + start_;
|
||||
const face& f = faces[id];
|
||||
|
||||
// convert global -> local index
|
||||
// Convert global -> local index
|
||||
// (note: Ensight indices start with 1)
|
||||
forAll(f, fp)
|
||||
{
|
||||
@ -205,7 +205,7 @@ void Foam::ensightPartFaces::write
|
||||
const pointField& points
|
||||
) const
|
||||
{
|
||||
if (ensightPart::size())
|
||||
if (size())
|
||||
{
|
||||
const localPoints ptList = calcLocalPoints();
|
||||
const labelUList& pointMap = ptList.list;
|
||||
|
||||
@ -138,44 +138,43 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- Part index (0-based)
|
||||
virtual label index() const
|
||||
{
|
||||
return ensightFaces::index();
|
||||
}
|
||||
//- Part index (0-based)
|
||||
virtual label index() const
|
||||
{
|
||||
return ensightFaces::index();
|
||||
}
|
||||
|
||||
|
||||
//- Number of elements in this part
|
||||
virtual label size() const
|
||||
{
|
||||
return ensightFaces::size();
|
||||
}
|
||||
//- Number of elements in this part
|
||||
virtual label size() const
|
||||
{
|
||||
return ensightFaces::size();
|
||||
}
|
||||
|
||||
|
||||
//- Return the patch index, -1 when not in use.
|
||||
inline label patchIndex() const
|
||||
{
|
||||
return patchIndex_;
|
||||
}
|
||||
//- Return the patch index, -1 when not in use.
|
||||
inline label patchIndex() const
|
||||
{
|
||||
return patchIndex_;
|
||||
}
|
||||
|
||||
|
||||
// Output
|
||||
// Output
|
||||
|
||||
//- Write summary information about the object
|
||||
virtual void writeSummary(Ostream&) const;
|
||||
//- Write summary information about the object
|
||||
virtual void writeSummary(Ostream&) const;
|
||||
|
||||
//- Write geometry
|
||||
virtual void write(ensightGeoFile&) const;
|
||||
//- Write geometry
|
||||
virtual void write(ensightGeoFile&) const;
|
||||
|
||||
//- Helper: write geometry given the pointField
|
||||
virtual void write(ensightGeoFile&, const pointField&) const;
|
||||
//- Helper: write geometry given the pointField
|
||||
virtual void write(ensightGeoFile&, const pointField&) const;
|
||||
|
||||
|
||||
//- Print various types of debugging information
|
||||
virtual void dumpInfo(Ostream&) const;
|
||||
|
||||
//- Print various types of debugging information
|
||||
virtual void dumpInfo(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -191,10 +191,7 @@ void Foam::ensightCells::sort()
|
||||
{
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
if (lists_[typeI])
|
||||
{
|
||||
Foam::sort(*(lists_[typeI]));
|
||||
}
|
||||
Foam::sort(*(lists_[typeI]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -233,28 +233,25 @@ void Foam::ensightFaces::sort()
|
||||
{
|
||||
if (flipMap_.size() == address_.size())
|
||||
{
|
||||
// sort flip too
|
||||
// sort flip map too
|
||||
|
||||
labelList order;
|
||||
label start = 0;
|
||||
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
if (lists_[typeI])
|
||||
SubList<label>& idLst = *(lists_[typeI]);
|
||||
const label sz = idLst.size();
|
||||
|
||||
if (sz)
|
||||
{
|
||||
SubList<label>& idLst = *(lists_[typeI]);
|
||||
const label sz = idLst.size();
|
||||
SubList<bool> flip(flipMap_, sz, start);
|
||||
start += sz; // for next sub-list
|
||||
|
||||
if (sz)
|
||||
{
|
||||
SubList<bool> flip(flipMap_, sz, start);
|
||||
start += sz; // for next sub-list
|
||||
Foam::sortedOrder(idLst, order);
|
||||
|
||||
sortedOrder(idLst, order);
|
||||
|
||||
idLst = reorder<labelList>(order, idLst);
|
||||
flip = reorder<boolList>(order, flip);
|
||||
}
|
||||
idLst = reorder<labelList>(order, idLst);
|
||||
flip = reorder<boolList>(order, flip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,16 +260,9 @@ void Foam::ensightFaces::sort()
|
||||
// no flip-maps, simpler to sort
|
||||
forAll(lists_, typeI)
|
||||
{
|
||||
if (lists_[typeI])
|
||||
{
|
||||
SubList<label>& idLst = *(lists_[typeI]);
|
||||
const label sz = idLst.size();
|
||||
if (sz)
|
||||
{
|
||||
Foam::sort(idLst);
|
||||
}
|
||||
}
|
||||
Foam::sort(*(lists_[typeI]));
|
||||
}
|
||||
flipMap_.clear(); // for safety
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -132,83 +132,82 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- The index in a list.
|
||||
inline label index() const;
|
||||
//- The index in a list.
|
||||
inline label index() const;
|
||||
|
||||
//- The index in a list, non-const access.
|
||||
inline label& index();
|
||||
//- The index in a list, non-const access.
|
||||
inline label& index();
|
||||
|
||||
//- The processor local size of all elements.
|
||||
inline label size() const;
|
||||
//- The processor local size of all elements.
|
||||
inline label size() const;
|
||||
|
||||
//- The global number of the specified element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline label total(const enum elemType) const;
|
||||
//- The global number of the specified element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
inline label total(const enum elemType) const;
|
||||
|
||||
//- The global number of all element types.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
label total() const;
|
||||
//- The global number of all element types.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
label total() const;
|
||||
|
||||
|
||||
//- The processor local sizes per element type.
|
||||
FixedList<label, 3> sizes() const;
|
||||
//- The processor local sizes per element type.
|
||||
FixedList<label, 3> sizes() const;
|
||||
|
||||
//- The global numbers per element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
const FixedList<label, 3>& totals() const;
|
||||
//- The global numbers per element type.
|
||||
// This value is only meaningful after a reduce operation.
|
||||
const FixedList<label, 3>& totals() const;
|
||||
|
||||
|
||||
//- Return the (local) face ids of the specified element type
|
||||
inline const labelUList& faceIds(const enum elemType) const;
|
||||
//- Return the (local) face ids of the specified element type
|
||||
inline const labelUList& faceIds(const enum elemType) const;
|
||||
|
||||
//- Return the face ids of all elements
|
||||
inline const labelUList& faceIds() const;
|
||||
//- Return the face ids of all elements
|
||||
inline const labelUList& faceIds() const;
|
||||
|
||||
//- Return the flip-map of all elements
|
||||
inline const boolList& flipMap() const;
|
||||
//- Return the flip-map of all elements
|
||||
inline const boolList& flipMap() const;
|
||||
|
||||
|
||||
//- Starting offset of element type.
|
||||
label offset(const enum elemType what) const;
|
||||
//- Starting offset of element type.
|
||||
label offset(const enum elemType what) const;
|
||||
|
||||
|
||||
// Edit
|
||||
// Edit
|
||||
|
||||
//- Classify the face types, set element list.
|
||||
void classify(const faceList& faces);
|
||||
//- Classify the face types, set element list.
|
||||
void classify(const faceList& faces);
|
||||
|
||||
|
||||
//- Classify the face types, set element list.
|
||||
// The indirect addressing can be used when classifying groups of
|
||||
// face (eg, from a faceZone etc) with an optional flipMap.
|
||||
// The optional exclude marker can be used to skip faces on particular
|
||||
// boundary types or regions.
|
||||
void classify
|
||||
(
|
||||
const faceList& faces,
|
||||
const labelUList& addressing,
|
||||
const boolList& flipMap = boolList(),
|
||||
const PackedBoolList& exclude = PackedBoolList()
|
||||
);
|
||||
//- Classify the face types, set element list.
|
||||
// The indirect addressing can be used when classifying groups of
|
||||
// face (eg, from a faceZone etc) with an optional flipMap.
|
||||
// The optional exclude marker can be used to skip faces on particular
|
||||
// boundary types or regions.
|
||||
void classify
|
||||
(
|
||||
const faceList& faces,
|
||||
const labelUList& addressing,
|
||||
const boolList& flipMap = boolList(),
|
||||
const PackedBoolList& exclude = PackedBoolList()
|
||||
);
|
||||
|
||||
|
||||
//- Set addressable sizes to zero, free up addressing memory.
|
||||
void clear();
|
||||
//- Set addressable sizes to zero, free up addressing memory.
|
||||
void clear();
|
||||
|
||||
//- Sum element counts across all processes.
|
||||
void reduce();
|
||||
//- Sum element counts across all processes.
|
||||
void reduce();
|
||||
|
||||
//- Sort element lists numerically.
|
||||
void sort();
|
||||
//- Sort element lists numerically.
|
||||
void sort();
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Return element from linear-list.
|
||||
inline label operator[](const label i) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -112,7 +112,6 @@ Foam::functionObjects::ddt2::ddt2
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
prevTimeIndex_(-1),
|
||||
selectFields_(),
|
||||
resultName_(word::null),
|
||||
blacklist_(),
|
||||
@ -218,20 +217,12 @@ bool Foam::functionObjects::ddt2::execute()
|
||||
<< "Unprocessed field " << ignored << endl;
|
||||
}
|
||||
|
||||
// Update time index
|
||||
prevTimeIndex_ = obr_.time().timeIndex();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::ddt2::write()
|
||||
{
|
||||
if (prevTimeIndex_ < obr_.time().timeIndex())
|
||||
{
|
||||
// Ensure written results reflect the current state
|
||||
execute();
|
||||
}
|
||||
if (results_.size())
|
||||
{
|
||||
Log << type() << ' ' << name() << " write:" << endl;
|
||||
|
||||
@ -101,9 +101,6 @@ class ddt2
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Time at last execute, ensures write uses up-to-date values
|
||||
label prevTimeIndex_;
|
||||
|
||||
//- Name of fields to process
|
||||
wordReList selectFields_;
|
||||
|
||||
|
||||
@ -100,7 +100,6 @@ Foam::functionObjects::zeroGradient::zeroGradient
|
||||
)
|
||||
:
|
||||
fvMeshFunctionObject(name, runTime, dict),
|
||||
prevTimeIndex_(-1),
|
||||
selectFields_(),
|
||||
resultName_(string::null),
|
||||
results_()
|
||||
@ -175,20 +174,12 @@ bool Foam::functionObjects::zeroGradient::execute()
|
||||
<< "Unprocessed field " << ignored << endl;
|
||||
}
|
||||
|
||||
// Update time index
|
||||
prevTimeIndex_ = obr_.time().timeIndex();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::zeroGradient::write()
|
||||
{
|
||||
if (prevTimeIndex_ < obr_.time().timeIndex())
|
||||
{
|
||||
// Ensure written results reflect the current state
|
||||
execute();
|
||||
}
|
||||
if (results_.size())
|
||||
{
|
||||
Log << type() << ' ' << name() << " write:" << endl;
|
||||
|
||||
@ -95,9 +95,6 @@ class zeroGradient
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Time at last execute, ensures write uses up-to-date values
|
||||
label prevTimeIndex_;
|
||||
|
||||
//- Name of fields to process
|
||||
wordReList selectFields_;
|
||||
|
||||
|
||||
@ -4,37 +4,58 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source the wmake functions
|
||||
. $WM_DIR/scripts/wmakeFunctions
|
||||
|
||||
# The source directory
|
||||
sourceDir=$PWD
|
||||
|
||||
# Where are any generated files stored?
|
||||
findObjectDir $sourceDir
|
||||
depDir="$objectsDir"
|
||||
# Ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
echo
|
||||
echo "======================================================================"
|
||||
echo "${PWD##*/} : $PWD"
|
||||
echo
|
||||
|
||||
|
||||
# CMake into objectsDir,
|
||||
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
|
||||
doCmake()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
|
||||
findObjectDir $sourceDir # Where are generated files stored?
|
||||
test -f "$objectsDir/CMakeCache.txt"
|
||||
retry=$? # CMakeCache.txt exists, but sources may have moved
|
||||
|
||||
mkdir -p $objectsDir && \
|
||||
(
|
||||
cd $objectsDir || exit 1
|
||||
|
||||
cmake $sourceDir || {
|
||||
if [ $retry -eq 0 ]
|
||||
then
|
||||
echo "Removing CMakeCache.txt and attempt again"
|
||||
rm -f CMakeCache.txt
|
||||
cmake $sourceDir
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
} && make
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if [ -d "$VTK_DIR" -o -d "$ParaView_DIR" ]
|
||||
then
|
||||
# ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
||||
|
||||
if type cmake > /dev/null 2>&1
|
||||
if [ "$targetType" != objects ]
|
||||
then
|
||||
(
|
||||
mkdir -p $depDir \
|
||||
&& cd $depDir \
|
||||
&& cmake $sourceDir \
|
||||
&& make
|
||||
) || {
|
||||
echo
|
||||
echo "WARNING: incomplete build of VTK-based post-processing"
|
||||
}
|
||||
else
|
||||
echo "WARNING: skipped - needs cmake"
|
||||
if type cmake > /dev/null 2>&1
|
||||
then
|
||||
doCmake $PWD || {
|
||||
echo
|
||||
echo " WARNING: incomplete build of VTK-based post-processing"
|
||||
echo
|
||||
}
|
||||
else
|
||||
echo "WARNING: skipped - needs cmake"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "WARNING: skipped - needs a VTK or a ParaView installation"
|
||||
@ -45,4 +66,4 @@ fi
|
||||
echo "======================================================================"
|
||||
echo
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
@ -94,17 +94,41 @@ Foam::label Foam::noiseModel::findStartTimeIndex
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noiseModel::noiseModel(const dictionary& dict)
|
||||
Foam::noiseModel::noiseModel(const dictionary& dict, const bool readFields)
|
||||
:
|
||||
dict_(dict),
|
||||
rhoRef_(dict.lookupOrDefault<scalar>("rhoRef", 1)),
|
||||
nSamples_(dict.lookupOrDefault<label>("N", 65536)),
|
||||
fLower_(dict.lookupOrDefault<scalar>("fl", 25)),
|
||||
fUpper_(dict.lookupOrDefault<scalar>("fu", 10000)),
|
||||
startTime_(dict.lookupOrDefault<scalar>("startTime", 0)),
|
||||
windowModelPtr_(windowModel::New(dict, nSamples_)),
|
||||
graphFormat_(dict.lookupOrDefault<word>("graphFormat", "raw"))
|
||||
rhoRef_(1),
|
||||
nSamples_(65536),
|
||||
fLower_(25),
|
||||
fUpper_(10000),
|
||||
startTime_(0),
|
||||
windowModelPtr_(),
|
||||
graphFormat_("raw")
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noiseModel::~noiseModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::noiseModel::read(const dictionary& dict)
|
||||
{
|
||||
dict.readIfPresent("rhoRef", rhoRef_);
|
||||
dict.readIfPresent("N", nSamples_);
|
||||
dict.readIfPresent("fl", fLower_);
|
||||
dict.readIfPresent("fu", fUpper_);
|
||||
dict.readIfPresent("startTime", startTime_);
|
||||
dict.readIfPresent("graphFormat", graphFormat_);
|
||||
|
||||
// Check number of samples - must be a power of 2 for our FFT
|
||||
bool powerOf2 = ((nSamples_ != 0) && !(nSamples_ & (nSamples_ - 1)));
|
||||
if (!powerOf2)
|
||||
@ -139,13 +163,11 @@ Foam::noiseModel::noiseModel(const dictionary& dict)
|
||||
<< exit(FatalIOError);
|
||||
|
||||
}
|
||||
|
||||
windowModelPtr_ = windowModel::New(dict, nSamples_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noiseModel::~noiseModel()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -124,7 +124,7 @@ protected:
|
||||
scalar checkUniformTimeStep
|
||||
(
|
||||
const scalarList& times
|
||||
) const;
|
||||
) const;
|
||||
|
||||
//- Find and return start time index
|
||||
label findStartTimeIndex
|
||||
@ -139,7 +139,7 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("noiseModel");
|
||||
|
||||
//- Run time selection table
|
||||
//- Run time selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
@ -155,7 +155,7 @@ public:
|
||||
static autoPtr<noiseModel> New(const dictionary& dict);
|
||||
|
||||
//- Constructor
|
||||
noiseModel(const dictionary& dict);
|
||||
noiseModel(const dictionary& dict, const bool readFields = true);
|
||||
|
||||
//- Destructor
|
||||
virtual ~noiseModel();
|
||||
@ -163,6 +163,9 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Abstract call to calculate
|
||||
virtual void calculate() = 0;
|
||||
};
|
||||
|
||||
@ -43,14 +43,12 @@ addToRunTimeSelectionTable(noiseModel, pointNoise, dictionary);
|
||||
|
||||
void pointNoise::filterTimeData
|
||||
(
|
||||
const Function1Types::CSV<scalar>& pData,
|
||||
const scalarField& t0,
|
||||
const scalarField& p0,
|
||||
scalarField& t,
|
||||
scalarField& p
|
||||
)
|
||||
) const
|
||||
{
|
||||
const scalarField t0(pData.x());
|
||||
const scalarField p0(pData.y());
|
||||
|
||||
DynamicList<scalar> tf(t0.size());
|
||||
DynamicList<scalar> pf(t0.size());
|
||||
|
||||
@ -68,23 +66,15 @@ void pointNoise::filterTimeData
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void pointNoise::calculate()
|
||||
void pointNoise::processData(const Function1Types::CSV<scalar>& data)
|
||||
{
|
||||
// Point data only handled by master
|
||||
if (!Pstream::master())
|
||||
{
|
||||
return;
|
||||
}
|
||||
Info<< "Reading data file " << data.fName() << endl;
|
||||
|
||||
Info<< "Reading data file" << endl;
|
||||
|
||||
Function1Types::CSV<scalar> pData("pressure", dict_, "Data");
|
||||
const fileName fNameBase = data.fName().name(true);
|
||||
|
||||
// Time and pressure history data
|
||||
scalarField t, p;
|
||||
filterTimeData(pData, t, p);
|
||||
filterTimeData(data.x(), data.y(), t, p);
|
||||
p *= rhoRef_;
|
||||
|
||||
Info<< " read " << t.size() << " values" << nl << endl;
|
||||
@ -96,7 +86,7 @@ void pointNoise::calculate()
|
||||
windowModelPtr_->validate(t.size());
|
||||
const windowModel& win = windowModelPtr_();
|
||||
const scalar deltaf = 1.0/(deltaT*win.nSamples());
|
||||
fileName outDir(fileName("postProcessing")/"noise"/typeName);
|
||||
fileName outDir(fileName("postProcessing")/"noise"/typeName/fNameBase);
|
||||
|
||||
// Create the fft
|
||||
noiseFFT nfft(deltaT, p);
|
||||
@ -185,12 +175,45 @@ void pointNoise::calculate()
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void pointNoise::calculate()
|
||||
{
|
||||
// Point data only handled by master
|
||||
if (!Pstream::master())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (inputFileNames_.size())
|
||||
{
|
||||
forAll(inputFileNames_, i)
|
||||
{
|
||||
const fileName fName = inputFileNames_[i].expand();
|
||||
Function1Types::CSV<scalar> data("pressure", dict_, "Data", fName);
|
||||
processData(data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Function1Types::CSV<scalar> data("pressure", dict_, "Data");
|
||||
processData(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
pointNoise::pointNoise(const dictionary& dict)
|
||||
pointNoise::pointNoise(const dictionary& dict, const bool readFields)
|
||||
:
|
||||
noiseModel(dict)
|
||||
{}
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -199,6 +222,18 @@ pointNoise::~pointNoise()
|
||||
{}
|
||||
|
||||
|
||||
bool pointNoise::read(const dictionary& dict)
|
||||
{
|
||||
if (noiseModel::read(dict))
|
||||
{
|
||||
dict.readIfPresent("inputFiles", inputFileNames_);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace noiseModels
|
||||
|
||||
@ -76,8 +76,8 @@ SeeAlso
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointNoise_H
|
||||
#define pointNoise_H
|
||||
#ifndef noiseModels_pointNoise_H
|
||||
#define noiseModels_pointNoise_H
|
||||
|
||||
#include "noiseModel.H"
|
||||
#include "CSV.H"
|
||||
@ -100,14 +100,24 @@ class pointNoise
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Input file names - optional
|
||||
List<fileName> inputFileNames_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
void filterTimeData
|
||||
(
|
||||
const Function1Types::CSV<scalar>& pData,
|
||||
const scalarField& t0,
|
||||
const scalarField& p0,
|
||||
scalarField& t,
|
||||
scalarField& p
|
||||
);
|
||||
) const;
|
||||
|
||||
//- Process the CSV data
|
||||
void processData(const Function1Types::CSV<scalar>& data);
|
||||
|
||||
|
||||
public:
|
||||
@ -116,7 +126,7 @@ public:
|
||||
TypeName("pointNoise");
|
||||
|
||||
//- Constructor
|
||||
pointNoise(const dictionary& dict);
|
||||
pointNoise(const dictionary& dict, const bool readFields = true);
|
||||
|
||||
//- Destructor
|
||||
virtual ~pointNoise();
|
||||
@ -124,6 +134,9 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Calculate
|
||||
virtual void calculate();
|
||||
|
||||
|
||||
@ -44,12 +44,9 @@ addToRunTimeSelectionTable(noiseModel, surfaceNoise, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void surfaceNoise::initialise(const dictionary& dict)
|
||||
void surfaceNoise::initialise(const fileName& fName)
|
||||
{
|
||||
dict.lookup("inputFile") >> inputFileName_;
|
||||
inputFileName_.expand();
|
||||
|
||||
dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
|
||||
Info<< "Reading data file " << fName << endl;
|
||||
|
||||
label nAvailableTimes = 0;
|
||||
|
||||
@ -57,17 +54,15 @@ void surfaceNoise::initialise(const dictionary& dict)
|
||||
if (Pstream::master())
|
||||
{
|
||||
// Create the surface reader
|
||||
const word readerType(dict.lookup("reader"));
|
||||
readerPtr_.reset(surfaceReader::New(readerType, inputFileName_).ptr());
|
||||
readerPtr_ = surfaceReader::New(readerType_, fName);
|
||||
|
||||
// Find the index of the pressure data
|
||||
const word pName(dict.lookupOrDefault<word>("p", "p"));
|
||||
const List<word> fieldNames(readerPtr_->fieldNames(0));
|
||||
pIndex_ = findIndex(fieldNames, pName);
|
||||
pIndex_ = findIndex(fieldNames, pName_);
|
||||
if (pIndex_ == -1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unable to find pressure field name " << pName
|
||||
<< "Unable to find pressure field name " << pName_
|
||||
<< " in list of available fields: " << fieldNames
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -76,12 +71,6 @@ void surfaceNoise::initialise(const dictionary& dict)
|
||||
// - Could be done later, but since this utility can process a lot of
|
||||
// data we can ensure that the user-input is correct prior to doing
|
||||
// the heavy lifting
|
||||
const word writerType(dict.lookup("writer"));
|
||||
dictionary optDict
|
||||
(
|
||||
dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)
|
||||
);
|
||||
writerPtr_.reset(surfaceWriter::New(writerType, optDict).ptr());
|
||||
|
||||
// Set the time range
|
||||
const instantList allTimes = readerPtr_->times();
|
||||
@ -404,18 +393,25 @@ Foam::scalar surfaceNoise::surfaceAverage
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
surfaceNoise::surfaceNoise(const dictionary& dict)
|
||||
surfaceNoise::surfaceNoise(const dictionary& dict, const bool readFields)
|
||||
:
|
||||
noiseModel(dict),
|
||||
inputFileName_("unknown-inputFile"),
|
||||
noiseModel(dict, false),
|
||||
inputFileNames_(),
|
||||
pName_("p"),
|
||||
pIndex_(0),
|
||||
times_(),
|
||||
deltaT_(0),
|
||||
startTimeIndex_(0),
|
||||
nFace_(0),
|
||||
fftWriteInterval_(1)
|
||||
fftWriteInterval_(1),
|
||||
readerType_(word::null),
|
||||
readerPtr_(nullptr),
|
||||
writerPtr_(nullptr)
|
||||
{
|
||||
initialise(dict);
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -427,271 +423,316 @@ surfaceNoise::~surfaceNoise()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool surfaceNoise::read(const dictionary& dict)
|
||||
{
|
||||
if (noiseModel::read(dict))
|
||||
{
|
||||
if (dict.found("inputFile"))
|
||||
{
|
||||
inputFileNames_.setSize(1);
|
||||
dict.lookup("inputFile") >> inputFileNames_[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
dict.lookup("inputFiles") >> inputFileNames_;
|
||||
}
|
||||
|
||||
dict.readIfPresent("fftWriteInterval", fftWriteInterval_);
|
||||
dict.readIfPresent("p", pName_);
|
||||
|
||||
dict.lookup("reader") >> readerType_;
|
||||
|
||||
word writerType(dict.lookup("writer"));
|
||||
dictionary optDict
|
||||
(
|
||||
dict.subOrEmptyDict("writeOptions").subOrEmptyDict(writerType)
|
||||
);
|
||||
|
||||
writerPtr_ = surfaceWriter::New(writerType, optDict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void surfaceNoise::calculate()
|
||||
{
|
||||
// Container for pressure time history data per face
|
||||
List<scalarField> pData;
|
||||
|
||||
// Processor procFaceOffsets
|
||||
labelList procFaceOffset;
|
||||
if (Pstream::parRun())
|
||||
forAll(inputFileNames_, i)
|
||||
{
|
||||
const label nProcs = Pstream::nProcs();
|
||||
const label nFacePerProc = floor(nFace_/nProcs) + 1;
|
||||
fileName fName = inputFileNames_[i];
|
||||
|
||||
procFaceOffset.setSize(nProcs + 1, 0);
|
||||
for (label i = 1; i < procFaceOffset.size(); i++)
|
||||
initialise(fName.expand());
|
||||
|
||||
// Container for pressure time history data per face
|
||||
List<scalarField> pData;
|
||||
|
||||
// Processor procFaceOffsets
|
||||
labelList procFaceOffset;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
procFaceOffset[i] = min(i*nFacePerProc, nFace_);
|
||||
const label nProcs = Pstream::nProcs();
|
||||
const label nFacePerProc = floor(nFace_/nProcs) + 1;
|
||||
|
||||
procFaceOffset.setSize(nProcs + 1, 0);
|
||||
for (label i = 1; i < procFaceOffset.size(); i++)
|
||||
{
|
||||
procFaceOffset[i] = min(i*nFacePerProc, nFace_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
procFaceOffset.setSize(1, nFace_);
|
||||
}
|
||||
|
||||
// Read pressure data from file
|
||||
readSurfaceData(procFaceOffset, pData);
|
||||
|
||||
// Process the pressure data, and store results as surface values per
|
||||
// frequency so that it can be output using the surface writer
|
||||
|
||||
Info<< "Creating noise FFTs" << endl;
|
||||
|
||||
// Storage for FFT data
|
||||
const label nLocalFace = pData.size();
|
||||
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
|
||||
const label nFFT = freq1.size()/fftWriteInterval_;
|
||||
List<scalarField> surfPrmsf(nFFT);
|
||||
List<scalarField> surfPSDf(nFFT);
|
||||
forAll(surfPrmsf, freqI)
|
||||
{
|
||||
surfPrmsf[freqI].setSize(nLocalFace);
|
||||
surfPSDf[freqI].setSize(nLocalFace);
|
||||
}
|
||||
|
||||
// Storage for 1/3 octave data
|
||||
labelList octave13BandIDs;
|
||||
scalarField octave13FreqCentre;
|
||||
noiseFFT::octaveBandInfo
|
||||
(
|
||||
freq1,
|
||||
fLower_,
|
||||
fUpper_,
|
||||
3,
|
||||
octave13BandIDs,
|
||||
octave13FreqCentre
|
||||
);
|
||||
|
||||
label bandSize = 0;
|
||||
if (octave13BandIDs.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Ocatve band calculation failed (zero sized). "
|
||||
<< "please check your input data"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
bandSize = octave13BandIDs.size() - 1;
|
||||
}
|
||||
|
||||
List<scalarField> surfPSD13f(bandSize);
|
||||
List<scalarField> surfPrms13f2(bandSize);
|
||||
forAll(surfPSD13f, freqI)
|
||||
{
|
||||
surfPSD13f[freqI].setSize(nLocalFace);
|
||||
surfPrms13f2[freqI].setSize(nLocalFace);
|
||||
}
|
||||
|
||||
const windowModel& win = windowModelPtr_();
|
||||
|
||||
forAll(pData, faceI)
|
||||
{
|
||||
const scalarField& p = pData[faceI];
|
||||
|
||||
noiseFFT nfft(deltaT_, p);
|
||||
graph Prmsf(nfft.RMSmeanPf(win));
|
||||
graph PSDf(nfft.PSDf(win));
|
||||
|
||||
// Store the frequency results in slot for face of surface
|
||||
forAll(surfPrmsf, i)
|
||||
else
|
||||
{
|
||||
label freqI = (i + 1)*fftWriteInterval_ - 1;
|
||||
surfPrmsf[i][faceI] = Prmsf.y()[freqI];
|
||||
surfPSDf[i][faceI] = PSDf.y()[freqI];
|
||||
procFaceOffset.setSize(1, nFace_);
|
||||
}
|
||||
|
||||
// PSD [Pa^2/Hz]
|
||||
graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
|
||||
// Read pressure data from file
|
||||
readSurfaceData(procFaceOffset, pData);
|
||||
|
||||
// Integrated PSD = P(rms)^2 [Pa^2]
|
||||
graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
|
||||
// Process the pressure data, and store results as surface values per
|
||||
// frequency so that it can be output using the surface writer
|
||||
|
||||
// Store the 1/3 octave results in slot for face of surface
|
||||
Info<< "Creating noise FFTs" << endl;
|
||||
|
||||
// Storage for FFT data
|
||||
const label nLocalFace = pData.size();
|
||||
const scalarField freq1(noiseFFT::frequencies(nSamples_, deltaT_));
|
||||
const label nFFT = freq1.size()/fftWriteInterval_;
|
||||
List<scalarField> surfPrmsf(nFFT);
|
||||
List<scalarField> surfPSDf(nFFT);
|
||||
forAll(surfPrmsf, freqI)
|
||||
{
|
||||
surfPrmsf[freqI].setSize(nLocalFace);
|
||||
surfPSDf[freqI].setSize(nLocalFace);
|
||||
}
|
||||
|
||||
// Storage for 1/3 octave data
|
||||
labelList octave13BandIDs;
|
||||
scalarField octave13FreqCentre;
|
||||
noiseFFT::octaveBandInfo
|
||||
(
|
||||
freq1,
|
||||
fLower_,
|
||||
fUpper_,
|
||||
3,
|
||||
octave13BandIDs,
|
||||
octave13FreqCentre
|
||||
);
|
||||
|
||||
label bandSize = 0;
|
||||
if (octave13BandIDs.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Ocatve band calculation failed (zero sized). "
|
||||
<< "please check your input data"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
bandSize = octave13BandIDs.size() - 1;
|
||||
}
|
||||
|
||||
List<scalarField> surfPSD13f(bandSize);
|
||||
List<scalarField> surfPrms13f2(bandSize);
|
||||
forAll(surfPSD13f, freqI)
|
||||
{
|
||||
surfPSD13f[freqI][faceI] = PSD13f.y()[freqI];
|
||||
surfPrms13f2[freqI][faceI] = Prms13f2.y()[freqI];
|
||||
surfPSD13f[freqI].setSize(nLocalFace);
|
||||
surfPrms13f2[freqI].setSize(nLocalFace);
|
||||
}
|
||||
}
|
||||
|
||||
// Output directory for graphs
|
||||
fileName outDir(fileName("postProcessing")/"noise"/typeName);
|
||||
const windowModel& win = windowModelPtr_();
|
||||
|
||||
const scalar deltaf = 1.0/(deltaT_*win.nSamples());
|
||||
Info<< "Writing fft surface data" << endl;
|
||||
{
|
||||
scalarField PrmsfAve(surfPrmsf.size(), 0);
|
||||
scalarField PSDfAve(surfPrmsf.size(), 0);
|
||||
scalarField fOut(surfPrmsf.size(), 0);
|
||||
|
||||
forAll(surfPrmsf, i)
|
||||
forAll(pData, faceI)
|
||||
{
|
||||
label freqI = i*fftWriteInterval_;
|
||||
fOut[i] = freq1[freqI];
|
||||
const word& fName = inputFileName_.name(true);
|
||||
const word gName = "fft";
|
||||
PrmsfAve[i] = writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"Prmsf",
|
||||
freq1[freqI],
|
||||
surfPrmsf[i],
|
||||
procFaceOffset
|
||||
);
|
||||
const scalarField& p = pData[faceI];
|
||||
|
||||
PSDfAve[i] = writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"PSDf",
|
||||
freq1[freqI],
|
||||
surfPSDf[i],
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"PSD",
|
||||
freq1[freqI],
|
||||
noiseFFT::PSD(surfPSDf[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"SPL",
|
||||
freq1[freqI],
|
||||
noiseFFT::SPL(surfPSDf[i]*deltaf),
|
||||
procFaceOffset
|
||||
);
|
||||
noiseFFT nfft(deltaT_, p);
|
||||
graph Prmsf(nfft.RMSmeanPf(win));
|
||||
graph PSDf(nfft.PSDf(win));
|
||||
|
||||
// Store the frequency results in slot for face of surface
|
||||
forAll(surfPrmsf, i)
|
||||
{
|
||||
label freqI = (i + 1)*fftWriteInterval_ - 1;
|
||||
surfPrmsf[i][faceI] = Prmsf.y()[freqI];
|
||||
surfPSDf[i][faceI] = PSDf.y()[freqI];
|
||||
}
|
||||
|
||||
// PSD [Pa^2/Hz]
|
||||
graph PSD13f(nfft.octaves(PSDf, octave13BandIDs, false));
|
||||
|
||||
// Integrated PSD = P(rms)^2 [Pa^2]
|
||||
graph Prms13f2(nfft.octaves(PSDf, octave13BandIDs, true));
|
||||
|
||||
// Store the 1/3 octave results in slot for face of surface
|
||||
forAll(surfPSD13f, freqI)
|
||||
{
|
||||
surfPSD13f[freqI][faceI] = PSD13f.y()[freqI];
|
||||
surfPrms13f2[freqI][faceI] = Prms13f2.y()[freqI];
|
||||
}
|
||||
}
|
||||
|
||||
graph Prmsfg
|
||||
const word& fNameBase = fName.name(true);
|
||||
|
||||
// Output directory for graphs
|
||||
fileName outDir
|
||||
(
|
||||
"Average Prms(f)",
|
||||
"f [Hz]",
|
||||
"P(f) [Pa]",
|
||||
fOut,
|
||||
PrmsfAve
|
||||
fileName("postProcessing")/"noise"/typeName/fNameBase
|
||||
);
|
||||
Prmsfg.write(outDir, graph::wordify(Prmsfg.title()), graphFormat_);
|
||||
|
||||
graph PSDfg
|
||||
(
|
||||
"Average PSD_f(f)",
|
||||
"f [Hz]",
|
||||
"PSD(f) [PaPa_Hz]",
|
||||
fOut,
|
||||
PSDfAve
|
||||
);
|
||||
PSDfg.write(outDir, graph::wordify(PSDfg.title()), graphFormat_);
|
||||
|
||||
graph PSDg
|
||||
(
|
||||
"Average PSD_dB_Hz(f)",
|
||||
"f [Hz]",
|
||||
"PSD(f) [dB_Hz]",
|
||||
fOut,
|
||||
noiseFFT::PSD(PSDfAve)
|
||||
);
|
||||
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
|
||||
|
||||
graph SPLg
|
||||
(
|
||||
"Average SPL_dB(f)",
|
||||
"f [Hz]",
|
||||
"SPL(f) [dB]",
|
||||
fOut,
|
||||
noiseFFT::SPL(PSDfAve*deltaf)
|
||||
);
|
||||
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
|
||||
}
|
||||
|
||||
|
||||
Info<< "Writing one-third octave surface data" << endl;
|
||||
{
|
||||
scalarField PSDfAve(surfPSD13f.size(), 0);
|
||||
scalarField Prms13f2Ave(surfPSD13f.size(), 0);
|
||||
|
||||
forAll(surfPSD13f, i)
|
||||
const scalar deltaf = 1.0/(deltaT_*win.nSamples());
|
||||
Info<< "Writing fft surface data" << endl;
|
||||
{
|
||||
const word& fName = inputFileName_.name(true);
|
||||
const word gName = "oneThirdOctave";
|
||||
PSDfAve[i] = writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"PSD13f",
|
||||
octave13FreqCentre[i],
|
||||
surfPSD13f[i],
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"PSD13",
|
||||
octave13FreqCentre[i],
|
||||
noiseFFT::PSD(surfPSD13f[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fName,
|
||||
gName,
|
||||
"SPL13",
|
||||
octave13FreqCentre[i],
|
||||
noiseFFT::SPL(surfPrms13f2[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
scalarField PrmsfAve(surfPrmsf.size(), 0);
|
||||
scalarField PSDfAve(surfPrmsf.size(), 0);
|
||||
scalarField fOut(surfPrmsf.size(), 0);
|
||||
|
||||
Prms13f2Ave[i] = surfaceAverage(surfPrms13f2[i], procFaceOffset);
|
||||
forAll(surfPrmsf, i)
|
||||
{
|
||||
label freqI = i*fftWriteInterval_;
|
||||
fOut[i] = freq1[freqI];
|
||||
const word gName = "fft";
|
||||
PrmsfAve[i] = writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"Prmsf",
|
||||
freq1[freqI],
|
||||
surfPrmsf[i],
|
||||
procFaceOffset
|
||||
);
|
||||
|
||||
PSDfAve[i] = writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"PSDf",
|
||||
freq1[freqI],
|
||||
surfPSDf[i],
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"PSD",
|
||||
freq1[freqI],
|
||||
noiseFFT::PSD(surfPSDf[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"SPL",
|
||||
freq1[freqI],
|
||||
noiseFFT::SPL(surfPSDf[i]*deltaf),
|
||||
procFaceOffset
|
||||
);
|
||||
}
|
||||
|
||||
graph Prmsfg
|
||||
(
|
||||
"Average Prms(f)",
|
||||
"f [Hz]",
|
||||
"P(f) [Pa]",
|
||||
fOut,
|
||||
PrmsfAve
|
||||
);
|
||||
Prmsfg.write(outDir, graph::wordify(Prmsfg.title()), graphFormat_);
|
||||
|
||||
graph PSDfg
|
||||
(
|
||||
"Average PSD_f(f)",
|
||||
"f [Hz]",
|
||||
"PSD(f) [PaPa_Hz]",
|
||||
fOut,
|
||||
PSDfAve
|
||||
);
|
||||
PSDfg.write(outDir, graph::wordify(PSDfg.title()), graphFormat_);
|
||||
|
||||
graph PSDg
|
||||
(
|
||||
"Average PSD_dB_Hz(f)",
|
||||
"f [Hz]",
|
||||
"PSD(f) [dB_Hz]",
|
||||
fOut,
|
||||
noiseFFT::PSD(PSDfAve)
|
||||
);
|
||||
PSDg.write(outDir, graph::wordify(PSDg.title()), graphFormat_);
|
||||
|
||||
graph SPLg
|
||||
(
|
||||
"Average SPL_dB(f)",
|
||||
"f [Hz]",
|
||||
"SPL(f) [dB]",
|
||||
fOut,
|
||||
noiseFFT::SPL(PSDfAve*deltaf)
|
||||
);
|
||||
SPLg.write(outDir, graph::wordify(SPLg.title()), graphFormat_);
|
||||
}
|
||||
|
||||
graph PSD13g
|
||||
(
|
||||
"Average PSD13_dB_Hz(fm)",
|
||||
"fm [Hz]",
|
||||
"PSD(fm) [dB_Hz]",
|
||||
octave13FreqCentre,
|
||||
noiseFFT::PSD(PSDfAve)
|
||||
);
|
||||
PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
|
||||
|
||||
graph SPL13g
|
||||
(
|
||||
"Average SPL13_dB(fm)",
|
||||
"fm [Hz]",
|
||||
"SPL(fm) [dB]",
|
||||
octave13FreqCentre,
|
||||
noiseFFT::SPL(Prms13f2Ave)
|
||||
);
|
||||
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
||||
Info<< "Writing one-third octave surface data" << endl;
|
||||
{
|
||||
scalarField PSDfAve(surfPSD13f.size(), 0);
|
||||
scalarField Prms13f2Ave(surfPSD13f.size(), 0);
|
||||
|
||||
forAll(surfPSD13f, i)
|
||||
{
|
||||
const word gName = "oneThirdOctave";
|
||||
PSDfAve[i] = writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"PSD13f",
|
||||
octave13FreqCentre[i],
|
||||
surfPSD13f[i],
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"PSD13",
|
||||
octave13FreqCentre[i],
|
||||
noiseFFT::PSD(surfPSD13f[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
writeSurfaceData
|
||||
(
|
||||
fNameBase,
|
||||
gName,
|
||||
"SPL13",
|
||||
octave13FreqCentre[i],
|
||||
noiseFFT::SPL(surfPrms13f2[i]),
|
||||
procFaceOffset
|
||||
);
|
||||
|
||||
Prms13f2Ave[i] =
|
||||
surfaceAverage(surfPrms13f2[i], procFaceOffset);
|
||||
}
|
||||
|
||||
graph PSD13g
|
||||
(
|
||||
"Average PSD13_dB_Hz(fm)",
|
||||
"fm [Hz]",
|
||||
"PSD(fm) [dB_Hz]",
|
||||
octave13FreqCentre,
|
||||
noiseFFT::PSD(PSDfAve)
|
||||
);
|
||||
PSD13g.write(outDir, graph::wordify(PSD13g.title()), graphFormat_);
|
||||
|
||||
graph SPL13g
|
||||
(
|
||||
"Average SPL13_dB(fm)",
|
||||
"fm [Hz]",
|
||||
"SPL(fm) [dB]",
|
||||
octave13FreqCentre,
|
||||
noiseFFT::SPL(Prms13f2Ave)
|
||||
);
|
||||
SPL13g.write(outDir, graph::wordify(SPL13g.title()), graphFormat_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ Description
|
||||
}
|
||||
|
||||
// Input file
|
||||
inputFile "postProcessing/faceSource1/surface/patch/patch.case";
|
||||
inputFiles ("postProcessing/faceSource1/surface/patch/patch.case");
|
||||
|
||||
// Write interval for FFT data, default = 1
|
||||
fftWriteInterval 100;
|
||||
@ -83,8 +83,8 @@ SeeAlso
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef surfaceNoise_H
|
||||
#define surfaceNoise_H
|
||||
#ifndef noiseModels_surfaceNoise_H
|
||||
#define noiseModels_surfaceNoise_H
|
||||
|
||||
#include "noiseModel.H"
|
||||
#include "labelList.H"
|
||||
@ -115,8 +115,11 @@ protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Input file name
|
||||
fileName inputFileName_;
|
||||
//- Input file names
|
||||
List<fileName> inputFileNames_;
|
||||
|
||||
//- Name of pressure field
|
||||
word pName_;
|
||||
|
||||
//- Index of pressure field in reader field list
|
||||
label pIndex_;
|
||||
@ -138,17 +141,20 @@ protected:
|
||||
// result in a very large number of output files (1 per frequency)
|
||||
label fftWriteInterval_;
|
||||
|
||||
//- Reader type
|
||||
word readerType_;
|
||||
|
||||
//- Pointer to the surface reader
|
||||
mutable autoPtr<surfaceReader> readerPtr_;
|
||||
|
||||
//- Pointer to the surface writer
|
||||
autoPtr<surfaceWriter> writerPtr_;
|
||||
mutable autoPtr<surfaceWriter> writerPtr_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Initialise
|
||||
void initialise(const dictionary& dict);
|
||||
void initialise(const fileName& fName);
|
||||
|
||||
//- Read surface data
|
||||
void readSurfaceData
|
||||
@ -183,7 +189,7 @@ public:
|
||||
TypeName("surfaceNoise");
|
||||
|
||||
//- Constructor
|
||||
surfaceNoise(const dictionary& dict);
|
||||
surfaceNoise(const dictionary& dict, const bool readFields = true);
|
||||
|
||||
//- Destructor
|
||||
virtual ~surfaceNoise();
|
||||
@ -191,6 +197,9 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Calculate
|
||||
virtual void calculate();
|
||||
};
|
||||
|
||||
@ -117,8 +117,8 @@ tmp<scalarField> curvatureSeparation::calcCosAngle
|
||||
{
|
||||
const fvMesh& mesh = owner().regionMesh();
|
||||
const vectorField nf(mesh.Sf()/mesh.magSf());
|
||||
const unallocLabelList& own = mesh.owner();
|
||||
const unallocLabelList& nbr = mesh.neighbour();
|
||||
const labelUList& own = mesh.owner();
|
||||
const labelUList& nbr = mesh.neighbour();
|
||||
|
||||
scalarField phiMax(mesh.nCells(), -GREAT);
|
||||
scalarField cosAngle(mesh.nCells(), 0.0);
|
||||
|
||||
@ -789,7 +789,7 @@ tmp<volScalarField::Internal> thermoSingleLayer::Srho() const
|
||||
toPrimary(filmPatchi, patchMass);
|
||||
|
||||
const label primaryPatchi = primaryPatchIDs()[i];
|
||||
const unallocLabelList& cells =
|
||||
const labelUList& cells =
|
||||
primaryMesh().boundaryMesh()[primaryPatchi].faceCells();
|
||||
|
||||
forAll(patchMass, j)
|
||||
@ -843,7 +843,7 @@ tmp<volScalarField::Internal> thermoSingleLayer::Srho
|
||||
toPrimary(filmPatchi, patchMass);
|
||||
|
||||
const label primaryPatchi = primaryPatchIDs()[i];
|
||||
const unallocLabelList& cells =
|
||||
const labelUList& cells =
|
||||
primaryMesh().boundaryMesh()[primaryPatchi].faceCells();
|
||||
|
||||
forAll(patchMass, j)
|
||||
@ -893,7 +893,7 @@ tmp<volScalarField::Internal> thermoSingleLayer::Sh() const
|
||||
toPrimary(filmPatchi, patchEnergy);
|
||||
|
||||
const label primaryPatchi = primaryPatchIDs()[i];
|
||||
const unallocLabelList& cells =
|
||||
const labelUList& cells =
|
||||
primaryMesh().boundaryMesh()[primaryPatchi].faceCells();
|
||||
|
||||
forAll(patchEnergy, j)
|
||||
|
||||
@ -4,16 +4,8 @@
|
||||
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
|
||||
sinclude $(RULES)/mplib$(WM_MPLIB)
|
||||
|
||||
ADIOS_INC = -I$(ADIOS_ARCH_PATH)/include
|
||||
|
||||
ADIOS_LIBS := \
|
||||
-L$(ADIOS_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
|
||||
-ladios_$(FOAM_MPI)
|
||||
|
||||
# ADIOS dependent libraries. Eg, after -L/usr/lib64 ...
|
||||
# Query as sequential to reduce mpi-dependencies
|
||||
|
||||
ADIOS_LIBS +=
|
||||
$(shell $(ADIOS_ARCH_PATH)/bin/adios_config -s -l | sed -e 's@^.*-L/usr/lib[^ ]*@@')
|
||||
# Obtain compile/link flags via adios_config
|
||||
ADIOS_INC := $(shell $(ADIOS_ARCH_PATH)/bin/adios_config -c)
|
||||
ADIOS_LIBS := $(shell $(ADIOS_ARCH_PATH)/bin/adios_config -l)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user