Commit 1fc3336f authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev/

parents 8827ab2d 0723cbed
testDataEntry.C
EXE = $(FOAM_APPBIN)/testDataEntry
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-llagrangianIntermediate \
-lradiation \
-lthermophysicalFunctions
\ No newline at end of file
testTable.C
EXE=$(FOAM_USER_APPBIN)/testTable
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
testDataEntry
Description
Tests lagrangian/intermediate/submodels/IO/DataEntry
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "DataEntry.H"
#include "IOdictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
IOdictionary dataEntryProperties
(
IOobject
(
"dataEntryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
autoPtr<DataEntry<scalar> > dataEntry
(
DataEntry<scalar>::New
(
"dataEntry",
dataEntryProperties
)
);
scalar x0 = readScalar(dataEntryProperties.lookup("x0"));
scalar x1 = readScalar(dataEntryProperties.lookup("x1"));
Info<< "Data entry type: " << dataEntry().type() << nl << endl;
Info<< "Inputs" << nl
<< " x0 = " << x0 << nl
<< " x1 = " << x1 << nl
<< endl;
Info<< "Interpolation" << nl
<< " f(x0) = " << dataEntry().value(x0) << nl
<< " f(x1) = " << dataEntry().value(x1) << nl
<< endl;
Info<< "Integration" << nl
<< " int(f(x)) lim(x0->x1) = " << dataEntry().integrate(x0, x1) << nl
<< endl;
return(0);
}
// ************************************************************************* //
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / 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
#
# Script
# foamPackBin <arch> [outputDir]
#
# Description
# Packs and compresses binary version of OpenFOAM for release
#
#------------------------------------------------------------------------------
if [ $# = 0 ]
then
echo "Error: architecture type expected, exiting"
echo
echo "Usage : ${0##*/} <arch> [outputDir]"
echo
exit 1
fi
arch=$1
timeStamp=$(date +%Y-%m-%d)
packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packFile=${packDir}.${arch}_${timeStamp}.gtgz
# add optional output directory
if [ -d "$2" ]
then
packFile="$2/$packFile"
fi
if [ -f $packFile ]
then
echo "Error: $packFile already exists"
exit 1
fi
# check for essential directories
for dir in $packDir $packDir/lib/$arch $packDir/applications/bin/$arch
do
if [ ! -d $dir ]
then
echo "Error: directory $dir does not exist"
exit 1
fi
done
# get list of directories
dirList=$(
for dir in \
$packDir/lib/$arch \
$packDir/applications/bin/$arch \
$packDir/wmake/rules \
$packDir/src/{mico,mpich,lam,openmpi}-*/platforms/$arch \
$packDir/src/{mico,mpich,lam,openmpi}-*/platforms/$arch \
;
do
[ -d $dir ] && echo $dir
done
)
echo
echo "Packing $arch port of $packDir into $packFile"
echo
tar czpf $packFile $dirList
if [ $? = 0 ]
then
echo "Finished packing and compressing file $packFile"
else
echo "Error: failure packing $packFile"
rm -f $packFile 2>/dev/null
fi
#------------------------------------------------------------------------------
......@@ -50,7 +50,6 @@ Foam::Table<Type>::Table
) << "Table is invalid (empty)" << nl
<< exit(FatalError);
}
Info<< table_;
}
......@@ -72,27 +71,18 @@ Type Foam::Table<Type>::value(const scalar x) const
return pTraits<Type>::zero;
}
// Find i such that x(i) < x < x(i+1)
label i = 0;
while ((table_[i].first() < x) && (i < table_.size()))
while ((table_[i+1].first() < x) && (i+1 < table_.size()))
{
i++;
}
if (i == 0)
{
return table_[0].second();
}
else if (i == table_.size() - 1)
{
return table_[i-1].second();
}
else
{
return
(x - table_[i-1].first())/(table_[i].first() - table_[i-1].first())
* (table_[i].second() - table_[i-1].second())
+ table_[i-1].second();
}
// Linear interpolation to find value
return
(x - table_[i].first())/(table_[i+1].first() - table_[i].first())
* (table_[i+1].second() - table_[i].second())
+ table_[i].second();
}
......@@ -127,11 +117,11 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
{
sum +=
(table_[i].second() + table_[i+1].second())
* (table_[i+1].first() - table_[i].first());
* (table_[i+1].first() - table_[i].first());
}
sum *= 0.5;
// Add table ends
// Add table ends (partial segments)
if (id1 > 0)
{
sum += 0.5
......@@ -148,4 +138,5 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
return sum;
}
// ************************************************************************* //
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment