/[lmdze]/trunk/misc/writefield.f
ViewVC logotype

Contents of /trunk/misc/writefield.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 115 - (show annotations)
Fri Sep 19 17:36:20 2014 UTC (9 years, 8 months ago) by guez
Original Path: trunk/bibio/writefield.f
File size: 2275 byte(s)
Extracted code from tau2alpha for first call into new procedure
init_tau2alpha. dxdys, dxdyu, dxdyv are now local variables if guide
computed by init_tau2alpha. This allows us to remove terrible argument
type of tau2alpha: we just give to tau2alpha the right dxdy and
rlat.

In module conf_guide_m, changed default values of tau_min_*, because
0.02 is too small for the default daystep = 240, iperiod = 5. Changed
default values of guide_[uv] to false. Moved variable ok_guide from
conf_gcm_m to conf_guide_m, ok_guide is no longer an input parameter,
it is computed from guide_*. Had then to move test on ok_guide and
day_step from conf_gcm_m to conf_guide_m. Added checks on input
nudging parameters in procedure conf_guide. Upgraded variable factt to
module conf_guide_m in order to check nudging parameters. Bug fix:
variable guide_q was not in namelist conf_guide_nml.

Removed unused variables aire_min, aire_max of MODULE guide_m.

Moved the call to conf_guide from guide to gcm. This was needed to
define ok_guide before getting into guide (since ok_guide is no longer
in conf_gcm_m). Moved test on grossismx and grossismy from tau2alpha
to guide. It is clearer now that only tau_max is used for a regular
grid, and we do not have to repeat this test in each call to
tau2alpha. In guide, we only call writefield when alpha is not a
constant.

1 module WriteField_m
2
3 use CreateNewField_m, only: CreateNewField, ncid, nbfield, MaxWriteField
4 use GetFieldIndex_m, only: GetFieldIndex
5 USE netcdf95, ONLY: nf95_put_var, nf95_sync
6
7 implicit none
8
9 integer, save:: Record(MaxWriteField)
10
11 interface WriteField
12 module procedure WriteField3d,WriteField2d,WriteField1d
13 end interface WriteField
14
15 private
16 public WriteField
17
18 contains
19
20 subroutine WriteField1d(name,Field)
21
22 character(len=*), intent(in):: name
23 real, intent(in):: Field(:)
24
25 ! Local:
26 integer index
27
28 !-------------------------------------------
29
30 Index=GetFieldIndex(name)
31
32 if (Index==-1) then
33 call CreateNewField(name, shape(field))
34 Index=nbfield
35 Record(Index) = 1
36 else
37 Record(Index)=Record(Index)+1
38 endif
39
40 call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
41 start = (/1, Record(Index)/))
42 call nf95_sync(Ncid(Index))
43
44 end subroutine WriteField1d
45
46 !****************************************************************
47
48 subroutine WriteField2d(name,Field)
49
50 character(len=*), intent(in):: name
51 real, intent(in):: Field(:, :)
52
53 ! Local:
54 integer index
55
56 !-------------------------------------------
57
58 Index=GetFieldIndex(name)
59
60 if (Index==-1) then
61 call CreateNewField(name, shape(field))
62 Index=nbfield
63 Record(Index) = 1
64 else
65 Record(Index)=Record(Index)+1
66 endif
67
68 call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
69 start = (/1, 1, Record(Index)/))
70 call nf95_sync(Ncid(Index))
71
72 end subroutine WriteField2d
73
74 !****************************************************************
75
76 subroutine WriteField3d(name,Field)
77
78 character(len=*), intent(in):: name
79 real, intent(in):: Field(:, :, :)
80
81 ! Local:
82 integer index
83
84 !-------------------------------------------
85
86 Index=GetFieldIndex(name)
87
88 if (Index==-1) then
89 call CreateNewField(name, shape(field))
90 Index=nbfield
91 Record(Index) = 1
92 else
93 Record(Index)=Record(Index)+1
94 endif
95
96 call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
97 start = (/1, 1, 1, Record(Index)/))
98 call nf95_sync(Ncid(Index))
99
100 end subroutine WriteField3d
101
102 end module WriteField_m

  ViewVC Help
Powered by ViewVC 1.1.21