Merge lp:~r-nelson/fluidity/p2_netcdf_init into lp:fluidity

Proposed by Rhodri Nelson
Status: Work in progress
Proposed branch: lp:~r-nelson/fluidity/p2_netcdf_init
Merge into: lp:fluidity
Diff against target: 76 lines (+17/-8)
2 files modified
ocean_forcing/load_netcdf.F90 (+15/-6)
preprocessor/Initialise_Fields.F90 (+2/-2)
To merge this branch: bzr merge lp:~r-nelson/fluidity/p2_netcdf_init
Reviewer Review Type Date Requested Status
Adam Candy Needs Information
Review via email: mp+71574@code.launchpad.net

Description of the change

An update so that scalar fields with p > 1 can be initialised from a NetCDF file.

To post a comment you must log in.
Revision history for this message
Adam Candy (asc) wrote :

Is this change already in the trunk too? If so, which revision does this merge request relate to?

review: Needs Information
Revision history for this message
Rhodri Nelson (r-nelson) wrote :

See the comment under the lp:~r-nelson/fluidity/parallel_sigma merge request. Will try and fix this later.

lp:~r-nelson/fluidity/p2_netcdf_init updated
3565. By Rhodri Nelson

Updating local changes.

Revision history for this message
Rhodri Nelson (r-nelson) wrote :

The correct changes seem to have been correctly upload now and so it should now be ready for review.

Unmerged revisions

3565. By Rhodri Nelson

Updating local changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ocean_forcing/load_netcdf.F90'
--- ocean_forcing/load_netcdf.F90 2010-12-17 16:50:11 +0000
+++ ocean_forcing/load_netcdf.F90 2011-09-07 23:53:25 +0000
@@ -18,7 +18,7 @@
1818
19 type(scalar_field), intent(inout) :: field19 type(scalar_field), intent(inout) :: field
20 character(len=*), intent(in) :: path20 character(len=*), intent(in) :: path
21 type(vector_field), intent(in) :: position21 type(vector_field), intent(inout) :: position
22 character(len=OPTION_PATH_LEN) :: field_name, format22 character(len=OPTION_PATH_LEN) :: field_name, format
23 real :: gravity_magnitude23 real :: gravity_magnitude
24 integer :: stat24 integer :: stat
@@ -47,18 +47,24 @@
4747
48 type(scalar_field), intent(inout) :: field48 type(scalar_field), intent(inout) :: field
49 character(len=*), intent(in) :: path49 character(len=*), intent(in) :: path
50 type(vector_field), intent(in) :: position50 type(vector_field), intent(inout) :: position
51 real, dimension(position%dim,node_count(position)) :: temp_pos51 real, dimension(position%dim,node_count(position)) :: temp_pos
52 character(len=FIELD_NAME_LEN) :: filename52 character(len=FIELD_NAME_LEN) :: filename
53 real, dimension(:), allocatable :: X, Y, Z53 real, dimension(:), allocatable :: X, Y, Z
54 54
55 integer :: NNodes, i55 integer :: NNodes, i
5656
57 type(scalar_field) :: tempfield
58 integer :: stat
59 type(mesh_type), pointer :: input_mesh
60
61 call allocate(tempfield, position%mesh, name="TemporaryScalarField")
62
63 call zero(tempfield)
64
57 call get_option(trim(path)//"/from_netcdf/file_name", filename)65 call get_option(trim(path)//"/from_netcdf/file_name", filename)
5866
59 assert(node_count(field)==node_count(position))67 NNodes=node_count(tempfield)
60
61 NNodes=node_count(field)
6268
63 allocate(X(NNodes), Y(NNodes), Z(NNodes))69 allocate(X(NNodes), Y(NNodes), Z(NNodes))
6470
@@ -91,9 +97,12 @@
91 call get_field_values(trim(filename)//char(0), X, Y, Z, NNodes)97 call get_field_values(trim(filename)//char(0), X, Y, Z, NNodes)
9298
93 do i=1,NNodes99 do i=1,NNodes
94 call set(field,i,Z(i))100 call set(tempfield,i,Z(i))
95 enddo101 enddo
96102
103 call remap_field(tempfield, field, stat)
104
105 call deallocate(tempfield)
97 deallocate(X, Y, Z)106 deallocate(X, Y, Z)
98107
99end subroutine108end subroutine
100109
=== modified file 'preprocessor/Initialise_Fields.F90'
--- preprocessor/Initialise_Fields.F90 2011-03-25 11:36:54 +0000
+++ preprocessor/Initialise_Fields.F90 2011-09-07 23:53:25 +0000
@@ -71,7 +71,7 @@
71 !!< setting a boundary condition surface_field, a.o.71 !!< setting a boundary condition surface_field, a.o.
72 type(scalar_field), intent(inout) :: field72 type(scalar_field), intent(inout) :: field
73 character(len=*), intent(in) :: path73 character(len=*), intent(in) :: path
74 type(vector_field), intent(in):: position74 type(vector_field), intent(inout):: position
75 !! if present use this time level, instead of that in the options tree75 !! if present use this time level, instead of that in the options tree
76 real, optional, intent(in):: time76 real, optional, intent(in):: time
77 character(len=*), intent(in), optional :: phase_path77 character(len=*), intent(in), optional :: phase_path
@@ -536,7 +536,7 @@
536 !! path should point to either /"path to field"/prescribed/value 536 !! path should point to either /"path to field"/prescribed/value
537 !! or /"path to field"/prognostic/initial_condition537 !! or /"path to field"/prognostic/initial_condition
538 character(len=*), intent(in) :: path538 character(len=*), intent(in) :: path
539 type(vector_field), intent(in):: position539 type(vector_field), intent(inout):: position
540 real, intent(in), optional :: time540 real, intent(in), optional :: time
541 character(len=*), intent(in), optional :: phase_path541 character(len=*), intent(in), optional :: phase_path
542542