From 55cd54fed2074aa32c44d8398d2437c24e9c8c84 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 15 Aug 2024 21:57:25 +0200 Subject: [PATCH 01/29] fix: correct python path for yac --- examples/bubble3d/run_bubble_tmp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 31a5b03c..51c3bde9 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -58,7 +58,7 @@ then spack load py-netcdf4 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/sw/spack-levante/libfyaml-0.7.12-fvbhgo/lib - export PYTHONPATH=${PYTHONPATH}:${path2yac}/yac-v3.2.0/python # path to python bindings + export PYTHONPATH=${PYTHONPATH}:${path2yac}/yac/python # path to python bindings export OMP_PROC_BIND=spread export OMP_PLACES=threads From dd09574b47b6325ffcd3f51a5f302dd3d0fc20a8 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 15 Aug 2024 21:57:49 +0200 Subject: [PATCH 02/29] fix: correct gridfile for bubble --- examples/bubble3d/run_bubble_tmp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 51c3bde9..d0616ae4 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -66,8 +66,8 @@ then cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc \ ${path2build}/aes_bubble_atm_3d_ml_20080801T000000Z.nc - cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_cgrid_ml.nc \ - ${path2build}/aes_bubble_atm_cgrid_ml.nc + cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc + ${path2build}/Torus_Triangles_20x4_5000m.nc mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ From b2f2946ef03fd332d93a81d861375f217aad0a24 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 15 Aug 2024 21:58:27 +0200 Subject: [PATCH 03/29] fix: don't activate cleoenv during compilation --- scripts/bash/compile_cleo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bash/compile_cleo.sh b/scripts/bash/compile_cleo.sh index df20c3b9..57604c32 100755 --- a/scripts/bash/compile_cleo.sh +++ b/scripts/bash/compile_cleo.sh @@ -25,7 +25,7 @@ executables="$4" # get from command line argument spack load cmake@3.23.1%gcc module load gcc/11.2.0-gcc-11.2.0 -source activate ${cleoenv} # or do 'unset CMAKE_PREFIX_PATH' if using default levante env +# source activate ${cleoenv} # TODO(CB): fix best practise if [ "${buildtype}" != "serial" ] && [ "${buildtype}" != "openmp" ] && [ "${buildtype}" != "cuda" ]; then From 259ab37fc879921a83062df11959b71da8456759 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 00:14:30 +0200 Subject: [PATCH 04/29] feat: chose file for ICONN data fom arguments passed to python script --- examples/bubble3d/run_bubble_tmp.sh | 2 +- examples/bubble3d/yac_bubble_data_reader.py | 28 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index d0616ae4..80658275 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -66,7 +66,7 @@ then cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc \ ${path2build}/aes_bubble_atm_3d_ml_20080801T000000Z.nc - cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc + cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc \ ${path2build}/Torus_Triangles_20x4_5000m.nc mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 3731040c..889712f0 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -1,8 +1,32 @@ +""" +Copyright (c) 2024 MPI-M, Clara Bayley + + +----- CLEO ----- +File: yac_bubble_data_reader.py +Project: bubble3d +Created Date: Friday 19th July 2024 +Author: Wilton Loch (WL) +Additional Contributors: Clara Bayley (CB) +----- +Last Modified: Friday 16th August 2024 +Modified By: CB +----- +License: BSD 3-Clause "New" or "Revised" License +https://opensource.org/licenses/BSD-3-Clause +----- +File Description: +Python file for yac for a one-way coupling between ICON's +output data and CLEO (e.g. for the bubble test case) +""" + + #!/usr/bin/env python3 from yac import YAC, UnstructuredGrid, Field, Location, Calendar, TimeUnit, def_calendar from netCDF4 import Dataset import numpy as np +import sys def map_vertices(array): @@ -63,8 +87,8 @@ def prepare_data_for_yac(source): return target -data_filename = "aes_bubble_atm_3d_ml_20080801T000000Z.nc" -grid_filename = "aes_bubble_atm_cgrid_ml.nc" +data_filename = sys.argv[1] +grid_filename = sys.argv[2] yac = YAC() From ad0162814eecf1c25f0b646762c3d9add23cfdb9 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 00:32:01 +0200 Subject: [PATCH 05/29] refactor: make yac script compatible with Torus Triangles gridfile --- examples/bubble3d/run_bubble_tmp.sh | 4 +++- examples/bubble3d/yac_bubble_data_reader.py | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 80658275..815eebda 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -72,5 +72,7 @@ then mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ : -n 1 python \ - ${path2CLEO}/examples/bubble3d/yac_bubble_data_reader.py + ${path2CLEO}/examples/bubble3d/yac_bubble_data_reader.py \ + ${path2build}/aes_bubble_atm_3d_ml_20080801T000000Z.nc \ + ${path2build}/Torus_Triangles_20x4_5000m.nc fi diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 889712f0..650ab731 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -51,24 +51,27 @@ def create_yac_unstructured_grid(grid_filname): dataset = Dataset(grid_filname, "r") # Read the variables - nv = dataset.dimensions["vertices"].size - no_cells = dataset.dimensions["ncells"].size + nv = dataset.dimensions["nv"].size + no_cells = dataset.dimensions["cell"].size vertices = [] - for cell in range(len(dataset["clon_bnds"])): + for cell in range(len(dataset["clon_vertices"])): for vertex in range(3): vertices.append( - [dataset["clon_bnds"][cell][vertex], dataset["clat_bnds"][cell][vertex]] + [ + dataset["clon_vertices"][cell][vertex], + dataset["clat_vertices"][cell][vertex], + ] ) cell_vertex_indices = map_vertices(vertices) - grid_name = "icon_atmos_grid" + grid_name = "Torus_Triangles_20x4_5000m" grid = UnstructuredGrid( grid_name, np.ones(no_cells) * nv, - dataset["clon_bnds"][:, :].flatten(), - dataset["clat_bnds"][:, :].flatten(), + dataset["clon_vertices"][:, :].flatten(), + dataset["clat_vertices"][:, :].flatten(), cell_vertex_indices, ) From e1df3b324dbd203a8acaf9e51db376da686abd04 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 00:42:02 +0200 Subject: [PATCH 06/29] chore: formatting --- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 190 +++++++++---------- 1 file changed, 87 insertions(+), 103 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index 0c52d6ef..1e5e45e3 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -6,10 +6,10 @@ * File: yac_cartesian_dynamics.cpp * Project: coupldyn_yac * Created Date: Friday 13th October 2023 - * Author: Clara Bayley (CB) - * Additional Contributors: + * Author: Wilton Loch (WL) + * Additional Contributors: Clara Bayley (CB) * ----- - * Last Modified: Wednesday 17th April 2024 + * Last Modified: Friday 16th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -18,25 +18,24 @@ * File Description: * functionality for dynamics solver in CLEO * where coupling is one-way and dynamics - * are read from file + * are read from a file via yac */ #include "coupldyn_yac/yac_cartesian_dynamics.hpp" -#include "cleoconstants.hpp" -#include +#include + #include +#include -#include +#include "cleoconstants.hpp" extern "C" { #include "yac.h" } -enum { - VERTICAL = 0, - EASTWARD = 1, - NORTHWARD = 2 -}; +enum { VERTICAL = 0, EASTWARD = 1, NORTHWARD = 2 }; + +namespace dlc = dimless_constants; /* return (k,i,j) indicies from idx for a flattened 3D array with ndims [nz, nx, ny]. kij is useful for then getting @@ -51,43 +50,41 @@ std::array kijfromindex(const std::array &ndims, const siz return std::array{k, i, j}; } -void create_vertex_coordinates(const Config &config, - const std::array ndims, - std::vector & vertex_longitudes, - std::vector & vertex_latitudes) { +void create_vertex_coordinates(const Config &config, const std::array ndims, + std::vector &vertex_longitudes, + std::vector &vertex_latitudes) { double lower_longitude = 0; double upper_longitude = ndims[EASTWARD] * (2 * std::numbers::pi / (ndims[EASTWARD] + 1)); double lower_latitude = (-0.5 * std::numbers::pi * ndims[NORTHWARD]) / (ndims[NORTHWARD] + 2); double upper_latitude = (0.5 * std::numbers::pi * ndims[NORTHWARD]) / (ndims[NORTHWARD] + 2); if (!std::isnan(config.get_yac_dynamics().lower_longitude)) - lower_longitude = config.get_yac_dynamics().lower_longitude; + lower_longitude = config.get_yac_dynamics().lower_longitude; if (!std::isnan(config.get_yac_dynamics().upper_longitude)) - upper_longitude = config.get_yac_dynamics().upper_longitude; + upper_longitude = config.get_yac_dynamics().upper_longitude; if (!std::isnan(config.get_yac_dynamics().lower_latitude)) - lower_latitude = config.get_yac_dynamics().lower_latitude; + lower_latitude = config.get_yac_dynamics().lower_latitude; if (!std::isnan(config.get_yac_dynamics().upper_latitude)) - upper_latitude = config.get_yac_dynamics().upper_latitude; + upper_latitude = config.get_yac_dynamics().upper_latitude; // Defines the vertex longitude and latitude values in radians for grid creation // The values are later permuted by YAC to generate all vertex coordinates for (size_t i = 0; i < vertex_longitudes.size(); i++) - vertex_longitudes[i] = lower_longitude + - i * ((upper_longitude - lower_longitude) / ndims[EASTWARD]); + vertex_longitudes[i] = + lower_longitude + i * ((upper_longitude - lower_longitude) / ndims[EASTWARD]); for (size_t i = 0; i < vertex_latitudes.size(); i++) - vertex_latitudes[i] = lower_latitude + - i * ((upper_latitude - lower_latitude) / ndims[NORTHWARD]); + vertex_latitudes[i] = + lower_latitude + i * ((upper_latitude - lower_latitude) / ndims[NORTHWARD]); } /* Creates the YAC grid and defines the cell and edge points based on ndims data */ -void create_grid_and_points_definitions(const Config &config, - const std::array ndims, - const std::string grid_name, - int & grid_id, int & cell_point_id, int & edge_point_id) { +void create_grid_and_points_definitions(const Config &config, const std::array ndims, + const std::string grid_name, int &grid_id, + int &cell_point_id, int &edge_point_id) { int cyclic_dimension[2] = {0, 0}; int total_cells[2] = {static_cast(ndims[EASTWARD]), static_cast(ndims[NORTHWARD])}; int total_vertices[2] = {static_cast(ndims[EASTWARD] + 1), @@ -105,19 +102,19 @@ void create_grid_and_points_definitions(const Config &config, create_vertex_coordinates(config, ndims, vertex_longitudes, vertex_latitudes); // Defines a regular 2D grid - yac_cdef_grid_reg2d(grid_name.c_str(), total_vertices, cyclic_dimension, - vertex_longitudes.data(), vertex_latitudes.data(), &grid_id); + yac_cdef_grid_reg2d(grid_name.c_str(), total_vertices, cyclic_dimension, vertex_longitudes.data(), + vertex_latitudes.data(), &grid_id); // --- Point definitions --- // Defines the cell center longitude and latitude values in radians // The values are later permuted by YAC to generate all cell center coordinates for (size_t i = 0; i < cell_center_longitudes.size(); i++) - cell_center_longitudes[i] = vertex_longitudes[i] - + (vertex_longitudes[i + 1] - vertex_longitudes[i]) / 2; + cell_center_longitudes[i] = + vertex_longitudes[i] + (vertex_longitudes[i + 1] - vertex_longitudes[i]) / 2; for (size_t i = 0; i < cell_center_latitudes.size(); i++) - cell_center_latitudes[i] = vertex_latitudes[i] - + (vertex_latitudes[i + 1] - vertex_latitudes[i]) / 2; + cell_center_latitudes[i] = + vertex_latitudes[i] + (vertex_latitudes[i + 1] - vertex_latitudes[i]) / 2; // Defines the edge center longitude and latitude values in radians. // Since it is not possible to generate edge center coordinates with a single @@ -146,12 +143,9 @@ void create_grid_and_points_definitions(const Config &config, &edge_point_id); } -void CartesianDynamics::receive_yac_field(unsigned int field_type, - unsigned int yac_field_id, - double ** yac_raw_data, - std::vector & target_array, - size_t vertical_levels, - double conversion_factor = 1.0) { +void CartesianDynamics::receive_yac_field(unsigned int field_type, unsigned int yac_field_id, + double **yac_raw_data, std::vector &target_array, + size_t vertical_levels, double conversion_factor = 1.0) { int info, error; unsigned int total_horizontal_cells = ndims[EASTWARD] * ndims[NORTHWARD]; bool edge_dimension = false; @@ -191,26 +185,20 @@ void CartesianDynamics::receive_yac_field(unsigned int field_type, /* This subroutine is the main entry point for receiving data from YAC. * It checks the dimensionality of the simulation based on the config data. */ void CartesianDynamics::receive_fields_from_yac() { - enum field_types { - CELL, - EASTWARD_EDGE, - NORTHWARD_EDGE - }; + enum field_types { CELL, EASTWARD_EDGE, NORTHWARD_EDGE }; - receive_yac_field(CELL, temp_yac_id, yac_raw_cell_data, - temp, ndims[VERTICAL], dimless_constants::TEMP0); - receive_yac_field(CELL, pressure_yac_id, yac_raw_cell_data, - press, ndims[VERTICAL], dimless_constants::P0); + receive_yac_field(CELL, temp_yac_id, yac_raw_cell_data, temp, ndims[VERTICAL], dlc::TEMP0); + receive_yac_field(CELL, pressure_yac_id, yac_raw_cell_data, press, ndims[VERTICAL], dlc::P0); receive_yac_field(CELL, qvap_yac_id, yac_raw_cell_data, qvap, ndims[VERTICAL]); receive_yac_field(CELL, qcond_yac_id, yac_raw_cell_data, qcond, ndims[VERTICAL]); - receive_yac_field(CELL, vertical_wind_yac_id, yac_raw_vertical_wind_data, - wvel, ndims[VERTICAL] + 1, dimless_constants::W0); + receive_yac_field(CELL, vertical_wind_yac_id, yac_raw_vertical_wind_data, wvel, + ndims[VERTICAL] + 1, dlc::W0); - receive_yac_field(EASTWARD_EDGE, eastward_wind_yac_id, yac_raw_edge_data, - uvel, ndims[VERTICAL], dimless_constants::W0); - receive_yac_field(NORTHWARD_EDGE, northward_wind_yac_id, yac_raw_edge_data, - vvel, ndims[VERTICAL], dimless_constants::W0); + receive_yac_field(EASTWARD_EDGE, eastward_wind_yac_id, yac_raw_edge_data, uvel, ndims[VERTICAL], + dlc::W0); + receive_yac_field(NORTHWARD_EDGE, northward_wind_yac_id, yac_raw_edge_data, vvel, ndims[VERTICAL], + dlc::W0); } CartesianDynamics::CartesianDynamics(const Config &config, const std::array i_ndims, @@ -236,8 +224,8 @@ CartesianDynamics::CartesianDynamics(const Config &config, const std::array Date: Fri, 16 Aug 2024 00:57:46 +0200 Subject: [PATCH 07/29] refactor: change obsstep, coupling step and add another superdroplet observer --- examples/bubble3d/src/config/bubble3d_config.yaml | 4 ++-- examples/bubble3d/src/main_bubble3d.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index 3c96a133..20b6e102 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -32,8 +32,8 @@ timesteps: CONDTSTEP : 2 # time between SD condensation [s] COLLTSTEP : 2 # time between SD collision [s] MOTIONTSTEP : 3 # time between SDM motion [s] - COUPLTSTEP : 1800 # time between dynamic couplings [s] - OBSTSTEP : 1800 # time between SDM observations [s] + COUPLTSTEP : 60 # time between dynamic couplings [s] + OBSTSTEP : 60 # time between SDM observations [s] T_END : 7200 # time span of integration from 0s to T_END [s] ### Initialisation Parameters ### diff --git a/examples/bubble3d/src/main_bubble3d.cpp b/examples/bubble3d/src/main_bubble3d.cpp index 24910efa..fc737590 100644 --- a/examples/bubble3d/src/main_bubble3d.cpp +++ b/examples/bubble3d/src/main_bubble3d.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th July 2024 + * Last Modified: Friday 16th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -98,11 +98,12 @@ template inline Observer auto create_superdrops_observer(const unsigned int interval, Dataset &dataset, const int maxchunk) { CollectDataForDataset auto sdid = CollectSdId(dataset, maxchunk); + CollectDataForDataset auto sdgbxindex = CollectSdgbxindex(dataset, maxchunk); CollectDataForDataset auto coord3 = CollectCoord3(dataset, maxchunk); CollectDataForDataset auto coord1 = CollectCoord1(dataset, maxchunk); CollectDataForDataset auto coord2 = CollectCoord2(dataset, maxchunk); - const auto collect_data = coord2 >> coord1 >> coord3 >> sdid; + const auto collect_data = coord2 >> coord1 >> coord3 >> sdgbxindex >> sdid; return SuperdropsObserver(interval, dataset, maxchunk, collect_data); } From dda857127c289a240e291f2c19870d3e2102c1d1 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 01:08:30 +0200 Subject: [PATCH 08/29] refactor: remove make clean from tmp file --- examples/bubble3d/run_bubble_tmp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 815eebda..eb7779f9 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -28,7 +28,7 @@ then elif [ "${action}" == "compile" ] then - cd ${path2build} && make clean + cd ${path2build} module purge module load openmpi/4.1.2-gcc-11.2.0 From 33c97c9c852511e64827ac805db10718e7f5d535 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 01:35:26 +0200 Subject: [PATCH 09/29] chore: formatting --- libs/coupldyn_yac/yac_cartesian_dynamics.hpp | 7 +++--- libs/coupldyn_yac/yac_comms.cpp | 23 ++++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp index 317f4491..905a25c9 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 17th April 2024 + * Last Modified: Friday 16th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -58,11 +58,10 @@ struct CartesianDynamics { // Target for lon and lat edge data respectively // (these are copied from united_edge_data after receiving from YAC) - std::vector uvel, wvel; + std::vector vvel, uvel; // Container for cell-centered vertical wind velocities - // (Only meaningful in 3D simulations) - std::vector vvel; + std::vector wvel; // YAC field ids int pressure_yac_id; diff --git a/libs/coupldyn_yac/yac_comms.cpp b/libs/coupldyn_yac/yac_comms.cpp index 8554fc5b..4f5d2b66 100644 --- a/libs/coupldyn_yac/yac_comms.cpp +++ b/libs/coupldyn_yac/yac_comms.cpp @@ -1,13 +1,15 @@ -/* Copyright (c) 2023 MPI-M, Clara Bayley +/* + * Copyright (c) 2024 MPI-M, Clara Bayley + * * * ----- CLEO ----- - * File: yaccomms.cpp + * File: yac_comms.cpp * Project: coupldyn_yac - * Created Date: Tuesday 31st October 2023 - * Author: Clara Bayley (CB) - * Additional Contributors: + * Created Date: Friday 3rd May 2024 + * Author: Wilton Loch (WL) + * Additional Contributors: Clara Bayley (CB) * ----- - * Last Modified: Tuesday 7th November 2023 + * Last Modified: Friday 16th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,8 +40,7 @@ void YacComms::receive_dynamics(const YacDynamics &ffdyn, const viewh_gbx h_gbxs /* updates the state of a gridbox using information received from YacDynamics solver for 1-way coupling to CLEO SDM */ -void YacComms::update_gridbox_state(const YacDynamics &ffdyn, const size_t ii, - Gridbox &gbx) const { +void YacComms::update_gridbox_state(const YacDynamics &ffdyn, const size_t ii, Gridbox &gbx) const { State &state(gbx.state); state.press = ffdyn.get_press(ii); @@ -52,8 +53,6 @@ void YacComms::update_gridbox_state(const YacDynamics &ffdyn, const size_t ii, state.vvel = ffdyn.get_vvel(ii); } -template void YacComms::send_dynamics(const viewh_constgbx, - YacDynamics &) const; +template void YacComms::send_dynamics(const viewh_constgbx, YacDynamics &) const; -template void YacComms::receive_dynamics(const YacDynamics &, - const viewh_gbx) const; +template void YacComms::receive_dynamics(const YacDynamics &, const viewh_gbx) const; From e0c2cae69e565735898efea7ab4d19340b5a2dcc Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 20:32:29 +0200 Subject: [PATCH 10/29] chore: formatting --- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 43 +++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index 1e5e45e3..c1c18af1 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -237,59 +237,62 @@ CartesianDynamics::CartesianDynamics(const Config &config, const std::array Date: Fri, 16 Aug 2024 20:33:36 +0200 Subject: [PATCH 11/29] refactor: make yac_bubble_data_reader python script more general + formatting --- examples/bubble3d/run_bubble_tmp.sh | 19 ++- examples/bubble3d/yac_bubble_data_reader.py | 135 +++++++++++++++++--- 2 files changed, 127 insertions(+), 27 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index eb7779f9..c875f1e4 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -63,16 +63,23 @@ then export OMP_PROC_BIND=spread export OMP_PLACES=threads - cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc \ - ${path2build}/aes_bubble_atm_3d_ml_20080801T000000Z.nc + icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc + icon_data_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc + icon_data_timestep=30 # must match ICON data file [seconds] + cleo_coupling_timestep=60 # must match CLEO config file [seconds] + cleo_t_end=3600 # must match CLEO config file [seconds] + cleo_vertical_levels=25 # must match CLEO gridfile - cp /work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc \ - ${path2build}/Torus_Triangles_20x4_5000m.nc + grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc + data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc + + cp ${icon_grid_file} ${icon_grid_file_copy} + cp ${icon_data_file} ${icon_data_file_copy} mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ : -n 1 python \ ${path2CLEO}/examples/bubble3d/yac_bubble_data_reader.py \ - ${path2build}/aes_bubble_atm_3d_ml_20080801T000000Z.nc \ - ${path2build}/Torus_Triangles_20x4_5000m.nc + ${grid_file_copy} ${data_file_copy} ${icon_data_timestep} \ + ${cleo_coupling_timestep} ${cleo_vertical_levels} ${cleo_t_end} fi diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 650ab731..40695cbc 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -29,6 +29,29 @@ import sys +def convert_seconds_to_isodate(seconds): + """converts seconds interval into an ISO 8601 format string""" + import isodate + from datetime import timedelta + + duration = timedelta(seconds=seconds) + + return isodate.duration_isoformat(duration) + + +def add_seconds_to_isodate(iso, seconds): + """adds seconds interval to ISO 8601 isodate given as a string + and returns a string for the new ISO 8601 isodate.""" + + from datetime import datetime, timedelta + + dt = datetime.fromisoformat(iso.replace("Z", "+00:00")) + new_dt = dt + timedelta(seconds=seconds) + new_iso = new_dt.isoformat().replace("+00:00", "Z") + + return new_iso + + def map_vertices(array): vertex_dict = {} vertex_mapping = 0 @@ -46,9 +69,16 @@ def map_vertices(array): return vertex_mapping_array -def create_yac_unstructured_grid(grid_filname): +def create_yac_unstructured_grid(grid_filename): + """create unstructured grid for YAC from ICON netcdf file. + Note different .nc files may have different names for variables, + e.g. "nv" <=> "vertices" + "cell" <=> "ncells" + "clon_vertices" <=> "clon_bnds" + "clat_vertices" <=> "clat_bnds" + """ # Open the NetCDF file - dataset = Dataset(grid_filname, "r") + dataset = Dataset(grid_filename, "r") # Read the variables nv = dataset.dimensions["nv"].size @@ -66,7 +96,7 @@ def create_yac_unstructured_grid(grid_filname): cell_vertex_indices = map_vertices(vertices) - grid_name = "Torus_Triangles_20x4_5000m" + grid_name = "aes_bubble_atm_icon_grid" grid = UnstructuredGrid( grid_name, np.ones(no_cells) * nv, @@ -90,50 +120,113 @@ def prepare_data_for_yac(source): return target -data_filename = sys.argv[1] -grid_filename = sys.argv[2] +grid_filename = sys.argv[1] +data_filename = sys.argv[2] +DATATSTEP = sys.argv[3] # must match ICON data file [seconds] +COUPLTSTEP = sys.argv[4] # must match CLEO config file [seconds] +T_END = sys.argv[6] # must match CLEO config file [seconds] +num_vertical_levels = sys.argv[5] # must match CLEO gridfile yac = YAC() def_calendar(Calendar.PROLEPTIC_GREGORIAN) -yac.def_datetime("2008-08-01T00:00:00Z", "2008-08-01T02:00:00Z") +iso_start = "2008-08-01T00:00:00Z" +iso_end = add_seconds_to_isodate(iso_start, T_END) +yac.def_datetime(iso_start, iso_end) component_name = "atm" component = yac.def_comp(component_name) grid = create_yac_unstructured_grid(grid_filename) # --- Field definitions --- +coupling_tstep = convert_seconds_to_isodate(COUPLTSTEP) + press = Field.create( - "pressure", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "pressure", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) temp = Field.create( - "temperature", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "temperature", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) qvap = Field.create( - "qvap", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "qvap", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) qcond = Field.create( - "qcond", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "qcond", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) eastward_wind = Field.create( - "eastward_wind", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "eastward_wind", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) northward_wind = Field.create( - "northward_wind", component, grid.cell_points, 25, "PT30M", TimeUnit.ISO_FORMAT + "northward_wind", + component, + grid.cell_points, + num_vertical_levels, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) vertical_wind = Field.create( - "vertical_wind", component, grid.cell_points, 26, "PT30M", TimeUnit.ISO_FORMAT + "vertical_wind", + component, + grid.cell_points, + num_vertical_levels + 1, + coupling_tstep, + TimeUnit.ISO_FORMAT, ) yac.enddef() dataset = Dataset(data_filename) -for step in range(5): - temp.put(prepare_data_for_yac(dataset["ta"][step, 0:25, :])) - press.put(prepare_data_for_yac(dataset["pfull"][step, 0:25, :])) - qvap.put(prepare_data_for_yac(dataset["hus"][step, 0:25, :])) - qcond.put(prepare_data_for_yac(dataset["clw"][step, 0:25, :])) - vertical_wind.put(prepare_data_for_yac(dataset["wa"][step, 0:26, :])) - eastward_wind.put(prepare_data_for_yac(dataset["ua"][step, 0:25, :])) - northward_wind.put(prepare_data_for_yac(dataset["va"][step, 0:25, :])) +assert ( + DATATSTEP <= COUPLTSTEP +), "COUPLTSTEP [s] must be greater than or equal to DATATSTEP [s]" +assert ( + DATATSTEP % COUPLTSTEP == 0.0 +), "COUPLTSTEP [s] must be integer multiple of DATATSTEP [s]" +datasteps_per_coupling_step = COUPLTSTEP / DATATSTEP +num_couplingsteps = int(np.floor(T_END / COUPLTSTEP) + 1) + +for coupling_step in range(num_couplingsteps): + timeindex = ( + coupling_step * datasteps_per_coupling_step + ) # index along time axis of data to "put" + temp.put(prepare_data_for_yac(dataset["ta"][timeindex, 0:num_vertical_levels, :])) + press.put( + prepare_data_for_yac(dataset["pfull"][timeindex, 0:num_vertical_levels, :]) + ) + qvap.put(prepare_data_for_yac(dataset["hus"][timeindex, 0:num_vertical_levels, :])) + qcond.put(prepare_data_for_yac(dataset["clw"][timeindex, 0:num_vertical_levels, :])) + vertical_wind.put( + prepare_data_for_yac(dataset["wa"][timeindex, 0 : num_vertical_levels + 1, :]) + ) + eastward_wind.put( + prepare_data_for_yac(dataset["ua"][timeindex, 0:num_vertical_levels, :]) + ) + northward_wind.put( + prepare_data_for_yac(dataset["va"][timeindex, 0:num_vertical_levels, :]) + ) From 70914cf5e55d68c4198f4ec2fc9248815ae206fa Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Fri, 16 Aug 2024 20:46:57 +0200 Subject: [PATCH 12/29] fix: minor bug fixes for typos and naming types for args into script --- examples/bubble3d/run_bubble_tmp.sh | 4 ++-- examples/bubble3d/yac_bubble_data_reader.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index c875f1e4..bb98f86a 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -73,8 +73,8 @@ then grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc - cp ${icon_grid_file} ${icon_grid_file_copy} - cp ${icon_data_file} ${icon_data_file_copy} + cp ${icon_grid_file} ${grid_file_copy} + cp ${icon_data_file} ${data_file_copy} mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 40695cbc..70641f3d 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -122,10 +122,10 @@ def prepare_data_for_yac(source): grid_filename = sys.argv[1] data_filename = sys.argv[2] -DATATSTEP = sys.argv[3] # must match ICON data file [seconds] -COUPLTSTEP = sys.argv[4] # must match CLEO config file [seconds] -T_END = sys.argv[6] # must match CLEO config file [seconds] -num_vertical_levels = sys.argv[5] # must match CLEO gridfile +DATATSTEP = float(sys.argv[3]) # must match ICON data file [seconds] +COUPLTSTEP = float(sys.argv[4]) # must match CLEO config file [seconds] +T_END = float(sys.argv[6]) # must match CLEO config file [seconds] +num_vertical_levels = int(sys.argv[5]) # must match CLEO gridfile yac = YAC() From 7ffa41d07d6712d6fa4cb49476f815b144b6cb39 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 13:15:43 +0200 Subject: [PATCH 13/29] refactor: make ICON grid name an input variable and aadded print statement --- examples/bubble3d/run_bubble_tmp.sh | 9 ++-- examples/bubble3d/yac_bubble_data_reader.py | 43 +++++++++++++++----- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 24 ++++++----- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index bb98f86a..a3079ea5 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -65,6 +65,7 @@ then icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc icon_data_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc + icon_grid_name="icon_atmos_grid" # must match CLEO (see yac_cartesian_dynamics.cpp) icon_data_timestep=30 # must match ICON data file [seconds] cleo_coupling_timestep=60 # must match CLEO config file [seconds] cleo_t_end=3600 # must match CLEO config file [seconds] @@ -73,13 +74,13 @@ then grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc - cp ${icon_grid_file} ${grid_file_copy} - cp ${icon_data_file} ${data_file_copy} + cp ${icon_grid_file} ${icon_grid_file_copy} + cp ${icon_data_file} ${icon_data_file_copy} mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ : -n 1 python \ ${path2CLEO}/examples/bubble3d/yac_bubble_data_reader.py \ - ${grid_file_copy} ${data_file_copy} ${icon_data_timestep} \ - ${cleo_coupling_timestep} ${cleo_vertical_levels} ${cleo_t_end} + ${icon_grid_file_copy} ${icon_data_file_copy} ${icon_grid_name} ${icon_data_timestep} \ + ${cleo_coupling_timestep} ${cleo_t_end} ${cleo_vertical_levels} fi diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 70641f3d..c1a1b89c 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -69,7 +69,7 @@ def map_vertices(array): return vertex_mapping_array -def create_yac_unstructured_grid(grid_filename): +def create_yac_unstructured_grid(grid_filename, grid_name): """create unstructured grid for YAC from ICON netcdf file. Note different .nc files may have different names for variables, e.g. "nv" <=> "vertices" @@ -96,7 +96,6 @@ def create_yac_unstructured_grid(grid_filename): cell_vertex_indices = map_vertices(vertices) - grid_name = "aes_bubble_atm_icon_grid" grid = UnstructuredGrid( grid_name, np.ones(no_cells) * nv, @@ -122,10 +121,38 @@ def prepare_data_for_yac(source): grid_filename = sys.argv[1] data_filename = sys.argv[2] -DATATSTEP = float(sys.argv[3]) # must match ICON data file [seconds] -COUPLTSTEP = float(sys.argv[4]) # must match CLEO config file [seconds] +grid_name = sys.argv[3] # must match CLEO (see yac_cartesian_dynamics.cpp) +DATATSTEP = float(sys.argv[4]) # must match ICON data file [seconds] +COUPLTSTEP = float(sys.argv[5]) # must match CLEO config file [seconds] T_END = float(sys.argv[6]) # must match CLEO config file [seconds] -num_vertical_levels = int(sys.argv[5]) # must match CLEO gridfile +num_vertical_levels = int(sys.argv[7]) # must match CLEO gridfile + +msg = ( + "--- INPUT ARGS ---" + + "\ngrid_filename: " + + grid_filename + + "\ndata_filename: " + + data_filename + + "\ngrid_name: " + + grid_name + + "\nDATASTEP: " + + str(DATATSTEP) + + "\nCOUPLTSTEP: " + + str(COUPLTSTEP) + + "\nT_END: " + + str(T_END) + + "\nnum_vertical_levels: " + + str(num_vertical_levels) + + "\n--- --- --- --- --- ---" +) +print(msg) + +assert ( + DATATSTEP <= COUPLTSTEP +), "COUPLTSTEP [s] must be greater than or equal to DATATSTEP [s]" +assert ( + COUPLTSTEP % DATATSTEP == 0.0 +), "COUPLTSTEP [s] must be integer multiple of DATATSTEP [s]" yac = YAC() @@ -202,12 +229,6 @@ def prepare_data_for_yac(source): dataset = Dataset(data_filename) -assert ( - DATATSTEP <= COUPLTSTEP -), "COUPLTSTEP [s] must be greater than or equal to DATATSTEP [s]" -assert ( - DATATSTEP % COUPLTSTEP == 0.0 -), "COUPLTSTEP [s] must be integer multiple of DATATSTEP [s]" datasteps_per_coupling_step = COUPLTSTEP / DATATSTEP num_couplingsteps = int(np.floor(T_END / COUPLTSTEP) + 1) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index c1c18af1..8b71a895 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -9,7 +9,7 @@ * Author: Wilton Loch (WL) * Additional Contributors: Clara Bayley (CB) * ----- - * Last Modified: Friday 16th August 2024 + * Last Modified: Saturday 17th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -237,7 +237,9 @@ CartesianDynamics::CartesianDynamics(const Config &config, const std::array Date: Sat, 17 Aug 2024 13:21:55 +0200 Subject: [PATCH 14/29] refactor: make ICON grid name an input variable and aadded print statement --- examples/bubble3d/run_bubble_tmp.sh | 4 ++-- examples/bubble3d/yac_bubble_data_reader.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index a3079ea5..be9ff38e 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -71,8 +71,8 @@ then cleo_t_end=3600 # must match CLEO config file [seconds] cleo_vertical_levels=25 # must match CLEO gridfile - grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc - data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc + icon_grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc + icon_data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc cp ${icon_grid_file} ${icon_grid_file_copy} cp ${icon_data_file} ${icon_data_file_copy} diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index c1a1b89c..fd79fc4f 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -163,7 +163,7 @@ def prepare_data_for_yac(source): component_name = "atm" component = yac.def_comp(component_name) -grid = create_yac_unstructured_grid(grid_filename) +grid = create_yac_unstructured_grid(grid_filename, grid_name) # --- Field definitions --- coupling_tstep = convert_seconds_to_isodate(COUPLTSTEP) From 63e5fe2fd45e74c88a94027eb173dec76b7ede5c Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 13:38:19 +0200 Subject: [PATCH 15/29] fix: use correct grid in tmp run script --- examples/bubble3d/run_bubble_tmp.sh | 4 ++-- examples/bubble3d/yac_bubble_data_reader.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index be9ff38e..eba8e616 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -63,7 +63,7 @@ then export OMP_PROC_BIND=spread export OMP_PLACES=threads - icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/Torus_Triangles_20x4_5000m.nc + icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_cgrid_ml.nc icon_data_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc icon_grid_name="icon_atmos_grid" # must match CLEO (see yac_cartesian_dynamics.cpp) icon_data_timestep=30 # must match ICON data file [seconds] @@ -71,7 +71,7 @@ then cleo_t_end=3600 # must match CLEO config file [seconds] cleo_vertical_levels=25 # must match CLEO gridfile - icon_grid_file_copy=${path2build}/share/icon_grid_file_Torus_Triangles_20x4_5000m.nc + icon_grid_file_copy=${path2build}/share/icon_grid_file_aes_bubble_atm_cgrid_ml.nc icon_data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc cp ${icon_grid_file} ${icon_grid_file_copy} diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index fd79fc4f..5904566a 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -119,6 +119,7 @@ def prepare_data_for_yac(source): return target +# TODO(CB): (move variables to and) read in variables from CLEO config file grid_filename = sys.argv[1] data_filename = sys.argv[2] grid_name = sys.argv[3] # must match CLEO (see yac_cartesian_dynamics.cpp) From e4a2bf72c19d4459f2f22ba5182a92cdf57ca7cf Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 13:45:40 +0200 Subject: [PATCH 16/29] refactor: reorganise tmp run script for clarity --- examples/bubble3d/run_bubble_tmp.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index eba8e616..2ab6d6e0 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -16,6 +16,11 @@ path2CLEO=${2:-${HOME}/CLEO} path2yac=${3:-/work/mh1126/m300950/yac} path2build=${4:-${HOME}/CLEO/build_bubble3d} +icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_cgrid_ml.nc +icon_data_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc +icon_grid_file_copy=${path2build}/share/icon_grid_file_aes_bubble_atm_cgrid_ml.nc +icon_data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc + if [ "${action}" == "build" ] then mkdir ${path2build} @@ -40,13 +45,18 @@ then elif [ "${action}" == "inputfiles" ] then + cp ${icon_grid_file} ${icon_grid_file_copy} + cp ${icon_data_file} ${icon_data_file_copy} + source activate /work/mh1126/m300950/cleoenv /work/mh1126/m300950/cleoenv/bin/python ${path2CLEO}/examples/bubble3d/bubble3d_inputfiles.py \ ${path2CLEO} \ ${path2build} \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ ${path2build}/share/bubble3d_dimlessGBxboundaries.dat \ - ${path2build}/share/bubble3d_dimlessSDsinit.dat 0 + ${path2build}/share/bubble3d_dimlessSDsinit.dat \ + ${icon_grid_file_copy} \ + 0 elif [ "${action}" == "run" ] then @@ -63,20 +73,12 @@ then export OMP_PROC_BIND=spread export OMP_PLACES=threads - icon_grid_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_cgrid_ml.nc - icon_data_file=/work/mh1126/m300950/icon/build/experiments/aes_bubble/aes_bubble_atm_3d_ml_20080801T000000Z.nc icon_grid_name="icon_atmos_grid" # must match CLEO (see yac_cartesian_dynamics.cpp) icon_data_timestep=30 # must match ICON data file [seconds] cleo_coupling_timestep=60 # must match CLEO config file [seconds] cleo_t_end=3600 # must match CLEO config file [seconds] cleo_vertical_levels=25 # must match CLEO gridfile - icon_grid_file_copy=${path2build}/share/icon_grid_file_aes_bubble_atm_cgrid_ml.nc - icon_data_file_copy=${path2build}/share/icon_data_file_aes_bubble_atm_3d_ml_20080801T000000Z.nc - - cp ${icon_grid_file} ${icon_grid_file_copy} - cp ${icon_data_file} ${icon_data_file_copy} - mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ : -n 1 python \ From f1d9d9f7a5d884229d34927305aa42d50d686380 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:12:16 +0200 Subject: [PATCH 17/29] refactor: change grid for cleo in bubble3d example --- examples/bubble3d/bubble3d.py | 3 ++- examples/bubble3d/bubble3d_inputfiles.py | 25 ++++++++++++++++++++---- examples/bubble3d/run_bubble_tmp.sh | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/examples/bubble3d/bubble3d.py b/examples/bubble3d/bubble3d.py index 5b60f69b..6bd119ae 100644 --- a/examples/bubble3d/bubble3d.py +++ b/examples/bubble3d/bubble3d.py @@ -28,6 +28,7 @@ path2CLEO = sys.argv[1] path2build = sys.argv[2] configfile = sys.argv[3] +icon_grid_file = sys.argv[4] # TODO(CB): move to config file import bubble3d_inputfiles @@ -64,7 +65,7 @@ os.system("rm " + initSDsfile) bubble3d_inputfiles.main( - path2CLEO, path2build, configfile, gridfile, initSDsfile, SDgbxs2plt + path2CLEO, path2build, configfile, gridfile, initSDsfile, icon_grid_file, SDgbxs2plt ) ### ---------------------------------------------------------------- ### ### ---------------------------------------------------------------- ### diff --git a/examples/bubble3d/bubble3d_inputfiles.py b/examples/bubble3d/bubble3d_inputfiles.py index 626aa4ee..c17e6248 100644 --- a/examples/bubble3d/bubble3d_inputfiles.py +++ b/examples/bubble3d/bubble3d_inputfiles.py @@ -23,7 +23,23 @@ import sys -def main(path2CLEO, path2build, configfile, gridfile, initSDsfile, SDgbxs2plt): +def get_zgrid(icon_grid_file, num_vertical_levels): + """returns zgrid for CLEO gridfile with same vertical levels as ICON grid file""" + import numpy as np + import xarray as xr + + grid = xr.open_dataset(icon_grid_file) + idx2 = int(grid.height.values[-1]) + idx1 = int(idx2 - num_vertical_levels - 1) + zhalf = grid.zghalf.values[idx1:idx2, 0] # [m] + zgrid = np.flip(zhalf) + + return zgrid # [m] + + +def main( + path2CLEO, path2build, configfile, gridfile, initSDsfile, icon_grid_file, SDgbxs2plt +): import numpy as np import matplotlib.pyplot as plt @@ -54,9 +70,10 @@ def main(path2CLEO, path2build, configfile, gridfile, initSDsfile, SDgbxs2plt): savefigpath = path2build + "/bin/" # directory for saving figures ### --- settings for 2-D gridbox boundaries --- ### - zgrid = [0, 1500, 60] # evenly spaced zhalf coords [zmin, zmax, zdelta] [m] - xgrid = [0, 1500, 50] # evenly spaced xhalf coords [m] - ygrid = np.array([0, 100, 200, 300]) # array of yhalf coords [m] + num_vertical_levels = 24 # TODO(CB): move to config file (?) + zgrid = get_zgrid(icon_grid_file, num_vertical_levels) # [m] + xgrid = [0, 5000, 100] # evenly spaced xhalf coords [m] + ygrid = np.array([0, 1000, 2000]) # array of yhalf coords [m] ### --- settings for initial superdroplets --- ### # settings for initial superdroplet coordinates diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 2ab6d6e0..634ef20f 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -77,12 +77,12 @@ then icon_data_timestep=30 # must match ICON data file [seconds] cleo_coupling_timestep=60 # must match CLEO config file [seconds] cleo_t_end=3600 # must match CLEO config file [seconds] - cleo_vertical_levels=25 # must match CLEO gridfile + cleo_num_vertical_levels=24 # must match CLEO gridfile mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ ${path2CLEO}/examples/bubble3d/src/config/bubble3d_config.yaml \ : -n 1 python \ ${path2CLEO}/examples/bubble3d/yac_bubble_data_reader.py \ ${icon_grid_file_copy} ${icon_data_file_copy} ${icon_grid_name} ${icon_data_timestep} \ - ${cleo_coupling_timestep} ${cleo_t_end} ${cleo_vertical_levels} + ${cleo_coupling_timestep} ${cleo_t_end} ${cleo_num_vertical_levels} fi From 1ff88120d5cdd98f51631d3d6344e39c1e5477cc Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:12:37 +0200 Subject: [PATCH 18/29] fix: ensure gbxidxs for plotting are ints --- pySD/initsuperdropsbinary_src/read_initsuperdrops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py index f718afa4..63635bf4 100644 --- a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py +++ b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py @@ -198,7 +198,7 @@ def plot_initGBxs_attrdistribs( gbxidxs = np.unique(attrs.sdgbxindex) savename = binpath + "initallGBxs_distribs" + savelabel + ".png" else: - gbxidxs = gbxs2plt + gbxidxs = [int(g) for g in gbxs2plt] savename = binpath + "initGBxs_distribs" + savelabel + ".png" fig, axs, lines = plot_initdistribs(attrs, gbxvols, gbxidxs) From 2e4a1a9324c23e83e7cc4e38ca26f09325184900 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:13:52 +0200 Subject: [PATCH 19/29] fix: ensure gbxidxs for plotting are ints --- pySD/initsuperdropsbinary_src/read_initsuperdrops.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py index 63635bf4..34dfc47b 100644 --- a/pySD/initsuperdropsbinary_src/read_initsuperdrops.py +++ b/pySD/initsuperdropsbinary_src/read_initsuperdrops.py @@ -403,7 +403,7 @@ def plot_initGBxs_dropletmasses( gbxidxs = np.unique(attrs.sdgbxindex) savename = binpath + "initallGBxs_dropletmasses" + savelabel + ".png" else: - gbxidxs = gbxs2plt + gbxidxs = [int(g) for g in gbxs2plt] savename = binpath + "initGBxs_dropletmasses" + savelabel + ".png" fig, axs, lines = plot_massdistribs( From 67ca5551a047c57abba91d2645f72618e993546d Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:22:31 +0200 Subject: [PATCH 20/29] fix: minor variable renaming --- examples/bubble3d/bubble3d_inputfiles.py | 1 + .../bubble3d/src/config/bubble3d_config.yaml | 6 +++--- examples/bubble3d/yac_bubble_data_reader.py | 18 +++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/bubble3d/bubble3d_inputfiles.py b/examples/bubble3d/bubble3d_inputfiles.py index c17e6248..8850f791 100644 --- a/examples/bubble3d/bubble3d_inputfiles.py +++ b/examples/bubble3d/bubble3d_inputfiles.py @@ -126,6 +126,7 @@ def main( SDgbxs2plt, ) plt.close() + rgrid.print_domain_info(constsfile, gridfile) ### ---------------------------------------------------------------- ### ### ---------------------------------------------------------------- ### diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index 20b6e102..4e616c1d 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -25,8 +25,8 @@ ### SDM Runtime Parameters ### domain: nspacedims : 3 # no. of spatial dimensions to model - ngbxs : 2250 # total number of Gbxs - maxnsupers: 2880 # maximum number of SDs + ngbxs : 2400 # total number of Gbxs + maxnsupers: 2400 # maximum number of SDs timesteps: CONDTSTEP : 2 # time between SD condensation [s] @@ -34,7 +34,7 @@ timesteps: MOTIONTSTEP : 3 # time between SDM motion [s] COUPLTSTEP : 60 # time between dynamic couplings [s] OBSTSTEP : 60 # time between SDM observations [s] - T_END : 7200 # time span of integration from 0s to T_END [s] + T_END : 3600 # time span of integration from 0s to T_END [s] ### Initialisation Parameters ### inputfiles: diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 5904566a..70ae87a9 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -71,8 +71,8 @@ def map_vertices(array): def create_yac_unstructured_grid(grid_filename, grid_name): """create unstructured grid for YAC from ICON netcdf file. - Note different .nc files may have different names for variables, - e.g. "nv" <=> "vertices" + Note different .nc files may have different names for variables, e.g. + "nv" <=> "vertices" "cell" <=> "ncells" "clon_vertices" <=> "clon_bnds" "clat_vertices" <=> "clat_bnds" @@ -81,16 +81,16 @@ def create_yac_unstructured_grid(grid_filename, grid_name): dataset = Dataset(grid_filename, "r") # Read the variables - nv = dataset.dimensions["nv"].size - no_cells = dataset.dimensions["cell"].size + nv = dataset.dimensions["vertices"].size + no_cells = dataset.dimensions["ncells"].size vertices = [] - for cell in range(len(dataset["clon_vertices"])): + for cell in range(len(dataset["clon_bnds"])): for vertex in range(3): vertices.append( [ - dataset["clon_vertices"][cell][vertex], - dataset["clat_vertices"][cell][vertex], + dataset["clon_bnds"][cell][vertex], + dataset["clat_bnds"][cell][vertex], ] ) @@ -99,8 +99,8 @@ def create_yac_unstructured_grid(grid_filename, grid_name): grid = UnstructuredGrid( grid_name, np.ones(no_cells) * nv, - dataset["clon_vertices"][:, :].flatten(), - dataset["clat_vertices"][:, :].flatten(), + dataset["clon_bnds"][:, :].flatten(), + dataset["clat_bnds"][:, :].flatten(), cell_vertex_indices, ) From 3e67b02ebebdcaa38a8a47c1b7ff2501764e910c Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:49:32 +0200 Subject: [PATCH 21/29] refactor: demand that yac is given max and min longitude and latitude in config params --- examples/bubble3d/bubble3d_inputfiles.py | 12 ++++++++--- .../bubble3d/src/config/bubble3d_config.yaml | 6 ++++-- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 20 ++++--------------- libs/initialise/optional_config_params.cpp | 17 +++++----------- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/examples/bubble3d/bubble3d_inputfiles.py b/examples/bubble3d/bubble3d_inputfiles.py index 8850f791..479f77d7 100644 --- a/examples/bubble3d/bubble3d_inputfiles.py +++ b/examples/bubble3d/bubble3d_inputfiles.py @@ -69,11 +69,17 @@ def main( isfigures = [True, True] savefigpath = path2build + "/bin/" # directory for saving figures - ### --- settings for 2-D gridbox boundaries --- ### + ### --- settings for 3-D gridbox boundaries --- ### num_vertical_levels = 24 # TODO(CB): move to config file (?) zgrid = get_zgrid(icon_grid_file, num_vertical_levels) # [m] - xgrid = [0, 5000, 100] # evenly spaced xhalf coords [m] - ygrid = np.array([0, 1000, 2000]) # array of yhalf coords [m] + xgrid = [ + 0, + 5000, + 100, + ] # evenly spaced xhalf coords [m] # distance must match longitude in config file + ygrid = np.array( + [0, 1500, 3000] + ) # array of yhalf coords [m] # distance must match latitudes in config file ### --- settings for initial superdroplets --- ### # settings for initial superdroplet coordinates diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index 4e616c1d..e243e213 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -54,5 +54,7 @@ outputdata: coupled_dynamics: type: yac - lower_latitude: -0.157079632 - upper_latitude: 0.157079632 + lower_longitude: -0.02255 + upper_longitude: 0.02255 + lower_latitude: -0.01347 + upper_latitude: 0.01347 diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index 8b71a895..bffd2dd3 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -53,22 +53,10 @@ std::array kijfromindex(const std::array &ndims, const siz void create_vertex_coordinates(const Config &config, const std::array ndims, std::vector &vertex_longitudes, std::vector &vertex_latitudes) { - double lower_longitude = 0; - double upper_longitude = ndims[EASTWARD] * (2 * std::numbers::pi / (ndims[EASTWARD] + 1)); - double lower_latitude = (-0.5 * std::numbers::pi * ndims[NORTHWARD]) / (ndims[NORTHWARD] + 2); - double upper_latitude = (0.5 * std::numbers::pi * ndims[NORTHWARD]) / (ndims[NORTHWARD] + 2); - - if (!std::isnan(config.get_yac_dynamics().lower_longitude)) - lower_longitude = config.get_yac_dynamics().lower_longitude; - - if (!std::isnan(config.get_yac_dynamics().upper_longitude)) - upper_longitude = config.get_yac_dynamics().upper_longitude; - - if (!std::isnan(config.get_yac_dynamics().lower_latitude)) - lower_latitude = config.get_yac_dynamics().lower_latitude; - - if (!std::isnan(config.get_yac_dynamics().upper_latitude)) - upper_latitude = config.get_yac_dynamics().upper_latitude; + lower_longitude = config.get_yac_dynamics().lower_longitude; + upper_longitude = config.get_yac_dynamics().upper_longitude; + lower_latitude = config.get_yac_dynamics().lower_latitude; + upper_latitude = config.get_yac_dynamics().upper_latitude; // Defines the vertex longitude and latitude values in radians for grid creation // The values are later permuted by YAC to generate all vertex coordinates diff --git a/libs/initialise/optional_config_params.cpp b/libs/initialise/optional_config_params.cpp index 9aa98d00..ae531de1 100644 --- a/libs/initialise/optional_config_params.cpp +++ b/libs/initialise/optional_config_params.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Friday 21st June 2024 + * Last Modified: Saturday 17th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -208,17 +208,10 @@ void OptionalConfigParams::YacDynamicsParams::set_params(const YAML::Node &confi assert((node["type"].as() == "yac")); - if (node["lower_longitude"]) - lower_longitude = node["lower_longitude"].as(); - - if (node["upper_longitude"]) - upper_longitude = node["upper_longitude"].as(); - - if (node["lower_latitude"]) - lower_latitude = node["lower_latitude"].as(); - - if (node["upper_latitude"]) - upper_latitude = node["upper_latitude"].as(); + lower_longitude = node["lower_longitude"].as(); + upper_longitude = node["upper_longitude"].as(); + lower_latitude = node["lower_latitude"].as(); + upper_latitude = node["upper_latitude"].as(); } void OptionalConfigParams::YacDynamicsParams::print_params() const { From f5989545e4354607891629f03baff29c510dbea6 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 14:53:15 +0200 Subject: [PATCH 22/29] fix: add missin types --- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index bffd2dd3..f86c702e 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -53,10 +53,10 @@ std::array kijfromindex(const std::array &ndims, const siz void create_vertex_coordinates(const Config &config, const std::array ndims, std::vector &vertex_longitudes, std::vector &vertex_latitudes) { - lower_longitude = config.get_yac_dynamics().lower_longitude; - upper_longitude = config.get_yac_dynamics().upper_longitude; - lower_latitude = config.get_yac_dynamics().lower_latitude; - upper_latitude = config.get_yac_dynamics().upper_latitude; + const auto lower_longitude = config.get_yac_dynamics().lower_longitude; + const auto upper_longitude = config.get_yac_dynamics().upper_longitude; + const auto lower_latitude = config.get_yac_dynamics().lower_latitude; + const auto upper_latitude = config.get_yac_dynamics().upper_latitude; // Defines the vertex longitude and latitude values in radians for grid creation // The values are later permuted by YAC to generate all vertex coordinates From bdc10d14a106ffb4dea3556a59723a2c218e19ff Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 15:07:55 +0200 Subject: [PATCH 23/29] chore: formatting --- libs/coupldyn_yac/yac_cartesian_dynamics.hpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp index 905a25c9..1fb82e17 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Friday 16th August 2024 + * Last Modified: Saturday 17th August 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -36,7 +36,6 @@ #include "initialise/config.hpp" - /* contains 1-D vector for each (thermo)dynamic variable which is ordered by gridbox at every timestep e.g. press = [p_gbx0(t0), p_gbx1(t0), ,... , p_gbxN(t0), @@ -73,9 +72,9 @@ struct CartesianDynamics { int vertical_wind_yac_id; // Containers to receive data from YAC - double ** yac_raw_cell_data; - double ** yac_raw_edge_data; - double ** yac_raw_vertical_wind_data; + double **yac_raw_cell_data; + double **yac_raw_edge_data; + double **yac_raw_vertical_wind_data; /* --- Private functions --- */ @@ -124,9 +123,9 @@ struct CartesianDynamics { /* Public call to receive data from YAC * If the problem is 2D turns into a wrapper for receive_hor_slice_from_yac */ void receive_fields_from_yac(); - void receive_yac_field(unsigned int field_type, unsigned int yac_field_id, - double ** yac_raw_data, std::vector & target_array, - size_t vertical_levels, double conversion_factor); + void receive_yac_field(unsigned int field_type, unsigned int yac_field_id, double **yac_raw_data, + std::vector &target_array, size_t vertical_levels, + double conversion_factor); }; /* type satisfying CoupledDyanmics solver concept @@ -139,9 +138,7 @@ struct YacDynamics { std::shared_ptr dynvars; // pointer to (thermo)dynamic variables /* Calls the get operations to receive data from YAC for each of the fields of interest */ - void run_dynamics(const unsigned int t_mdl) const { - dynvars->receive_fields_from_yac(); - } + void run_dynamics(const unsigned int t_mdl) const { dynvars->receive_fields_from_yac(); } public: YacDynamics(const Config &config, const unsigned int couplstep, const std::array ndims, From 3a111f586417aa28bdbde3588a99d0cefbcc34dc Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 16:44:55 +0200 Subject: [PATCH 24/29] fix: correct ordering of yac_raw_data into target_array for each variable --- libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 60 +++++++++++--------- libs/coupldyn_yac/yac_cartesian_dynamics.hpp | 7 ++- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index f86c702e..2ef217b7 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -131,49 +131,53 @@ void create_grid_and_points_definitions(const Config &config, const std::array &target_array, const size_t ndims_north, + const size_t ndims_east, const size_t vertical_levels, const double conversion_factor) const { + for (size_t j = 0; j < ndims_north; j++) { + for (size_t i = 0; i < ndims_east; i++) { + for (size_t k = 0; k < vertical_levels; k++) { + auto vertical_idx = k; + auto source_idx = j * ndims_east + i; + auto ii = (ndims_east * j + i) * vertical_levels + k; + target_array[ii] = yac_raw_data[vertical_idx][source_idx] / conversion_factor; + } + } + } +} + void CartesianDynamics::receive_yac_field(unsigned int field_type, unsigned int yac_field_id, double **yac_raw_data, std::vector &target_array, - size_t vertical_levels, double conversion_factor = 1.0) { + size_t vertical_levels, + double conversion_factor = 1.0) const { int info, error; - unsigned int total_horizontal_cells = ndims[EASTWARD] * ndims[NORTHWARD]; - bool edge_dimension = false; - std::vector::iterator target_it = target_array.begin(); - yac_cget(yac_field_id, vertical_levels, yac_raw_data, &info, &error); switch (field_type) { - case 0: - for (size_t i = 0; i < vertical_levels; i++) - for (size_t j = 0; j < total_horizontal_cells; j++) - target_array[i * total_horizontal_cells + j] = yac_raw_data[i][j] / conversion_factor; + case 0: // CELL + yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD], ndims[EASTWARD], + vertical_levels, conversion_factor); return; - case 1: - edge_dimension = true; - break; - - case 2: - edge_dimension = false; - break; - } + case 1: // EASTWARD_EDGE + yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD], + ndims[EASTWARD] + 1, vertical_levels, conversion_factor); + return; - for (size_t vertical_index = 0; vertical_index < ndims[VERTICAL]; vertical_index++) { - unsigned int source_index = 0; - for (size_t lat_index = 0; lat_index < (ndims[NORTHWARD] + 1) * 2 - 1; lat_index++) { - if (lat_index % 2 == edge_dimension) { - for (size_t index = 0; index < ndims[EASTWARD] + edge_dimension; - index++, target_it++, source_index++) - *target_it = yac_raw_data[vertical_index][source_index] / conversion_factor; - } else - source_index += ndims[EASTWARD] + !edge_dimension; - } + case 2: // NORTHWARD_EDGE + yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD] + 1, + ndims[EASTWARD], vertical_levels, conversion_factor); + return; } } /* This subroutine is the main entry point for receiving data from YAC. * It checks the dimensionality of the simulation based on the config data. */ void CartesianDynamics::receive_fields_from_yac() { - enum field_types { CELL, EASTWARD_EDGE, NORTHWARD_EDGE }; + enum field_types { CELL = 0, EASTWARD_EDGE = 1, NORTHWARD_EDGE = 2 }; receive_yac_field(CELL, temp_yac_id, yac_raw_cell_data, temp, ndims[VERTICAL], dlc::TEMP0); receive_yac_field(CELL, pressure_yac_id, yac_raw_cell_data, press, ndims[VERTICAL], dlc::P0); diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp index 1fb82e17..454343fd 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp @@ -103,6 +103,11 @@ struct CartesianDynamics { meaning a 2D set of grid boxes along u and w directions */ void receive_hor_slice_from_yac(int cell_offset, int u_edges_offset, int w_edges_offset); + void yac_raw_data_to_target_array(double **yac_raw_data, std::vector &target_array, + const size_t ndims_north, const size_t ndims_east, + const size_t vertical_levels, + const double conversion_factor) const; + public: CartesianDynamics(const Config &config, const std::array i_ndims, const unsigned int nsteps); @@ -125,7 +130,7 @@ struct CartesianDynamics { void receive_fields_from_yac(); void receive_yac_field(unsigned int field_type, unsigned int yac_field_id, double **yac_raw_data, std::vector &target_array, size_t vertical_levels, - double conversion_factor); + double conversion_factor) const; }; /* type satisfying CoupledDyanmics solver concept From e74a3f237fd8411d318e4309957bdcd957df0eb7 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 17:06:49 +0200 Subject: [PATCH 25/29] refactor: reorganise functionality to remove case switch --- examples/bubble3d/yac_bubble_data_reader.py | 32 ++++++------ libs/coupldyn_yac/yac_cartesian_dynamics.cpp | 54 ++++++++------------ libs/coupldyn_yac/yac_cartesian_dynamics.hpp | 5 +- 3 files changed, 40 insertions(+), 51 deletions(-) diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index 70ae87a9..d096be7c 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -109,6 +109,14 @@ def create_yac_unstructured_grid(grid_filename, grid_name): return grid +def icon_data_slice(data, timeidx, num_vertical_levels): + ''' returns slice of data at timeidx from + lowest height level to lowest+num_vertical_levels accounting for + fact that ICON data height levels go from top to bottom''' + num_data_vertical_levels = data.shape[1] + assert (num_data_vertical_levels >= num_vertical_levels), "data must have at least as many vertical levels as desired for slice" + heightidx = num_data_vertical_levels - num_vertical_levels # index of uppermost desired level of ICON data + return np.flip(data[timeidx, heightidx:, :]) def prepare_data_for_yac(source): vertical_levels = len(source[:, 1]) @@ -234,21 +242,13 @@ def prepare_data_for_yac(source): num_couplingsteps = int(np.floor(T_END / COUPLTSTEP) + 1) for coupling_step in range(num_couplingsteps): - timeindex = ( + timeidx = ( coupling_step * datasteps_per_coupling_step ) # index along time axis of data to "put" - temp.put(prepare_data_for_yac(dataset["ta"][timeindex, 0:num_vertical_levels, :])) - press.put( - prepare_data_for_yac(dataset["pfull"][timeindex, 0:num_vertical_levels, :]) - ) - qvap.put(prepare_data_for_yac(dataset["hus"][timeindex, 0:num_vertical_levels, :])) - qcond.put(prepare_data_for_yac(dataset["clw"][timeindex, 0:num_vertical_levels, :])) - vertical_wind.put( - prepare_data_for_yac(dataset["wa"][timeindex, 0 : num_vertical_levels + 1, :]) - ) - eastward_wind.put( - prepare_data_for_yac(dataset["ua"][timeindex, 0:num_vertical_levels, :]) - ) - northward_wind.put( - prepare_data_for_yac(dataset["va"][timeindex, 0:num_vertical_levels, :]) - ) + temp.put(prepare_data_for_yac(icon_data_slice(dataset["ta"], timeidx, num_vertical_levels))) + press.put(prepare_data_for_yac(icon_data_slice(dataset["pfull"], timeidx, num_vertical_levels))) + qvap.put(prepare_data_for_yac(icon_data_slice(dataset["hus"], timeidx, num_vertical_levels))) + qcond.put(prepare_data_for_yac(icon_data_slice(dataset["clw"], timeidx, num_vertical_levels))) + vertical_wind.put(prepare_data_for_yac(icon_data_slice(dataset["wa"], timeidx, num_vertical_levels+1))) + eastward_wind.put(prepare_data_for_yac(icon_data_slice(dataset["ua"], timeidx, num_vertical_levels))) + northward_wind.put(prepare_data_for_yac(icon_data_slice(dataset["va"], timeidx, num_vertical_levels))) diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp index 2ef217b7..4da671a1 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.cpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.cpp @@ -149,48 +149,36 @@ void CartesianDynamics::yac_raw_data_to_target_array( } } -void CartesianDynamics::receive_yac_field(unsigned int field_type, unsigned int yac_field_id, - double **yac_raw_data, std::vector &target_array, +void CartesianDynamics::receive_yac_field(unsigned int yac_field_id, double **yac_raw_data, + std::vector &target_array, + const size_t ndims_north, const size_t ndims_east, size_t vertical_levels, double conversion_factor = 1.0) const { int info, error; yac_cget(yac_field_id, vertical_levels, yac_raw_data, &info, &error); - - switch (field_type) { - case 0: // CELL - yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD], ndims[EASTWARD], - vertical_levels, conversion_factor); - return; - - case 1: // EASTWARD_EDGE - yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD], - ndims[EASTWARD] + 1, vertical_levels, conversion_factor); - return; - - case 2: // NORTHWARD_EDGE - yac_raw_data_to_target_array(yac_raw_data, target_array, ndims[NORTHWARD] + 1, - ndims[EASTWARD], vertical_levels, conversion_factor); - return; - } + yac_raw_data_to_target_array(yac_raw_data, target_array, ndims_north, ndims_east, vertical_levels, + conversion_factor); } /* This subroutine is the main entry point for receiving data from YAC. * It checks the dimensionality of the simulation based on the config data. */ void CartesianDynamics::receive_fields_from_yac() { - enum field_types { CELL = 0, EASTWARD_EDGE = 1, NORTHWARD_EDGE = 2 }; - - receive_yac_field(CELL, temp_yac_id, yac_raw_cell_data, temp, ndims[VERTICAL], dlc::TEMP0); - receive_yac_field(CELL, pressure_yac_id, yac_raw_cell_data, press, ndims[VERTICAL], dlc::P0); - receive_yac_field(CELL, qvap_yac_id, yac_raw_cell_data, qvap, ndims[VERTICAL]); - receive_yac_field(CELL, qcond_yac_id, yac_raw_cell_data, qcond, ndims[VERTICAL]); - - receive_yac_field(CELL, vertical_wind_yac_id, yac_raw_vertical_wind_data, wvel, - ndims[VERTICAL] + 1, dlc::W0); - - receive_yac_field(EASTWARD_EDGE, eastward_wind_yac_id, yac_raw_edge_data, uvel, ndims[VERTICAL], - dlc::W0); - receive_yac_field(NORTHWARD_EDGE, northward_wind_yac_id, yac_raw_edge_data, vvel, ndims[VERTICAL], - dlc::W0); + const auto n = ndims[NORTHWARD]; + const auto e = ndims[EASTWARD]; + const auto v = ndims[VERTICAL]; + receive_yac_field(temp_yac_id, yac_raw_cell_data, temp, n, e, v, dlc::TEMP0); + receive_yac_field(pressure_yac_id, yac_raw_cell_data, press, n, e, v, dlc::P0); + receive_yac_field(qvap_yac_id, yac_raw_cell_data, qvap, n, e, v); + receive_yac_field(qcond_yac_id, yac_raw_cell_data, qcond, n, e, v); + + const auto v1 = ndims[VERTICAL] + 1; + receive_yac_field(vertical_wind_yac_id, yac_raw_vertical_wind_data, wvel, n, e, v1, dlc::W0); + + const auto e1 = ndims[EASTWARD] + 1; + receive_yac_field(eastward_wind_yac_id, yac_raw_edge_data, uvel, n, e1, v, dlc::W0); + + const auto n1 = ndims[NORTHWARD] + 1; + receive_yac_field(northward_wind_yac_id, yac_raw_edge_data, vvel, n1, e, v, dlc::W0); } CartesianDynamics::CartesianDynamics(const Config &config, const std::array i_ndims, diff --git a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp index 454343fd..a13d32fb 100644 --- a/libs/coupldyn_yac/yac_cartesian_dynamics.hpp +++ b/libs/coupldyn_yac/yac_cartesian_dynamics.hpp @@ -128,8 +128,9 @@ struct CartesianDynamics { /* Public call to receive data from YAC * If the problem is 2D turns into a wrapper for receive_hor_slice_from_yac */ void receive_fields_from_yac(); - void receive_yac_field(unsigned int field_type, unsigned int yac_field_id, double **yac_raw_data, - std::vector &target_array, size_t vertical_levels, + void receive_yac_field(unsigned int yac_field_id, double **yac_raw_data, + std::vector &target_array, const size_t ndims_north, + const size_t ndims_east, size_t vertical_levels, double conversion_factor) const; }; From 981f486106c9411a8811b731e84dda75f1c92bb5 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 17:58:50 +0200 Subject: [PATCH 26/29] fix: correctly slice icon data to account for vertical levels being top down not bottom up --- examples/bubble3d/yac_bubble_data_reader.py | 56 +++++++++++++++++---- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/examples/bubble3d/yac_bubble_data_reader.py b/examples/bubble3d/yac_bubble_data_reader.py index d096be7c..dd4d6645 100755 --- a/examples/bubble3d/yac_bubble_data_reader.py +++ b/examples/bubble3d/yac_bubble_data_reader.py @@ -109,15 +109,21 @@ def create_yac_unstructured_grid(grid_filename, grid_name): return grid + def icon_data_slice(data, timeidx, num_vertical_levels): - ''' returns slice of data at timeidx from + """returns slice of data at timeidx from lowest height level to lowest+num_vertical_levels accounting for - fact that ICON data height levels go from top to bottom''' + fact that ICON data height levels go from top to bottom""" num_data_vertical_levels = data.shape[1] - assert (num_data_vertical_levels >= num_vertical_levels), "data must have at least as many vertical levels as desired for slice" - heightidx = num_data_vertical_levels - num_vertical_levels # index of uppermost desired level of ICON data + assert ( + num_data_vertical_levels >= num_vertical_levels + ), "data must have at least as many vertical levels as desired for slice" + heightidx = ( + num_data_vertical_levels - num_vertical_levels + ) # index of uppermost desired level of ICON data return np.flip(data[timeidx, heightidx:, :]) + def prepare_data_for_yac(source): vertical_levels = len(source[:, 1]) horizontal_size = len(source[1, :]) @@ -245,10 +251,38 @@ def prepare_data_for_yac(source): timeidx = ( coupling_step * datasteps_per_coupling_step ) # index along time axis of data to "put" - temp.put(prepare_data_for_yac(icon_data_slice(dataset["ta"], timeidx, num_vertical_levels))) - press.put(prepare_data_for_yac(icon_data_slice(dataset["pfull"], timeidx, num_vertical_levels))) - qvap.put(prepare_data_for_yac(icon_data_slice(dataset["hus"], timeidx, num_vertical_levels))) - qcond.put(prepare_data_for_yac(icon_data_slice(dataset["clw"], timeidx, num_vertical_levels))) - vertical_wind.put(prepare_data_for_yac(icon_data_slice(dataset["wa"], timeidx, num_vertical_levels+1))) - eastward_wind.put(prepare_data_for_yac(icon_data_slice(dataset["ua"], timeidx, num_vertical_levels))) - northward_wind.put(prepare_data_for_yac(icon_data_slice(dataset["va"], timeidx, num_vertical_levels))) + temp.put( + prepare_data_for_yac( + icon_data_slice(dataset["ta"], timeidx, num_vertical_levels) + ) + ) + press.put( + prepare_data_for_yac( + icon_data_slice(dataset["pfull"], timeidx, num_vertical_levels) + ) + ) + qvap.put( + prepare_data_for_yac( + icon_data_slice(dataset["hus"], timeidx, num_vertical_levels) + ) + ) + qcond.put( + prepare_data_for_yac( + icon_data_slice(dataset["clw"], timeidx, num_vertical_levels) + ) + ) + vertical_wind.put( + prepare_data_for_yac( + icon_data_slice(dataset["wa"], timeidx, num_vertical_levels + 1) + ) + ) + eastward_wind.put( + prepare_data_for_yac( + icon_data_slice(dataset["ua"], timeidx, num_vertical_levels) + ) + ) + northward_wind.put( + prepare_data_for_yac( + icon_data_slice(dataset["va"], timeidx, num_vertical_levels) + ) + ) From 33c9cbb49d46da54c6fc466e2c4f8c97774e8003 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sat, 17 Aug 2024 18:06:24 +0200 Subject: [PATCH 27/29] chore: extend bubble example run time --- examples/bubble3d/run_bubble_tmp.sh | 2 +- examples/bubble3d/src/config/bubble3d_config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bubble3d/run_bubble_tmp.sh b/examples/bubble3d/run_bubble_tmp.sh index 634ef20f..75e20d65 100755 --- a/examples/bubble3d/run_bubble_tmp.sh +++ b/examples/bubble3d/run_bubble_tmp.sh @@ -76,7 +76,7 @@ then icon_grid_name="icon_atmos_grid" # must match CLEO (see yac_cartesian_dynamics.cpp) icon_data_timestep=30 # must match ICON data file [seconds] cleo_coupling_timestep=60 # must match CLEO config file [seconds] - cleo_t_end=3600 # must match CLEO config file [seconds] + cleo_t_end=7200 # must match CLEO config file [seconds] cleo_num_vertical_levels=24 # must match CLEO gridfile mpiexec -n 1 ${path2build}/examples/bubble3d/src/bubble3D \ diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index e243e213..e446b02d 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -34,7 +34,7 @@ timesteps: MOTIONTSTEP : 3 # time between SDM motion [s] COUPLTSTEP : 60 # time between dynamic couplings [s] OBSTSTEP : 60 # time between SDM observations [s] - T_END : 3600 # time span of integration from 0s to T_END [s] + T_END : 7200 # time span of integration from 0s to T_END [s] ### Initialisation Parameters ### inputfiles: From df9f1377bc7f66626e10c655a51e98bea1161b47 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sun, 18 Aug 2024 12:07:29 +0200 Subject: [PATCH 28/29] refactor: set good params for bubble example --- examples/bubble3d/bubble3d_inputfiles.py | 11 ++++++----- examples/bubble3d/src/config/bubble3d_config.yaml | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/bubble3d/bubble3d_inputfiles.py b/examples/bubble3d/bubble3d_inputfiles.py index 479f77d7..193c5d6c 100644 --- a/examples/bubble3d/bubble3d_inputfiles.py +++ b/examples/bubble3d/bubble3d_inputfiles.py @@ -40,7 +40,6 @@ def get_zgrid(icon_grid_file, num_vertical_levels): def main( path2CLEO, path2build, configfile, gridfile, initSDsfile, icon_grid_file, SDgbxs2plt ): - import numpy as np import matplotlib.pyplot as plt sys.path.append(path2CLEO) # for imports from pySD package @@ -74,12 +73,14 @@ def main( zgrid = get_zgrid(icon_grid_file, num_vertical_levels) # [m] xgrid = [ 0, + 100000, 5000, - 100, ] # evenly spaced xhalf coords [m] # distance must match longitude in config file - ygrid = np.array( - [0, 1500, 3000] - ) # array of yhalf coords [m] # distance must match latitudes in config file + ygrid = [ + 0, + 12000, + 6000, + ] # evenly spaced xhalf coords [m] # distance must match latitudes in config file ### --- settings for initial superdroplets --- ### # settings for initial superdroplet coordinates diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index e446b02d..14d31c45 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -25,8 +25,8 @@ ### SDM Runtime Parameters ### domain: nspacedims : 3 # no. of spatial dimensions to model - ngbxs : 2400 # total number of Gbxs - maxnsupers: 2400 # maximum number of SDs + ngbxs : 960 # total number of Gbxs + maxnsupers: 960 # maximum number of SDs timesteps: CONDTSTEP : 2 # time between SD condensation [s] @@ -54,7 +54,7 @@ outputdata: coupled_dynamics: type: yac - lower_longitude: -0.02255 - upper_longitude: 0.02255 - lower_latitude: -0.01347 - upper_latitude: 0.01347 + lower_longitude: -3.29867229 + upper_longitude: 2.98451302 + lower_latitude: -1.30899694 + upper_latitude: 1.30899694 From d5a026c228b1cbbb3ae578b33cc7f5192b3dcfde Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Sun, 18 Aug 2024 12:27:41 +0200 Subject: [PATCH 29/29] refactor: bubble with higher resolution settings --- examples/bubble3d/bubble3d_inputfiles.py | 4 ++-- examples/bubble3d/src/config/bubble3d_config.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/bubble3d/bubble3d_inputfiles.py b/examples/bubble3d/bubble3d_inputfiles.py index 193c5d6c..2f101eb7 100644 --- a/examples/bubble3d/bubble3d_inputfiles.py +++ b/examples/bubble3d/bubble3d_inputfiles.py @@ -73,8 +73,8 @@ def main( zgrid = get_zgrid(icon_grid_file, num_vertical_levels) # [m] xgrid = [ 0, - 100000, - 5000, + 30000, + 2500, ] # evenly spaced xhalf coords [m] # distance must match longitude in config file ygrid = [ 0, diff --git a/examples/bubble3d/src/config/bubble3d_config.yaml b/examples/bubble3d/src/config/bubble3d_config.yaml index 14d31c45..d175038a 100644 --- a/examples/bubble3d/src/config/bubble3d_config.yaml +++ b/examples/bubble3d/src/config/bubble3d_config.yaml @@ -25,8 +25,8 @@ ### SDM Runtime Parameters ### domain: nspacedims : 3 # no. of spatial dimensions to model - ngbxs : 960 # total number of Gbxs - maxnsupers: 960 # maximum number of SDs + ngbxs : 576 # total number of Gbxs + maxnsupers: 576 # maximum number of SDs timesteps: CONDTSTEP : 2 # time between SD condensation [s] @@ -54,7 +54,7 @@ outputdata: coupled_dynamics: type: yac - lower_longitude: -3.29867229 - upper_longitude: 2.98451302 - lower_latitude: -1.30899694 - upper_latitude: 1.30899694 + lower_longitude: -0.9424777965 + upper_longitude: 0.9424777965 + lower_latitude: -0.392699082 + upper_latitude: 0.392699082