REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_init_from_netcdf.cpp
Go to the documentation of this file.
1/**
2 * \file REMORA_init_from_netcdf.cpp
3 */
4
5#include <REMORA.H>
6#include <REMORA_Constants.H>
8#include <REMORA_DataStruct.H>
9
10using namespace amrex;
11
12#ifdef REMORA_USE_NETCDF
13
14/** \brief helper function for reading in initial state data from netcdf */
15void
16read_data_from_netcdf (int /*lev*/, const Box& domain, const std::string& fname,
17 FArrayBox& NC_temp_fab, FArrayBox& NC_salt_fab,
18 FArrayBox& NC_xvel_fab, FArrayBox& NC_yvel_fab);
19
20/** \brief helper function for reading in land-sea masks from netcdf */
21void
22read_masks_from_netcdf (int /*lev*/, const Box& domain, const std::string& fname,
23 FArrayBox& NC_mskr_fab, FArrayBox& NC_msku_fab,
24 FArrayBox& NC_mskv_fab);
25
26/** \brief helper function for reading boundary data from netcdf */
27Real
28read_bdry_from_netcdf (const Box& domain, const std::string& fname,
29 Vector<Vector<FArrayBox>>& bdy_data_xlo,
30 Vector<Vector<FArrayBox>>& bdy_data_xhi,
31 Vector<Vector<FArrayBox>>& bdy_data_ylo,
32 Vector<Vector<FArrayBox>>& bdy_data_yhi,
33 int& width, amrex::Real& start_bdy_time,
34 std::string bdry_time_varname,
35 amrex::GpuArray<amrex::GpuArray<bool, AMREX_SPACEDIM*2>,BdyVars::NumTypes+1>&);
36
37/** \brief helper function to initialize state from netcdf */
38void
40 FArrayBox& temp_fab, FArrayBox& salt_fab,
41 FArrayBox& x_vel_fab, FArrayBox& y_vel_fab,
42 const Vector<FArrayBox>& NC_temp_fab,
43 const Vector<FArrayBox>& NC_salt_fab,
44 const Vector<FArrayBox>& NC_xvel_fab,
45 const Vector<FArrayBox>& NC_yvel_fab);
46
47/** \brief helper function to read bathymetry from netcdf */
48void
49read_bathymetry_from_netcdf (int lev, const Box& domain, const std::string& fname,
50 FArrayBox& NC_h_fab);
51
52/** \brief helper function to read grid variables from netcdf */
53void
54read_grid_vars_from_netcdf (int lev, const Box& domain, const std::string& fname,
55 FArrayBox& NC_pm_fab, FArrayBox& NC_pn_fab,
56 FArrayBox& NC_xr_fab, FArrayBox& NC_yr_fab,
57 FArrayBox& NC_xu_fab, FArrayBox& NC_yu_fab,
58 FArrayBox& NC_xv_fab, FArrayBox& NC_yv_fab,
59 FArrayBox& NC_xp_fab, FArrayBox& NC_yp_fab);
60
61/** \brief helper function to read full-domain high resolution bathymetry from netcdf */
62void
63read_bathymetry_full_domain_from_netcdf (const Box& domain, const std::string& fname,
64 FArrayBox& NC_h_fab, IntVect ngrow);
65
66/** \brief helper function to read full-domain high resolution grid variables from netcdf */
67void
68read_grid_vars_full_domain_from_netcdf (const Box& domain, const std::string& fname,
69 FArrayBox& NC_pm_fab, FArrayBox& NC_pn_fab,
70 IntVect ngrow);
71
72/** \brief helper function to read coriolis factor from netcdf */
73void
74read_coriolis_from_netcdf (int lev, const Box& domain, const std::string& fname, FArrayBox& NC_fcor_fab);
75
76/** \brief helper function to read sea surface height from netcdf */
77void
78read_zeta_from_netcdf (int lev, const Box& domain, const std::string& fname,
79 FArrayBox& NC_zeta_fab);
80
81/** \brief helper function to read climatology nudging from netcdf */
82void
83read_clim_nudg_coeff_from_netcdf (int lev, const Box& domain, const std::string& fname,
84 bool do_m2_clim_nudg,
85 bool do_m3_clim_nudg,
86 bool do_temp_clim_nudg,
87 bool do_salt_clim_nudg,
88 FArrayBox& NC_M2NC_fab,
89 FArrayBox& NC_M3NC_fab,
90 FArrayBox& NC_TempNC_fab,
91 FArrayBox& NC_SaltNC_fab);
92
93/** \brief helper function to read in vector of data from netcdf */
94void read_vec_from_netcdf (int lev, const amrex::Vector<std::string>& fnames, const std::string& field_name, amrex::Vector<int>& vec_dat);
95
96/**
97 * @param lev Integer specifying the current level
98 */
99void
101{
102 // *** FArrayBox's at this level for holding the INITIAL data
103 Vector<FArrayBox> NC_temp_fab ; NC_temp_fab.resize(num_boxes_at_level[lev]);
104 Vector<FArrayBox> NC_salt_fab ; NC_salt_fab.resize(num_boxes_at_level[lev]);
105 Vector<FArrayBox> NC_xvel_fab ; NC_xvel_fab.resize(num_boxes_at_level[lev]);
106 Vector<FArrayBox> NC_yvel_fab ; NC_yvel_fab.resize(num_boxes_at_level[lev]);
107
108 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
109 {
110 read_data_from_netcdf(lev, boxes_at_level[lev][idx], nc_init_file[lev][idx],
111 NC_temp_fab[idx], NC_salt_fab[idx],
112 NC_xvel_fab[idx], NC_yvel_fab[idx]);
113 }
114
115
116 MultiFab mf_temp(*cons_new[lev], make_alias, Temp_comp, 1);
117 MultiFab mf_salt(*cons_new[lev], make_alias, Salt_comp, 1);
118
119#ifdef _OPENMP
120#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
121#endif
122 {
123 // Don't tile this since we are operating on full FABs in this routine
124 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
125 {
126 // Define fabs for holding the initial data
127 FArrayBox &temp_fab = mf_temp[mfi];
128 FArrayBox &salt_fab = mf_salt[mfi];
129 FArrayBox &xvel_fab = (*xvel_new[lev])[mfi];
130 FArrayBox &yvel_fab = (*yvel_new[lev])[mfi];
131
132 init_state_from_netcdf(lev, temp_fab, salt_fab,
133 xvel_fab, yvel_fab,
134 NC_temp_fab, NC_salt_fab,
135 NC_xvel_fab, NC_yvel_fab);
136 } // mf
137 } // omp
138
139 if (nscalar > 1) {
140 cons_new[lev]->setVal(0.0_rt, Tracer_comp + 1, nscalar - 1, cons_new[lev]->nGrowVect());
141 }
142}
143
144/**
145 * @param lev Integer specifying the current level
146 */
147void
149{
150 // *** FArrayBox's at this level for holding the INITIAL data
151 Vector<FArrayBox> NC_zeta_fab ; NC_zeta_fab.resize(num_boxes_at_level[lev]);
152
153 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
154 {
155 read_zeta_from_netcdf(lev,boxes_at_level[lev][idx], nc_init_file[lev][idx],
156 NC_zeta_fab[idx]);
157
158#ifdef _OPENMP
159#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
160#endif
161 {
162 // Don't tile this since we are operating on full FABs in this routine
163 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
164 {
165 FArrayBox &zeta_fab = (*vec_zeta[lev])[mfi];
166
167 //
168 // FArrayBox to FArrayBox copy does "copy on intersection"
169 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
170 //
171
172 zeta_fab.template copy<RunOn::Device>(NC_zeta_fab[idx],0,0,1);
173 } // mf
174 } // omp
175 } // idx
176
177 vec_zeta[lev]->FillBoundary(geom[lev].periodicity());
178 (*physbcs[lev])(*vec_zeta[lev],*vec_mskr[lev].get(),0,1,vec_zeta[lev]->nGrowVect(),t_new[lev],zeta_bc(),0,*vec_zeta[lev],*vec_msku[lev],*vec_mskv[lev]);
179// (*physbcs[lev])(*vec_zeta[lev],*vec_mskr[lev].get(),1,1,vec_zeta[lev]->nGrowVect(),t_new[lev],BCVars::zeta_bc);
180// (*physbcs[lev])(*vec_zeta[lev],*vec_mskr[lev].get(),2,1,vec_zeta[lev]->nGrowVect(),t_new[lev],BCVars::zeta_bc);
181
183 Real told = t_new[lev];
184 fill_from_bdyfiles(lev, *vec_zeta[lev], *vec_mskr[lev], told, zeta_bc(),BdyVars::zeta,0,0,
185 *vec_zeta[lev]);
186 }
187 if (lev>0) {
188 FillPatch(lev, t_old[lev], *vec_zeta[lev], GetVecOfPtrs(vec_zeta), zeta_bc(), BdyVars::zeta,
189 0, false,false,0,0,0.0,*vec_zeta[lev]);
190 }
191// fill_from_bdyfiles(lev, *vec_zeta[lev], *vec_mskr[lev], told, BCVars::zeta_bc,BdyVars::zeta,1,1);
192// fill_from_bdyfiles(lev, *vec_zeta[lev], *vec_mskr[lev], told, BCVars::zeta_bc,BdyVars::zeta,2,2);
193}
194
195/**
196 * @param lev Integer specifying the current level
197 */
198void
200{
201 // *** FArrayBox's at this level for holding the INITIAL data
202 Vector<FArrayBox> NC_pm_fab ; NC_pm_fab.resize(num_boxes_at_level[lev]);
203 Vector<FArrayBox> NC_pn_fab ; NC_pn_fab.resize(num_boxes_at_level[lev]);
204
205 Vector<FArrayBox> NC_xr_fab ; NC_xr_fab.resize(num_boxes_at_level[lev]);
206 Vector<FArrayBox> NC_yr_fab ; NC_yr_fab.resize(num_boxes_at_level[lev]);
207 Vector<FArrayBox> NC_xu_fab ; NC_xu_fab.resize(num_boxes_at_level[lev]);
208 Vector<FArrayBox> NC_yu_fab ; NC_yu_fab.resize(num_boxes_at_level[lev]);
209 Vector<FArrayBox> NC_xv_fab ; NC_xv_fab.resize(num_boxes_at_level[lev]);
210 Vector<FArrayBox> NC_yv_fab ; NC_yv_fab.resize(num_boxes_at_level[lev]);
211 Vector<FArrayBox> NC_xp_fab ; NC_xp_fab.resize(num_boxes_at_level[lev]);
212 Vector<FArrayBox> NC_yp_fab ; NC_yp_fab.resize(num_boxes_at_level[lev]);
213
214 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
215 {
217 NC_pm_fab[idx], NC_pn_fab[idx],
218 NC_xr_fab[idx], NC_yr_fab[idx],
219 NC_xu_fab[idx], NC_yu_fab[idx],
220 NC_xv_fab[idx], NC_yv_fab[idx],
221 NC_xp_fab[idx], NC_yp_fab[idx]);
222
223#ifdef _OPENMP
224#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
225#endif
226 {
227 // Don't tile this since we are operating on full FABs in this routine
228 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
229 {
230 FArrayBox &pm_fab = (*vec_pm[lev])[mfi];
231 FArrayBox &pn_fab = (*vec_pn[lev])[mfi];
232 FArrayBox &xr_fab = (*vec_xr[lev])[mfi];
233 FArrayBox &yr_fab = (*vec_yr[lev])[mfi];
234 FArrayBox &xu_fab = (*vec_xu[lev])[mfi];
235 FArrayBox &yu_fab = (*vec_yu[lev])[mfi];
236 FArrayBox &xv_fab = (*vec_xv[lev])[mfi];
237 FArrayBox &yv_fab = (*vec_yv[lev])[mfi];
238 FArrayBox &xp_fab = (*vec_xp[lev])[mfi];
239 FArrayBox &yp_fab = (*vec_yp[lev])[mfi];
240
241 //
242 // FArrayBox to FArrayBox copy does "copy on intersection"
243 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
244 //
245
246 pm_fab.template copy<RunOn::Device>(NC_pm_fab[idx]);
247 pn_fab.template copy<RunOn::Device>(NC_pn_fab[idx]);
248
249 xr_fab.template copy<RunOn::Device>(NC_xr_fab[idx]);
250 yr_fab.template copy<RunOn::Device>(NC_yr_fab[idx]);
251 xu_fab.template copy<RunOn::Device>(NC_xu_fab[idx]);
252 yu_fab.template copy<RunOn::Device>(NC_yu_fab[idx]);
253 xv_fab.template copy<RunOn::Device>(NC_xv_fab[idx]);
254 yv_fab.template copy<RunOn::Device>(NC_yv_fab[idx]);
255 xp_fab.template copy<RunOn::Device>(NC_xp_fab[idx]);
256 yp_fab.template copy<RunOn::Device>(NC_yp_fab[idx]);
257 } // mf
258 } // omp
259 } // idx
260
261 Real dummy_time = 0.0_rt;
262 if (lev > 0) {
263 FillPatch(lev,dummy_time,*vec_pm[lev],GetVecOfPtrs(vec_pm),
265 BdyVars::null,0,false,true);
266 FillPatch(lev,dummy_time,*vec_pn[lev],GetVecOfPtrs(vec_pn),
268 BdyVars::null,0,false,true);
269 }
270
271
272 int ng = vec_pm[lev]->nGrow();
273
274 const auto& dom_lo = amrex::lbound(geom[lev].Domain());
275 const auto& dom_hi = amrex::ubound(geom[lev].Domain());
276
277 //
278 // We need values of pm and pn outside the domain so we fill
279 // them here with foextrap
280 //
281 // We first fill interior ghost cells because we will need to extrapolate
282 // from ghost cells inside the domain to ghost cells outside the domain
283 //
284 vec_pm[lev]->FillBoundary(geom[lev].periodicity());
285 vec_pn[lev]->FillBoundary(geom[lev].periodicity());
286
287 vec_xr[lev]->FillBoundary(geom[lev].periodicity());
288 vec_yr[lev]->FillBoundary(geom[lev].periodicity());
289 vec_xu[lev]->FillBoundary(geom[lev].periodicity());
290 vec_yu[lev]->FillBoundary(geom[lev].periodicity());
291 vec_xv[lev]->FillBoundary(geom[lev].periodicity());
292 vec_yv[lev]->FillBoundary(geom[lev].periodicity());
293 vec_xp[lev]->FillBoundary(geom[lev].periodicity());
294 vec_yp[lev]->FillBoundary(geom[lev].periodicity());
295
296 for ( MFIter mfi(*vec_pm[lev]); mfi.isValid(); ++mfi )
297 {
298 Box bx = mfi.tilebox();
299
300 auto pm_fab = vec_pm[lev]->array(mfi);
301 auto pn_fab = vec_pn[lev]->array(mfi);
302
303 Box gbx_lox = adjCellLo(bx,0,ng); gbx_lox.grow(1,ng); gbx_lox.setBig (0,dom_lo.x-2);
304 Box gbx_hix = adjCellHi(bx,0,ng); gbx_hix.grow(1,ng); gbx_hix.setSmall(0,dom_hi.x+2);
305 Box gbx_loy = adjCellLo(bx,1,ng); gbx_loy.grow(0,ng); gbx_loy.setBig (1,dom_lo.y-2);
306 Box gbx_hiy = adjCellHi(bx,1,ng); gbx_hiy.grow(0,ng); gbx_hiy.setSmall(1,dom_hi.y+2);
307
308 // if (gbx_lox.ok()) amrex::AllPrint() << "GBX_XLO " << gbx_lox << std::endl;
309 // if (gbx_hix.ok()) amrex::AllPrint() << "GBX_XHI " << gbx_hix << std::endl;
310 // if (gbx_loy.ok()) amrex::AllPrint() << "GBX_YLO " << gbx_loy << std::endl;
311 // if (gbx_hiy.ok()) amrex::AllPrint() << "GBX_YHI " << gbx_hiy << std::endl;
312
313 if (gbx_lox.ok()) {
314 ParallelFor(gbx_lox, [=] AMREX_GPU_DEVICE (int i, int j, int k)
315 {
316 pm_fab(i,j,k,0) = pm_fab(dom_lo.x-1,j,k,0);
317 pn_fab(i,j,k,0) = pn_fab(dom_lo.x-1,j,k,0);
318 });
319 }
320 if (gbx_hix.ok()) {
321 ParallelFor(gbx_hix, [=] AMREX_GPU_DEVICE (int i, int j, int k)
322 {
323 pm_fab(i,j,k,0) = pm_fab(dom_hi.x+1,j,k,0);
324 pn_fab(i,j,k,0) = pn_fab(dom_hi.x+1,j,k,0);
325 });
326 }
327 if (gbx_loy.ok()) {
328 ParallelFor(gbx_loy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
329 {
330 pm_fab(i,j,k,0) = pm_fab(i,dom_lo.y-1,k,0);
331 pn_fab(i,j,k,0) = pn_fab(i,dom_lo.y-1,k,0);
332 });
333 }
334 if (gbx_hiy.ok()) {
335 ParallelFor(gbx_hiy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
336 {
337 pm_fab(i,j,k,0) = pm_fab(i,dom_hi.y+1,k,0);
338 pn_fab(i,j,k,0) = pn_fab(i,dom_hi.y+1,k,0);
339 });
340 }
341 } // mfi
342}
343/**
344 * @param lev Integer specifying the current level
345 */
346void
348{
349 // *** FArrayBox's at this level for holding the INITIAL data
350 Vector<FArrayBox> NC_h_fab ; NC_h_fab.resize(num_boxes_at_level[lev]);
351 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
352 {
354 NC_h_fab[idx]);
355
356#ifdef _OPENMP
357#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
358#endif
359 {
360 // Don't tile this since we are operating on full FABs in this routine
361 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
362 {
363 FArrayBox &h_fab = (*vec_h[lev])[mfi];
364
365 //
366 // FArrayBox to FArrayBox copy does "copy on intersection"
367 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
368 //
369
370 // Copy into both components of h
371 h_fab.template copy<RunOn::Device>(NC_h_fab[idx],0,0,1);
372 h_fab.template copy<RunOn::Device>(NC_h_fab[idx],0,1,1);
373 } // mf
374 } // omp
375 } // idx
376
377 const double dummy_time = 0.0_rt;
378 // Unconditional foextrap will overwrite periodicity, but EnforcePeriodicity will
379 // be called on h afterwards
380 FillPatch(lev,dummy_time,*vec_h[lev],GetVecOfPtrs(vec_h),
382 BdyVars::null,0,false,true,1);
383 FillPatch(lev,dummy_time,*vec_h[lev],GetVecOfPtrs(vec_h),
385 BdyVars::null,1,false,true,1);
386
387 vec_h[lev]->FillBoundary(geom[lev].periodicity());
388}
389
390/**
391 * @param lev Integer specifying the current level
392 */
393void
395{
396 // *** FArrayBox's at this level for holding the INITIAL data
397 Vector<FArrayBox> NC_fcor_fab ; NC_fcor_fab.resize(num_boxes_at_level[lev]);
398
399 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
400 {
402 NC_fcor_fab[idx]);
403
404#ifdef _OPENMP
405#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
406#endif
407 {
408 // Don't tile this since we are operating on full FABs in this routine
409 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
410 {
411 FArrayBox &fcor_fab = (*vec_fcor[lev])[mfi];
412
413 //
414 // FArrayBox to FArrayBox copy does "copy on intersection"
415 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
416 //
417
418 fcor_fab.template copy<RunOn::Device>(NC_fcor_fab[idx]);
419 } // mf
420 } // omp
421 } // idx
422 vec_fcor[lev]->FillBoundary(geom[lev].periodicity());
423}
424
425/**
426 * @param lev Integer specifying the current level
427 */
428void
430{
431 // *** FArrayBox's at this level for holding the INITIAL data
432 Vector<FArrayBox> NC_mskr_fab ; NC_mskr_fab.resize(num_boxes_at_level[lev]);
433 Vector<FArrayBox> NC_msku_fab ; NC_msku_fab.resize(num_boxes_at_level[lev]);
434 Vector<FArrayBox> NC_mskv_fab ; NC_mskv_fab.resize(num_boxes_at_level[lev]);
435
436 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
437 {
438 read_masks_from_netcdf(lev,boxes_at_level[lev][idx], nc_grid_file[lev][idx],
439 NC_mskr_fab[idx],NC_msku_fab[idx],
440 NC_mskv_fab[idx]);
441
442#ifdef _OPENMP
443#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
444#endif
445 {
446 // Don't tile this since we are operating on full FABs in this routine
447 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
448 {
449 FArrayBox &mskr_fab = (*vec_mskr[lev])[mfi];
450 FArrayBox &msku_fab = (*vec_msku[lev])[mfi];
451 FArrayBox &mskv_fab = (*vec_mskv[lev])[mfi];
452
453 //
454 // FArrayBox to FArrayBox copy does "copy on intersection"
455 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
456 //
457
458 mskr_fab.template copy<RunOn::Device>(NC_mskr_fab[idx]);
459 msku_fab.template copy<RunOn::Device>(NC_msku_fab[idx]);
460 mskv_fab.template copy<RunOn::Device>(NC_mskv_fab[idx]);
461 } // mf
462 } // omp
463 } // idx
464
465 update_mskp(lev);
466 vec_mskr[lev]->FillBoundary(geom[lev].periodicity());
467 vec_msku[lev]->FillBoundary(geom[lev].periodicity());
468 vec_mskv[lev]->FillBoundary(geom[lev].periodicity());
469 vec_mskp[lev]->FillBoundary(geom[lev].periodicity());
470}
471
472/**
473 * @param lev Integer specifying the current level
474 */
475void
477{
478 if (nc_bdry_file.empty() || nc_bdry_file[0].empty()) {
479 amrex::Error("NetCDF boundary file name must be provided via input");
480 }
481
482 amrex::Vector<std::string> field_name = {"u", "v", "temp", "salt", "ubar", "vbar", "zeta"};
483 amrex::Vector<IntVect > index_types = {IntVect(1,0,0), IntVect(0,1,0),
484 IntVect(0,0,0), IntVect(0,0,0),
485 IntVect(1,0,0), IntVect(0,1,0),
486 IntVect(0,0,0)};
487 std::vector<bool > is_2d = {false, false, false, false, true, true, true};
488
489 amrex::Print() << "DOING INIT AT LEVEL " << lev << std::endl;
490 int rx = 1; int ry = 1;
491 if (lev > 0) {
492 for (int k = lev-1; k >= 0; k--) {
493 rx *= ref_ratio[k][0];
494 ry *= ref_ratio[k][1];
495 }
496 }
497 for (int ivar = 0; ivar < BdyVars::NumTypes; ivar++) {
498 boundary_series[lev].push_back(std::unique_ptr<NCTimeSeriesBoundary>(new NCTimeSeriesBoundary(lev, geom, nc_bdry_file, field_name[ivar],
500 index_types[ivar],
501 &phys_bc_need_data[ivar], is_2d[ivar], rx, ry)));
502 boundary_series[lev][ivar]->Initialize();
503 }
504}
505
506/**
507 * \brief Helper function to initialize state and velocity data in a Fab from a REMORAdataset.
508 *
509 * @param lev Integer specifying current level
510 * @param state_fab FArrayBox object holding the state data we initialize
511 * @param temp_fab FArrayBox object holding the temperature data we initialize
512 * @param salt_fab FArrayBox object holding the salt data we initialize
513 * @param x_vel_fab FArrayBox object holding the x-velocity data we initialize
514 * @param y_vel_fab FArrayBox object holding the y-velocity data we initialize
515 * @param NC_temp_fab Vector of FArrayBox objects with the REMORA dataset specifying temperature
516 * @param NC_salt_fab Vector of FArrayBox objects with the REMORA dataset specifying salinity
517 * @param NC_xvel_fab Vector of FArrayBox objects with the REMORA dataset specifying x-velocity
518 * @param NC_yvel_fab Vector of FArrayBox objects with the REMORA dataset specifying y-velocity
519 */
520void
522 FArrayBox& temp_fab, FArrayBox& salt_fab,
523 FArrayBox& x_vel_fab, FArrayBox& y_vel_fab,
524 const Vector<FArrayBox>& NC_temp_fab,
525 const Vector<FArrayBox>& NC_salt_fab,
526 const Vector<FArrayBox>& NC_xvel_fab,
527 const Vector<FArrayBox>& NC_yvel_fab)
528{
529 int nboxes = NC_xvel_fab.size();
530 for (int idx = 0; idx < nboxes; idx++)
531 {
532 //
533 // FArrayBox to FArrayBox copy does "copy on intersection"
534 // This only works here because we have broadcast the FArrayBox of data from the netcdf file to all ranks
535 //
536 temp_fab.template copy<RunOn::Device>(NC_temp_fab[idx]);
537 salt_fab.template copy<RunOn::Device>(NC_salt_fab[idx]);
538 x_vel_fab.template copy<RunOn::Device>(NC_xvel_fab[idx]);
539 y_vel_fab.template copy<RunOn::Device>(NC_yvel_fab[idx]);
540 } // idx
541}
542
543/**
544 * @param lev Integer specifying the current level
545 */
546void
548{
549 // *** FArrayBox's at this level for holding the INITIAL data
550 Vector<FArrayBox> NC_M2NC_fab ; NC_M2NC_fab.resize(num_boxes_at_level[lev]);
551 Vector<FArrayBox> NC_M3NC_fab ; NC_M3NC_fab.resize(num_boxes_at_level[lev]);
552 Vector<FArrayBox> NC_TempNC_fab ; NC_TempNC_fab.resize(num_boxes_at_level[lev]);
553 Vector<FArrayBox> NC_SaltNC_fab ; NC_SaltNC_fab.resize(num_boxes_at_level[lev]);
554
555 for (int idx = 0; idx < num_boxes_at_level[lev]; idx++)
556 {
562 NC_M2NC_fab[idx],NC_M3NC_fab[idx],
563 NC_TempNC_fab[idx],NC_SaltNC_fab[idx]);
564
565#ifdef _OPENMP
566#pragma omp parallel if (amrex::Gpu::notInLaunchRegion())
567#endif
568 {
569 // Don't tile this since we are operating on full FABs in this routine
570 for ( MFIter mfi(*cons_new[lev], false); mfi.isValid(); ++mfi )
571 {
573 FArrayBox &ubarNC_fab = (*vec_nudg_coeff[BdyVars::ubar][lev])[mfi];
574 ubarNC_fab.template copy<RunOn::Device>(NC_M2NC_fab[idx]);
575 FArrayBox &vbarNC_fab = (*vec_nudg_coeff[BdyVars::vbar][lev])[mfi];
576 vbarNC_fab.template copy<RunOn::Device>(NC_M2NC_fab[idx]);
577 }
579 FArrayBox &uNC_fab = (*vec_nudg_coeff[BdyVars::u][lev])[mfi];
580 uNC_fab.template copy<RunOn::Device>(NC_M3NC_fab[idx]);
581 FArrayBox &vNC_fab = (*vec_nudg_coeff[BdyVars::v][lev])[mfi];
582 vNC_fab.template copy<RunOn::Device>(NC_M3NC_fab[idx]);
583 }
585 FArrayBox &TempNC_fab = (*vec_nudg_coeff[BdyVars::t][lev])[mfi];
586 TempNC_fab.template copy<RunOn::Device>(NC_TempNC_fab[idx]);
587 }
589 FArrayBox &SaltNC_fab = (*vec_nudg_coeff[BdyVars::s][lev])[mfi];
590 SaltNC_fab.template copy<RunOn::Device>(NC_SaltNC_fab[idx]);
591 }
592
593 } // mf
594 } // omp
595 } // idx
596
598 vec_nudg_coeff[BdyVars::ubar][lev]->FillBoundary(geom[lev].periodicity());
599 vec_nudg_coeff[BdyVars::vbar][lev]->FillBoundary(geom[lev].periodicity());
602 }
604 vec_nudg_coeff[BdyVars::u][lev]->FillBoundary(geom[lev].periodicity());
605 vec_nudg_coeff[BdyVars::v][lev]->FillBoundary(geom[lev].periodicity());
608 }
610 vec_nudg_coeff[BdyVars::t][lev]->FillBoundary(geom[lev].periodicity());
612 }
614 vec_nudg_coeff[BdyVars::s][lev]->FillBoundary(geom[lev].periodicity());
616 }
617}
618
619/**
620 * @param[in ] lev level to read in river data
621 */
622void
624{
625 amrex::Vector<int> river_pos_x;
626 amrex::Vector<int> river_pos_y;
627 amrex::Vector<int> river_direction_tmp;
628
629 std::string river_x_name = "river_Xposition";
630 std::string river_y_name = "river_Eposition";
631 std::string river_dir_name = "river_direction";
632
633 read_vec_from_netcdf(lev, nc_riv_file, river_x_name, river_pos_x);
634 read_vec_from_netcdf(lev, nc_riv_file, river_y_name, river_pos_y);
635 read_vec_from_netcdf(lev, nc_riv_file, river_dir_name, river_direction_tmp);
636
637 int nriv = river_pos_x.size();
638 amrex::Gpu::DeviceVector<int> xpos_d(nriv);
639 amrex::Gpu::DeviceVector<int> ypos_d(nriv);
640 river_direction.resize(nriv);
641#ifdef AMREX_USE_GPU
642 Gpu::htod_memcpy(xpos_d.data(), river_pos_x.data(), sizeof(int)*nriv);
643 Gpu::htod_memcpy(ypos_d.data(), river_pos_y.data(), sizeof(int)*nriv);
644 Gpu::htod_memcpy(river_direction.data(), river_direction_tmp.data(), sizeof(int)*nriv);
645#else
646 std::memcpy(xpos_d.data(), river_pos_x.data(), sizeof(int)*nriv);
647 std::memcpy(ypos_d.data(), river_pos_y.data(), sizeof(int)*nriv);
648 std::memcpy(river_direction.data(), river_direction_tmp.data(), sizeof(int)*nriv);
649#endif
650 const int* xpos_ptr = xpos_d.data();
651 const int* ypos_ptr = ypos_d.data();
652
653 for (amrex::MFIter mfi(*(vec_river_position[lev]).get(),true); mfi.isValid(); ++mfi) {
654 amrex::Box bx = mfi.growntilebox(amrex::IntVect(NGROW,NGROW,0));
655 auto river_pos = vec_river_position[lev]->array(mfi);
656 ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int ) {
657 for (int iriv=0; iriv < nriv; iriv++) {
658 int xriv = xpos_ptr[iriv]-1;
659 int yriv = ypos_ptr[iriv]-1;
660 if (i==xriv && j==yriv) {
661 river_pos(i,j,0) = iriv;
662 }
663 }
664 });
665 }
666}
667
668/**
669 * @param[inout] mf multifab of data to convert
670 */
671void
673 Real inv_days_to_inv_s = 1.0_rt / (3600._rt * 24._rt);
674
675 for ( MFIter mfi(*mf, TilingIfNotGPU()); mfi.isValid(); ++mfi )
676 {
677 Array4<Real> const& arr = mf->array(mfi);
678 Box bx = mfi.growntilebox(IntVect(NGROW,NGROW,0));
679 ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) {
680 arr(i,j,k) *= inv_days_to_inv_s;
681 });
682 }
683
684}
685
686void
688{
689 if (nc_grid_file_hires.empty()) {
690 Abort("Must specify high-resolution grid file when initializing from NetCDF and hires_grid_level > 0");
691 }
692 Vector<FArrayBox> NC_h_fab ; NC_h_fab.resize(1);
694
695 // Don't tile this since we are operating on full FABs in this routine
696 for ( MFIter mfi(*vec_h_full_domain[hires_grid_level], false); mfi.isValid(); ++mfi )
697 {
698 FArrayBox &h_fab = (*vec_h_full_domain[hires_grid_level])[mfi];
699 h_fab.template copy<RunOn::Device>(NC_h_fab[0]);
700 }
701
702 // Average down to fill levels below hires_grid_level. Use a special average_down so
703 // grow cells get populated by averaged down fine data
704 for (int lev=hires_grid_level-1; lev >= 0; lev--) {
706 }
707}
708
709void
711{
712 if (nc_grid_file_hires.empty()) {
713 Abort("Must specify high-resolution grid file when initializing from NetCDF and hires_grid_level > 0");
714 }
715 Vector<FArrayBox> NC_pm_fab ; NC_pm_fab.resize(1);
716 Vector<FArrayBox> NC_pn_fab ; NC_pn_fab.resize(1);
717
719 NC_pm_fab[0], NC_pn_fab[0],
721
722 // Don't tile this since we are operating on full FABs in this routine
723 for ( MFIter mfi(*vec_h_full_domain[hires_grid_level], false); mfi.isValid(); ++mfi )
724 {
725 FArrayBox &pm_fab = (*vec_pm_full_domain[hires_grid_level])[mfi];
726 FArrayBox &pn_fab = (*vec_pn_full_domain[hires_grid_level])[mfi];
727 pm_fab.template copy<RunOn::Device>(NC_pm_fab[0]);
728 pn_fab.template copy<RunOn::Device>(NC_pn_fab[0]);
729 }
730
731 // Average down to fill levels below hires_grid_level. Use a special average_down so
732 // grow cells get populated by averaged down fine data
733 for (int lev=hires_grid_level-1; lev >= 0; lev--) {
736
737 int rrx = ref_ratio[lev][0];
738 int rry = ref_ratio[lev][1];
739 // pm and pn need to be rescaled by the refinement ratio
740 for ( MFIter mfi(*vec_h_full_domain[lev], TilingIfNotGPU()); mfi.isValid(); ++mfi )
741 {
742 Array4<Real> const& pm = vec_pm_full_domain[lev]->array(mfi);
743 Array4<Real> const& pn = vec_pn_full_domain[lev]->array(mfi);
744 Box ubx = mfi.growntilebox(cum_ref_ratios[lev] - IntVect(1,0,0));;
745 Box vbx = mfi.growntilebox(cum_ref_ratios[lev] - IntVect(0,1,0));;
746 ParallelFor(makeSlab(ubx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int ) {
747 pm(i,j,0) = pm(i,j,0) / Real(rrx);
748 });
749 ParallelFor(makeSlab(vbx,2,0), [=] AMREX_GPU_DEVICE (int i, int j, int ) {
750 pn(i,j,0) = pn(i,j,0) / Real(rry);
751 });
752 }
753 }
754
755 for (int lev=0; lev<=hires_grid_level; lev++) {
756 int ng = vec_pm_full_domain[lev]->nGrow();
757
758 const auto& dom_lo = amrex::lbound(geom[lev].Domain());
759 const auto& dom_hi = amrex::ubound(geom[lev].Domain());
760
761 for ( MFIter mfi(*vec_pm_full_domain[lev]); mfi.isValid(); ++mfi )
762 {
763 Box bx = mfi.tilebox();
764
765 auto pm_fab = vec_pm_full_domain[lev]->array(mfi);
766 auto pn_fab = vec_pn_full_domain[lev]->array(mfi);
767
768 Box gbx_lox = adjCellLo(bx,0,ng); gbx_lox.grow(1,ng); gbx_lox.setBig (0,dom_lo.x-2);
769 Box gbx_hix = adjCellHi(bx,0,ng); gbx_hix.grow(1,ng); gbx_hix.setSmall(0,dom_hi.x+2);
770 Box gbx_loy = adjCellLo(bx,1,ng); gbx_loy.grow(0,ng); gbx_loy.setBig (1,dom_lo.y-2);
771 Box gbx_hiy = adjCellHi(bx,1,ng); gbx_hiy.grow(0,ng); gbx_hiy.setSmall(1,dom_hi.y+2);
772
773 // if (gbx_lox.ok()) amrex::AllPrint() << "GBX_XLO " << gbx_lox << std::endl;
774 // if (gbx_hix.ok()) amrex::AllPrint() << "GBX_XHI " << gbx_hix << std::endl;
775 // if (gbx_loy.ok()) amrex::AllPrint() << "GBX_YLO " << gbx_loy << std::endl;
776 // if (gbx_hiy.ok()) amrex::AllPrint() << "GBX_YHI " << gbx_hiy << std::endl;
777
778 if (gbx_lox.ok()) {
779 ParallelFor(gbx_lox, [=] AMREX_GPU_DEVICE (int i, int j, int k)
780 {
781 pm_fab(i,j,k,0) = pm_fab(dom_lo.x-1,j,k,0);
782 pn_fab(i,j,k,0) = pn_fab(dom_lo.x-1,j,k,0);
783 });
784 }
785 if (gbx_hix.ok()) {
786 ParallelFor(gbx_hix, [=] AMREX_GPU_DEVICE (int i, int j, int k)
787 {
788 pm_fab(i,j,k,0) = pm_fab(dom_hi.x+1,j,k,0);
789 pn_fab(i,j,k,0) = pn_fab(dom_hi.x+1,j,k,0);
790 });
791 }
792 if (gbx_loy.ok()) {
793 ParallelFor(gbx_loy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
794 {
795 pm_fab(i,j,k,0) = pm_fab(i,dom_lo.y-1,k,0);
796 pn_fab(i,j,k,0) = pn_fab(i,dom_lo.y-1,k,0);
797 });
798 }
799 if (gbx_hiy.ok()) {
800 ParallelFor(gbx_hiy, [=] AMREX_GPU_DEVICE (int i, int j, int k)
801 {
802 pm_fab(i,j,k,0) = pm_fab(i,dom_hi.y+1,k,0);
803 pn_fab(i,j,k,0) = pn_fab(i,dom_hi.y+1,k,0);
804 });
805 }
806 } // mfi
807 }
808}
809
810#endif // REMORA_USE_NETCDF
#define NGROW
#define Temp_comp
#define Tracer_comp
#define Salt_comp
void read_vec_from_netcdf(int lev, const amrex::Vector< std::string > &fnames, const std::string &field_name, amrex::Vector< int > &vec_dat)
helper function to read in vector of data from netcdf
void read_coriolis_from_netcdf(int lev, const Box &domain, const std::string &fname, FArrayBox &NC_fcor_fab)
helper function to read coriolis factor from netcdf
void read_grid_vars_from_netcdf(int lev, const Box &domain, const std::string &fname, FArrayBox &NC_pm_fab, FArrayBox &NC_pn_fab, FArrayBox &NC_xr_fab, FArrayBox &NC_yr_fab, FArrayBox &NC_xu_fab, FArrayBox &NC_yu_fab, FArrayBox &NC_xv_fab, FArrayBox &NC_yv_fab, FArrayBox &NC_xp_fab, FArrayBox &NC_yp_fab)
helper function to read grid variables from netcdf
void read_zeta_from_netcdf(int lev, const Box &domain, const std::string &fname, FArrayBox &NC_zeta_fab)
helper function to read sea surface height from netcdf
Real read_bdry_from_netcdf(const Box &domain, const std::string &fname, Vector< Vector< FArrayBox > > &bdy_data_xlo, Vector< Vector< FArrayBox > > &bdy_data_xhi, Vector< Vector< FArrayBox > > &bdy_data_ylo, Vector< Vector< FArrayBox > > &bdy_data_yhi, int &width, amrex::Real &start_bdy_time, std::string bdry_time_varname, amrex::GpuArray< amrex::GpuArray< bool, AMREX_SPACEDIM *2 >, BdyVars::NumTypes+1 > &)
helper function for reading boundary data from netcdf
void read_bathymetry_from_netcdf(int lev, const Box &domain, const std::string &fname, FArrayBox &NC_h_fab)
helper function to read bathymetry from netcdf
void init_state_from_netcdf(int lev, FArrayBox &temp_fab, FArrayBox &salt_fab, FArrayBox &x_vel_fab, FArrayBox &y_vel_fab, const Vector< FArrayBox > &NC_temp_fab, const Vector< FArrayBox > &NC_salt_fab, const Vector< FArrayBox > &NC_xvel_fab, const Vector< FArrayBox > &NC_yvel_fab)
helper function to initialize state from netcdf
void read_bathymetry_full_domain_from_netcdf(const Box &domain, const std::string &fname, FArrayBox &NC_h_fab, IntVect ngrow)
helper function to read full-domain high resolution bathymetry from netcdf
void read_masks_from_netcdf(int, const Box &domain, const std::string &fname, FArrayBox &NC_mskr_fab, FArrayBox &NC_msku_fab, FArrayBox &NC_mskv_fab)
helper function for reading in land-sea masks from netcdf
void read_data_from_netcdf(int, const Box &domain, const std::string &fname, FArrayBox &NC_temp_fab, FArrayBox &NC_salt_fab, FArrayBox &NC_xvel_fab, FArrayBox &NC_yvel_fab)
helper function for reading in initial state data from netcdf
void read_grid_vars_full_domain_from_netcdf(const Box &domain, const std::string &fname, FArrayBox &NC_pm_fab, FArrayBox &NC_pn_fab, IntVect ngrow)
helper function to read full-domain high resolution grid variables from netcdf
void read_clim_nudg_coeff_from_netcdf(int lev, const Box &domain, const std::string &fname, bool do_m2_clim_nudg, bool do_m3_clim_nudg, bool do_temp_clim_nudg, bool do_salt_clim_nudg, FArrayBox &NC_M2NC_fab, FArrayBox &NC_M3NC_fab, FArrayBox &NC_TempNC_fab, FArrayBox &NC_SaltNC_fab)
helper function to read climatology nudging from netcdf
A class to hold and interpolate time series data read from a NetCDF file.
std::string nc_grid_file_hires
Grid file for high resolution bathymetry.
Definition REMORA.H:1529
amrex::Vector< std::string > nc_riv_file
NetCDF river file(s)
Definition REMORA.H:1538
int foextrap_periodic_bc() const noexcept
Definition REMORA.H:1123
void init_bathymetry_from_netcdf(int lev)
Bathymetry data initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_fcor
coriolis factor (2D)
Definition REMORA.H:469
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h
Bathymetry data (2D, positive valued, h in ROMS)
Definition REMORA.H:306
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm
horizontal scaling factor: 1 / dx (2D)
Definition REMORA.H:459
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yv
y_grid on v-points (2D)
Definition REMORA.H:484
amrex::Vector< amrex::MultiFab * > cons_new
multilevel data container for current step's scalar data: temperature, salinity, passive tracer
Definition REMORA.H:294
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskr
land/sea mask at cell centers (2D)
Definition REMORA.H:448
void init_grid_vars_from_netcdf(int lev)
Grid variable initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yp
y_grid on psi-points (2D)
Definition REMORA.H:489
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xr
x_grid on rho points (2D)
Definition REMORA.H:472
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xv
x_grid on v-points (2D)
Definition REMORA.H:482
amrex::Vector< amrex::Vector< amrex::Box > > boxes_at_level
the boxes specified at each level by tagging criteria
Definition REMORA.H:1330
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_msku
land/sea mask at x-faces (2D)
Definition REMORA.H:450
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pm_full_domain
horizontal scaling factor: 1 / dx (2D) on whole domain
Definition REMORA.H:463
void init_data_from_netcdf(int lev)
Problem initialization from NetCDF file.
void init_masks_from_netcdf(int lev)
Mask data initialization from NetCDF file.
amrex::Vector< amrex::MultiFab * > yvel_new
multilevel data container for current step's y velocities (v in ROMS)
Definition REMORA.H:298
int zeta_bc() const noexcept
Definition REMORA.H:1121
amrex::Vector< amrex::IntVect > cum_ref_ratios
Cumulative refinement ratio between level 0 and level i.
Definition REMORA.H:1533
amrex::Vector< int > num_boxes_at_level
how many boxes specified at each level by tagging criteria
Definition REMORA.H:1326
amrex::Vector< amrex::MultiFab * > xvel_new
multilevel data container for current step's x velocities (u in ROMS)
Definition REMORA.H:296
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskp
land/sea mask at cell corners (2D)
Definition REMORA.H:454
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_mskv
land/sea mask at y-faces (2D)
Definition REMORA.H:452
amrex::Vector< std::unique_ptr< REMORAPhysBCFunct > > physbcs
Vector (over level) of functors to apply physical boundary conditions.
Definition REMORA.H:1347
void FillPatch(int lev, amrex::Real time, amrex::MultiFab &mf_to_be_filled, amrex::Vector< amrex::MultiFab * > const &mfs, const int bccomp, const int bdy_var_type=BdyVars::null, const int icomp=0, const bool fill_all=true, const bool fill_set=true, const int n_not_fill=0, const int icomp_calc=0, const amrex::Real dt=amrex::Real(0.0), const amrex::MultiFab &mf_calc=amrex::MultiFab())
Fill a new MultiFab by copying in phi from valid region and filling ghost cells.
std::string nc_clim_coeff_file
NetCDF climatology coefficient file.
Definition REMORA.H:1543
amrex::Vector< std::string > bdry_time_name_byvar
Name of time fields for boundary data.
Definition REMORA.H:1548
void init_riv_pos_from_netcdf(int lev)
static amrex::Vector< std::string > nc_bdry_file
NetCDF boundary data.
Definition REMORA.H:51
void update_mskp(int lev)
Set psi-point mask to be consistent with rho-point mask.
void init_zeta_from_netcdf(int lev)
Sea-surface height data initialization from NetCDF file.
void init_coriolis_from_netcdf(int lev)
Coriolis parameter data initialization from NetCDF file.
void fill_from_bdyfiles(int lev, amrex::MultiFab &mf_to_fill, const amrex::MultiFab &mf_mask, const amrex::Real time, const int bccomp, const int bdy_var_type, const int icomp_to_fill, const int icomp_calc=0, const amrex::MultiFab &mf_calc=amrex::MultiFab(), const amrex::Real=amrex::Real(0.0))
Fill boundary data from netcdf file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_h_full_domain
Bathymetry data on the whole domain at each potential level.
Definition REMORA.H:309
int nscalar
Number of passive scalars carried in the state.
Definition REMORA.H:1408
void average_down_with_grow_cells(int lev, amrex::Vector< std::unique_ptr< amrex::MultiFab > > &mf)
Average down from level lev+1 to lev in mf, including grow cells.
Definition REMORA.cpp:1753
amrex::Vector< amrex::Real > t_new
new time at each level
Definition REMORA.H:1337
void init_bdry_from_netcdf(int lev)
Boundary data initialization from NetCDF file.
static SolverChoice solverChoice
Container for algorithmic choices.
Definition REMORA.H:1467
amrex::Vector< std::unique_ptr< amrex::iMultiFab > > vec_river_position
iMultiFab for river positions; contents are indices of rivers
Definition REMORA.H:1275
amrex::Vector< amrex::Vector< std::unique_ptr< NCTimeSeriesBoundary > > > boundary_series
Vector over BdyVars of boundary series data containers.
Definition REMORA.H:1271
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xp
x_grid on psi-points (2D)
Definition REMORA.H:487
static amrex::Vector< amrex::Vector< std::string > > nc_grid_file
NetCDF grid file.
Definition REMORA.H:53
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_zeta
free surface height (2D)
Definition REMORA.H:445
amrex::Gpu::DeviceVector< int > river_direction
Vector over rivers of river direction: 0: u-face; 1: v-face; 2: w-face.
Definition REMORA.H:1277
amrex::Box nc_hires_grid_box
Box for the full domain at nc_hires_grid_level.
Definition REMORA.H:1531
void init_clim_nudg_coeff_from_netcdf(int lev)
Climatology nudging coefficient initialization from NetCDF file.
void init_bathymetry_full_domain_from_netcdf()
Full domain high-res bathymetry data initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yu
y_grid on u-points (2D)
Definition REMORA.H:479
void init_grid_vars_full_domain_from_netcdf()
Full domain high-res grid variable initialization from NetCDF file.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_xu
x_grid on u-points (2D)
Definition REMORA.H:477
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn_full_domain
horizontal scaling factor: 1 / dy (2D) on whole domain
Definition REMORA.H:465
amrex::GpuArray< amrex::GpuArray< bool, AMREX_SPACEDIM *2 >, BdyVars::NumTypes+1 > phys_bc_need_data
These are flags that indicate whether we need to read in boundary data from file.
Definition REMORA.H:1373
amrex::Vector< amrex::Vector< std::unique_ptr< amrex::MultiFab > > > vec_nudg_coeff
Climatology nudging coefficients.
Definition REMORA.H:523
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_pn
horizontal scaling factor: 1 / dy (2D)
Definition REMORA.H:461
static amrex::Vector< amrex::Vector< std::string > > nc_init_file
NetCDF initialization file.
Definition REMORA.H:52
amrex::Vector< amrex::Real > t_old
old time at each level
Definition REMORA.H:1339
int hires_grid_level
Which level the high resolution bathymetry is at.
Definition REMORA.H:1527
void convert_inv_days_to_inv_s(amrex::MultiFab *)
Convert data in a multifab from inverse days to inverse seconds.
amrex::Vector< std::unique_ptr< amrex::MultiFab > > vec_yr
y_grid on rho points (2D)
Definition REMORA.H:474