ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ReadFromWRFInput.H
Go to the documentation of this file.
1 /**
2  * \file ERF_ReadFromWRFInput.H
3  */
4 #ifndef ERF_READ_FROM_WRFINPUT_H_
5 #define ERF_READ_FROM_WRFINPUT_H_
6 
7 #include <AMReX_Box.H>
8 #include <AMReX_IntVect.H>
9 
10 namespace erf_wrfinput {
11 
12 /**
13  * Shift horizontal WRF file coordinates into the ERF index space used by
14  * init_from_wrfinput. Keep k unchanged: WRF nests carry the parent's eta
15  * column, while their horizontal origins may be cropped or offset.
16  */
17 inline amrex::IntVect
18 file_to_erf_shift (const amrex::Box& erf_file_box,
19  const amrex::Box& file_subdomain)
20 {
21  amrex::IntVect shift(0);
22  shift[0] = erf_file_box.smallEnd(0) - file_subdomain.smallEnd(0);
23  shift[1] = erf_file_box.smallEnd(1) - file_subdomain.smallEnd(1);
24  return shift;
25 }
26 
27 /** Map one file-coordinate box into the ERF index space used by init_from_wrfinput. */
28 inline amrex::Box
29 file_box_to_erf (amrex::Box file_box, const amrex::IntVect& shift)
30 {
31  file_box.shift(shift);
32  return file_box;
33 }
34 
35 } // namespace erf_wrfinput
36 
37 #ifdef ERF_USE_NETCDF
38 void
39 read_from_wrfinput (int lev,
40  const amrex::Box& subdomain,
41  const std::string& fname,
42  amrex::FArrayBox& NC_fab,
43  const std::string& NC_name,
44  amrex::Geometry& geom,
45  int& use_theta_m,
46  int& success);
47 
48 void
49 check_wrfinput_geometry (int lev,
50  const std::string& fname,
51  const amrex::Geometry& geom,
52  int& use_theta_m);
53 
54 int
55 wrfinput_var_box (const amrex::Box& subdomain_to_read,
56  const std::string& fname,
57  const std::string& NC_name,
58  amrex::Box& var_box);
59 
60 void
61 read_region_from_wrfinput (const std::string& fname,
62  const std::string& NC_name,
63  const amrex::Box& var_box,
64  const amrex::Box& region,
65  amrex::FArrayBox& fab,
66  int max_readers);
67 #endif
68 
69 #endif
Definition: ERF_ReadFromWRFInput.H:10
amrex::IntVect file_to_erf_shift(const amrex::Box &erf_file_box, const amrex::Box &file_subdomain)
Definition: ERF_ReadFromWRFInput.H:18
amrex::Box file_box_to_erf(amrex::Box file_box, const amrex::IntVect &shift)
Definition: ERF_ReadFromWRFInput.H:29