Dear all,
I want to set value for boundaries. As my understanding, boundary direction should be like this(shown in the attached figure): The first row in the table (matrix) represents the north , the end row represents the south; the first column represents the west and the end column represents the east. Is it right?
Another confusion is that: when I set value for western boundary, the given data should be from (i=1,j=1) to (i=1,j=Mm); Similarity, the data for the southern boundary should be from (i=1,j=1) to (i=Lm,j=1).Is it right? If so, when I set value for western boundary, data for the squeezed matrix eta_rho (time, s_rho, eta_rho) should be from (i=1,j=1) to (i=1,j=Mm),right?
Can someone answer my questions? Thank you very much.
My confusion about boundary sets
-
- Posts: 11
- Joined: Mon Aug 19, 2013 4:37 pm
- Location: Zhejiang University
My confusion about boundary sets
- Attachments
-
- figure.png (22 KiB) Viewed 4496 times
-
- Posts: 7
- Joined: Tue Jun 28, 2016 7:00 pm
Re: My confusion about boundary sets
Yes, this is correct, if your parent data array is arranged so that (1,1) is in the southwest corner. Here is a look at how I clip my arrays in matlab:
2-D
zeta_east = S.zeta(end,:);
zeta_west = S.zeta(1, : );
zeta_north = S.zeta(:,end);
zeta_south = S.zeta(:, 1);
3-D
u_east = S.u(end,:,:);
u_west = S.u(1, :,:);
u_north = S.u(:,end,:);
u_south = S.u(:, 1,:);
That produces the correct sized arrays (after squeezing the singleton dimensions.) Good luck!
2-D
zeta_east = S.zeta(end,:);
zeta_west = S.zeta(1, : );
zeta_north = S.zeta(:,end);
zeta_south = S.zeta(:, 1);
3-D
u_east = S.u(end,:,:);
u_west = S.u(1, :,:);
u_north = S.u(:,end,:);
u_south = S.u(:, 1,:);
That produces the correct sized arrays (after squeezing the singleton dimensions.) Good luck!
Re: My confusion about boundary sets
If the graphic is showing the computational domain, with rho points going from 1 to Lm, 1 to Mm, then the outer edge is the location of the boundary. U,V boundary conditions will be located on that edge while rho point boundary conditions are outside of that (i=0, i=Lm+1, etc.)
The dimensions of the rho-point boundary arrays will then be i=0, j=0 to j=Lm+1, or Lm+2, Mm+2.
The dimensions of the rho-point boundary arrays will then be i=0, j=0 to j=Lm+1, or Lm+2, Mm+2.
-
- Posts: 11
- Joined: Mon Aug 19, 2013 4:37 pm
- Location: Zhejiang University
Re: My confusion about boundary sets
noah.eckman wrote: 2-D
zeta_east = S.zeta(end,:);
zeta_west = S.zeta(1, : );
zeta_north = S.zeta(:,end);
zeta_south = S.zeta(:, 1);
Thank you very much for your quick reply.
Seems I have a misunderstanding in the direction distributions. I think all the matrix must be have directions like I showed in the former figure. But from your script in matlab, I think your direction is like this:west in the upper boundary of the matrix, east in the bottom, south in the left and north in the right boundary.
Now, there comes the question: How can I judge my direction? The followings is an example of my grid, table 1 is extracted from lon_rho, table 2 is from lat_rho.
Table 1 data extracted from lon_rho
124.43 124.43 124.43 124.43 124.43 124.43 124.43 124.43
124.41 124.41 124.41 124.41 124.41 124.41 124.41 124.41
124.39 124.39 124.39 124.39 124.39 124.39 124.39 124.39
124.38 124.38 124.38 124.38 124.38 124.38 124.38 124.38
124.36 124.36 124.36 124.36 124.36 124.36 124.36 124.36
Table 2 data extracted from lat_rho
29.35 29.36 29.37 29.39 29.40 29.41 29.42 29.44
29.35 29.36 29.37 29.39 29.40 29.41 29.42 29.44
29.35 29.36 29.37 29.39 29.40 29.41 29.42 29.44
29.35 29.36 29.37 29.39 29.40 29.41 29.42 29.44
29.35 29.36 29.37 29.39 29.40 29.41 29.42 29.44
So, where is my east boundary? where is my other boundaries? I’m stuck in this problem for a long time. Hope sincerely someone can answer my questions. Thank you very much.
-
- Posts: 11
- Joined: Mon Aug 19, 2013 4:37 pm
- Location: Zhejiang University
Re: My confusion about boundary sets
kate wrote:If the graphic is showing the computational domain, with rho points going from 1 to Lm, 1 to Mm, then the outer edge is the location of the boundary.
Thank you,Kate. When we set value for each boundary, how can we judge the boundary direction? According to the computatioal grid or the reality geographical position?
Re: My confusion about boundary sets
You had the directions right in the first slide. It's by the computational grid, not the lat,lon values.