Problem faced during online nesting for ROMS using self created grid

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Problem faced during online nesting for ROMS using self created grid

#1 Unread post by neelbasak08 »

Hello!

I have been using ROMS for the past 1 month and now I require to use nested grids for my ROMS model purposes. I had previously created my own grid which was coarse in nature. Then I tried to use matlab routines provided with ROMS package such as coarse2fine.m and contact.m for this purpose and following the https://www.myroms.org/wiki/Lake_Jersey ... Example_AC guideline for my job.

I was able to create a fine grid for a small region within my parent grid using the script coarse2fine.m and it ran fairly successfully giving the following output:
>> Imin = 123;
>> Imax = 125;
>> Jmin = 9;
>> Jmax = 12;
>> C = coarse2fine ('phillipines_grd_1.nc', 'phillipines_grd_1_c.nc', 3, Imin, Imax, Jmin, Jmax);

Interpolating from coarse to fine ...

Computing grid spacing: great circle distances

Number of points: Coarse = 300 x 150, fine = 8 x 11

Requested global attribute "history" not found in: phillipines_grd_1_c.nc
Writing finer grid variables into: phillipines_grd_1_c.nc

Wrote f Min= 1.42597e-05 Max= 1.51042e-05
Wrote h Min= NaN Max= NaN
Wrote pm Min= 6.55346e-04 Max= 6.55732e-04
Wrote pn Min= 2.69675e-04 Max= 2.69675e-04
Wrote dmde Min=-9.19073e-02 Max=-8.77672e-02
Wrote dndx Min=-6.07687e-07 Max= 6.07687e-07
Wrote angle Min=-2.15317e-14 Max= 6.03125e-14
Wrote lon_rho Min= 1.21780e+02 Max= 1.21876e+02
Wrote lat_rho Min= 5.61112e+00 Max= 5.94459e+00
Wrote lon_psi Min= 1.21786e+02 Max= 1.21869e+02
Wrote lat_psi Min= 5.62779e+00 Max= 5.92792e+00
Wrote lon_u Min= 1.21786e+02 Max= 1.21869e+02
Wrote lat_u Min= 5.61112e+00 Max= 5.94459e+00
Wrote lon_v Min= 1.21780e+02 Max= 1.21876e+02
Wrote lat_v Min= 5.62779e+00 Max= 5.92792e+00
Wrote mask_rho Min= 1.00000e+00 Max= 1.00000e+00
Wrote mask_psi Min= 1.00000e+00 Max= 1.00000e+00
Wrote mask_u Min= 1.00000e+00 Max= 1.00000e+00
Wrote mask_v Min= 1.00000e+00 Max= 1.00000e+00
But when I trying to execute contact .m script using the coarse file phillipines_grd_1.nc and the finer file phillipines_grd_1_c.nc , I encountered the following error:
Gnames = {'phillipines_grd_1.nc', 'phillipines_grd_1_c.nc'};
>> Cname = 'phillipines_contact.nc';
>> [S,G] = contact(Gnames, Cname);
Unrecognized function or variable 'RFactors'.

Error in contact (line 311)
G(ng).refine_factor = RFactors(ng);
I am not sure what might be triggering this error. Is it due to the line Requested global attribute "history" not found in: phillipines_grd_1_c.nc which was shown while making finer grid ? I'm not sure as it is the first time I'm doing nesting of grids. Also is this https://www.myroms.org/wiki/Lake_Jersey ... Example_AC the correct way for going forward with my nested grids or is it just specifically tailored for Lake Jersey case ?

Kind regards
-neel
Attachments
contact.m
(128.62 KiB) Downloaded 282 times
coarse2fine.m
(20.86 KiB) Downloaded 308 times
phillipines_grd_1.nc
(6.85 MiB) Downloaded 317 times
phillipines_grd_1_c.nc
finer grid created from phillipines_grd_1.nc using coarse2fine.m script
(18.66 KiB) Downloaded 328 times

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#2 Unread post by neelbasak08 »

Hello !

I am trying to create a finer grid from my initial coarse grid for my nesting purpose in ROMS model. I used the matlab script coarse2fine.m . The region I wanted my refinement is a portion with the coarser grid having the boundary cordinates : [longitude left = 123; longitude right = 125; latitude lower = 9; latitude upper = 12]. My coarser grid lies between these set of cordinates roughly : [longitude left = 115; longitude right = 129; latitude lower = 3.9; latitude upper = 19].

When I try to execute the script coarse2fine.m I get the following output:
>
>> Imin = 123;
>> Imax = 125;
>> Jmin = 9;
>> Jmax = 12;
>>
F = coarse2fine('phillipines_grd_1.nc','phillipines_grd_1_fine.nc',3,Imin, Imax, Jmin, Jmax);

Interpolating from coarse to fine ...

Computing grid spacing: great circle distances

Number of points: Coarse = 300 x 150, fine = 896 x 446

Requested global attribute "history" not found in: phillipines_grd_1_fine.nc
Writing finer grid variables into: phillipines_grd_1_fine.nc

Wrote f Min= 1.22310e-05 Max= 4.90423e-05
Wrote h Min= NaN Max= NaN
Wrote pm Min= 6.54512e-04 Max= 6.92536e-04
Wrote pn Min= 2.69675e-04 Max= 2.69675e-04
Wrote dmde Min=-2.99595e-01 Max=-7.53537e-02
Wrote dndx Min=-1.82306e-06 Max= 1.82306e-06
Wrote angle Min=-1.12673e-12 Max= 1.17268e-12
Wrote lon_rho Min= 1.16733e+02 Max= 1.29074e+02
Wrote lat_rho Min= 4.81080e+00 Max= 1.96501e+01
Wrote lon_psi Min= 1.16740e+02 Max= 1.29067e+02
Wrote lat_psi Min= 4.82747e+00 Max= 1.96334e+01
Wrote lon_u Min= 1.16740e+02 Max= 1.29067e+02
Wrote lat_u Min= 4.81080e+00 Max= 1.96501e+01
Wrote lon_v Min= 1.16733e+02 Max= 1.29074e+02
Wrote lat_v Min= 4.82747e+00 Max= 1.96334e+01
Wrote mask_rho Min= 0.00000e+00 Max= 1.00000e+00
Wrote mask_psi Min= 0.00000e+00 Max= 2.00000e+00
Wrote mask_u Min= 0.00000e+00 Max= 1.00000e+00
Wrote mask_v Min= 0.00000e+00 Max= 1.00000e+00

F =

struct with fields:

grid_name: 'phillipines_grd_1_fine.nc'
parent_grid: 'phillipines_grd_1.nc'
TimeRecord: []
Lm: 894
Mm: 444
N: 15
coarse_factor: []
refine_factor: 3
parent_Imin: 1
parent_Imax: 299
parent_Jmin: 1
parent_Jmax: 149
Vtransform: 9.96920996838687e+36
Vstretching: 9.96920996838687e+36
theta_s: 9.96920996838687e+36
theta_b: 9.96920996838687e+36
Tcline: 9.96920996838687e+36
hc: 9.96920996838687e+36
s_rho: [15×1 double]
Cs_r: [15×1 double]
s_w: [16×1 double]
Cs_w: [16×1 double]
spherical: 1
uniform: 0
curvilinear: 1
vector_rotation: 1
x_rho: []
y_rho: []
x_psi: []
y_psi: []
x_u: []
y_u: []
x_v: []
y_v: []
lon_rho: [896×446 double]
lat_rho: [896×446 double]
lon_psi: [895×445 double]
lat_psi: [895×445 double]
lon_u: [895×446 double]
lat_u: [895×446 double]
lon_v: [896×445 double]
lat_v: [896×445 double]
lon_perimeter: [2677×1 double]
lat_perimeter: [2677×1 double]
lon_rho_west: [1×446 double]
lat_rho_west: [1×446 double]
lon_rho_east: [1×446 double]
lat_rho_east: [1×446 double]
lon_rho_south: [896×1 double]
lat_rho_south: [896×1 double]
lon_rho_north: [896×1 double]
lat_rho_north: [896×1 double]
lon_u_west: [1×446 double]
lat_u_west: [1×446 double]
lon_u_east: [1×446 double]
lat_u_east: [1×446 double]
lon_u_south: [895×1 double]
lat_u_south: [895×1 double]
lon_u_north: [895×1 double]
lat_u_north: [895×1 double]
lon_v_west: [1×445 double]
lat_v_west: [1×445 double]
lon_v_east: [1×445 double]
lat_v_east: [1×445 double]
lon_v_south: [896×1 double]
lat_v_south: [896×1 double]
lon_v_north: [896×1 double]
lat_v_north: [896×1 double]
mask_rho: [896×446 double]
mask_psi: [895×445 double]
mask_u: [895×446 double]
mask_v: [896×445 double]
angle: [896×446 double]
pm: [896×446 double]
pn: [896×446 double]
dndx: [896×446 double]
dmde: [896×446 double]
h: [896×446 double]
f: [896×446 double]
But when I try to view the grid in matlab it kind of distorts and doesn't look like the grid I wanted to make . Infact, all coastline, boundaries, mesh disappears. WHat might be the issue here ? I am unable to figure it out.

Any help in any kind is deeply appreciated.

Kind regards
-Neel
Attachments
phillipines_grd_1.nc
coarse grid nc file
(6.85 MiB) Downloaded 330 times
phillipines_grd_1_c.nc
fine grid created using coarse2fine.m from the coarse grid
(18.66 KiB) Downloaded 313 times
coarse2fine.m
(20.86 KiB) Downloaded 333 times
coarse mesh
coarse mesh
fine mesh
fine mesh

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Problem faced during online nesting for ROMS using self created grid

#3 Unread post by wilkin »

You have ...

Code: Select all

>> Imin = 123;
>> Imax = 125;
>> Jmin = 9;
>> Jmax = 12;
Those are i,j indices, not longitude and latitude. You asked for a 2 x 3 (!) subset of your parent grid and that's exactly what you got.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#4 Unread post by neelbasak08 »

Thanks Mr. Wilkin !

What I intended to do is to refine my mesh in the region of [longitude left = 123; longitude right = 125; latitude lower = 9; latitude upper = 12] which is portion of my coarser grid having domain [longitude left = 115; longitude right = 129; latitude lower = 3.9; latitude upper = 19].

If I want to refine my mesh in the intended domain then , how should I enter my Imin, Imax, Jmin and Jmax values given that I have only latitude and longitude values in order to use coarse2fine.m script. Is there a method of conversion from lat, lon values to I,J values ?
I was also unable to understand what you meant by the line " You asked for a 2 x 3 (!) subset of your parent grid and that's exactly what you got."

Kind regards
-Neel

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Problem faced during online nesting for ROMS using self created grid

#5 Unread post by wilkin »

The help on coarse2fine explains:

Code: Select all

%    Imin       Coarse grid lower-left  I-coordinate (PSI-point)
%    Imax       Coarse grid upper-right I-coordinate (PSI-point)
%    Jmin       Coarse grid lower-left  J-coordinate (PSI-point)
%    Jmax       Coarse grid upper-right J-coordinate (PSI-point)
In your parent grid file you have variables ...

Code: Select all

lon_psi: [895×445 double]
lat_psi: [895×445 double]
so you need to find the Imin, Jmin etc. indices into the 895 x 445 lon_psi and lat_psi arrays that correspond to the limits you want of 127.0 E to 129.0 E longitude and 9.0 N and 12.0 N latitude.

i.e find lon_psi(Imin,Jmin) = 127.0, etc.

So it wasn't 2 x 3 you refined, but 3 x 4 (Imin = 123 to Imax = 125 is 3 points by 9 to 12 is 4 points) which you refined by a factor of 3 so you got a nested grid of 9 x 12.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#6 Unread post by neelbasak08 »

Thanks Mr. Wilkin,

My parent grid i.e. the coarse grid has the following array structure when I try to view it in MATLAB using ncdisp command :
lon_psi
Size: 299x149
Dimensions: xi_psi,eta_psi
Datatype: double
Attributes:
long_names = 'longitude of PSI-points'
units = 'degree_east'
lat_psi
Size: 299x149
Dimensions: xi_psi,eta_psi
Datatype: double
Attributes:
long_names = 'latitude of PSI-points'
units = 'degree_north

..........etc'
As you mentioned to use the find command which I did, I was shown an error:

Code: Select all

lon_psi=ncread(file,'lon_psi');
         find lon_psi(Imin,Jmin) = 123.027389915433
Error using find
Second argument must be a positive scalar integer. 
And got similar error for other values as well.

I checked what was contained in the variable lon_psi and found that it does contain the longitude value 123.027389915433 in it. Then what might be the reason behind this error ? Maybe my grid has spherical coordinates instead or cartesian ? Or what am I doing wrong ?

Kind regards
-Neel
Attachments
phillipines_grd_1.nc
parent coarse grid
(6.85 MiB) Downloaded 326 times

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#7 Unread post by neelbasak08 »

Hello!

While trying to execute my ROMS model which has a nested grid in it, I get the following error:
sbasak08@DESKTOP-UOIVLQT:~/roms/Projects/philippines$ ./romsG <External/roms_philippines.in
--------------------------------------------------------------------------------
Model Input Parameters: ROMS/TOMS version 3.9
Tuesday - June 1, 2021 - 10:36:31 AM
--------------------------------------------------------------------------------

LOAD_LBC - incorrect continuation symbol in line:
Clo Clo Clo Clo \ ! salinity,Grid 1
number of nested grid values exceeded.
Found Error: 02 Line: 3407 Source: ROMS/Utility/read_phypar.F
Found Error: 02 Line: 191 Source: ROMS/Utility/inp_par.F
Found Error: 02 Line: 115 Source: ROMS/Drivers/nl_ocean.h, ROMS_initialize

Elapsed wall CPU time for each process (seconds):


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dynamic and Automatic memory (MB) usage for Grid 01: 298x148x15 tiling: 1x1

tile Dynamic Automatic USAGE

0 1.80 11.52 13.32

SUM 1.80 11.52 13.32

Dynamic and Automatic memory (MB) usage for Grid 02: 298x148x15 tiling: 1x1

tile Dynamic Automatic USAGE

0 0.00 11.52 11.52

SUM 0.00 11.52 11.52

TOTAL 1.80 23.04 24.84

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

ROMS/TOMS - Output NetCDF summary for Grid 01:
close_io.f90:151: runtime error: signed integer overflow: -4702111234474983746 * -4702111234474983746 cannot be represented in type 'integer(kind=8)'
close_io.f90:151: runtime error: signed integer overflow: -4815586015397456958 * -4702111234474983746 cannot be represented in type 'integer(kind=8)'
close_io.f90:151: runtime error: load of misaligned address 0xb44df19f5718e4ba for type 'integer(kind=4)', which requires 4 byte alignment
0xb44df19f5718e4ba: note: pointer points here
<memory cannot be printed>

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0 0x7f3dff060d01 in ???
#1 0x7f3dff05fed5 in ???
#2 0x7f3dfe39620f in ???
#3 0x7f3e05c79709 in close_out_
at /home/sbasak08/roms/Projects/philippines/Build_romsG/close_io.f90:151
#4 0x7f3e03bc4d4b in __ocean_control_mod_MOD_roms_finalize
at /home/sbasak08/roms/Projects/philippines/Build_romsG/ocean_control.f90:265
#5 0x7f3e03bc2391 in ocean
at /home/sbasak08/roms/Projects/philippines/Build_romsG/master.f90:93
#6 0x7f3e03bc24db in main
at /home/sbasak08/roms/Projects/philippines/Build_romsG/master.f90:50
Segmentation fault (core dumped)
sbasak08@DESKTOP-UOIVLQT:~/roms/Projects/philippines$
I am not sure what might be causing this "LOAD_LBC - incorrect continuation symbol in line: Clo Clo Clo Clo \ ! salinity, Grid number of nested grid values exceeded" error. I am using 1 child grid with 1 parent grid. According to https://www.myroms.org/wiki/Lake_Jersey ... Example_AB , where they've used 1 nested grid with a parent they too have used:
Ngrids = 2
NestLayers = 2
GridsInLayer = 1 1
LBC(isFsur) == Clo Clo Clo Clo \ ! free-surface, Grid 1
Nes Nes Nes Nes ! free-surface, Grid 2

LBC(isUbar) == Clo Clo Clo Clo \ ! 2D U-momentum, Grid 1
Nes Nes Nes Nes ! 2D U-momentum, Grid 2

LBC(isVbar) == Clo Clo Clo Clo \ ! 2D V-momentum, Grid 1
Nes Nes Nes Nes ! 2D V-momentum, Grid 2

LBC(isUvel) == Clo Clo Clo Clo \ ! 3D U-momentum, Grid 1
Nes Nes Nes Nes ! 3D U-momentum, Grid 2

LBC(isVvel) == Clo Clo Clo Clo \ ! 3D V-momentum, Grid 1
Nes Nes Nes Nes ! 3D V-momentum, Grid 2

LBC(isMtke) == Clo Clo Clo Clo \ ! mixing TKE, Grid 1
Nes Nes Nes Nes ! mixing TKE, Grid 2

LBC(isTvar) == Clo Clo Clo Clo \ ! temperature, Grid 1
Clo Clo Clo Clo \ ! salinity, Grid 1
Nes Nes Nes Nes \ ! temperature, Grid 2
Even I am using the same script structure as shown above.
part of my roms_philippines.in file
part of my roms_philippines.in file
Is that because of the grid file I am using? Or the nested one/contact one? I can see that the h min and max is changing to NaN, is that a possible reason for this error? I created my child grid using Matlab script of coarse2fine.m from the ROMS Matlab repository and I got the file
philippines_child_ceb.nc
child grid
(2.15 MiB) Downloaded 318 times
with an output in the command window like this:
>> Imin = 153;
>> Imax = 202;
>> Jmin = 43;
>> Jmax = 74;
>> C = coarse2fine ('philippines_parent.nc', 'philippines_child_ceb.nc', 3, Imin, Imax, Jmin, Jmax);

Interpolating from coarse to fine ...

Computing grid spacing: great circle distances

Number of points: Coarse = 300 x 150, fine = 149 x 95

Requested global attribute "history" not found in: philippines_child_ceb.nc
Writing finer grid variables into: philippines_child_ceb.nc

Wrote f Min= 2.41572e-05 Max= 3.04438e-05
Wrote h Min= NaN Max= NaN
Wrote pm Min= 5.29309e-04 Max= 5.29309e-04
Wrote pn Min= 3.02453e-04 Max= 3.04994e-04
Wrote dmde Min=-2.38549e-06 Max= 2.38549e-04
If the error's due to the build file as the read_phypar.f is present in the build_romsG folder, should I be building it again to solve the issue or the cpps defs are incorrectly written in my header file? My header file looks like this:
/*
** svn $Id: lake_jersey.h 995 2020-01-10 04:01:28Z arango $
*******************************************************************************
** Copyright (c) 2002-2020 The ROMS/TOMS Group **
** Licensed under a MIT/X style license **
** See License_ROMS.txt **
*******************************************************************************
**
** Options for Lake Jersey forced with wind.
**
** Application flag: Philippines
**
** Input scripts: roms_philippines.in
**
*/

#define UV_ADV
#define UV_COR
#define UV_QDRAG
#define UV_VIS4
#define MIX_S_UV
#define DJ_GRADPS
#define SPLINES_VDIFF
#define SPLINES_VVISC
#define BULK_FLUXES
#define SOLVE3D
#define BODYFORCE
#define NESTING
#define ONE_WAY
#define ANA_SMFLUX
#define ANA_STFLUX
#define ANA_INITIAL
#define ANA_SSFLUX
#define ANA_DRAG
#define ANA_BSFLUX
#define ANA_BTFLUX
#define MASKING
What might be the reason behind this error and is there any way to resolve it?

Any help is deeply appreciated by me.

Kind regards
-Neel
Attachments
philippines_parent.nc
parent grid
(6.85 MiB) Downloaded 304 times
philippines_contact.nc
contact file
(2.36 MiB) Downloaded 327 times

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#8 Unread post by neelbasak08 »

In response to my previous post where I had said I had this "LOAD_LBC" error has been resolved. Although I've met with a new error in this case. this time it says:
ROMS I/O variables Metadata File: External/varinfo.dat

READ_CONTACT - inconsistent grid order, Lm = 298 147
in input file:
Found Error: 05 Line: 235 Source: ROMS/Utility/inp_par.F
Found Error: 05 Line: 115 Source: ROMS/Drivers/nl_ocean.h, ROMS_initialize

Elapsed wall CPU time for each process (seconds):


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dynamic and Automatic memory (MB) usage for Grid 01: 298x148x15 tiling: 1x1
So I tried to check my contact file because the error makes it very clear that something's wrong there but when I view it in MATLAB using the ncread command to see the variable Lm, I see that its Lm is a 2x1 matrix with values 298 147. I am not understanding why it's showing an inconsistent grid order error? Because my child grid is of resolution 149x95 and parent grid is 300 x 150, sp by that my Lm value should be 298 and 147 only in the contact file.

Am I naming the grids in incorrect order in my .in file? Because changing it didn't work. Or is it something else?
Screenshot 2021-06-01 174855.jpg
Screenshot 2021-06-01 174855.jpg (120.43 KiB) Viewed 24315 times
Kind regards
-Neel
Attachments
philippines_contact_new.nc
(2.36 MiB) Downloaded 301 times
New Text Document.txt
error log
(17.76 KiB) Downloaded 321 times

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Problem faced during online nesting for ROMS using self created grid

#9 Unread post by wilkin »

You log file is reporting exactly the same inputs for the parent and child grids:
Resolution, Grid 01: 298x148x15, Parallel Threads: 1, Tiling: 1x1

Physical Parameters, Grid: 01
=============================

60000 ntimes Number of timesteps for 3-D equations.
10.000 dt Timestep size (s) for 3-D equations.


and ...
Resolution, Grid 02: 298x148x15, Parallel Threads: 1, Tiling: 1x1


Physical Parameters, Grid: 02
=============================

60000 ntimes Number of timesteps for 3-D equations.
10.000 dt Timestep size (s) for 3-D equations.
While it is possible you've built a child grid with the same dimension, you certainly shouldn't have the same number of timesteps and dt for both grids.

I don't think you've understood how to configure roms.in for nesting.

If your grid refinement factor is, say, 3, then we would expect to see


Physical Parameters, Grid: 02
=============================

180000 ntimes Number of timesteps for 3-D equations.
3.333333 dt Timestep size (s) for 3-D equations.
Having an irrational number for dt in the child such that dt(child) times refine factor is not EXACTLY equal to dt (parent) is not recommended. Make the parent dt an integer multiple of the child dt.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#10 Unread post by neelbasak08 »

Thanks Mr. Wilkin !

Now, I am facing a different issue altogether. The error looks something like this:
(Grid = 02, Min = 0.00000000E+00 Max = 0.00000000E+00)
ANA_INITIAL - potential temperature: temp
(Grid = 02, Min = 1.00000000E+01 Max = 1.00000000E+01)

NETCDF_CHECK_DIM - inconsistent size of dimension: xi_rho 149 300
in file: philippines_child_ceb701Jan2020_v5.nc
Found Error: 02 Line: 186 Source: ROMS/Utility/inquiry.F
Found Error: 02 Line: 133 Source: ROMS/Utility/get_2dfld.F
Found Error: 02 Line: 158 Source: ROMS/Nonlinear/get_data.F
Found Error: 02 Line: 659 Source: ROMS/Nonlinear/initial.F
Found Error: 02 Line: 191 Source: ROMS/Drivers/nl_ocean.h, ROMS_initialize

Elapsed wall CPU time for each process (seconds):

Thread # 0 CPU: 4.359
Total: 4.359

Nonlinear model elapsed CPU time profile, Grid: 01

Allocation and array initialization .............. 3.125 (71.6846 %)
2D/3D coupling, vertical metrics ................. 0.250 ( 5.7348 %)
Omega vertical velocity .......................... 0.078 ( 1.7921 %)
Equation of state for seawater ................... 0.141 ( 3.2258 %)
Nesting algorithm ................................ 0.016 ( 0.3584 %)
Total: 3.609 82.7957 %

Nonlinear model elapsed CPU time profile, Grid: 02

Allocation and array initialization .............. 3.125 (71.6846 %)
2D/3D coupling, vertical metrics ................. 0.062 ( 1.4337 %)
Omega vertical velocity .......................... 0.016 ( 0.3584 %)
Equation of state for seawater ................... 0.062 ( 1.4337 %)
Total: 3.266 74.9104 %

Unique kernel(s) regions profiled ................ 6.875 157.7061 %
Residual, non-profiled code ...................... -2.516 -57.7061 %


All percentages are with respect to total time = 4.359


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dynamic and Automatic memory (MB) usage for Grid 01: 298x148x15 tiling: 1x1

tile Dynamic Automatic USAGE

0 194.67 36.84 231.51

SUM 194.67 36.84 231.51

Dynamic and Automatic memory (MB) usage for Grid 02: 147x93x15 tiling: 1x1

tile Dynamic Automatic USAGE

0 70.83 12.03 82.86

SUM 70.83 12.03 82.86

TOTAL 265.49 48.87 314.36

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

ROMS/TOMS - Output NetCDF summary for Grid 01:

ROMS/TOMS - Output NetCDF summary for Grid 02:

Analytical header files used:

ROMS/Functionals/ana_initial.h
Found Error: 02 Line: 361 Source: ROMS/Utility/close_io.F, close_out

ROMS/TOMS - Input error ............. exit_flag: 2


ERROR: Abnormal termination: NetCDF INPUT.
REASON: No error
ERROR STOP

Error termination. Backtrace:
#0 0x7f9f99e90d01 in ???
#1 0x7f9f99e91849 in ???
#2 0x7f9f99e92f77 in ???
#3 0x7f9f9e9fb482 in ocean
at /home/sbasak08/roms/Projects/philippines/Build_romsG/master.f90:101
#4 0x7f9f9e9fb4db in main
at /home/sbasak08/roms/Projects/philippines/Build_romsG/master.f90:50
I can see that it's due to the tpxo9 forcing file that I used. I actually have 2 tpx09 forcing files, one corresponding to my parent grid 300 x 150 and one corresponding to my nested child grid 149 x 93. But I have two different TPXO9 files for one for each type of grid, then why is ROMS showing this error?
Screenshot 2021-06-01 234936.jpg
Do I need to have a forcing file that will have both my parent grid resolution and child grid resolution, but is that even a possible thing? Or is there some other reason behind it ?

Kind regards
-Neel
Attachments
error_3.txt
error log file
(43.5 KiB) Downloaded 338 times

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Problem faced during online nesting for ROMS using self created grid

#11 Unread post by wilkin »

You can't have a tidal boundary condition file for the nested grid. It gets its boundary conditions from the parent.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

User avatar
neelbasak08
Posts: 99
Joined: Wed Dec 09, 2020 3:58 pm
Location: Thapar Institute of Engineering and Technology, Patiala, PN, India

Re: Problem faced during online nesting for ROMS using self created grid

#12 Unread post by neelbasak08 »

wilkin wrote: Tue Jun 01, 2021 6:30 pm You can't have a tidal boundary condition file for the nested grid. It gets its boundary conditions from the parent.
Thanks Mr Wilkin!

As you said that the nested grid should take its tidal forcing from the parent grid, I tried that now by removing the child grid's forcing file in both TIDENAME and FRCNAME variable and just kept the parent grid's forcing file there. But even now I am getting the same sort of error where it says it inconsistent xi_rho dimension 300 149
(Grid = 02, Min = 0.00000000E+00 Max = 0.00000000E+00)
ANA_INITIAL - potential temperature: temp
(Grid = 02, Min = 1.00000000E+01 Max = 1.00000000E+01)

NETCDF_CHECK_DIM - inconsistent size of dimension: xi_rho 300 149
in file: frc_TPXO9_philippines_grd_1_v101Jan2020_v4a.nc
Found Error: 02 Line: 186 Source: ROMS/Utility/inquiry.F
Found Error: 02 Line: 133 Source: ROMS/Utility/get_2dfld.F
Found Error: 02 Line: 158 Source: ROMS/Nonlinear/get_data.F
Found Error: 02 Line: 659 Source: ROMS/Nonlinear/initial.F
Found Error: 02 Line: 191 Source: ROMS/Drivers/nl_ocean.h, ROMS_initialize

Elapsed wall CPU time for each process (seconds):

Thread # 0 CPU: 4.359
Total: 4.359

Nonlinear model elapsed CPU time profile, Grid: 01

Allocation and array initialization .............. 3.125 (71.6846 %)
2D/3D coupling, vertical metrics ................. 0.250 ( 5.7348 %)
Omega vertical velocity .......................... 0.078 ( 1.7921 %)
Equation of state for seawater ................... 0.141 ( 3.2258 %)
Nesting algorithm ................................ 0.016 ( 0.3584 %)
Total: 3.609 82.7957 %

Nonlinear model elapsed CPU time profile, Grid: 02

Allocation and array initialization .............. 3.125 (71.6846 %)
2D/3D coupling, vertical metrics ................. 0.062 ( 1.4337 %)
Omega vertical velocity .......................... 0.016 ( 0.3584 %)
Equation of state for seawater ................... 0.062 ( 1.4337 %)
Total: 3.266 74.9104 %

Unique kernel(s) regions profiled ................ 6.875 157.7061 %
Residual, non-profiled code ...................... -2.516 -57.7061 %


All percentages are with respect to total time = 4.359
What might be the reason that ROMS is asking the xi_rho coordinate of my nested grid from the parent tidal forcing file?

Kind regards
-Neel

User avatar
wilkin
Posts: 922
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: Problem faced during online nesting for ROMS using self created grid

#13 Unread post by wilkin »

Are you reading the instructions - "GLOSSARY" - at the end of the roms.in template?

You see there that the tides go in one file - and apply only to the parent grid:
! TIDENAME Tidal constituents period, phase, elevation, and current data.
! This data is needed when SSH_TIDES, UV_TIDES, or both are
! activated to force tides at the open boundaries. Currently,
! in nested applications, the tidal forcing is used in the
! coarser/larger grid (ng=1). If AVERAGES_DETIDE is activated,
! several least-squares time-accumulated harmonic variables
! are written into this NetCDF file to facilitate restart for
! during long fitting simulations.
The surface forcing files are separate. Tides do not go in this list:
! NFFILES Number of unique forcing files per nested grid.
!
! FRCNAME Input forcing fields filename per nested grid.
!
! The USER has the option to enter several filenames for forcing fields
! and or split input data time records for each nested grid. For example,
! the USER may have different files for wind products, heat fluxes, etc.
! The model will scan the file list and will read the needed data from
! the first file in the list containing the forcing field. Therefore,
! the order of the filenames is essential. It is also possible to split
! input data time records into several NetCDF files.
!
! Use a single line per entry with a continuation (\) or vertical bar (|)
! symbol after each entry, except the last one:
!
! NFFILES == 6 ! number of unique forcing files
!
! FRCNAME == my_lwrad_year1.nc | ! net longwave radiation flux
! my_lwrad_year2.nc \
! my_swrad_year1.nc | ! solar shortwave radiation flux
! my_swrad_year2.nc \
! my_winds_year1.nc | ! surface winds
! my_winds_year2.nc \
! my_Pair_year1.nc | ! surface air pressure
! my_Pair_year2.nc \
! my_Qair_year1.nc | ! surface air relative humidity
! my_Qair_year2.nc \
! my_Tair_year1.nc | ! surface air temperature
! my_Tair_year2.nc
If the dimension of the fricing data file does not match the grid this triggers automatic regridding. This is the easiest approach because then the files will also be regridded for the nests. You need add nothing more. But if you have regridded the forcing data yourself to your parent grid, you must also regrid to the child grid and add those file in the FRCNAME list.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Post Reply