Boundary conditions from SMC grids #881
Replies: 8 comments
-
@ukmo-ccbunney or @ukmo-jianguo-li could you help answer this question? |
Beta Was this translation helpful? Give feedback.
-
Thanks @JessicaMeixner-NOAA for the quick reply. I only wanted to add that I now understand just a little bit more of what's going on. What WW3 writes in the files Again, in the case of a regular grid this makes to me, but I don't know how it works with a SMC grid of various levels of resolution (e.g., the 4 "surrounding" points might not all be on the base resolution of the grid, what happens in that case?). I'm running a few tests and finding some small issues with that, the wave height at the boundary segment is lower than the interpolated wave height from the gridded output, and I wouldn't expect a significant difference there. Is it possible to modify W3GFCL to treat SMC grids differently, and grab the 4 closest points to each boundary point? Then we could modify the interpolation weights to be proportional to the inverse distance, or similar. Many thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi, Emilio cc Jessica
You are right, the boundary interpolation part is based on a regular grid model. SMC grid has a mirror regular grid at its base resolution so the boundary spectral output from a SMC grid model will use the mirror regular grid for the interpolation. In refined area, the mirror grid is mapped to the last SMC grid cell within the base resolution mesh. This will usually the largest cell within the given regular grid mesh area. Nevertheless, it is usually not at the base resolution grid centre and hence it will definitely have some errors if the output boundary spectra are from a refined area of the SMC grid. If any of you could update the boundary interpolation subroutine to take into account of the refinement, it will be great.
Emilio, I like to know a bit more about your boundary problem. Are the boundary spectra are from a SMC grid model and in a refined area? If not, you may check whether other factors are causing the problem, such as the boundary point is close to coastline or the model spectra is underestimated in the first place. Usually, wave spectra do not change much over one grid length if they are in an open water area and the interpolation would not show much difference even if the interpolation distance has some errors.
Hope this may help.
Kind regards.
Jian-Guo
From: Emilio Echevarria ***@***.***>
Sent: 07 February 2023 03:42
To: NOAA-EMC/WW3 ***@***.***>
Cc: Li, JianGuo ***@***.***>; Mention ***@***.***>
Subject: Re: [NOAA-EMC/WW3] Boundary conditions from SMC grids (Discussion #881)
Thanks @JessicaMeixner-NOAA<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJessicaMeixner-NOAA&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533353769%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pWTBY7LtWufm2KhXcrEix4iBxGeQNifzpkUgnTDGLjY%3D&reserved=0> for the quick reply. I only wanted to add that I now understand just a little bit more of what's going on. What WW3 writes in the files nest#.ww3 (after the header) is: each bnd point coordinates and the indices and interpolation weights of the 4 surrounding points (here<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNOAA-EMC%2FWW3%2Fblob%2Fdevelop%2Fmodel%2Fsrc%2Fw3iobcmd.F90%23L376-L380&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533353769%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MZo0pz6rA5Qg6R%2BbaDan0%2BWIA2BVVDOodBEX%2FeYR%2Fkg%3D&reserved=0>?). I'm interested in understanding how these 4 surrounding points are calculated. Looking at w3gridmd.F90, it looks like they're defined by IXR and IYR, which in turn come from calling W3GRMP.
So, looking at these lines<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNOAA-EMC%2FWW3%2Fblob%2Fdevelop%2Fmodel%2Fsrc%2Fw3gsrumd.F90%23L2710-L2713&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533353769%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=G3088iPNDUYGLpO2ezWKBjFF3NzhBneesV7TrqT9nN4%3D&reserved=0>, it seems that the 4 surrounding points are calculated with the function W3GFCL<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNOAA-EMC%2FWW3%2Fblob%2Fdevelop%2Fmodel%2Fsrc%2Fw3gsrumd.F90%23L1252-L1260&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533509993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=lkAmZcK509wfo78IstcXNpbbtmBKT6ycbE9%2F83fzk9g%3D&reserved=0>.
Again, in the case of a regular grid this makes to me, but I don't know how it works with a SMC grid of various levels of resolution (e.g., the 4 "surrounding" points might not all be on the base resolution of the grid, what happens in that case?). I'm running a few tests and finding some small issues with that, the wave height at the boundary segment is lower than the interpolated wave height from the gridded output, and I wouldn't expect a significant difference there. Is it possible to modify W3GFCL to treat SMC grids differently, and grab the 4 closest points to each boundary point? Then we could modify the interpolation weights to be proportional to the inverse distance, or similar.
Many thanks,
Emilio
-
Reply to this email directly, view it on GitHub<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNOAA-EMC%2FWW3%2Fdiscussions%2F881%23discussioncomment-4889217&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533509993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=e%2FscoYK%2BzG%2BswBNIrP%2B7mzUZdEt4wgdl%2FDp%2F4VYB%2Bmo%3D&reserved=0>, or unsubscribe<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANGV3EFTE3MVR3GNE6LXFKTWWHACHANCNFSM6AAAAAAUTI55YY&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7C35642e5b2ab940c079ed08db08bd5799%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638113381533509993%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Wt4cazh76QQWcDNAionNF2JaJqKkBubAeZGZOP7qYzo%3D&reserved=0>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you very much @ukmo-jianguo-li for your explanation, now it makes sense. I can say pretty confidently now that the issue I have with the boundaries is not because of being too close to land, but because they are in a refined area of the SMC. One edge of the child grid sits on the base resolution of the SMC, and there is no problem there. Then the only remaining question I have is, where exactly in the WW3 source code is that mirror grid at the base resolution calculated? |
Beta Was this translation helpful? Give feedback.
-
Hi, Emilio
The base resolution regular grid is setup by the regular grid parameters inside ww3_grid.inp. For instance, the following parameter lines specify our global SMC 3-6-12-25 km global grid.
'SMCG' T 'SMPL'
1024 736
0.35156250 0.23437500 1.
0.17578125 -82.3828125 1.
Note the 'SMCG' grid type is a recent update in version 7 for the multi-grid option with SMC sub-grids. If you are using old versions, the regular grid type ''RECT' should be used. Inside the ww3_grid program, the regular grid mapping arrays are setup with SMC grid cell array. It is possible to set up the mirror regular grid at the finest SMC grid resolution, but it will waste a lot of storage for regular grid output.
Hope this helps.
Kind regards.
Jian-Guo
From: Emilio Echevarria ***@***.***>
Sent: 08 February 2023 02:36
To: NOAA-EMC/WW3 ***@***.***>
Cc: Li, JianGuo ***@***.***>; Mention ***@***.***>
Subject: Re: [NOAA-EMC/WW3] Boundary conditions from SMC grids (Discussion #881)
Thank you very much @ukmo-jianguo-li<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fukmo-jianguo-li&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7Cf6d25ecf16ba4b24457c08db097d2897%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638114205379678224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=N2b7OgBBXl%2BdCd%2FJIwjrTioOcdL65qiNsLczoUAaF5o%3D&reserved=0> for your explanation, now it makes sense. I can say pretty confidently now that the issue I have with the boundaries is not because of being too close to land, but because they are in a refined area of the SMC. One edge of the child grid sits on the base resolution of the SMC, and there is no problem there.
Then the only remaining question I have is, where exactly in the WW3 source code is that mirror grid at the base resolution calculated?
-
Reply to this email directly, view it on GitHub<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNOAA-EMC%2FWW3%2Fdiscussions%2F881%23discussioncomment-4900160&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7Cf6d25ecf16ba4b24457c08db097d2897%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638114205379678224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cHFJS2oHd7MO0x6OjnLdxATP8XQn4vo%2BQU8Xh7pBDEo%3D&reserved=0>, or unsubscribe<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FANGV3EHDHJOQ3JOM3UP3MMDWWMA7LANCNFSM6AAAAAAUTI55YY&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7Cf6d25ecf16ba4b24457c08db097d2897%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638114205379678224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OCEvkI92wK7alJi4BctYD7Hmbi2iOPXVARVNsbZUTsk%3D&reserved=0>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi @ukmo-jianguo-li thank you so much, it does help a lot. I'm interested in that option, how could I go about trying to set up the mirror grid not at the base resolution (size-4 cells in my case), not at the highest resolution (size-1) but at the first refinement level (size-2 cells)? Could you point me to the bits of code that should be modified? Many thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi, Emilio
It could be done but you need to modify the ww3_grid program first. The mirror grid is represented by the mapping array (MAPFS), which links each regular grid with a sea point. You just need to modify the mapping array according to your chosen resolution level. I did not try this so could not say more than these. The MAPSF, mapping a sea point to a regular grid point, also needs to be altered accordingly as far as I see. There might be other parts to be modified but I could not figure out right now. It needs a careful checking of the source code.
It is a big change and I would not say it is a piece of cake. But it will be useful if you could make it work.
Good luck.
Jian-Guo
From: Emilio Echevarria ***@***.***>
Sent: 08 February 2023 20:20
To: NOAA-EMC/WW3 ***@***.***>
Cc: Li, JianGuo ***@***.***>; Mention ***@***.***>
Subject: Re: [NOAA-EMC/WW3] Boundary conditions from SMC grids (Discussion #881)
Hi @ukmo-jianguo-li<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fukmo-jianguo-li&data=05%7C01%7Cjianguo.li%40metoffice.gov.uk%7Cb7be3cc351fc484694f008db0a11dc3f%7C17f1816120d7474687fd50fe3e3b6619%7C0%7C0%7C638114844047892750%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=yuahoPw6B9%2FVnYeGsYjlPCNj5%2Fayz0m8TcOR8SsKtvk%3D&reserved=0> thank you so much, it does help a lot.
I'm interested in that option, how could I go about trying to set up the mirror grid not at the base resolution (size-4 cells in my case), not at the highest resolution (size-1) but at the first refinement level (size-2 cells)? Could you point me to the bits of code that should be modified?
Many thanks,
Emilio
|
Beta Was this translation helpful? Give feedback.
-
Thank you Dr. Li, That's good to know. But I believe I will try a slightly different approach, I feel like it would be easier to select the 4 nearest SMC cells and compute inverse distance interpolation weights from these, hopefully that's a bit more straightforward. Best regards, |
Beta Was this translation helpful? Give feedback.
-
Dear WAVEWATCH modellers,
I'm trying to understand the logic for generating boundary conditions for regional grids when using a SMC grid, I would appreciate any advice/comment.
If I understand correctly, we define the segments of output boundary points at the end of ww3_grid.inp. For each of these locations, to compute the boundary conditions, WW3 seems to grab the 4 surrounding points and compute some interpolation weights (https://github.com/NOAA-EMC/WW3/blob/develop/model/src/w3gridmd.F90#L5755-L5819). These interpolation weights come from https://github.com/NOAA-EMC/WW3/blob/develop/model/src/w3gsrumd.F90#L2710-L2733. It seems that if at least one of the 4 surrounding points is "sea" then the calculation is carried out (see here, notice the
.OR.
s), and if there are points on land the interpolation weight for that point is zero and the rest get updated.Now, all of this makes sense to me in a regular grid scenario. What happens exactly when we use a SMC grid, where we only define an array of sea points? The land-sea mask logic seems to still be there somehow (e.g., I see the file
mask.ww3
being generated), how is this calculated for the SMC grid? I can see the mask is defined on the base resolution of the SMC grid. But for interpolating to the boundary points location, how does it work when for example we have higher resolution points close to the coast? If I understand correctly, WW3 will still grab the 4 surrounding points, but how are these calculated in the SMC case, where you have different resolutions when getting close to the coast? As far as I can see the 4 surrounding points are defined on the base resolution of the SMC grid, but what if we have points at a higher resolution than the base resolution?I am probably missing something obvious, but if someone can point me to the relevant pieces of code for this issue, I would really appreciate it.
Kind regards,
Emilio
Beta Was this translation helpful? Give feedback.
All reactions