Program Listing for File WindNinja.hpp

Program Listing for File WindNinja.hpp#

Return to documentation for file (src/modules/interp_met/WindNinja.hpp)

//
// Canadian Hydrological Model - The Canadian Hydrological Model (CHM) is a novel
// modular unstructured mesh based approach for hydrological modelling
// Copyright (C) 2018 Christopher Marsh
//
// This file is part of Canadian Hydrological Model.
//
// Canadian Hydrological Model 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.
//
// Canadian Hydrological Model 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 Canadian Hydrological Model.  If not, see
// <http://www.gnu.org/licenses/>.
//

#pragma once

#include "logger.hpp"
#include "triangulation.hpp"
#include "module_base.hpp"
#include "math/coordinates.hpp"
#include <physics/Atmosphere.h>
#include <cstdlib>
#include <string>

#include <Winstral_parameters.hpp>

#include <cmath>
#include <armadillo>
#define _USE_MATH_DEFINES
#include <cmath>


class WindNinja : public module_base
{
REGISTER_MODULE_HPP(WindNinja);
public:
    WindNinja(config_file cfg);
    ~WindNinja();
    virtual void run(mesh& domain);
    virtual void init(mesh& domain);
    double ys;
    double yc;
    class data : public face_info
    {
    public:
        double curvature;
        interpolation interp;
        double corrected_theta;
        double W;
        double temp_u;
        interpolation interp_smoothing;
        double W_transf;
    };
    double distance;
    int N_windfield; //  Number of wind fields in the library
    bool ninja_average; // Boolean to activate linear interpolation betweem the closest 2 wind fields from the library
    double H_forc; // Reference height for GEM forcing and WindNinja wind field library
    double Max_spdup;  // Maximal value of crest speedup
    double Min_spdup;  // Minimal value of crest speedup
    double scale_factor; // used to scale up the windspeeds in the case of a serious bias
    int L_avg;   // Size of the square of averaging when computing the speed-up map
                 // Not used by default and set to -1 if not specified in the config file.
    bool ninja_recirc; // Boolean to activate wind speed reduction on the leeside of mountainous terrain

    bool compute_Sx; // uses the Sx module to influence the windspeeds so Sx needs to be computed during the windspeed evaluation, instead of a seperate module
    double Sx_crit;    // Critical values of the Winstral parameter to determine the occurence of flow separation.
    std::shared_ptr<Winstral_parameters> Sx;
};