two-way nesting only in the first refined grid
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
two-way nesting only in the first refined grid
Dear all,
Finally I have been able to run my model with 3 refined grid, but something strange is happening. When I run the model the first refined grid works in a two-way mode feeding the refined grid the parent grid and the parent grid the refined grid. But the other two refined grid work in one-way mode, the parent grid are feeding them but they are not feeding the parent grid. I have two refined grid with a refined factor of 3 and the other one with a refined factor of 4, so :
! Number of nested grids.
Ngrids = 4
! Number of grid nesting layers. This parameter is used to allow refinement
! and composite grid combinations.
NestLayers = 3
! Number of grids in each nesting layer [1:NestLayers].
! se ponen segun paso de tiempo
GridsInLayer = 1 2 1
The code has been updated to the last revision 781
I have run the parent grid with each one of the refined grid alone, and it works in two-ways but as soon as I run it together I only get the two-way mode in the first refined grid.
Has anyone found this problem or has any clue about where could be the mistake?.
Thanks a lot !!!
-Francisco
Finally I have been able to run my model with 3 refined grid, but something strange is happening. When I run the model the first refined grid works in a two-way mode feeding the refined grid the parent grid and the parent grid the refined grid. But the other two refined grid work in one-way mode, the parent grid are feeding them but they are not feeding the parent grid. I have two refined grid with a refined factor of 3 and the other one with a refined factor of 4, so :
! Number of nested grids.
Ngrids = 4
! Number of grid nesting layers. This parameter is used to allow refinement
! and composite grid combinations.
NestLayers = 3
! Number of grids in each nesting layer [1:NestLayers].
! se ponen segun paso de tiempo
GridsInLayer = 1 2 1
The code has been updated to the last revision 781
I have run the parent grid with each one of the refined grid alone, and it works in two-ways but as soon as I run it together I only get the two-way mode in the first refined grid.
Has anyone found this problem or has any clue about where could be the mistake?.
Thanks a lot !!!
-Francisco
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
I have been reviewing the output log and it always gives :
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 03
If I am working with two refined nestings, should it be?
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 03
FINE2COARSE - exchanging data between grids: dg = 03 and rg = 01 at cr = 04
Please, I will really appreciate any help or idea to be followed.
Thanks a lot.
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 03
If I am working with two refined nestings, should it be?
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 03
FINE2COARSE - exchanging data between grids: dg = 03 and rg = 01 at cr = 04
Please, I will really appreciate any help or idea to be followed.
Thanks a lot.
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid ¿BUG?
Dear all,
After reviewing all the nesting code several time I have been able to resolve my problem, although not in a very nice way. I am pretty sure that there is something I have made wrong but with this change in the main3d.F all my refined grids run in two-ways model.
I have change from the original main3d.F, line 808:
DO il=NestLayers,1,-1
IF (do_twoway(nl,il,istep,ng)) THEN
CALL nesting (ng, iNLM, n2way)
END IF
END DO
to
DO ng=2,4,1 ! My refined grid are the ng=2,3 and 4
DO il=NestLayers,1,-1
IF (do_twoway(nl,il,istep,ng)) THEN
CALL nesting (ng, iNLM, n2way)
END IF
END DO
END DO
I hope it could be useful in someway.
After reviewing all the nesting code several time I have been able to resolve my problem, although not in a very nice way. I am pretty sure that there is something I have made wrong but with this change in the main3d.F all my refined grids run in two-ways model.
I have change from the original main3d.F, line 808:
DO il=NestLayers,1,-1
IF (do_twoway(nl,il,istep,ng)) THEN
CALL nesting (ng, iNLM, n2way)
END IF
END DO
to
DO ng=2,4,1 ! My refined grid are the ng=2,3 and 4
DO il=NestLayers,1,-1
IF (do_twoway(nl,il,istep,ng)) THEN
CALL nesting (ng, iNLM, n2way)
END IF
END DO
END DO
I hope it could be useful in someway.
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: two-way nesting only in the first refined grid
Nope, this is not a good idea! because of the internal manipulations in several routine inside module nesting. It seems to me that you didn't specified the parameters correctly. The order of the grids are crucial. You need to think about the logical order when generating the contact NetCDF file with the Matlab script contact.m. This order needs to be maintained in ROMS.
We have several applications with three refinement grids. I am sure that you are not setting the nesting layers correctly. That may explain the problems that you are having. You need to read the instructions carefully. Check the wiki for details and examine the LAKE_JERSEY test case. You may need NestLayers = 4 and GridInLayer = 1 1 1 1 if you have three telescoping refinement grids. The order of such grids is very important in this case.
I always recommend to start simple but users keep ignoring it.
We have several applications with three refinement grids. I am sure that you are not setting the nesting layers correctly. That may explain the problems that you are having. You need to read the instructions carefully. Check the wiki for details and examine the LAKE_JERSEY test case. You may need NestLayers = 4 and GridInLayer = 1 1 1 1 if you have three telescoping refinement grids. The order of such grids is very important in this case.
I always recommend to start simple but users keep ignoring it.
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
Dear Arango,
Thanks a lot for your answer. I have followed your advice and first I examined the Lake Jersey case example and use it for my first simple case, one parent grid and one refined grid. Only after have been able to run it I moved to the next step, one parent grid and two refined grid as one of the Lake Jersey examples. I have followed the Lake example to prepare my files and run my test, and then I found the problem, the second refined grid didn´t run in two ways. After reviewing it several time, compare it with all the nesting example available and don´t find the solution, I decided to write on the forum and meanwhile I have been trying to find a solution to my problem.
I know that it is not a good idea to do it as I have done but after a lot of test It has been the only way found to resolve my problem, so I decided to share it in the forum. I will keep on following your advice and keep on trying to find what I have done wrong without doing any changes in the code.
Regards,
-Francisco
Thanks a lot for your answer. I have followed your advice and first I examined the Lake Jersey case example and use it for my first simple case, one parent grid and one refined grid. Only after have been able to run it I moved to the next step, one parent grid and two refined grid as one of the Lake Jersey examples. I have followed the Lake example to prepare my files and run my test, and then I found the problem, the second refined grid didn´t run in two ways. After reviewing it several time, compare it with all the nesting example available and don´t find the solution, I decided to write on the forum and meanwhile I have been trying to find a solution to my problem.
I know that it is not a good idea to do it as I have done but after a lot of test It has been the only way found to resolve my problem, so I decided to share it in the forum. I will keep on following your advice and keep on trying to find what I have done wrong without doing any changes in the code.
Regards,
-Francisco
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: two-way nesting only in the first refined grid
Perhaps, you should show us a diagram (plot) of all grids and their refinement ratio with respect the donor grid to check if you are setting the grids correctly.
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
Dear Arango,
Thanks a lot for your help, I really appreciate your effort. Attached you will find a diagram of my grids with the refinement factors for each grid.
My contact file has been made :
Gnames = {'parent_grid.nc', 'refined_grid_1.nc', 'refined_grid_2.nc', ,'refined_grid_3.nc'};
fcontact='contact_file.nc';
contact(Gnames,fcontact)
In my model.in file I have:
! Number of nested grids.
Ngrids = 4
! Number of grid nesting layers. This parameter is used to allow refinement
! and composite grid combinations.
NestLayers = 3
! Number of grids in each nesting layer [1:NestLayers].
GridsInLayer = 1 2 1
With this configuration the function fine2coarse is run only in the first refined grid ('refined_grid_1.nc'). If you need some more information, please ask me. I don´t want to fill the forum of a lot of configuration and output files but I will be glad to upload them if it can be useful.
Best regards,
-Francisco
Thanks a lot for your help, I really appreciate your effort. Attached you will find a diagram of my grids with the refinement factors for each grid.
My contact file has been made :
Gnames = {'parent_grid.nc', 'refined_grid_1.nc', 'refined_grid_2.nc', ,'refined_grid_3.nc'};
fcontact='contact_file.nc';
contact(Gnames,fcontact)
In my model.in file I have:
! Number of nested grids.
Ngrids = 4
! Number of grid nesting layers. This parameter is used to allow refinement
! and composite grid combinations.
NestLayers = 3
! Number of grids in each nesting layer [1:NestLayers].
GridsInLayer = 1 2 1
With this configuration the function fine2coarse is run only in the first refined grid ('refined_grid_1.nc'). If you need some more information, please ask me. I don´t want to fill the forum of a lot of configuration and output files but I will be glad to upload them if it can be useful.
Best regards,
-Francisco
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: two-way nesting only in the first refined grid
Refined grid by a factor of 4 is illegal. I don't know why contact.m allowed you to work by such a factor. You should get an error warning and stop.
You only can have refimnement ratios of 3, 5, 7, 9, etc in ROMS because it is discritized on a C-grid. As a matter of dynamics and because of numerical issues, it is recommended to have refinement ratios of 3, 5, or 7.
You only can have refimnement ratios of 3, 5, 7, 9, etc in ROMS because it is discritized on a C-grid. As a matter of dynamics and because of numerical issues, it is recommended to have refinement ratios of 3, 5, or 7.
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
Dear Arango,
Thanks a lot for your answer.
The issue with the contact function it ´s my fault. It works well and it gave me the warning but I have had bad experience (instabilities) working with other models (ROMS-AGRIF) with refine factor higher than 3, so I decided (a really bad decision) to use the value closer to 3, and to ignore the warning.
I have used a refine factor of 5 for the refined_grid_3 and rebuild the contact file but I am still getting the same problem. The fine2coarse function only it´s run for the first refined grid. In the model output I only get:
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 04
Ignoring the two-way mode for the other refined grids.
Regards,
-Francisco
Thanks a lot for your answer.
The issue with the contact function it ´s my fault. It works well and it gave me the warning but I have had bad experience (instabilities) working with other models (ROMS-AGRIF) with refine factor higher than 3, so I decided (a really bad decision) to use the value closer to 3, and to ignore the warning.
I have used a refine factor of 5 for the refined_grid_3 and rebuild the contact file but I am still getting the same problem. The fine2coarse function only it´s run for the first refined grid. In the model output I only get:
FINE2COARSE - exchanging data between grids: dg = 02 and rg = 01 at cr = 04
Ignoring the two-way mode for the other refined grids.
Regards,
-Francisco
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: two-way nesting only in the first refined grid
I will have to reproduce this problem with a test case to see what it is going on. Your fix to main3d.F is not correct.
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
Thanks a lot !!
I know that my fix is not correct I share it in the forum just in case it could help to figure out where was my problem. Now I have forgotten about it and I am trying to find where is my misconfiguration.
-Francisco
I know that my fix is not correct I share it in the forum just in case it could help to figure out where was my problem. Now I have forgotten about it and I am trying to find where is my misconfiguration.
-Francisco
- arango
- Site Admin
- Posts: 1367
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: two-way nesting only in the first refined grid
Please update. I fixed the problem that you were having. See the following trac ticket for details. Thank you for reporting this problem
-
- Posts: 68
- Joined: Tue Nov 10, 2009 6:42 pm
- Location: Technical University of Cartagena,Murcia, Spain
Re: two-way nesting only in the first refined grid
Dear Arango,
Thanks a lot for fixing it. I am really glad to have been able to contribute to improve ROMS.
Thanks a lot for fixing it. I am really glad to have been able to contribute to improve ROMS.