Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the new initialisation options to the Regent version #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ task main()
fill(setup_data.{jpiglo, jpjglo, nit000, nitend, record, jphgr_msh}, 0)
fill(setup_data.{dx, dy, dep_const, rdt, cbfr, visc}, 0)
read_namelist(setup_data)
if(setup_data.jphgr_msh < 0 or setup_data.jphgr_msh > 3) then
c.printf("Wrong grid definition type (jphgr_msh must be 0, 1, 2, or 3), check your namelist file")
return
end

var grid_space = ispace(int2d, {x = setup_data[0].jpiglo + 3,
y = setup_data[0].jpjglo + 3},
Expand All @@ -117,7 +121,7 @@ task main()


--Initialise model
model_init(grid, loop_conditions_data)
model_init(grid, loop_conditions_data, setup_data.jphgr_msh)

--Create the sea surface field.
var sea_surface = region(grid_space, uvt_time_field)
Expand Down
25 changes: 17 additions & 8 deletions benchmarks/nemo/nemolite2d/manual_versions/regent/model_init.rg
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ do

end

task init_east( tmask_east : region(ispace(int2d), grid_fields)) where
task init_east( tmask_east : region(ispace(int2d), grid_fields), boundary_value : int1d) where
writes(tmask_east.tmask)
do

for point in tmask_east do
tmask_east[point].tmask = SOLID_BOUNDARY
tmask_east[point].tmask = boundary_value
end
end

Expand All @@ -169,10 +169,10 @@ do
tmask_north[point].tmask = SOLID_BOUNDARY
end
end
task init_south( tmask_south : region(ispace(int2d), grid_fields)) where writes(tmask_south.tmask) do
task init_south( tmask_south : region(ispace(int2d), grid_fields), boundary_value : int1d) where writes(tmask_south.tmask) do

for point in tmask_south do
tmask_south[point].tmask = TIDAL_MASK
tmask_south[point].tmask = boundary_value
end
end

Expand Down Expand Up @@ -342,7 +342,8 @@ end

--This initialises the fields in the model grid.
task model_init( grid : region(ispace(int2d), grid_fields),
loop_conditions_data : region(ispace(int2d), loop_conditions)) where
loop_conditions_data : region(ispace(int2d), loop_conditions),
jphgr_msh : int32) where
writes(grid.{tmask, dx_t, dx_u, dx_v, dy_t, dy_t, dy_v, gphi_u, gphi_v, xt, yt, area_t, area_u, area_v}),
reads(grid.{tmask, dx_t, dx_u, dx_v, dy_t, dy_t, dy_u, dy_v, gphi_u, gphi_v, xt, yt, area_t ,area_u, area_v}),
writes( loop_conditions_data.{compute_vel_ufield, compute_vel_vfield, update_sea_surface_t, update_uvel_boundary,
Expand All @@ -359,12 +360,20 @@ do
init_centre_launcher(centre_region[int2d({0,0})])

init_west(west_region[int2d({0,0})])

init_east(east_region[int2d({0,0})])

if( jphgr_msh == 2 or jphgr_msh == 3) then
init_east(east_region[int2d({0,0})], TIDAL_MASK)
else
init_east(east_region[int2d({0,0})], SOLID_BOUNDARY)
end

init_north(north_region[int2d({0,0})])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I changed the order of boundary order inits to west north east south. This affects the value of the NE corner, so it may be better to change it here as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm if the value of the NE corner has changed I need to do a bit more work than reordering, as the east_region and north_region declarations are defined to be non-overlapping, so ordering is irrelevant (and they can execute in parallel). I'll have another look in a bit and check this matches still.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only the value of the T-mask in the boundary region, not inside the simulation domain (in case that helps you).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not - it shouldn't be a big change either way, the simulation domain is all initialised by init_centre (or the launcher since that is also done in parallel).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten about this - I'll try to look at this soon and fix it so this can be merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having just reviewed Sergi's new PR, I see this one is still open. Do you (eventually) want to proceed with it @LonelyCat124 ?

Copy link
Collaborator Author

@LonelyCat124 LonelyCat124 Sep 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have forgotten what I needed to do - I think it would be good to do in principle but I don't remember what options I needed to add.


init_south(south_region[int2d({0,0})])
if( jphgr_msh == 1 or jphgr_msh == 3) then
init_south(south_region[int2d({0,0})], TIDAL_MASK)
else
init_south(south_region[int2d({0,0})], SOLID_BOUNDARY)
end


loop_bound_compute_vel_ufield(grid, loop_conditions_data)
Expand Down