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
1=== modified file 'ocean_forcing/load_netcdf.F90'
2--- ocean_forcing/load_netcdf.F90 2010-12-17 16:50:11 +0000
3+++ ocean_forcing/load_netcdf.F90 2011-09-07 23:53:25 +0000
4@@ -18,7 +18,7 @@
5
6 type(scalar_field), intent(inout) :: field
7 character(len=*), intent(in) :: path
8- type(vector_field), intent(in) :: position
9+ type(vector_field), intent(inout) :: position
10 character(len=OPTION_PATH_LEN) :: field_name, format
11 real :: gravity_magnitude
12 integer :: stat
13@@ -47,18 +47,24 @@
14
15 type(scalar_field), intent(inout) :: field
16 character(len=*), intent(in) :: path
17- type(vector_field), intent(in) :: position
18+ type(vector_field), intent(inout) :: position
19 real, dimension(position%dim,node_count(position)) :: temp_pos
20 character(len=FIELD_NAME_LEN) :: filename
21 real, dimension(:), allocatable :: X, Y, Z
22
23 integer :: NNodes, i
24
25+ type(scalar_field) :: tempfield
26+ integer :: stat
27+ type(mesh_type), pointer :: input_mesh
28+
29+ call allocate(tempfield, position%mesh, name="TemporaryScalarField")
30+
31+ call zero(tempfield)
32+
33 call get_option(trim(path)//"/from_netcdf/file_name", filename)
34
35- assert(node_count(field)==node_count(position))
36-
37- NNodes=node_count(field)
38+ NNodes=node_count(tempfield)
39
40 allocate(X(NNodes), Y(NNodes), Z(NNodes))
41
42@@ -91,9 +97,12 @@
43 call get_field_values(trim(filename)//char(0), X, Y, Z, NNodes)
44
45 do i=1,NNodes
46- call set(field,i,Z(i))
47+ call set(tempfield,i,Z(i))
48 enddo
49
50+ call remap_field(tempfield, field, stat)
51+
52+ call deallocate(tempfield)
53 deallocate(X, Y, Z)
54
55 end subroutine
56
57=== modified file 'preprocessor/Initialise_Fields.F90'
58--- preprocessor/Initialise_Fields.F90 2011-03-25 11:36:54 +0000
59+++ preprocessor/Initialise_Fields.F90 2011-09-07 23:53:25 +0000
60@@ -71,7 +71,7 @@
61 !!< setting a boundary condition surface_field, a.o.
62 type(scalar_field), intent(inout) :: field
63 character(len=*), intent(in) :: path
64- type(vector_field), intent(in):: position
65+ type(vector_field), intent(inout):: position
66 !! if present use this time level, instead of that in the options tree
67 real, optional, intent(in):: time
68 character(len=*), intent(in), optional :: phase_path
69@@ -536,7 +536,7 @@
70 !! path should point to either /"path to field"/prescribed/value
71 !! or /"path to field"/prognostic/initial_condition
72 character(len=*), intent(in) :: path
73- type(vector_field), intent(in):: position
74+ type(vector_field), intent(inout):: position
75 real, intent(in), optional :: time
76 character(len=*), intent(in), optional :: phase_path
77