Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sustr and svstr to netcdf plotfile #229

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Source/IO/NCPlotFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ REMORA::WriteNCPlotFile_which(int lev, int which_subdomain,
ncf.def_var("zeta", NC_FLOAT, {nt_name, ny_s_name, nx_s_name});
ncf.def_var("ubar", NC_FLOAT, {nt_name, ny_u_name, nx_u_name});
ncf.def_var("vbar", NC_FLOAT, {nt_name, ny_v_name, nx_v_name});
ncf.def_var("sustr", NC_FLOAT, {nt_name, ny_u_name, nx_u_name});
ncf.def_var("svstr", NC_FLOAT, {nt_name, ny_v_name, nx_v_name});

// We are doing single-level writes but it doesn't have to be level 0
//
Expand Down Expand Up @@ -461,6 +463,16 @@ REMORA::WriteNCPlotFile_which(int lev, int which_subdomain,
nc_plot_var.put(tmp.dataPtr(), {local_start_nt,local_start_y,local_start_x},
{local_nt, local_ny, local_nx});
}
{
FArrayBox tmp;
tmp.resize(tmp_bx_2d,1,amrex::The_Pinned_Arena());
tmp.template copy<RunOn::Device>((*vec_sustr[lev])[mfi.index()],0,0,1);

auto nc_plot_var = ncf.var("sustr");
nc_plot_var.par_access(NC_COLLECTIVE);
nc_plot_var.put(tmp.dataPtr(), {local_start_nt,local_start_y,local_start_x},
{local_nt, local_ny, local_nx});
}
} // in subdomain
} // mfi

Expand Down Expand Up @@ -521,6 +533,16 @@ REMORA::WriteNCPlotFile_which(int lev, int which_subdomain,
nc_plot_var.put(tmp.dataPtr(), {local_start_nt,local_start_y,local_start_x},
{local_nt, local_ny, local_nx});
}
{
FArrayBox tmp;
tmp.resize(tmp_bx_2d,1,amrex::The_Pinned_Arena());
tmp.template copy<RunOn::Device>((*vec_svstr[lev])[mfi.index()],0,0,1);

auto nc_plot_var = ncf.var("svstr");
nc_plot_var.par_access(NC_COLLECTIVE);
nc_plot_var.put(tmp.dataPtr(), {local_start_nt,local_start_y,local_start_x},
{local_nt, local_ny, local_nx});
}

} // in subdomain
} // mfi
Expand Down
1 change: 1 addition & 0 deletions Source/REMORA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ REMORA::init_only (int lev, Real time)
init_set_vmix(lev);
set_hmixcoef(lev);
set_coriolis(lev);
init_custom_smflux(geom[lev], time, *vec_sustr[lev], *vec_svstr[lev], solverChoice);

// Ensure that the face-based data are the same on both sides of a periodic domain.
// The data associated with the lower grid ID is considered the correct value.
Expand Down
Loading