From 8cbff022b89e93aa59ee35faa754643da84e0c25 Mon Sep 17 00:00:00 2001 From: "Reuben D. Budiardja" Date: Fri, 22 Mar 2024 16:47:45 -0400 Subject: [PATCH 1/9] Updated Summit GCC setup script. --- builds/setup.summit.gcc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builds/setup.summit.gcc.sh b/builds/setup.summit.gcc.sh index 0f15f6bfe..15a7d7ff9 100755 --- a/builds/setup.summit.gcc.sh +++ b/builds/setup.summit.gcc.sh @@ -4,7 +4,7 @@ # source ./setup.summit.gcc.sh #module load gcc/10.2.0 cuda/11.4.0 fftw hdf5 python -module load gcc cuda fftw hdf5 python googletest/1.11.0 +#module load gcc cuda fftw hdf5 python googletest/1.11.0 +module load gcc cuda/12.2.0 fftw hdf5 python -export F_OFFLOAD="-fopenmp" export CHOLLA_ENVSET=1 From 0003ed5e3d40cd121d004b24b241fbb005cd132d Mon Sep 17 00:00:00 2001 From: "Reuben D. Budiardja" Date: Fri, 22 Mar 2024 16:47:45 -0400 Subject: [PATCH 2/9] Updated Summit GCC setup script. --- builds/setup.summit.gcc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builds/setup.summit.gcc.sh b/builds/setup.summit.gcc.sh index 0f15f6bfe..15a7d7ff9 100755 --- a/builds/setup.summit.gcc.sh +++ b/builds/setup.summit.gcc.sh @@ -4,7 +4,7 @@ # source ./setup.summit.gcc.sh #module load gcc/10.2.0 cuda/11.4.0 fftw hdf5 python -module load gcc cuda fftw hdf5 python googletest/1.11.0 +#module load gcc cuda fftw hdf5 python googletest/1.11.0 +module load gcc cuda/12.2.0 fftw hdf5 python -export F_OFFLOAD="-fopenmp" export CHOLLA_ENVSET=1 From 9324343a301bebba2c2bb3a75062cf1223b9bc4d Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 16 Apr 2024 11:38:54 -0400 Subject: [PATCH 3/9] add dust and basic_scalar to Write_Slices_HDF5 --- src/io/io.cpp | 126 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 29 deletions(-) diff --git a/src/io/io.cpp b/src/io/io.cpp index 5cab7862d..da3c690a7 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -13,7 +13,7 @@ #ifdef HDF5 #include #endif // HDF5 -#include "../grid/grid3D.h" +#include "../grid/grid3D.h" #include "../io/io.h" #include "../utils/cuda_utilities.h" #include "../utils/hydro_utilities.h" @@ -1845,7 +1845,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) Real *dataset_buffer_GE; #endif #ifdef SCALAR - Real *dataset_buffer_scalar; + #ifdef BASIC_SCALAR + Real *dataset_buffer_basic_scalar; + #endif + #ifdef DUST + Real *dataset_buffer_dust; + #endif #endif herr_t status; int xslice, yslice, zslice; @@ -1885,7 +1890,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); #endif #ifdef SCALAR - dataset_buffer_scalar = (Real *)malloc(NSCALARS * H.nx_real * H.ny_real * sizeof(Real)); + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); + #endif + #ifdef DUST + dataset_buffer_dust = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); + #endif #endif // Copy the xy slices to the memory buffers @@ -1927,9 +1937,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = C.GasEnergy[id]; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.nx * H.ny] = C.scalar[id + ii * H.n_cells]; - } + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + #endif + #ifdef DUST + dataset_buffer_dust[buf_id] = C.dust_density[id]; + #endif #endif #ifdef MPI_CHOLLA } @@ -1949,9 +1962,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = 0; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.nx * H.ny] = 0; - } + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = 0; + #endif + #ifdef DUST + dataset_buffer_dust[buf_id] = 0; + #endif #endif } #endif // MPI_CHOLLA @@ -1973,7 +1989,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_GE, "/GE_xy"); #endif #ifdef SCALAR - status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_scalar, "/scalar_xy"); + #ifdef BASIC_SCALAR + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_basic_scalar, "/basic_scalar_xy"); + #endif + #ifdef DUST + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_dust, "/d_dust_xy"); + #endif #endif // Free the dataspace id status = H5Sclose(dataspace_id); @@ -1988,7 +2009,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) free(dataset_buffer_GE); #endif #ifdef SCALAR - free(dataset_buffer_scalar); + #ifdef BASIC_SCALAR + free(dataset_buffer_basic_scalar); + #endif + #ifdef DUST + free(dataset_buffer_dust); + #endif #endif // Create the xz data space for the datasets @@ -2011,7 +2037,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); #endif #ifdef SCALAR - dataset_buffer_scalar = (Real *)malloc(NSCALARS * H.nx_real * H.nz_real * sizeof(Real)); + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); + #endif + #ifdef DUST + dataset_buffer_dust = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); + #endif #endif // Copy the xz slices to the memory buffers @@ -2053,9 +2084,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = C.GasEnergy[id]; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.nx * H.nz] = C.scalar[id + ii * H.n_cells]; - } + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + #endif + #ifdef DUST + dataset_buffer_dust[buf_id] = C.dust_density[id]; + #endif #endif #ifdef MPI_CHOLLA } @@ -2075,9 +2109,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = 0; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.nx * H.nz] = 0; - } + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = 0; + #endif + #ifdef DUST + dataset_buffer_dust[buf_id] = 0; + #endif #endif } #endif // MPI_CHOLLA @@ -2099,7 +2136,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_GE, "/GE_xz"); #endif #ifdef SCALAR - status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_scalar, "/scalar_xz"); +#ifdef BASIC_SCALAR + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_basic_scalar, "/basic_scalar_xz"); + #endif + #ifdef DUST + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_dust, "/d_dust_xz"); + #endif #endif // Free the dataspace id @@ -2115,7 +2157,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) free(dataset_buffer_GE); #endif #ifdef SCALAR - free(dataset_buffer_scalar); + #ifdef BASIC_SCALAR + free(dataset_buffer_basic_scalar); + #endif + #ifdef DUST + free(dataset_buffer_dust); + #endif #endif // Create the yz data space for the datasets @@ -2138,7 +2185,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE = (Real *)malloc(H.ny_real * H.nz_real * sizeof(Real)); #endif #ifdef SCALAR - dataset_buffer_scalar = (Real *)malloc(NSCALARS * H.ny_real * H.nz_real * sizeof(Real)); + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar = (Real *)malloc(H.ny_real * H.nz_real * sizeof(Real)); + #endif + #ifdef DUST + dataset_buffer_dust = (Real *)malloc(H.ny_real * H.nz_real * sizeof(Real)); + #endif #endif // Copy the yz slices to the memory buffers @@ -2179,9 +2231,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = C.GasEnergy[id]; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.ny * H.nz] = C.scalar[id + ii * H.n_cells]; - } + #ifdef DUST + dataset_buffer_dust[buf_id] = C.dust_density[id]; + #endif + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + #endif #endif #ifdef MPI_CHOLLA } @@ -2201,9 +2256,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) dataset_buffer_GE[buf_id] = 0; #endif #ifdef SCALAR - for (int ii = 0; ii < NSCALARS; ii++) { - dataset_buffer_scalar[buf_id + ii * H.ny * H.nz] = 0; - } + #ifdef BASIC_SCALAR + dataset_buffer_basic_scalar[buf_id] = 0; + #endif + #ifdef DUST + dataset_buffer_dust[buf_id] = 0; + #endif #endif } #endif // MPI_CHOLLA @@ -2225,7 +2283,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_GE, "/GE_yz"); #endif #ifdef SCALAR - status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_scalar, "/scalar_yz"); + #ifdef BASIC_SCALAR + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_basic_scalar, "/basic_scalar_yz"); + #endif + #ifdef DUST + status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_dust, "/d_dust_yz"); + #endif #endif // Free the dataspace id @@ -2241,7 +2304,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) free(dataset_buffer_GE); #endif #ifdef SCALAR - free(dataset_buffer_scalar); + #ifdef BASIC_SCALAR + free(dataset_buffer_basic_scalar); + #endif + #ifdef DUST + free(dataset_buffer_dust); + #endif #endif } else { From 03c59dae08fa7773858d6110174f3ea7c106da6a Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 16 Apr 2024 11:40:03 -0400 Subject: [PATCH 4/9] run clang format --- src/io/io.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/io/io.cpp b/src/io/io.cpp index da3c690a7..74ed4077b 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -13,7 +13,7 @@ #ifdef HDF5 #include #endif // HDF5 -#include "../grid/grid3D.h" +#include "../grid/grid3D.h" #include "../io/io.h" #include "../utils/cuda_utilities.h" #include "../utils/hydro_utilities.h" @@ -1845,12 +1845,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) Real *dataset_buffer_GE; #endif #ifdef SCALAR - #ifdef BASIC_SCALAR + #ifdef BASIC_SCALAR Real *dataset_buffer_basic_scalar; - #endif - #ifdef DUST + #endif + #ifdef DUST Real *dataset_buffer_dust; - #endif + #endif #endif herr_t status; int xslice, yslice, zslice; @@ -1891,10 +1891,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); + dataset_buffer_basic_scalar = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); #endif #ifdef DUST - dataset_buffer_dust = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); + dataset_buffer_dust = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); #endif #endif @@ -1938,10 +1938,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; #endif #ifdef DUST - dataset_buffer_dust[buf_id] = C.dust_density[id]; + dataset_buffer_dust[buf_id] = C.dust_density[id]; #endif #endif #ifdef MPI_CHOLLA @@ -1963,10 +1963,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = 0; + dataset_buffer_basic_scalar[buf_id] = 0; #endif #ifdef DUST - dataset_buffer_dust[buf_id] = 0; + dataset_buffer_dust[buf_id] = 0; #endif #endif } @@ -2011,7 +2011,7 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #ifdef SCALAR #ifdef BASIC_SCALAR free(dataset_buffer_basic_scalar); - #endif + #endif #ifdef DUST free(dataset_buffer_dust); #endif @@ -2085,10 +2085,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; #endif #ifdef DUST - dataset_buffer_dust[buf_id] = C.dust_density[id]; + dataset_buffer_dust[buf_id] = C.dust_density[id]; #endif #endif #ifdef MPI_CHOLLA @@ -2110,10 +2110,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = 0; + dataset_buffer_basic_scalar[buf_id] = 0; #endif #ifdef DUST - dataset_buffer_dust[buf_id] = 0; + dataset_buffer_dust[buf_id] = 0; #endif #endif } @@ -2136,12 +2136,12 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_GE, "/GE_xz"); #endif #ifdef SCALAR -#ifdef BASIC_SCALAR + #ifdef BASIC_SCALAR status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_basic_scalar, "/basic_scalar_xz"); - #endif - #ifdef DUST + #endif + #ifdef DUST status = Write_HDF5_Dataset(file_id, dataspace_id, dataset_buffer_dust, "/d_dust_xz"); - #endif + #endif #endif // Free the dataspace id @@ -2162,7 +2162,7 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef DUST free(dataset_buffer_dust); - #endif + #endif #endif // Create the yz data space for the datasets @@ -2232,10 +2232,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef DUST - dataset_buffer_dust[buf_id] = C.dust_density[id]; + dataset_buffer_dust[buf_id] = C.dust_density[id]; #endif #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; + dataset_buffer_basic_scalar[buf_id] = C.basic_scalar[id]; #endif #endif #ifdef MPI_CHOLLA @@ -2257,10 +2257,10 @@ void Grid3D::Write_Slices_HDF5(hid_t file_id) #endif #ifdef SCALAR #ifdef BASIC_SCALAR - dataset_buffer_basic_scalar[buf_id] = 0; + dataset_buffer_basic_scalar[buf_id] = 0; #endif #ifdef DUST - dataset_buffer_dust[buf_id] = 0; + dataset_buffer_dust[buf_id] = 0; #endif #endif } From dc250a724636fc62e540d6a6f45bf8381b24796c Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 16 Apr 2024 12:07:58 -0400 Subject: [PATCH 5/9] wrap dust macro in scalar macro in Write_Projection_HDF5 --- src/io/io.cpp | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/io/io.cpp b/src/io/io.cpp index 74ed4077b..e1a029597 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -1506,9 +1506,11 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) Real *dataset_buffer_Txy, *dataset_buffer_Txz; herr_t status; Real dxy, dxz, Txy, Txz; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST Real dust_xy, dust_xz; Real *dataset_buffer_dust_xy, *dataset_buffer_dust_xz; + #endif #endif Real mu = 0.6; @@ -1523,9 +1525,11 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) dataset_buffer_dxz = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); dataset_buffer_Txy = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); dataset_buffer_Txz = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dataset_buffer_dust_xy = (Real *)malloc(H.nx_real * H.ny_real * sizeof(Real)); dataset_buffer_dust_xz = (Real *)malloc(H.nx_real * H.nz_real * sizeof(Real)); + #endif #endif // Create the data space for the datasets @@ -1540,8 +1544,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) for (int i = 0; i < H.nx_real; i++) { dxy = 0; Txy = 0; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dust_xy = 0; + #endif #endif // for each xy element, sum over the z column for (int k = 0; k < H.nz_real; k++) { @@ -1553,8 +1559,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) // sum density Real const d = C.density[id]; dxy += d * H.dz; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dust_xy += C.dust_density[id] * H.dz; + #endif #endif // calculate number density Real const n = d * DENSITY_UNIT / (mu * MP); @@ -1583,8 +1591,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) int const buf_id = j + i * H.ny_real; dataset_buffer_dxy[buf_id] = dxy; dataset_buffer_Txy[buf_id] = Txy; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dataset_buffer_dust_xy[buf_id] = dust_xy; + #endif #endif } } @@ -1594,8 +1604,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) for (int i = 0; i < H.nx_real; i++) { dxz = 0; Txz = 0; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dust_xz = 0; + #endif #endif // for each xz element, sum over the y column for (int j = 0; j < H.ny_real; j++) { @@ -1606,8 +1618,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) // sum density Real const d = C.density[id]; dxz += d * H.dy; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dust_xz += C.dust_density[id] * H.dy; + #endif #endif // calculate number density Real const n = d * DENSITY_UNIT / (mu * MP); @@ -1633,8 +1647,10 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) int const buf_id = k + i * H.nz_real; dataset_buffer_dxz[buf_id] = dxz; dataset_buffer_Txz[buf_id] = Txz; - #ifdef DUST + #ifdef SCALAR + #ifdef DUST dataset_buffer_dust_xz[buf_id] = dust_xz; + #endif #endif } } @@ -1644,9 +1660,11 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_xz_id, dataset_buffer_dxz, "/d_xz"); status = Write_HDF5_Dataset(file_id, dataspace_xy_id, dataset_buffer_Txy, "/T_xy"); status = Write_HDF5_Dataset(file_id, dataspace_xz_id, dataset_buffer_Txz, "/T_xz"); - #ifdef DUST + #ifdef SCALAR + #ifdef DUST status = Write_HDF5_Dataset(file_id, dataspace_xy_id, dataset_buffer_dust_xy, "/d_dust_xy"); status = Write_HDF5_Dataset(file_id, dataspace_xz_id, dataset_buffer_dust_xz, "/d_dust_xz"); + #endif #endif // Free the dataspace ids @@ -1660,10 +1678,12 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) free(dataset_buffer_dxz); free(dataset_buffer_Txy); free(dataset_buffer_Txz); - #ifdef DUST + #ifdef SCALAR + #ifdef DUST free(dataset_buffer_dust_xy); free(dataset_buffer_dust_xz); - #endif // DUST + #endif + #endif } #endif // HDF5 From dd26fa8a22eb01d9f51daa4b74a3a45fd331587e Mon Sep 17 00:00:00 2001 From: helenarichie Date: Wed, 17 Apr 2024 09:18:17 -0400 Subject: [PATCH 6/9] save WIP for dust in rotated projection HDF5 output --- src/io/io.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/io/io.cpp b/src/io/io.cpp index e1a029597..c8698d643 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -1699,10 +1699,21 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) Real *dataset_buffer_vxxzr; Real *dataset_buffer_vyxzr; Real *dataset_buffer_vzxzr; + #ifdef SCALAR + #ifdef DUST + Real *dataset_buffer_dust_xzr; + #endif + #endif herr_t status; Real dxy, dxz, Txy, Txz; Real d, vx, vy, vz; + #ifdef SCALAR + #ifdef DUST + Real dust_density_xy, dust_density_xz; + Real dust_density; + #endif + #endif Real x, y, z; // cell positions Real xp, yp, zp; // rotated positions @@ -1748,6 +1759,11 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) dataset_buffer_vxxzr = (Real *)calloc(nx_dset * nz_dset, sizeof(Real)); dataset_buffer_vyxzr = (Real *)calloc(nx_dset * nz_dset, sizeof(Real)); dataset_buffer_vzxzr = (Real *)calloc(nx_dset * nz_dset, sizeof(Real)); + #ifdef SCALAR + #ifdef DUST + dataset_buffer_dust_xzr = (Real *)calloc(nx_dset * nz_dset, sizeof(Real)); + #endif + #endif // Create the data space for the datasets dims[0] = nx_dset; @@ -1794,6 +1810,13 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) // calculate number density Real const n = d * DENSITY_UNIT / (mu * MP); + #ifdef SCALAR + #ifdef DUST + dust_density = C.dust_density[id]; + dataset_buffer_dust_xzr[buf_id] += dust_density * H.dy; + #endif + #endif + // calculate temperature #ifdef DE Real const T = hydro_utilities::Calc_Temp_DE(C.GasEnergy[id], gama, n); @@ -1831,6 +1854,11 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) status = Write_HDF5_Dataset(file_id, dataspace_xzr_id, dataset_buffer_vxxzr, "/vx_xzr"); status = Write_HDF5_Dataset(file_id, dataspace_xzr_id, dataset_buffer_vyxzr, "/vy_xzr"); status = Write_HDF5_Dataset(file_id, dataspace_xzr_id, dataset_buffer_vzxzr, "/vz_xzr"); + #ifdef SCALAR + #ifdef DUST + status = Write_HDF5_Dataset(file_id, dataspace_xzr_id, dataset_buffer_dust_xzr, "/d_dust_xzr"); + #endif + #endif // Free the dataspace id status = H5Sclose(dataspace_xzr_id); @@ -1841,6 +1869,11 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) free(dataset_buffer_vxxzr); free(dataset_buffer_vyxzr); free(dataset_buffer_vzxzr); + #ifdef SCALAR + #ifdef DUST + free(dataset_buffer_dust_xzr); + #endif + #endif } else { chprintf("Rotated projection write only implemented for 3D data.\n"); From 2daf060ea5e438343f5cf4e6b9dabf663c03e9ad Mon Sep 17 00:00:00 2001 From: helenarichie Date: Wed, 17 Apr 2024 09:54:45 -0400 Subject: [PATCH 7/9] remove print statement --- src/dust/dust_cuda.cu | 1 - 1 file changed, 1 deletion(-) diff --git a/src/dust/dust_cuda.cu b/src/dust/dust_cuda.cu index f5cb6b7b7..805f82db3 100644 --- a/src/dust/dust_cuda.cu +++ b/src/dust/dust_cuda.cu @@ -80,7 +80,6 @@ __global__ void Dust_Kernel(Real *dev_conserved, int nx, int ny, int nz, int n_g density_gas = dev_conserved[id + n_cells * grid_enum::density]; density_dust = dev_conserved[id + n_cells * grid_enum::dust_density]; - printf("%d %f", id, density_dust); // convert mass density to number density number_density = density_gas * DENSITY_UNIT / (mu * MP); From cd81ee6e5059ca82d96a59fd5bd681c4c281f7e2 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Thu, 13 Jun 2024 13:26:19 -0400 Subject: [PATCH 8/9] save io updates --- src/io/io.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/io/io.cpp b/src/io/io.cpp index d1ee15563..cef40cae3 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -1698,7 +1698,6 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) #endif // DE Txz += T * d * H.dy; } - } int const buf_id = k + i * H.nz_real; dataset_buffer_dxz[buf_id] = dxz; dataset_buffer_Txz[buf_id] = Txz; @@ -1707,7 +1706,7 @@ void Grid3D::Write_Projection_HDF5(hid_t file_id) dataset_buffer_dust_xz[buf_id] = dust_xz; #endif #endif - } + } } // Write the projected density and temperature arrays to file From 07ecea490c1f841c764ced1693c3226bb68db6c0 Mon Sep 17 00:00:00 2001 From: Helena Richie Date: Mon, 29 Jul 2024 14:42:48 -0400 Subject: [PATCH 9/9] create macro for grid-wide dust/cloud mass reduction and enable in dust M82 build --- builds/make.type.m82 | 1 + src/analysis/global_reduce_dust.cu | 70 +++++++++ src/analysis/global_reduce_dust.h | 15 ++ src/analysis/outflow_analysis.cu | 241 ----------------------------- src/analysis/outflow_analysis.h | 15 -- src/global/global.cpp | 3 +- src/global/global.h | 2 +- src/grid/grid3D.cpp | 12 +- src/grid/grid3D.h | 2 +- 9 files changed, 96 insertions(+), 265 deletions(-) create mode 100644 src/analysis/global_reduce_dust.cu create mode 100644 src/analysis/global_reduce_dust.h delete mode 100644 src/analysis/outflow_analysis.cu delete mode 100644 src/analysis/outflow_analysis.h diff --git a/builds/make.type.m82 b/builds/make.type.m82 index a13aa2a7a..730724e01 100644 --- a/builds/make.type.m82 +++ b/builds/make.type.m82 @@ -25,6 +25,7 @@ DFLAGS += -DBASIC_SCALAR DFLAGS += -DDUST # DFLAGS += -DOUTFLOW_ANALYSIS +DFLAGS += -DGLOBAL_REDUCE_DUST DFLAGS += -DSCALAR_FLOOR # MW_MODEL vs m82 (default) diff --git a/src/analysis/global_reduce_dust.cu b/src/analysis/global_reduce_dust.cu new file mode 100644 index 000000000..207cc7237 --- /dev/null +++ b/src/analysis/global_reduce_dust.cu @@ -0,0 +1,70 @@ +#ifdef DUST + #ifdef GLOBAL_REDUCE_DUST + // STL includes + #include + #include + + #include + #include + #include + + #include "../analysis/global_reduce_dust.h" + #include "../grid/grid_enum.h" + #include "../utils/DeviceVector.h" + #include "../utils/cuda_utilities.h" + #include "../utils/hydro_utilities.h" + #include "../utils/reduction_utilities.h" + +void Global_Reduce_Dust(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, int n_ghost, int n_fields, + Real *mass_cloud, Real *mass_dust, Real density_cloud_init) +{ + cuda_utilities::AutomaticLaunchParams static const launchParams(Global_Reduce_Dust_Kernel); + + cuda_utilities::DeviceVector dev_mass_cloud(1); + cuda_utilities::DeviceVector dev_mass_dust(1); + + hipLaunchKernelGGL(Global_Reduce_Dust_Kernel, launchParams.get_numBlocks(), launchParams.get_threadsPerBlock(), 0, 0, + dev_conserved, nx, ny, nz, dx, dy, dz, n_ghost, n_fields, dev_mass_cloud.data(), + dev_mass_dust.data(), density_cloud_init); + cudaDeviceSynchronize(); + + *mass_cloud = dev_mass_cloud[0]; + *mass_dust = dev_mass_dust[0]; +} + +__global__ void Global_Reduce_Dust_Kernel(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, + int n_ghost, int n_fields, Real *mass_cloud, Real *mass_dust, + Real density_cloud_init) +{ + int xid, yid, zid, n_cells; + n_cells = nx * ny * nz; + + Real density_gas; + Real mass_cloud_stride = 0.0; + Real density_dust; + Real mass_dust_stride = 0.0; + + for (size_t id = threadIdx.x + blockIdx.x * blockDim.x; id < n_cells; id += blockDim.x * gridDim.x) { + cuda_utilities::compute3DIndices(id, nx, ny, xid, yid, zid); + // grid cells + if (xid > n_ghost - 1 && xid < nx - n_ghost && yid > n_ghost - 1 && yid < ny - n_ghost && zid > n_ghost - 1 && + zid < nz - n_ghost) { + density_gas = dev_conserved[id + n_cells * grid_enum::density]; + density_dust = dev_conserved[id + n_cells * grid_enum::dust_density]; + + mass_dust_stride += density_dust * dx * dy * dz; + + if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { + mass_cloud_stride += density_gas * dx * dy * dz; + } + } + } + + __syncthreads(); + + reduction_utilities::Grid_Reduce_Add(mass_cloud_stride, mass_cloud); + reduction_utilities::Grid_Reduce_Add(mass_dust_stride, mass_dust); +} + + #endif // GLOBAL_REDUCE_DUST +#endif // DUST diff --git a/src/analysis/global_reduce_dust.h b/src/analysis/global_reduce_dust.h new file mode 100644 index 000000000..8a48a937c --- /dev/null +++ b/src/analysis/global_reduce_dust.h @@ -0,0 +1,15 @@ +#ifdef GLOBAL_REDUCE_DUST + #ifndef GLOBAL_REDUCE_DUST_CUDA_H + #define GLOBAL_REDUCE_DUST_CUDA_H + + #include "../global/global.h" + #include "../utils/gpu.hpp" + +void Global_Reduce_Dust(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, int n_ghost, int n_fields, + Real *mass_cloud, Real *mass_dust, Real density_cloud_init); + +__global__ void Global_Reduce_Dust_Kernel(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, + int n_ghost, int n_fields, Real *mass_cloud, Real *mass_dust, + Real density_cloud_init); + #endif // GLOBAL_REDUCE_DUST_CUDA_H +#endif // GLOBAL_REDUCE_DUST diff --git a/src/analysis/outflow_analysis.cu b/src/analysis/outflow_analysis.cu deleted file mode 100644 index 0fe164ec0..000000000 --- a/src/analysis/outflow_analysis.cu +++ /dev/null @@ -1,241 +0,0 @@ -#ifdef DUST - #ifdef OUTFLOW_ANALYSIS - // STL includes - #include - #include - - #include - #include - #include - - #include "../analysis/outflow_analysis.h" - #include "../grid/grid_enum.h" - #include "../utils/DeviceVector.h" - #include "../utils/cuda_utilities.h" - #include "../utils/hydro_utilities.h" - #include "../utils/reduction_utilities.h" - -void Outflow_Analysis(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, int n_ghost, int n_fields, - Real *mass_cloud, Real *mass_dust, Real density_cloud_init) -{ - cuda_utilities::AutomaticLaunchParams static const launchParams(Outflow_Analysis_Kernel); - - cuda_utilities::DeviceVector dev_mass_cloud(1); - cuda_utilities::DeviceVector dev_mass_dust(1); - - hipLaunchKernelGGL(Outflow_Analysis_Kernel, launchParams.get_numBlocks(), launchParams.get_threadsPerBlock(), 0, 0, - dev_conserved, nx, ny, nz, dx, dy, dz, n_ghost, n_fields, dev_mass_cloud.data(), - dev_mass_dust.data(), density_cloud_init); - cudaDeviceSynchronize(); - - *mass_cloud = dev_mass_cloud[0]; - *mass_dust = dev_mass_dust[0]; -} - -__global__ void Outflow_Analysis_Kernel(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, - int n_ghost, int n_fields, Real *mass_cloud, Real *mass_dust, - Real density_cloud_init) -{ - int xid, yid, zid, n_cells; - n_cells = nx * ny * nz; - - Real density_gas; - Real mass_cloud_stride = 0.0; - Real density_dust; - Real mass_dust_stride = 0.0; - - for (size_t id = threadIdx.x + blockIdx.x * blockDim.x; id < n_cells; id += blockDim.x * gridDim.x) { - cuda_utilities::compute3DIndices(id, nx, ny, xid, yid, zid); - // grid cells - if (xid > n_ghost - 1 && xid < nx - n_ghost && yid > n_ghost - 1 && yid < ny - n_ghost && zid > n_ghost - 1 && - zid < nz - n_ghost) { - density_gas = dev_conserved[id + n_cells * grid_enum::density]; - density_dust = dev_conserved[id + n_cells * grid_enum::dust_density]; - - mass_dust_stride += density_dust * dx * dy * dz; - - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 30)) { - mass_cloud_stride += density_gas * dx * dy * dz; - } - } - } - - __syncthreads(); - - reduction_utilities::Grid_Reduce_Add(mass_cloud_stride, mass_cloud); - reduction_utilities::Grid_Reduce_Add(mass_dust_stride, mass_dust); - - /* - // int id, xid, yid, zid, gid; - - // calculate ghost cell ID and i,j,k in GPU grid - int id = threadIdx.x + blockIdx.x * blockDim.x; - - int isize, jsize; - - // +x boundary first - isize = n_ghost; - jsize = ny; - - // not true i,j,k but relative i,j,k in the GPU grid - zid = id / (isize * jsize); - yid = (id - zid * isize * jsize) / isize; - xid = id - zid * isize * jsize - yid * isize; - - // map thread id to ghost cell id - xid += nx - n_ghost; // +x boundary - int gid = xid + yid * nx + zid * nx * ny; - - // boundary cells - // -x boundary - if (xid == n_ghost && xid < nx && yid < ny && zid < nz) { - velocity_x = dev_conserved[gid + n_cells * grid_enum::momentum_x] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_x < 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - printf("-x %e/n", density_gas * DENSITY_UNIT); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_x) * dx * dx; - } - #ifdef DUST - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_x) * dx * dx; - #endif // DUST - } - } - // +x boundary - if (xid == nx - n_ghost && xid < nx && yid < ny && zid < nz) { - velocity_x = dev_conserved[gid + n_cells * grid_enum::momentum_x] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_x > 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - printf("+x %e/n", density_gas * DENSITY_UNIT); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_x) * dx * dx; - } - #ifdef DUST - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_x) * dx * dx; - #endif // DUST - } - } - - // +y boundary next - isize = nx; - jsize = n_ghost; - // ksize = nz; - - // not true i,j,k but relative i,j,k - zid = id / (isize * jsize); - yid = (id - zid * isize * jsize) / isize; - xid = id - zid * isize * jsize - yid * isize; - - // map thread id to ghost cell id - yid += ny - n_ghost; - gid = xid + yid * nx + zid * nx * ny; - - // -y boundary - if (xid < nx && yid == n_ghost && yid < ny && zid < nz) { - velocity_y = dev_conserved[gid + n_cells * grid_enum::momentum_y] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_y < 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - // printf("-y cloud %e/n", density_gas * DENSITY_UNIT); - printf("yid: %d\n", yid); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_y) * dx * dx; - } - #ifdef DUST - // printf("-y dust %e/n", density_dust * DENSITY_UNIT); - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_y) * dx * dx; - #endif // DUST - } - } - // +y boundary - if (xid < nx && yid == ny - n_ghost && yid < ny && zid < nz) { - velocity_y = dev_conserved[gid + n_cells * grid_enum::momentum_y] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_y > 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - // printf("+y %e/n", density_gas * DENSITY_UNIT); - printf("yid: %d\n", yid); - printf("yid: %d\n", ny_real); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_y) * dx * dx; - } - #ifdef DUST - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_y) * dx * dx; - #endif // DUST - } - } - - isize = nx; - jsize = ny; - // ksize = n_ghost; - - // not true i,j,k but relative i,j,k - zid = id / (isize * jsize); - yid = (id - zid * isize * jsize) / isize; - xid = id - zid * isize * jsize - yid * isize; - - // map thread id to ghost cell id - zid += nz - n_ghost; - gid = xid + yid * nx + zid * nx * ny; - - // -z boundary - if (xid < nx && yid < ny && zid == n_ghost && zid < nz) { - velocity_z = dev_conserved[gid + n_cells * grid_enum::momentum_z] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_z < 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - printf("-z %e/n", density_gas * DENSITY_UNIT); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_z) * dx * dx; - } - #ifdef DUST - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_z) * dx * dx; - #endif // DUST - } - } - // +z bondary - if (xid < nx && yid < ny && zid == nz - n_ghost && zid < nz) { - velocity_z = dev_conserved[gid + n_cells * grid_enum::momentum_z] / density_gas; - density_gas = dev_conserved[gid + n_cells * grid_enum::density]; - #ifdef DUST - density_dust = dev_conserved[gid + n_cells * grid_enum::dust_density]; - #endif - if (velocity_z > 0) { - if ((density_gas * DENSITY_UNIT) >= (density_cloud_init / 3)) { - printf("+z %e/n", density_gas * DENSITY_UNIT); - mass_cloud_bndry_stride += density_gas * dx * dy * dz; - rate_cloud_stride += density_gas * std::abs(velocity_z) * dx * dx; - } - #ifdef DUST - mass_dust_bndry_stride += density_dust * dx * dy * dz; - rate_dust_stride += density_dust * std::abs(velocity_z) * dx * dx; - #endif // DUST - } - } - */ -} - - #endif // OUTFLOW_ANALYSIS -#endif // DUST diff --git a/src/analysis/outflow_analysis.h b/src/analysis/outflow_analysis.h deleted file mode 100644 index 1f945d4f5..000000000 --- a/src/analysis/outflow_analysis.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef OUTFLOW_ANALYSIS - #ifndef OUTFLOW_ANALYSIS_CUDA_H - #define OUTFLOW_ANALYSIS_CUDA_H - - #include "../global/global.h" - #include "../utils/gpu.hpp" - -void Outflow_Analysis(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, int n_ghost, int n_fields, - Real *mass_cloud, Real *mass_dust, Real density_cloud_init); - -__global__ void Outflow_Analysis_Kernel(Real *dev_conserved, int nx, int ny, int nz, Real dx, Real dy, Real dz, - int n_ghost, int n_fields, Real *mass_cloud, Real *mass_dust, - Real density_cloud_init); - #endif // OUTFLOW_ANALYSIS_H -#endif // OUTFLOW_ANALYSIS diff --git a/src/global/global.cpp b/src/global/global.cpp index cabf95b0e..0c8479dc8 100644 --- a/src/global/global.cpp +++ b/src/global/global.cpp @@ -516,9 +516,10 @@ void Parse_Param(char *name, char *value, struct Parameters *parms) } else if (strcmp(name, "density_wind_init") == 0) { parms->density_wind_init = atof(value); #endif -#if defined(OUTFLOW_ANALYSIS) || defined(CLOUD_TRACKING) +#if defined(OUTFLOW_ANALYSIS) || defined(GLOBAL_REDUCE_DUST) || defined(CLOUD_TRACKING) } else if (strcmp(name, "density_cloud_init") == 0) { parms->density_cloud_init = atof(value); + chprintf("Initial cloud density: %e (g/cm^3)\n", parms->density_cloud_init); #endif #ifdef SCALAR #ifdef DUST diff --git a/src/global/global.h b/src/global/global.h index 28e3a3672..f731d9b87 100644 --- a/src/global/global.h +++ b/src/global/global.h @@ -312,7 +312,7 @@ struct Parameters { #ifdef CLOUD_TRACKING Real density_wind_init; #endif -#if defined(CLOUD_TRACKING) || defined(OUTFLOW_ANALYSIS) +#if defined(CLOUD_TRACKING) || defined(OUTFLOW_ANALYSIS) || defined(GLOBAL_REDUCE_DUST) Real density_cloud_init; #endif #ifdef TILED_INITIAL_CONDITIONS diff --git a/src/grid/grid3D.cpp b/src/grid/grid3D.cpp index 97e11d9ac..27108f881 100644 --- a/src/grid/grid3D.cpp +++ b/src/grid/grid3D.cpp @@ -46,8 +46,8 @@ #include "../dust/dust_cuda.h" // provides Dust_Update #endif -#ifdef OUTFLOW_ANALYSIS - #include "../analysis/outflow_analysis.h" // provides Dust_Update +#ifdef GLOBAL_REDUCE_DUST + #include "../analysis/global_reduce_dust.h" #endif /*! \fn Grid3D(void) @@ -172,7 +172,7 @@ void Grid3D::Initialize(struct Parameters *P) H.density_wind_init = P->density_wind_init; #endif -#if defined(CLOUD_TRACKING) || defined(OUTFLOW_ANALYSIS) +#if defined(CLOUD_TRACKING) || defined(GLOBAL_REDUCE_DUST) H.density_cloud_init = P->density_cloud_init; #endif @@ -591,10 +591,10 @@ Real Grid3D::Update_Hydro_Grid() #endif // CLOUD_TRACKING #ifdef DUST - #ifdef OUTFLOW_ANALYSIS + #ifdef GLOBAL_REDUCE_DUST Real mass_cloud, mass_dust = 0; - Outflow_Analysis(C.device, H.nx, H.ny, H.nz, H.dx, H.dy, H.dz, H.n_ghost, H.n_fields, &mass_cloud, &mass_dust, + Global_Reduce_Dust(C.device, H.nx, H.ny, H.nz, H.dx, H.dy, H.dz, H.n_ghost, H.n_fields, &mass_cloud, &mass_dust, H.density_cloud_init); #ifdef MPI_CHOLLA @@ -605,7 +605,7 @@ Real Grid3D::Update_Hydro_Grid() #endif // MPI_CHOLLA chprintf("@@ Cloud mass: %e Dust mass: %e \n", arr_reduced[0], arr_reduced[1]); - #endif // OUTFLOW_ANALYSIS + #endif // GLOBAL_REDUCE_DUST #endif // DUST #ifdef CHEMISTRY_GPU diff --git a/src/grid/grid3D.h b/src/grid/grid3D.h index 4ca127180..c24213573 100644 --- a/src/grid/grid3D.h +++ b/src/grid/grid3D.h @@ -219,7 +219,7 @@ struct Header { Real velocity_x_cloud_avg = 0; #endif // CLOUD_TRACKING -#if defined(CLOUD_TRACKING) || defined(OUTFLOW_ANALYSIS) +#if defined(CLOUD_TRACKING) || defined(OUTFLOW_ANALYSIS) || defined(GLOBAL_REDUCE_DUST) Real density_cloud_init; #endif /*! \var t_wall