From 53502f79b85ccfdab59f2796fbce03baa680933b Mon Sep 17 00:00:00 2001 From: sergio Date: Thu, 9 Feb 2017 13:13:45 -0800 Subject: [PATCH 1/3] BUG: Correcting calculation of azimuth angle in the solar direction --- .../solarCalculator/solarCalculator.C | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C index caae10e34d..d887867658 100644 --- a/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C +++ b/src/thermophysicalModels/radiation/submodels/solarCalculator/solarCalculator.C @@ -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_ <R().transform(direction_); if (debug) From 7e20157d950dc693cfccbd9def03b1e69b8202a6 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 10 Feb 2017 13:56:42 +0000 Subject: [PATCH 2/3] ENH: setSystem*Dictionary - expand file names to enable the use of --- src/OpenFOAM/include/setSystemMeshDictionaryIO.H | 2 +- src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/include/setSystemMeshDictionaryIO.H b/src/OpenFOAM/include/setSystemMeshDictionaryIO.H index c4e5a27ae9..b664940d1a 100644 --- a/src/OpenFOAM/include/setSystemMeshDictionaryIO.H +++ b/src/OpenFOAM/include/setSystemMeshDictionaryIO.H @@ -20,7 +20,7 @@ if (dictPath.size()) { dictIO = IOobject ( - dictPath, + dictPath.expand(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE diff --git a/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H b/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H index 510f278c60..15a812693e 100644 --- a/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H +++ b/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H @@ -20,7 +20,7 @@ if (dictPath.size()) { dictIO = IOobject ( - dictPath, + dictPath.expand(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE From 84aa391403c12f9185a3ea4d78db8a8ea24f7ad7 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Fri, 10 Feb 2017 13:57:36 +0000 Subject: [PATCH 3/3] BUG: noise - updated creation of control dictionary to allow -case option and env variables. Fixes #402 --- .../utilities/postProcessing/noise/noise.C | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/applications/utilities/postProcessing/noise/noise.C b/applications/utilities/postProcessing/noise/noise.C index 88ef922589..c872b1557c 100644 --- a/applications/utilities/postProcessing/noise/noise.C +++ b/applications/utilities/postProcessing/noise/noise.C @@ -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" - IOdictionary dict - ( - IOobject - ( - dictName.expand(), - runTime, - IOobject::MUST_READ - ) - ); + Info<< "Reading " << dictName << "\n" << endl; + + IOdictionary dict(dictIO); autoPtr model(noiseModel::New(dict)); model->calculate();