PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Uniform.cc
Go to the documentation of this file.
1/* Copyright (C) 2018, 2019, 2023, 2024, 2025 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include "pism/coupler/atmosphere/Uniform.hh"
21
22#include "pism/geometry/Geometry.hh"
23#include "pism/util/Logger.hh"
24
25namespace pism {
26namespace atmosphere {
27
28Uniform::Uniform(std::shared_ptr<const Grid> grid)
29 : AtmosphereModel(grid, std::shared_ptr<AtmosphereModel>()) {
32}
33
34void Uniform::init_impl(const Geometry &geometry) {
35 (void) geometry;
36
37 m_log->message(2, "* Initializing the test atmosphere model...\n");
38
39 m_temperature->set(m_config->get_number("atmosphere.uniform.temperature", "kelvin"));
40 m_precipitation->set(m_config->get_number("atmosphere.uniform.precipitation", "kg m-2 s-1"));
41}
42
43void Uniform::update_impl(const Geometry &geometry, double t, double dt) {
44 (void) geometry;
45 (void) t;
46 (void) dt;
47}
48
52
56
61
63 m_precipitation->end_access();
64 m_temperature->end_access();
65}
66
67void Uniform::init_timeseries_impl(const std::vector<double> &ts) const {
68 m_ts_times = ts;
69}
70
71void Uniform::temp_time_series_impl(int i, int j, std::vector<double> &values) const {
72 for (size_t k = 0; k < m_ts_times.size(); ++k) {
73 values[k] = (*m_temperature)(i, j);
74 }
75}
76
77void Uniform::precip_time_series_impl(int i, int j, std::vector<double> &values) const {
78 for (size_t k = 0; k < m_ts_times.size(); ++k) {
79 values[k] = (*m_precipitation)(i, j);
80 }
81}
82
83} // end of namespace atmosphere
84} // end of namespace pism
std::shared_ptr< const Grid > grid() const
Definition Component.cc:107
std::shared_ptr< const Config > m_config
configuration database used by this component
Definition Component.hh:160
std::shared_ptr< const Logger > m_log
logger (for easy access)
Definition Component.hh:164
virtual void begin_access() const
Checks if an Array is allocated and calls DAVecGetArray.
Definition Array.cc:598
static std::shared_ptr< array::Scalar > allocate_temperature(std::shared_ptr< const Grid > grid)
static std::shared_ptr< array::Scalar > allocate_precipitation(std::shared_ptr< const Grid > grid)
A purely virtual class defining the interface of a PISM Atmosphere Model.
Uniform(std::shared_ptr< const Grid > g)
Definition Uniform.cc:28
const array::Scalar & air_temperature_impl() const
Definition Uniform.cc:53
void init_timeseries_impl(const std::vector< double > &ts) const
Definition Uniform.cc:67
void init_impl(const Geometry &geometry)
Definition Uniform.cc:34
void begin_pointwise_access_impl() const
Definition Uniform.cc:57
void temp_time_series_impl(int i, int j, std::vector< double > &values) const
Definition Uniform.cc:71
std::shared_ptr< array::Scalar > m_precipitation
Definition Uniform.hh:47
std::shared_ptr< array::Scalar > m_temperature
Definition Uniform.hh:47
void update_impl(const Geometry &geometry, double t, double dt)
Definition Uniform.cc:43
const array::Scalar & precipitation_impl() const
Definition Uniform.cc:49
void precip_time_series_impl(int i, int j, std::vector< double > &values) const
Definition Uniform.cc:77
void end_pointwise_access_impl() const
Definition Uniform.cc:62
static const double k
Definition exactTestP.cc:42