Skip to content
Snippets Groups Projects
Commit a843d84f authored by mattijs's avatar mattijs
Browse files

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents a7eaf819 cf501ffa
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -106,21 +106,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
fileName dictName(runTime.system()/"noiseDict");
if (args.optionFound("dict"))
{
dictName = args["dict"];
}
const word dictName("noiseDict");
#include "setSystemRunTimeDictionaryIO.H"
Info<< "Reading " << dictName << "\n" << endl;
IOdictionary dict
(
IOobject
(
dictName.expand(),
runTime,
IOobject::MUST_READ
)
);
IOdictionary dict(dictIO);
autoPtr<noiseModel> model(noiseModel::New(dict));
model->calculate();
......
......@@ -208,19 +208,32 @@ compileApplication()
wmake $1
}
#
# cloneCase srcDir dstDir
#
cloneCase()
{
if [ -d "$2" ]
if [ -e "$2" ]
then
echo "Case already cloned: remove case directory $2 to clone"
else
elif [ -d "$1" ]
then
echo "Cloning $2 case from $1"
mkdir $2
cpfiles="0.orig 0 system constant"
for f in $cpfiles
# These must exist, so do not hide error messages
for f in system constant
do
\cp -r $1/$f $2
done
# Either (or both) may exist, so error messages may be spurious
for f in 0 0.orig
do
\cp -r $1/$f $2 2>/dev/null
done
else
echo "Error: cannot clone from non-existent directory"
echo " $1"
fi
}
......@@ -243,7 +256,7 @@ restore0Dir()
if [ -d 0.orig ]
then
\rm -rf 0
\cp -r 0.orig 0 > /dev/null 2>&1
\cp -r 0.orig 0 2>/dev/null
else
echo " Warning: no 0.orig/ found"
fi
......
......@@ -10,12 +10,16 @@
// ------------------------------------------------------------------------- //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......
......@@ -20,7 +20,7 @@ if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
dictPath.expand(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
......
......@@ -20,7 +20,7 @@ if (dictPath.size())
{
dictIO = IOobject
(
dictPath,
dictPath.expand(),
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -32,26 +32,28 @@ License
template<class Type>
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
{
List<Field<Type>> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
Pstream::scatterList(allValues);
field =
ListListOps::combine<Field<Type>>
(
allValues,
accessOp<Field<Type>>()
);
if (Pstream::parRun())
{
List<Field<Type>> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
Pstream::scatterList(allValues);
field =
ListListOps::combine<Field<Type>>
(
allValues,
accessOp<Field<Type>>()
);
}
}
template<class Type>
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
{
combineFields(field());
combineFields(field.ref());
}
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -26,6 +26,9 @@ License
#include "solarCalculator.H"
#include "Time.H"
#include "unitConversion.H"
#include "constants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -104,6 +107,14 @@ void Foam::solarCalculator::calculateBetaTetha()
beta_ = max(asin(cos(L)*cos(deltaRad)*cos(H) + sin(L)*sin(deltaRad)), 1e-3);
tetha_ = acos((sin(beta_)*sin(L) - sin(deltaRad))/(cos(beta_)*cos(L)));
// theta is the angle between the SOUTH axis and the Sun
// If the hour angle is lower than zero (morning) the Sun is positioned
// on the East side.
if (H < 0)
{
tetha_ += 2*(constant::mathematical::pi - tetha_);
}
if (debug)
{
Info << tab << "altitude : " << radToDeg(beta_) << endl;
......@@ -126,9 +137,10 @@ void Foam::solarCalculator::calculateSunDirection()
new coordinateSystem("grid", Zero, gridUp_, eastDir_)
);
// Assuming 'z' vertical, 'y' North and 'x' East
direction_.z() = -sin(beta_);
direction_.y() = cos(beta_)*cos(tetha_); //North
direction_.x() = cos(beta_)*sin(tetha_); //East
direction_.y() = cos(beta_)*cos(tetha_); // South axis
direction_.x() = cos(beta_)*sin(tetha_); // West axis
direction_ /= mag(direction_);
......@@ -137,6 +149,7 @@ void Foam::solarCalculator::calculateSunDirection()
Info<< "Sun direction in absolute coordinates : " << direction_ <<endl;
}
// Transform to actual coordinate system
direction_ = coord_->R().transform(direction_);
if (debug)
......
......@@ -4,7 +4,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) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -26,71 +26,135 @@
# Allrun
#
# Description
# Runs tutorial cases and summarizes the outcome as 'testLoopReport'
#
#------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
usage()
{
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION]
options:
-collect Collect logs only. Can be useful for aborted runs.
-help print the usage
* Runs tutorial cases and summarizes the outcome as 'testLoopReport'
USAGE
exit 1
}
#------------------------------------------------------------------------------
unset optCollectOnly
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-collect)
optCollectOnly=true
;;
-*)
usage "unknown option: $1"
;;
*)
break
;;
esac
shift
done
#------------------------------------------------------------------------------
# logReport <logfile>
# Extracts useful info from log file.
logReport()
{
caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)log\."/""/g`
appAndCase="Application $app - case $caseName"
local logfile=$1
fatalError=`grep "FOAM FATAL" $1`
UxSS=`grep -E "Ux[:| ]*solution singularity" $1`
UySS=`grep -E "Uy[:| ]*solution singularity" $1`
UzSS=`grep -E "Uz[:| ]*solution singularity" $1`
completed=`grep -E "^[\t ]*[eE]nd" $1`
# logfile is path/to/case/log.application
caseName=$(dirname $logfile | sed -e 's/\(.*\)\.\///g')
app=$(echo $logfile | sed -e 's/\(.*\)log\.//g')
appAndCase="Application $app - case $caseName"
if [ "$fatalError" ]
if grep -q "FOAM FATAL" $logfile
then
echo "$appAndCase: ** FOAM FATAL ERROR **"
elif [ "$UxSS" -a "$UySS" -a "$UzSS" ]
then
echo "$appAndCase: ** Solution singularity **"
elif [ "$completed" ]
then
completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'`
if [ "$completionTime" ]
return 1
fi
# Check for solution singularity on U equation
for eqn in Ux Uy Uz
do
if grep -q -E "${eqn}[:| ]*solution singularity" $logfile
then
completionTime="in $completionTime"
if [ "$eqn" = Uz ]
then
# Can only get here if Ux,Uy,Uz all failed
echo "$appAndCase: ** Solution singularity **"
return 1
fi
else
break
fi
echo "$appAndCase: completed $completionTime"
done
if grep -q -E "^[\t ]*[Ee]nd" $logfile
then
# Extract time from this type of content
## ExecutionTime = 60.2 s ClockTime = 63 s --> "60.2 s"
completionTime=$(tail -10 $logfile | \
sed -n -e '/Execution/{s/^[^=]*=[ \t]*//; s/\( s\) .*$/\1/; p}')
echo "$appAndCase: completed${completionTime:+ in }$completionTime"
else
echo "$appAndCase: unconfirmed completion"
fi
}
# Recursively run all tutorials
foamRunTutorials -test -skipFirst
if [ -z "$optCollectOnly" ]
then
# Recursively run all tutorials
foamRunTutorials -test -skipFirst
fi
# Analyse all log files
rm testLoopReport > /dev/null 2>&1 &
touch testLoopReport
echo "Collecting log files..." 1>&2
rm -f logs testLoopReport > /dev/null 2>&1
touch logs testLoopReport
for appDir in *
do
(
[ -d $appDir ] && cd $appDir || exit
[ -d $appDir ] || continue
echo -n " $appDir..." 1>&2
logs=`find . -name "log.*"`
[ -n "$logs" ] || exit
logs=$(find -L $appDir -type f -name 'log.*')
if [ -n "$logs" ]
then
echo 1>&2
else
echo " (no logs)" 1>&2
continue
fi
for log in `echo $logs | xargs ls -rt`
# Sort logs by time-stamp
for log in $(echo $logs | xargs ls -rt)
do
logReport $log >> ../testLoopReport
# Concatenate and summarize logs
cat "$log" >> logs 2>/dev/null
logReport $log
done
echo "" >> ../testLoopReport
)
done
find . -name "log.*" -exec cat {} \; >> logs
echo
done > testLoopReport
#------------------------------------------------------------------------------
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