Merge branch 'master' into develop

This commit is contained in:
Andrew Heather
2017-02-10 14:00:26 +00:00
4 changed files with 24 additions and 20 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -106,21 +106,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
fileName dictName(runTime.system()/"noiseDict"); const word dictName("noiseDict");
if (args.optionFound("dict")) #include "setSystemRunTimeDictionaryIO.H"
{
dictName = args["dict"];
}
IOdictionary dict Info<< "Reading " << dictName << "\n" << endl;
(
IOobject IOdictionary dict(dictIO);
(
dictName.expand(),
runTime,
IOobject::MUST_READ
)
);
autoPtr<noiseModel> model(noiseModel::New(dict)); autoPtr<noiseModel> model(noiseModel::New(dict));
model->calculate(); model->calculate();

View File

@ -20,7 +20,7 @@ if (dictPath.size())
{ {
dictIO = IOobject dictIO = IOobject
( (
dictPath, dictPath.expand(),
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -20,7 +20,7 @@ if (dictPath.size())
{ {
dictIO = IOobject dictIO = IOobject
( (
dictPath, dictPath.expand(),
runTime, runTime,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenCFD Ltd. \\ / A nd | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -26,6 +26,9 @@ License
#include "solarCalculator.H" #include "solarCalculator.H"
#include "Time.H" #include "Time.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "constants.H"
using namespace Foam::constant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * 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); 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))); 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) if (debug)
{ {
Info << tab << "altitude : " << radToDeg(beta_) << endl; Info << tab << "altitude : " << radToDeg(beta_) << endl;
@ -126,9 +137,10 @@ void Foam::solarCalculator::calculateSunDirection()
new coordinateSystem("grid", Zero, gridUp_, eastDir_) new coordinateSystem("grid", Zero, gridUp_, eastDir_)
); );
// Assuming 'z' vertical, 'y' North and 'x' East
direction_.z() = -sin(beta_); direction_.z() = -sin(beta_);
direction_.y() = cos(beta_)*cos(tetha_); //North direction_.y() = cos(beta_)*cos(tetha_); // South axis
direction_.x() = cos(beta_)*sin(tetha_); //East direction_.x() = cos(beta_)*sin(tetha_); // West axis
direction_ /= mag(direction_); direction_ /= mag(direction_);
@ -137,6 +149,7 @@ void Foam::solarCalculator::calculateSunDirection()
Info<< "Sun direction in absolute coordinates : " << direction_ <<endl; Info<< "Sun direction in absolute coordinates : " << direction_ <<endl;
} }
// Transform to actual coordinate system
direction_ = coord_->R().transform(direction_); direction_ = coord_->R().transform(direction_);
if (debug) if (debug)