source: issm/oecreview/Archive/24684-25833/ISSM-25299-25300.diff@ 27230

Last change on this file since 27230 was 25834, checked in by Mathieu Morlighem, 4 years ago

CHG: added 24684-25833

File size: 69.2 KB
RevLine 
[25834]1Index: ../trunk-jpl/src/m/solve/loadresultfromdisk.py
2===================================================================
3--- ../trunk-jpl/src/m/solve/loadresultfromdisk.py (nonexistent)
4+++ ../trunk-jpl/src/m/solve/loadresultfromdisk.py (revision 25300)
5@@ -0,0 +1,87 @@
6+import struct
7+
8+import numpy as np
9+
10+
11+def loadresultfromdisk(filename, step, name, *args): # {{{
12+ """
13+ LOADRESULTFROMDISK - load specific result of solution sequence from disk
14+ file "filename"
15+
16+ Usage:
17+ variable = loadresultsfromdisk(filename, step, name)
18+
19+ TODO:
20+ - Test this module against output of src/m/solve/loadresultsfromdisk.m
21+ """
22+ print('Got hwrwefew')
23+ exit()
24+ # Open file
25+ try:
26+ fid = open(filename, 'rb')
27+ except IOError as e:
28+ raise IOError("loadresultsfromdisk error message: could not open {} for binary reading".format(filename))
29+
30+ if len(args) == 4:
31+ # Put the pointer on the right position in the file
32+ fpos = args[0]
33+ fid.seek(fpos)
34+
35+ while True:
36+ # read field
37+ fpos = tell(fid)
38+ length = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
39+
40+ fieldname = struct.unpack('{}s'.format(length), fid.read(length))[0][:-1]
41+ fieldname = fieldname.decode() #strings are binaries when stored so need to be converted back
42+ rtime = struct.unpack('d', fid.read(struct.calcsize('d')))[0]
43+ rstep = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
44+
45+ # TODO: Check number of characters unpacked and break if need be (see
46+ # src/m/solve/loadresultfromdisk.py)
47+
48+ if (rstep == step) and (fieldname == name):
49+ # ok, go read the result really
50+ datatype = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
51+ M = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
52+ if datatype == 1:
53+ field = np.array(struct.unpack('{}d'.format(M), fid.read(M * struct.calcsize('d'))), dtype=float)
54+ elif datatype == 2:
55+ field = struct.unpack('{}s'.format(M), fid.read(M))[0][:-1]
56+ field = field.decode()
57+ elif datatype == 3:
58+ N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
59+ field = np.zeros(shape=(M, N), dtype=float)
60+ for i in range(M):
61+ field[i, :] = struct.unpack('{}d'.format(N), fid.read(N * struct.calcsize('d')))
62+ elif datatype == 4:
63+ N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
64+ field = np.zeros(shape=(M, N), dtype=int)
65+ for i in range(M):
66+ field[i, :] = struct.unpack('{}i'.format(N), fid.read(N * struct.calcsize('i')))
67+ else:
68+ raise TypeError("cannot read data of type {}".format(datatype))
69+
70+ variable = field
71+ break
72+ else:
73+ # just skim to next results
74+ datatype = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
75+ M = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
76+ if datatype == 1:
77+ fid.seek(M * 8, 1)
78+ elif datatype == 2:
79+ fid.seek(M, 1)
80+ elif datatype == 3:
81+ N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
82+ fid.seek(N * M * 8, 1)
83+ elif datatype == 4:
84+ N = struct.unpack('i', fid.read(struct.calcsize('i')))[0]
85+ fid.seek(N * M * 4, 1)
86+ else:
87+ raise TypeError("cannot read data of type {}".format(datatype))
88+
89+ fid.close()
90+
91+ return (variable, fpos)
92+# }}}
93Index: ../trunk-jpl/src/m/solve/loadresultfromdisk.m
94===================================================================
95--- ../trunk-jpl/src/m/solve/loadresultfromdisk.m (revision 25299)
96+++ ../trunk-jpl/src/m/solve/loadresultfromdisk.m (revision 25300)
97@@ -1,5 +1,5 @@
98 function [variable fpos]=loadresultfromdisk(filename,step,name,varargin)
99-%LOADRESULTFROMDISK - load specific result of solution sequence from disk file "filename"
100+%LOADRESULTFROMDISK - load specific result of solution sequence from disk file "filename"
101 %
102 % Usage:
103 % variable=loadresultfromdisk(filename,step,name);
104@@ -11,11 +11,11 @@
105 end
106
107 if nargin==4,
108+ %Put the pointer on the right position in the file:
109 fpos=varargin{1};
110 fseek(fid,fpos,'bof');
111 end
112
113- %Put the pointer on the right position in the file:
114 while 1,
115
116 %read field
117Index: ../trunk-jpl/src/m/solve/loadresultsfromcluster.py
118===================================================================
119--- ../trunk-jpl/src/m/solve/loadresultsfromcluster.py (revision 25299)
120+++ ../trunk-jpl/src/m/solve/loadresultsfromcluster.py (revision 25300)
121@@ -1,8 +1,9 @@
122 import os
123+import platform
124 import socket
125-import platform
126+
127+from helpers import *
128 from loadresultsfromdisk import loadresultsfromdisk
129-from helpers import *
130
131
132 def loadresultsfromcluster(md, runtimename=False):
133Index: ../trunk-jpl/src/m/solve/solve.py
134===================================================================
135--- ../trunk-jpl/src/m/solve/solve.py (revision 25299)
136+++ ../trunk-jpl/src/m/solve/solve.py (revision 25300)
137@@ -136,7 +136,7 @@
138 filelist = [modelname + '.bin ', modelname + '.toolkits ', modelname + '.queue ']
139 if md.qmu.isdakota:
140 filelist.append(modelname + '.qmu.in')
141-
142+
143 if not restart:
144 cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist)
145
146@@ -153,5 +153,4 @@
147 if md.verbose.solution:
148 print('loading results from cluster')
149 md = loadresultsfromcluster(md)
150-
151 return md
152Index: ../trunk-jpl/src/m/classes/clusters/pfe.m
153===================================================================
154--- ../trunk-jpl/src/m/classes/clusters/pfe.m (revision 25299)
155+++ ../trunk-jpl/src/m/classes/clusters/pfe.m (revision 25300)
156@@ -6,451 +6,451 @@
157 % cluster=pfe('np',3,'login','username');
158
159 classdef pfe
160- properties (SetAccess=public)
161- % {{{
162- name = 'pfe'
163- login = '';
164- modules = {'comp-intel/2016.2.181' 'mpi-sgi/mpt'};
165- numnodes = 20;
166- cpuspernode = 8;
167- port = 1025;
168- queue = 'long';
169- time = 12*60;
170- processor = 'ivy';
171- srcpath = '';
172- codepath = '';
173- executionpath = '';
174- grouplist = 's1690';
175- interactive = 0;
176- bbftp = 0;
177- numstreams = 8;
178- hyperthreading = 0;
179- end
180- %}}}
181- methods
182- function cluster=pfe(varargin) % {{{
183+ properties (SetAccess=public)
184+ % {{{
185+ name = 'pfe'
186+ login = '';
187+ modules = {'comp-intel/2016.2.181' 'mpi-sgi/mpt'};
188+ numnodes = 20;
189+ cpuspernode = 8;
190+ port = 1025;
191+ queue = 'long';
192+ time = 12*60;
193+ processor = 'ivy';
194+ srcpath = '';
195+ codepath = '';
196+ executionpath = '';
197+ grouplist = 's1690';
198+ interactive = 0;
199+ bbftp = 0;
200+ numstreams = 8;
201+ hyperthreading = 0;
202+ end
203+ %}}}
204+ methods
205+ function cluster=pfe(varargin) % {{{
206
207- %initialize cluster using default settings if provided
208- if (exist('pfe_settings')==2), pfe_settings; end
209+ %initialize cluster using default settings if provided
210+ if (exist('pfe_settings')==2), pfe_settings; end
211
212- %use provided options to change fields
213- cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
214- end
215- %}}}
216- function disp(cluster) % {{{
217- % display the object
218- disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
219- disp(sprintf(' name: %s',cluster.name));
220- disp(sprintf(' login: %s',cluster.login));
221- modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1);
222- disp(sprintf(' modules: %s',modules));
223- disp(sprintf(' port: %i',cluster.port));
224- disp(sprintf(' numnodes: %i',cluster.numnodes));
225- disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));
226- disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));
227- disp(sprintf(' queue: %s',cluster.queue));
228- disp(sprintf(' time: %i',cluster.time));
229- disp(sprintf(' processor: %s',cluster.processor));
230- disp(sprintf(' codepath: %s ($ISSM_DIR on pfe)',cluster.codepath));
231- disp(sprintf(' executionpath: %s (directory containing issm.exe on pfe)',cluster.executionpath));
232- disp(sprintf(' grouplist: %s',cluster.grouplist));
233- disp(sprintf(' interactive: %i',cluster.interactive));
234- disp(sprintf(' hyperthreading: %i',cluster.hyperthreading));
235- end
236- %}}}
237- function numprocs=np(cluster) % {{{
238- %compute number of processors
239- numprocs=cluster.numnodes*cluster.cpuspernode;
240- end
241- %}}}
242- function md = checkconsistency(cluster,md,solution,analyses) % {{{
243+ %use provided options to change fields
244+ cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
245+ end
246+ %}}}
247+ function disp(cluster) % {{{
248+ % display the object
249+ disp(sprintf('class ''%s'' object ''%s'' = ',class(cluster),inputname(1)));
250+ disp(sprintf(' name: %s',cluster.name));
251+ disp(sprintf(' login: %s',cluster.login));
252+ modules=''; for i=1:length(cluster.modules), modules=[modules cluster.modules{i} ',']; end; modules=modules(1:end-1);
253+ disp(sprintf(' modules: %s',modules));
254+ disp(sprintf(' port: %i',cluster.port));
255+ disp(sprintf(' numnodes: %i',cluster.numnodes));
256+ disp(sprintf(' cpuspernode: %i',cluster.cpuspernode));
257+ disp(sprintf(' np: %i',cluster.cpuspernode*cluster.numnodes));
258+ disp(sprintf(' queue: %s',cluster.queue));
259+ disp(sprintf(' time: %i',cluster.time));
260+ disp(sprintf(' processor: %s',cluster.processor));
261+ disp(sprintf(' codepath: %s ($ISSM_DIR on pfe)',cluster.codepath));
262+ disp(sprintf(' executionpath: %s (directory containing issm.exe on pfe)',cluster.executionpath));
263+ disp(sprintf(' grouplist: %s',cluster.grouplist));
264+ disp(sprintf(' interactive: %i',cluster.interactive));
265+ disp(sprintf(' hyperthreading: %i',cluster.hyperthreading));
266+ end
267+ %}}}
268+ function numprocs=np(cluster) % {{{
269+ %compute number of processors
270+ numprocs=cluster.numnodes*cluster.cpuspernode;
271+ end
272+ %}}}
273+ function md = checkconsistency(cluster,md,solution,analyses) % {{{
274
275- available_queues={'long','normal','debug','devel','alphatst@pbspl233'};
276- queue_requirements_time=[5*24*60 8*60 2*60 2*60 24*60];
277- queue_requirements_np=[2048 2048 150 150 2048];
278+ available_queues={'long','normal','debug','devel','alphatst@pbspl233'};
279+ queue_requirements_time=[5*24*60 8*60 2*60 2*60 24*60];
280+ queue_requirements_np=[2048 2048 150 150 2048];
281
282- QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
283+ QueueRequirements(available_queues,queue_requirements_time,queue_requirements_np,cluster.queue,cluster.np,cluster.time)
284
285- %now, check cluster.cpuspernode according to processor type
286- if strcmpi(cluster.processor,'wes'),
287- if cluster.hyperthreading,
288- if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
289- md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
290- end
291- else
292- if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
293- md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''wes'' processors');
294- end
295- end
296- elseif strcmpi(cluster.processor,'ivy'),
297- if cluster.hyperthreading,
298- if ((cluster.cpuspernode>40 ) | (cluster.cpuspernode<1)),
299- md = checkmessage(md,'cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode');
300- end
301- else
302- if ((cluster.cpuspernode>20 ) | (cluster.cpuspernode<1)),
303- md = checkmessage(md,'cpuspernode should be between 1 and 20 for ''ivy'' processors');
304- end
305- end
306- elseif strcmpi(cluster.processor,'bro'),
307- if cluster.hyperthreading,
308- if ((cluster.cpuspernode>56 ) | (cluster.cpuspernode<1)),
309- md = checkmessage(md,'cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode');
310- end
311- else
312- if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)),
313- md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''bro'' processors');
314- end
315- end
316- elseif strcmpi(cluster.processor,'has'),
317- if cluster.hyperthreading,
318- if ((cluster.cpuspernode>48 ) | (cluster.cpuspernode<1)),
319- md = checkmessage(md,'cpuspernode should be between 1 and 48 for ''has'' processors in hyperthreading mode');
320- end
321- else
322- if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
323- md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''has'' processors');
324- end
325- end
326-
327- elseif strcmpi(cluster.processor,'san'),
328- if cluster.hyperthreading,
329- if ((cluster.cpuspernode>32 ) | (cluster.cpuspernode<1)),
330- md = checkmessage(md,'cpuspernode should be between 1 and 32 for ''san'' processors in hyperthreading mode');
331- end
332- else
333- if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
334- md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''san'' processors');
335- end
336- end
337+ %now, check cluster.cpuspernode according to processor type
338+ if strcmpi(cluster.processor,'wes'),
339+ if cluster.hyperthreading,
340+ if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
341+ md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
342+ end
343+ else
344+ if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
345+ md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''wes'' processors');
346+ end
347+ end
348+ elseif strcmpi(cluster.processor,'ivy'),
349+ if cluster.hyperthreading,
350+ if ((cluster.cpuspernode>40 ) | (cluster.cpuspernode<1)),
351+ md = checkmessage(md,'cpuspernode should be between 1 and 40 for ''ivy'' processors in hyperthreading mode');
352+ end
353+ else
354+ if ((cluster.cpuspernode>20 ) | (cluster.cpuspernode<1)),
355+ md = checkmessage(md,'cpuspernode should be between 1 and 20 for ''ivy'' processors');
356+ end
357+ end
358+ elseif strcmpi(cluster.processor,'bro'),
359+ if cluster.hyperthreading,
360+ if ((cluster.cpuspernode>56 ) | (cluster.cpuspernode<1)),
361+ md = checkmessage(md,'cpuspernode should be between 1 and 56 for ''bro'' processors in hyperthreading mode');
362+ end
363+ else
364+ if ((cluster.cpuspernode>28 ) | (cluster.cpuspernode<1)),
365+ md = checkmessage(md,'cpuspernode should be between 1 and 28 for ''bro'' processors');
366+ end
367+ end
368+ elseif strcmpi(cluster.processor,'has'),
369+ if cluster.hyperthreading,
370+ if ((cluster.cpuspernode>48 ) | (cluster.cpuspernode<1)),
371+ md = checkmessage(md,'cpuspernode should be between 1 and 48 for ''has'' processors in hyperthreading mode');
372+ end
373+ else
374+ if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
375+ md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''has'' processors');
376+ end
377+ end
378+
379+ elseif strcmpi(cluster.processor,'san'),
380+ if cluster.hyperthreading,
381+ if ((cluster.cpuspernode>32 ) | (cluster.cpuspernode<1)),
382+ md = checkmessage(md,'cpuspernode should be between 1 and 32 for ''san'' processors in hyperthreading mode');
383+ end
384+ else
385+ if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
386+ md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''san'' processors');
387+ end
388+ end
389
390- else
391- md = checkmessage(md,'unknown processor type, should be ''wes'' or ''has'' or ''ivy'' or ''san''');
392- end
393+ else
394+ md = checkmessage(md,'unknown processor type, should be ''wes'' or ''has'' or ''ivy'' or ''san''');
395+ end
396
397- %Miscelaneous
398- if isempty(cluster.login), md = checkmessage(md,'login empty'); end
399- if isempty(cluster.srcpath), md = checkmessage(md,'srcpath empty'); end
400- if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
401- if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
402- if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end
403+ %Miscellaneous
404+ if isempty(cluster.login), md = checkmessage(md,'login empty'); end
405+ if isempty(cluster.srcpath), md = checkmessage(md,'srcpath empty'); end
406+ if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
407+ if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
408+ if isempty(cluster.grouplist), md = checkmessage(md,'grouplist empty'); end
409
410- end
411- %}}}
412- function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
413+ end
414+ %}}}
415+ function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota,isoceancoupling) % {{{
416
417- if(isgprof), disp('gprof not supported by cluster, ignoring...'); end
418+ if(isgprof), disp('gprof not supported by cluster, ignoring...'); end
419
420- executable='issm.exe';
421- if isdakota,
422- version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
423- if (version>=6),
424- executable='issm_dakota.exe';
425- end
426- end
427- if isoceancoupling,
428- executable='issm_ocean.exe';
429- end
430+ executable='issm.exe';
431+ if isdakota,
432+ version=IssmConfig('_DAKOTA_VERSION_'); version=str2num(version(1:3));
433+ if (version>=6),
434+ executable='issm_dakota.exe';
435+ end
436+ end
437+ if isoceancoupling,
438+ executable='issm_ocean.exe';
439+ end
440
441- %write queuing script
442- fid=fopen([modelname '.queue'],'w');
443- fprintf(fid,'#PBS -S /bin/bash\n');
444-% fprintf(fid,'#PBS -N %s\n',modelname);
445- fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
446- fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
447- fprintf(fid,'#PBS -q %s \n',cluster.queue);
448- fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
449- fprintf(fid,'#PBS -m e\n');
450- fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
451- fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
452- fprintf(fid,'. /usr/share/modules/init/bash\n\n');
453- for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
454- fprintf(fid,'export PATH="$PATH:."\n\n');
455- fprintf(fid,'export MPI_LAUNCH_TIMEOUT=520\n');
456- fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
457- fprintf(fid,'export ISSM_DIR="%s"\n',cluster.srcpath); %FIXME
458- fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
459- fprintf(fid,'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ISSM_DIR/externalpackages/petsc/install/lib"\n');
460- fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
461- if ~isvalgrind,
462- fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
463- else
464- fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
465- end
466- if ~io_gather, %concatenate the output files:
467- fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
468- end
469- fclose(fid);
470+ %write queuing script
471+ fid=fopen([modelname '.queue'],'w');
472+ fprintf(fid,'#PBS -S /bin/bash\n');
473+% fprintf(fid,'#PBS -N %s\n',modelname);
474+ fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
475+ fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
476+ fprintf(fid,'#PBS -q %s \n',cluster.queue);
477+ fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
478+ fprintf(fid,'#PBS -m e\n');
479+ fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
480+ fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
481+ fprintf(fid,'. /usr/share/modules/init/bash\n\n');
482+ for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
483+ fprintf(fid,'export PATH="$PATH:."\n\n');
484+ fprintf(fid,'export MPI_LAUNCH_TIMEOUT=520\n');
485+ fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
486+ fprintf(fid,'export ISSM_DIR="%s"\n',cluster.srcpath); %FIXME
487+ fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
488+ fprintf(fid,'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ISSM_DIR/externalpackages/petsc/install/lib"\n');
489+ fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
490+ if ~isvalgrind,
491+ fprintf(fid,'/u/scicon/tools/bin/several_tries mpiexec -np %i /u/scicon/tools/bin/mbind.x -cs -n%i %s/%s %s %s %s\n',cluster.np,cluster.cpuspernode,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
492+ else
493+ fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/' dirname],modelname);
494+ end
495+ if ~io_gather, %concatenate the output files:
496+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
497+ end
498+ fclose(fid);
499
500- %in interactive mode, create a run file, and errlog and outlog file
501- if cluster.interactive,
502- fid=fopen([modelname '.run'],'w');
503- if cluster.interactive==10,
504- fprintf(fid,'module unload mpi-mvapich2/1.4.1/gcc\n');
505- fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[pwd() '/run'],modelname);
506- else
507- if ~isvalgrind,
508- fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
509- else
510- fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
511- end
512- end
513- if ~io_gather, %concatenate the output files:
514- fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
515- end
516- fclose(fid);
517- fid=fopen([modelname '.errlog'],'w');
518- fclose(fid);
519- fid=fopen([modelname '.outlog'],'w');
520- fclose(fid);
521- end
522- end %}}}
523- function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
524+ %in interactive mode, create a run file, and errlog and outlog file
525+ if cluster.interactive,
526+ fid=fopen([modelname '.run'],'w');
527+ if cluster.interactive==10,
528+ fprintf(fid,'module unload mpi-mvapich2/1.4.1/gcc\n');
529+ fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[pwd() '/run'],modelname);
530+ else
531+ if ~isvalgrind,
532+ fprintf(fid,'mpiexec -np %i %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
533+ else
534+ fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/%s %s %s %s\n',cluster.np,cluster.codepath,executable,solution,[cluster.executionpath '/Interactive' num2str(cluster.interactive)],modelname);
535+ end
536+ end
537+ if ~io_gather, %concatenate the output files:
538+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
539+ end
540+ fclose(fid);
541+ fid=fopen([modelname '.errlog'],'w');
542+ fclose(fid);
543+ fid=fopen([modelname '.outlog'],'w');
544+ fclose(fid);
545+ end
546+ end %}}}
547+ function BuildQueueScriptMultipleModels(cluster,dirname,modelname,solution,dirnames,modelnames,nps) % {{{
548
549- %some checks:
550- if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
551+ %some checks:
552+ if isempty(modelname), error('BuildQueueScriptMultipleModels error message: need a non empty model name!');end
553
554- %what is the executable being called?
555- executable='issm_slr.exe';
556+ %what is the executable being called?
557+ executable='issm_slr.exe';
558
559- if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
560+ if ispc(), error('BuildQueueScriptMultipleModels not support yet on windows machines');end;
561
562- %write queuing script
563- fid=fopen([modelname '.queue'],'w');
564+ %write queuing script
565+ fid=fopen([modelname '.queue'],'w');
566
567- fprintf(fid,'#PBS -S /bin/bash\n');
568- fprintf(fid,'#PBS -N %s\n',modelname);
569- fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
570- fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
571- fprintf(fid,'#PBS -q %s \n',cluster.queue);
572- fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
573- fprintf(fid,'#PBS -m e\n');
574- fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
575- fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
576- fprintf(fid,'. /usr/share/modules/init/bash\n\n');
577- for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
578- fprintf(fid,'export PATH="$PATH:."\n\n');
579- fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
580- fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
581- fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
582- fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
583+ fprintf(fid,'#PBS -S /bin/bash\n');
584+ fprintf(fid,'#PBS -N %s\n',modelname);
585+ fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
586+ fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
587+ fprintf(fid,'#PBS -q %s \n',cluster.queue);
588+ fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
589+ fprintf(fid,'#PBS -m e\n');
590+ fprintf(fid,'#PBS -o %s.outlog \n',[cluster.executionpath '/' dirname '/' modelname]);
591+ fprintf(fid,'#PBS -e %s.errlog \n\n',[cluster.executionpath '/' dirname '/' modelname]);
592+ fprintf(fid,'. /usr/share/modules/init/bash\n\n');
593+ for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
594+ fprintf(fid,'export PATH="$PATH:."\n\n');
595+ fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
596+ fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
597+ fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
598+ fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,dirname);
599
600- %number of cpus:
601- mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
602+ %number of cpus:
603+ mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
604
605- %executable:
606- mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
607+ %executable:
608+ mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
609
610- %solution name:
611- mpistring=[mpistring sprintf('%s ',solution)];
612+ %solution name:
613+ mpistring=[mpistring sprintf('%s ',solution)];
614
615- %execution directory and model name:
616- mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
617+ %execution directory and model name:
618+ mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
619
620- %inform main executable of how many icecaps, glaciers and earth models are being run:
621- mpistring=[mpistring sprintf(' %i ',length(dirnames))];
622+ %inform main executable of how many icecaps, glaciers and earth models are being run:
623+ mpistring=[mpistring sprintf(' %i ',length(dirnames))];
624
625- %icecaps, glaciers and earth location, names and number of processors associated:
626- for i=1:length(dirnames),
627- mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
628- end
629+ %icecaps, glaciers and earth location, names and number of processors associated:
630+ for i=1:length(dirnames),
631+ mpistring=[mpistring sprintf(' %s/%s %s %i ',cluster.executionpath,dirnames{i},modelnames{i},nps{i})];
632+ end
633
634- %write this long string to disk:
635- fprintf(fid,mpistring);
636- fclose(fid);
637+ %write this long string to disk:
638+ fprintf(fid,mpistring);
639+ fclose(fid);
640
641- if cluster.interactive,
642- fid=fopen([modelname '.run'],'w');
643+ if cluster.interactive,
644+ fid=fopen([modelname '.run'],'w');
645
646- %number of cpus:
647- mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
648+ %number of cpus:
649+ mpistring=sprintf('mpiexec -np %i ',cluster.numnodes*cluster.cpuspernode);
650
651- %executable:
652- mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
653+ %executable:
654+ mpistring=[mpistring sprintf('%s/%s ',cluster.codepath,executable)];
655
656- %solution name:
657- mpistring=[mpistring sprintf('%s ',solution)];
658+ %solution name:
659+ mpistring=[mpistring sprintf('%s ',solution)];
660
661- %execution directory and model name:
662- mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
663+ %execution directory and model name:
664+ mpistring=[mpistring sprintf('%s/%s %s',cluster.executionpath,dirname,modelname)];
665
666- %inform main executable of how many icecaps, glaciers and earth models are being run:
667- mpistring=[mpistring sprintf(' %i ',length(dirnames))];
668+ %inform main executable of how many icecaps, glaciers and earth models are being run:
669+ mpistring=[mpistring sprintf(' %i ',length(dirnames))];
670
671- %icecaps, glaciers and earth location, names and number of processors associated:
672- for i=1:length(dirnames),
673- mpistring=[mpistring sprintf(' %s/Interactive%i %s %i ',cluster.executionpath,cluster.interactive,modelnames{i},nps{i})];
674- end
675+ %icecaps, glaciers and earth location, names and number of processors associated:
676+ for i=1:length(dirnames),
677+ mpistring=[mpistring sprintf(' %s/Interactive%i %s %i ',cluster.executionpath,cluster.interactive,modelnames{i},nps{i})];
678+ end
679
680- %write this long string to disk:
681- fprintf(fid,mpistring);
682- fclose(fid);
683+ %write this long string to disk:
684+ fprintf(fid,mpistring);
685+ fclose(fid);
686
687- fid=fopen([modelname '.errlog'],'w');
688- fclose(fid);
689- fid=fopen([modelname '.outlog'],'w');
690- fclose(fid);
691- end
692- end
693- %}}}
694- function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
695+ fid=fopen([modelname '.errlog'],'w');
696+ fclose(fid);
697+ fid=fopen([modelname '.outlog'],'w');
698+ fclose(fid);
699+ end
700+ end
701+ %}}}
702+ function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind,isgprof) % {{{
703
704- if(isgprof), disp('gprof not supported by cluster, ignoring...'); end
705+ if(isgprof), disp('gprof not supported by cluster, ignoring...'); end
706
707- %write queuing script
708- fid=fopen([modelname '.queue'],'w');
709- fprintf(fid,'#PBS -S /bin/bash\n');
710- % fprintf(fid,'#PBS -N %s\n',modelname);
711- fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
712- fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
713- fprintf(fid,'#PBS -q %s \n',cluster.queue);
714- fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
715- fprintf(fid,'#PBS -m e\n');
716- fprintf(fid,'#PBS -o %s.outlog \n',modelname);
717- fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
718- fprintf(fid,'. /usr/share/modules/init/bash\n\n');
719- for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
720- fprintf(fid,'export PATH="$PATH:."\n');
721- fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
722- fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
723- fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
724- fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,modelname);
725- fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
726- if ~io_gather, %concatenate the output files:
727- fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
728- end
729- fclose(fid);
730+ %write queuing script
731+ fid=fopen([modelname '.queue'],'w');
732+ fprintf(fid,'#PBS -S /bin/bash\n');
733+ % fprintf(fid,'#PBS -N %s\n',modelname);
734+ fprintf(fid,'#PBS -l select=%i:ncpus=%i:model=%s\n',cluster.numnodes,cluster.cpuspernode,cluster.processor);
735+ fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
736+ fprintf(fid,'#PBS -q %s \n',cluster.queue);
737+ fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
738+ fprintf(fid,'#PBS -m e\n');
739+ fprintf(fid,'#PBS -o %s.outlog \n',modelname);
740+ fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
741+ fprintf(fid,'. /usr/share/modules/init/bash\n\n');
742+ for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end
743+ fprintf(fid,'export PATH="$PATH:."\n');
744+ fprintf(fid,'export ISSM_DIR="%s/../"\n',cluster.codepath); %FIXME
745+ fprintf(fid,'source $ISSM_DIR/etc/environment.sh\n'); %FIXME
746+ fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
747+ fprintf(fid,'cd %s/%s/\n\n',cluster.executionpath,modelname);
748+ fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname); %FIXME
749+ if ~io_gather, %concatenate the output files:
750+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
751+ end
752+ fclose(fid);
753
754- %in interactive mode, create a run file, and errlog and outlog file
755- if cluster.interactive,
756- fid=fopen([modelname '.run'],'w');
757- if ~isvalgrind,
758- fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
759- else
760- fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
761- end
762- if ~io_gather, %concatenate the output files:
763- fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
764- end
765- fclose(fid);
766- fid=fopen([modelname '.errlog'],'w');
767- fclose(fid);
768- fid=fopen([modelname '.outlog'],'w');
769- fclose(fid);
770- end
771- end %}}}
772- function BuildOceanQueueScript(np,cluster,modelname) % {{{
773+ %in interactive mode, create a run file, and errlog and outlog file
774+ if cluster.interactive,
775+ fid=fopen([modelname '.run'],'w');
776+ if ~isvalgrind,
777+ fprintf(fid,'mpiexec -np %i %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
778+ else
779+ fprintf(fid,'mpiexec -np %i valgrind --leak-check=full %s/kriging.exe %s %s\n',cluster.np,cluster.codepath,[cluster.executionpath '/' modelname],modelname);
780+ end
781+ if ~io_gather, %concatenate the output files:
782+ fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
783+ end
784+ fclose(fid);
785+ fid=fopen([modelname '.errlog'],'w');
786+ fclose(fid);
787+ fid=fopen([modelname '.outlog'],'w');
788+ fclose(fid);
789+ end
790+ end %}}}
791+ function BuildOceanQueueScript(np,cluster,modelname) % {{{
792
793- %write queuing script
794- fid=fopen([modelname '.queue'],'w');
795- fprintf(fid,'#PBS -S /bin/bash\n');
796- fprintf(fid,'#PBS -l select=1:ncpus=%i:model=%s\n',np,cluster.processor);
797- fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
798- fprintf(fid,'#PBS -q %s \n',cluster.queue);
799- fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
800- fprintf(fid,'#PBS -m e\n');
801- fprintf(fid,'#PBS -o %s.outlog \n',modelname);
802- fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
803- fprintf(fid,'. /usr/share/modules/init/bash\n\n');
804- %for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end %FIXME: should use this!
805- fprintf(fid,'module load comp-intel/2016.2.181\n');
806- fprintf(fid,'module load netcdf/4.4.1.1_mpt\n');
807- fprintf(fid,'module load mpi-sgi/mpt.2.15r20\n');
808- fprintf(fid,'export PATH="$PATH:."\n');
809- fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
810- fprintf(fid,['cd ' pwd() ' \n\n']);
811- fprintf(fid,'mpiexec -np %i ./mitgcmuv\n',np);
812- % if ~io_gather, %concatenate the output files:
813- % fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
814- % end
815- fclose(fid);
816+ %write queuing script
817+ fid=fopen([modelname '.queue'],'w');
818+ fprintf(fid,'#PBS -S /bin/bash\n');
819+ fprintf(fid,'#PBS -l select=1:ncpus=%i:model=%s\n',np,cluster.processor);
820+ fprintf(fid,'#PBS -l walltime=%i\n',cluster.time*60); %walltime is in seconds.
821+ fprintf(fid,'#PBS -q %s \n',cluster.queue);
822+ fprintf(fid,'#PBS -W group_list=%s\n',cluster.grouplist);
823+ fprintf(fid,'#PBS -m e\n');
824+ fprintf(fid,'#PBS -o %s.outlog \n',modelname);
825+ fprintf(fid,'#PBS -e %s.errlog \n\n',modelname);
826+ fprintf(fid,'. /usr/share/modules/init/bash\n\n');
827+ %for i=1:numel(cluster.modules), fprintf(fid,['module load ' cluster.modules{i} '\n']); end %FIXME: should use this!
828+ fprintf(fid,'module load comp-intel/2016.2.181\n');
829+ fprintf(fid,'module load netcdf/4.4.1.1_mpt\n');
830+ fprintf(fid,'module load mpi-sgi/mpt.2.15r20\n');
831+ fprintf(fid,'export PATH="$PATH:."\n');
832+ fprintf(fid,'export MPI_GROUP_MAX=64\n\n');
833+ fprintf(fid,['cd ' pwd() ' \n\n']);
834+ fprintf(fid,'mpiexec -np %i ./mitgcmuv\n',np);
835+ % if ~io_gather, %concatenate the output files:
836+ % fprintf(fid,'cat %s.outbin.* > %s.outbin',modelname,modelname);
837+ % end
838+ fclose(fid);
839
840- %in interactive mode, create a run file, and errlog and outlog file
841- if cluster.interactive,
842- fid=fopen([modelname '.run'],'w');
843- fprintf(fid,'module load mpi-sgi/mpt.2.15r20\n');
844- fprintf(fid,['mpiexec -np %i ./mitgcmuv \n'],np);
845- fprintf(fid,['touch ' modelname '.lock %s\n']);
846- fclose(fid);
847- fid=fopen([modelname '.errlog'],'w');
848- fclose(fid);
849- fid=fopen([modelname '.outlog'],'w');
850- fclose(fid);
851- end
852+ %in interactive mode, create a run file, and errlog and outlog file
853+ if cluster.interactive,
854+ fid=fopen([modelname '.run'],'w');
855+ fprintf(fid,'module load mpi-sgi/mpt.2.15r20\n');
856+ fprintf(fid,['mpiexec -np %i ./mitgcmuv \n'],np);
857+ fprintf(fid,['touch ' modelname '.lock %s\n']);
858+ fclose(fid);
859+ fid=fopen([modelname '.errlog'],'w');
860+ fclose(fid);
861+ fid=fopen([modelname '.outlog'],'w');
862+ fclose(fid);
863+ end
864
865- end %}}}
866- function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
867+ end %}}}
868+ function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{
869
870- %compress the files into one zip.
871- compressstring=['tar -zcf ' dirname '.tar.gz '];
872- for i=1:numel(filelist),
873- compressstring = [compressstring ' ' filelist{i}];
874- end
875- if cluster.interactive,
876- compressstring = [compressstring ' ' modelname '.run ' modelname '.errlog ' modelname '.outlog '];
877- end
878- system(compressstring);
879+ %compress the files into one zip.
880+ compressstring=['tar -zcf ' dirname '.tar.gz '];
881+ for i=1:numel(filelist),
882+ compressstring = [compressstring ' ' filelist{i}];
883+ end
884+ if cluster.interactive,
885+ compressstring = [compressstring ' ' modelname '.run ' modelname '.errlog ' modelname '.outlog '];
886+ end
887+ system(compressstring);
888
889- disp('uploading input file and queueing script');
890- if cluster.interactive==10,
891- directory=[pwd() '/run/'];
892- elseif cluster.interactive,
893- directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
894- else
895- directory=cluster.executionpath;
896- end
897+ disp('uploading input file and queueing script');
898+ if cluster.interactive==10,
899+ directory=[pwd() '/run/'];
900+ elseif cluster.interactive,
901+ directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)];
902+ else
903+ directory=cluster.executionpath;
904+ end
905
906- if ~cluster.bbftp,
907- issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
908- else
909- issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
910- end
911+ if ~cluster.bbftp,
912+ issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']});
913+ else
914+ issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']});
915+ end
916
917- end
918- %}}}
919- function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
920+ end
921+ %}}}
922+ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{
923
924- %lauch command, to be executed via ssh
925- if ~cluster.interactive,
926- if ~isempty(restart)
927- launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
928- else
929- launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
930- ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
931- end
932- else
933- if ~isempty(restart)
934- launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
935- else
936- if cluster.interactive==10,
937- launchcommand=['cd ' pwd() '/run && tar -zxf ' dirname '.tar.gz'];
938- else
939- launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
940- end
941- end
942- end
943+ %lauch command, to be executed via ssh
944+ if ~cluster.interactive,
945+ if ~isempty(restart)
946+ launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue '];
947+ else
948+ launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ...
949+ ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue '];
950+ end
951+ else
952+ if ~isempty(restart)
953+ launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive)];
954+ else
955+ if cluster.interactive==10,
956+ launchcommand=['cd ' pwd() '/run && tar -zxf ' dirname '.tar.gz'];
957+ else
958+ launchcommand=['cd ' cluster.executionpath '/Interactive' num2str(cluster.interactive) ' && tar -zxf ' dirname '.tar.gz'];
959+ end
960+ end
961+ end
962
963- disp('launching solution sequence on remote cluster');
964- issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
965- end
966- %}}}
967- function Download(cluster,dirname,filelist)% {{{
968+ disp('launching solution sequence on remote cluster');
969+ issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
970+ end
971+ %}}}
972+ function Download(cluster,dirname,filelist)% {{{
973
974- %copy files from cluster to current directory
975- if cluster.interactive==10,
976- directory=[pwd() '/run/'];
977- elseif ~cluster.interactive,
978- directory=[cluster.executionpath '/' dirname '/'];
979- else
980- directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
981- end
982+ %copy files from cluster to current directory
983+ if cluster.interactive==10,
984+ directory=[pwd() '/run/'];
985+ elseif ~cluster.interactive,
986+ directory=[cluster.executionpath '/' dirname '/'];
987+ else
988+ directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive) '/'];
989+ end
990
991- if ~cluster.bbftp,
992- issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
993- else
994- issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
995- end
996+ if ~cluster.bbftp,
997+ issmscpin(cluster.name,cluster.login,cluster.port,directory,filelist);
998+ else
999+ issmbbftpin(cluster.name, cluster.login, cluster.port, cluster.numstreams, directory, filelist);
1000+ end
1001
1002- end %}}}
1003+ end %}}}
1004 end
1005 end
1006Index: ../trunk-jpl/src/m/classes/clusters/pfe.py
1007===================================================================
1008--- ../trunk-jpl/src/m/classes/clusters/pfe.py (revision 25299)
1009+++ ../trunk-jpl/src/m/classes/clusters/pfe.py (revision 25300)
1010@@ -31,6 +31,7 @@
1011 self.queue = 'long'
1012 self.time = 12 * 60
1013 self.processor = 'wes'
1014+ self.srcpath = ''
1015 self.codepath = ''
1016 self.executionpath = ''
1017 self.grouplist = 's1010'
1018@@ -60,11 +61,11 @@
1019 s = "%s\n%s" % (s, fielddisplay(self, 'cpuspernode', 'number of nodes per CPUs'))
1020 s = "%s\n%s" % (s, fielddisplay(self, 'np', 'number of CPUs'))
1021 s = "%s\n%s" % (s, fielddisplay(self, 'port', 'machine access port'))
1022- s = "%s\n%s" % (s, fielddisplay(self, 'codepath', 'code path on the cluster'))
1023- s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'execution path on the cluster'))
1024 s = "%s\n%s" % (s, fielddisplay(self, 'queue', 'name of the queue'))
1025 s = "%s\n%s" % (s, fielddisplay(self, 'time', 'walltime requested'))
1026 s = "%s\n%s" % (s, fielddisplay(self, 'processor', 'type of processor'))
1027+ s = "%s\n%s" % (s, fielddisplay(self, 'codepath', '$ISSM_DIR on pfe'))
1028+ s = "%s\n%s" % (s, fielddisplay(self, 'executionpath', 'directory containing issm.exe on pfe'))
1029 s = "%s\n%s" % (s, fielddisplay(self, 'grouplist', 'name of the group'))
1030 s = "%s\n%s" % (s, fielddisplay(self, 'interactive', ''))
1031 s = "%s\n%s" % (s, fielddisplay(self, 'bbftp', ''))
1032@@ -112,9 +113,11 @@
1033 else:
1034 md = md.checkmessage('unknown processor type, should be ''neh'', ''wes'' or ''har'' or ''ivy''')
1035
1036- #Miscelaneous
1037+ #Miscellaneous
1038 if not self.login:
1039 md = md.checkmessage('login empty')
1040+ if not self.srcpath:
1041+ md = md.checkmessage('srcpath empty')
1042 if not self.codepath:
1043 md = md.checkmessage('codepath empty')
1044 if not self.executionpath:
1045@@ -152,8 +155,9 @@
1046 fid.write('module load mpi-sgi/mpt.2.11r13\n')
1047 fid.write('export PATH="$PATH:."\n\n')
1048 fid.write('export MPI_GROUP_MAX=64\n\n')
1049- fid.write('export ISSM_DIR="%s/../ "\n' % self.codepath)
1050+ fid.write('export ISSM_DIR="%s"\n' % self.srcpath)
1051 fid.write('source $ISSM_DIR/etc/environment.sh\n')
1052+ fid.write('export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ISSM_DIR/externalpackages/petsc/install/lib"\n')
1053 fid.write('cd %s/%s/ \n\n' % (self.executionpath, dirname))
1054 fid.write('mpiexec - np %i %s/%s %s %s/%s %s\n' % (self.nprocs(), self.codepath, executable, str(solution), self.executionpath, dirname, modelname))
1055
1056Index: ../trunk-jpl/src/m/classes/fourierlove.py
1057===================================================================
1058--- ../trunk-jpl/src/m/classes/fourierlove.py (revision 25299)
1059+++ ../trunk-jpl/src/m/classes/fourierlove.py (revision 25300)
1060@@ -64,9 +64,9 @@
1061 self.frequencies = [0] #Hz
1062 self.sh_nmax = 256 # .35 degree, 40 km at the equator.
1063 self.sh_nmin = 1
1064- self.g0 = 10 # m / s^2
1065- self.r0 = 6378e3 #m
1066- self.mu0 = 1e11 # Pa
1067+ self.g0 = 9.81 # m/s^2
1068+ self.r0 = 6371e3 #m
1069+ self.mu0 = 1e11 # Pa
1070 self.allow_layer_deletion = 1
1071 self.love_kernels = 0
1072 self.forcing_type = 11
1073Index: ../trunk-jpl/test/Par/GiaIvinsBenchmarksAB.py
1074===================================================================
1075--- ../trunk-jpl/test/Par/GiaIvinsBenchmarksAB.py (revision 25299)
1076+++ ../trunk-jpl/test/Par/GiaIvinsBenchmarksAB.py (revision 25300)
1077@@ -11,6 +11,7 @@
1078 from verbose import *
1079 from SetIceSheetBC import *
1080
1081+
1082 rad = 600000.
1083 nv = md.mesh.numberofvertices
1084 if (np.isnan(md.geometry.thickness)):
1085@@ -20,7 +21,7 @@
1086 if (dist <= rad):
1087 md.geometry.thickness[i] = 2000.0
1088 else:
1089- md.geometry.thickness[i] = 1.0 # non-zero thickness
1090+ md.geometry.thickness[i] = 0
1091
1092 md.geometry.thickness = md.geometry.thickness.reshape(-1, 1)
1093 md.geometry.base = np.zeros((md.mesh.numberofvertices, 1))
1094Index: ../trunk-jpl/test/Par/GiaIvinsBenchmarksCD.py
1095===================================================================
1096--- ../trunk-jpl/test/Par/GiaIvinsBenchmarksCD.py (revision 25299)
1097+++ ../trunk-jpl/test/Par/GiaIvinsBenchmarksCD.py (revision 25300)
1098@@ -1,5 +1,4 @@
1099 #Geometry specific to Experiments C and D
1100-
1101 import inspect
1102 import os.path
1103
1104@@ -22,7 +21,7 @@
1105 if (dist <= rad):
1106 md.geometry.thickness[i] = 3000.0
1107 else:
1108- md.geometry.thickness[i] = 1.0 # non - zero thickness
1109+ md.geometry.thickness[i] = 0
1110
1111 md.geometry.thickness = md.geometry.thickness.reshape(-1, 1)
1112 md.geometry.base = np.zeros((md.mesh.numberofvertices, 1))
1113Index: ../trunk-jpl/test/NightlyRun/test2001.py
1114===================================================================
1115--- ../trunk-jpl/test/NightlyRun/test2001.py (revision 25299)
1116+++ ../trunk-jpl/test/NightlyRun/test2001.py (revision 25300)
1117@@ -31,11 +31,13 @@
1118 #Define loading history (see test2001.m for the description)
1119 md.timestepping.start_time = 2400000 # 2, 400 kyr
1120 md.timestepping.final_time = 2500000 # 2, 500 kyr
1121-md.geometry.thickness = np.vstack((np.hstack((md.geometry.thickness * 0.0, 0.0)),
1122- np.hstack((md.geometry.thickness / 2.0, 0.1)),
1123- np.hstack((md.geometry.thickness, 0.2)),
1124- np.hstack((md.geometry.thickness, 1.0)),
1125- np.hstack((md.geometry.thickness, md.timestepping.start_time)))).T
1126+md.geometry.thickness = np.array([
1127+ np.append(md.geometry.thickness * 0.0, 0.0),
1128+ np.append(md.geometry.thickness / 2.0, 0.1),
1129+ np.append(md.geometry.thickness, 0.2),
1130+ np.append(md.geometry.thickness, 1.0),
1131+ np.append(md.geometry.thickness, md.timestepping.start_time)
1132+ ]).T
1133
1134 #Solve for GIA deflection
1135 md.cluster = generic('name', gethostname(), 'np', 3)
1136Index: ../trunk-jpl/test/NightlyRun/test2051.m
1137===================================================================
1138--- ../trunk-jpl/test/NightlyRun/test2051.m (revision 25299)
1139+++ ../trunk-jpl/test/NightlyRun/test2051.m (revision 25300)
1140@@ -23,7 +23,7 @@
1141
1142 % find out elements that have zero loads throughout the loading history.
1143 pos = find(sum(abs(md.geometry.thickness(1:end-1,:)),2)==0);
1144-md.mask.ice_levelset(pos)=1; % no-ice.
1145+md.mask.ice_levelset(pos)=1; % no ice
1146
1147 md.cluster=generic('name',oshostname(),'np',3);
1148 md.verbose=verbose('1111111');
1149@@ -37,8 +37,8 @@
1150
1151 %Test Name: GiaIvinsBenchmarksAB2dA2
1152 %% different evaluation time. {{{
1153-md.timestepping.start_time=2005100; % after 5 kyr of deglaciation
1154-md.geometry.thickness(end,end) = md.timestepping.start_time;
1155+md.timestepping.start_time=2005100; % after 5 kyr of deglaciation
1156+md.geometry.thickness(end,end) = md.timestepping.start_time;
1157
1158 md=solve(md,'Gia');
1159
1160Index: ../trunk-jpl/test/NightlyRun/test2053.m
1161===================================================================
1162--- ../trunk-jpl/test/NightlyRun/test2053.m (revision 25299)
1163+++ ../trunk-jpl/test/NightlyRun/test2053.m (revision 25300)
1164@@ -8,7 +8,7 @@
1165 md.gia.cross_section_shape=2; % for elliptical edge
1166
1167 % evaluation time (termed start_time)
1168-md.timestepping.start_time=0.3; % for t \approx 0 kyr : to get eleastic response!
1169+md.timestepping.start_time=0.3; % for t \approx 0 kyr : to get elastic response!
1170 md.timestepping.final_time=2500000; % 2,500 kyr
1171
1172 %% define loading history {{{
1173@@ -22,7 +22,7 @@
1174
1175 % find out elements that have zero loads throughout the loading history.
1176 pos = find(sum(abs(md.geometry.thickness(1:end-1,:)),2)==0);
1177-md.mask.ice_levelset(pos)=1; % no-ice.
1178+md.mask.ice_levelset(pos)=1; % no ice
1179
1180 md.cluster=generic('name',oshostname(),'np',3);
1181 md.verbose=verbose('1111111');
1182Index: ../trunk-jpl/test/NightlyRun/test2051.py
1183===================================================================
1184--- ../trunk-jpl/test/NightlyRun/test2051.py (revision 25299)
1185+++ ../trunk-jpl/test/NightlyRun/test2051.py (revision 25300)
1186@@ -1,4 +1,4 @@
1187-#Test Name: GiaIvinsBenchmarksAB2dA1
1188+#Test Name: GiaIvinsBenchmarksAB2dA
1189 from socket import gethostname
1190
1191 import numpy as np
1192@@ -16,23 +16,58 @@
1193 md = parameterize(md, '../Par/GiaIvinsBenchmarksAB.py')
1194
1195 # indicate what you want to compute
1196-md.gia.cross_section_shape = 1 # for square-edged x - section
1197+md.gia.cross_section_shape = 1 # for square-edged x-section
1198
1199-# define loading history
1200+# evaluation time (termed start_time)
1201 md.timestepping.start_time = 2002100 # after 2 kyr of deglaciation
1202-md.timestepping.final_time = 2500000 # 2, 500 kyr
1203-md.geometry.thickness = np.array([np.append(md.geometry.thickness * 0.0, 0.0),
1204- np.append(md.geometry.thickness, 1000),
1205- np.append(md.geometry.thickness, 2000000),
1206- np.append(md.geometry.thickness * 0.0, 2000100),
1207- np.append(md.geometry.thickness * 0.0, md.timestepping.start_time)]).T
1208+md.timestepping.final_time = 2500000 # 2,500 kyr
1209
1210-# solve for GIA deflection
1211+# define loading history
1212+md.geometry.thickness = np.array([
1213+ np.append(md.geometry.thickness * 0.0, 0.0),
1214+ np.append(md.geometry.thickness, 1000),
1215+ np.append(md.geometry.thickness, 2000000),
1216+ np.append(md.geometry.thickness * 0.0, 2000100),
1217+ np.append(md.geometry.thickness * 0.0, md.timestepping.start_time)
1218+ ]).T
1219+
1220+# find out the elements that have zero loads throughout the loading history
1221+pos = np.where(np.abs(md.geometry.thickness[0:-2, :].sum(axis=1)) == 0)[0]
1222+md.mask.ice_levelset[pos] = 1 # no ice
1223+
1224 md.cluster = generic('name', gethostname(), 'np', 3)
1225 md.verbose = verbose('1111111')
1226+
1227+# solve for GIA deflection
1228 md = solve(md, 'Gia')
1229
1230-#Fields and tolerances to track changes
1231-field_names = ['UGia', 'UGiaRate']
1232-field_tolerances = [1e-13, 1e-13]
1233-field_values = [md.results.GiaSolution.UGia, md.results.GiaSolution.UGiaRate]
1234+# Test Name: GiaIvinsBenchmarksAB2dA1
1235+U_AB2dA1 = md.results.GiaSolution.UGia
1236+URate_AB2dA1 = md.results.GiaSolution.UGiaRate
1237+
1238+# Test Name: GiaIvinsBenchmarksAB2dA2
1239+# different evaluation time # {{{
1240+md.timestepping.start_time = 2005100 # after 5 kyr of deglaciation
1241+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1242+
1243+md = solve(md, 'Gia')
1244+
1245+U_AB2dA2 = md.results.GiaSolution.UGia
1246+URate_AB2dA2 = md.results.GiaSolution.UGiaRate
1247+# }}}
1248+
1249+# Test Name: GiaIvinsBenchmarksAB2dA3
1250+# different evaluation time # {{{
1251+md.timestepping.start_time = 2010100 # after 10 kyr of deglaciation
1252+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1253+
1254+md = solve(md, 'Gia')
1255+
1256+U_AB2dA3 = md.results.GiaSolution.UGia
1257+URate_AB2dA3 = md.results.GiaSolution.UGiaRate
1258+# }}}
1259+
1260+# Fields and tolerances to track changes
1261+field_names = ['U_AB2dA1','URate_AB2dA1','U_AB2dA2','URate_AB2dA2','U_AB2dA3','URate_AB2dA3']
1262+field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13]
1263+field_values = [U_AB2dA1, URate_AB2dA1, U_AB2dA2, URate_AB2dA2, U_AB2dA3, URate_AB2dA3]
1264Index: ../trunk-jpl/test/NightlyRun/test2052.py
1265===================================================================
1266--- ../trunk-jpl/test/NightlyRun/test2052.py (revision 25299)
1267+++ ../trunk-jpl/test/NightlyRun/test2052.py (revision 25300)
1268@@ -1,4 +1,4 @@
1269-#Test Name: GiaIvinsBenchmarksAB2dC1
1270+#Test Name: GiaIvinsBenchmarksAB2dC
1271 from socket import gethostname
1272
1273 import numpy as np
1274@@ -10,28 +10,63 @@
1275 from triangle import *
1276
1277
1278-#Benchmark experiments (Figure A2c Ivins and James, 1999, Geophys. J. Int.)
1279-md = triangle(model(), '../Exp/RoundFrontEISMINT.exp', 200000)
1280+# Benchmark experiments (Figure A2a Ivins and James, 1999, Geophys. J. Int.)
1281+md = triangle(model(), '../Exp/RoundFrontEISMINT.exp', 200000.)
1282 md = setmask(md, '', '')
1283 md = parameterize(md, '../Par/GiaIvinsBenchmarksCD.py')
1284
1285-#indicate what you want to compute
1286+# indicate what you want to compute
1287 md.gia.cross_section_shape = 1 # for square-edged x-section
1288
1289-#define loading history
1290-md.timestepping.start_time = 0.3 # for t \approx 0 kyr : to get eleastic response!
1291+# evaluation time (termed start_time)
1292+md.timestepping.start_time = 0.3 # for t \approx 0 kyr : to get elastic response!
1293 md.timestepping.final_time = 2500000 # 2,500 kyr
1294-md.geometry.thickness = np.array([np.append(md.geometry.thickness * 0.0, 0.0),
1295- np.append(md.geometry.thickness / 2.0, 0.1),
1296- np.append(md.geometry.thickness, 0.2),
1297- np.append(md.geometry.thickness, md.timestepping.start_time)]).T
1298
1299-#solve for GIA deflection
1300+# define loading history
1301+md.geometry.thickness = np.array([
1302+ np.append(md.geometry.thickness * 0.0, 0.0),
1303+ np.append(md.geometry.thickness / 2.0, 0.1),
1304+ np.append(md.geometry.thickness, 0.2),
1305+ np.append(md.geometry.thickness, md.timestepping.start_time)
1306+ ]).T
1307+
1308+# find out elements that have zero loads throughout the loading history
1309+pos = np.where(np.abs(md.geometry.thickness[0:-2, :].sum(axis=1)) == 0)[0]
1310+md.mask.ice_levelset[pos] = 1 # no ice
1311+
1312 md.cluster = generic('name', gethostname(), 'np', 3)
1313 md.verbose = verbose('1111111')
1314+
1315+# solve for GIA deflection
1316 md = solve(md, 'Gia')
1317
1318-#Fields and tolerances to track changes
1319-field_names = ['UGia', 'UGiaRate']
1320-field_tolerances = [1e-13, 1e-13]
1321-field_values = [md.results.GiaSolution.UGia, md.results.GiaSolution.UGiaRate]
1322+# Test Name: GiaIvinsBenchmarksAB2dC1
1323+U_AB2dC1 = md.results.GiaSolution.UGia
1324+URate_AB2dC1 = md.results.GiaSolution.UGiaRate
1325+
1326+# Test Name: GiaIvinsBenchmarksAB2dC2
1327+# different evaluation time # {{{
1328+md.timestepping.start_time = 1000.3 # for t \approx 1 kyr
1329+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1330+
1331+md = solve(md, 'Gia')
1332+
1333+U_AB2dC2 = md.results.GiaSolution.UGia
1334+URate_AB2dC2 = md.results.GiaSolution.UGiaRate
1335+# }}}
1336+
1337+# Test Name: GiaIvinsBenchmarksAB2dC3
1338+# different evaluation time # {{{
1339+md.timestepping.start_time = 2400000 # for t \approx \infty
1340+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1341+
1342+md = solve(md, 'Gia')
1343+
1344+U_AB2dC3 = md.results.GiaSolution.UGia
1345+URate_AB2dC3 = md.results.GiaSolution.UGiaRate
1346+# }}}
1347+
1348+# Fields and tolerances to track changes
1349+field_names = ['U_AB2dC1', 'URate_AB2dC1', 'U_AB2dC2', 'URate_AB2dC2', 'U_AB2dC3', 'URate_AB2dC3']
1350+field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13]
1351+field_values = [U_AB2dC1, URate_AB2dC1, U_AB2dC2, URate_AB2dC2, U_AB2dC3, URate_AB2dC3]
1352Index: ../trunk-jpl/test/NightlyRun/test2053.py
1353===================================================================
1354--- ../trunk-jpl/test/NightlyRun/test2053.py (revision 25299)
1355+++ ../trunk-jpl/test/NightlyRun/test2053.py (revision 25300)
1356@@ -1,4 +1,4 @@
1357-#Test Name: GiaIvinsBenchmarksAB2dD1
1358+#Test Name: GiaIvinsBenchmarksAB2dD
1359 from socket import gethostname
1360
1361 import numpy as np
1362@@ -10,28 +10,64 @@
1363 from triangle import *
1364
1365
1366-#Benchmark experiments (Figure A2c Ivins and James, 1999, Geophys. J. Int.)
1367+# Benchmark experiments (Figure A2a Ivins and James, 1999, Geophys. J. Int.)
1368 md = triangle(model(), '../Exp/RoundFrontEISMINT.exp', 200000)
1369 md = setmask(md, '', '')
1370 md = parameterize(md, '../Par/GiaIvinsBenchmarksCD.py')
1371
1372-#indicate what you want to compute
1373-md.gia.cross_section_shape = 2 # for square-edged x - section
1374+# indicate what you want to compute
1375+md.gia.cross_section_shape = 2 # for elliptical edge
1376
1377-#define loading history
1378-md.timestepping.start_time = 0.3 # for t \approx 0 kyr : to get eleastic response!
1379-md.timestepping.final_time = 2500000 # 2, 500 kyr
1380-md.geometry.thickness = np.array([np.append(md.geometry.thickness * 0.0, 0.0),
1381- np.append(md.geometry.thickness / 2.0, 0.1),
1382- np.append(md.geometry.thickness, 0.2),
1383- np.append(md.geometry.thickness, md.timestepping.start_time)]).T
1384+# evaluation time (termed start_time)
1385+md.timestepping.start_time = 0.3 # for t \approx 0 kyr : to get elastic response!
1386+md.timestepping.final_time = 2500000 # 2,500 kyr
1387
1388-#solve for GIA deflection
1389+# define loading history
1390+md.geometry.thickness = np.array([
1391+ np.append(md.geometry.thickness * 0.0, 0.0),
1392+ np.append(md.geometry.thickness / 2.0, 0.1),
1393+ np.append(md.geometry.thickness, 0.2),
1394+ np.append(md.geometry.thickness, md.timestepping.start_time)
1395+ ]).T
1396+
1397+# find out elements that have zero loads throughout the loading history
1398+pos = np.where(np.abs(md.geometry.thickness[0:-2, :].sum(axis=1)) == 0)[0]
1399+md.mask.ice_levelset[pos] = 1 # no ice
1400+
1401 md.cluster = generic('name', gethostname(), 'np', 3)
1402 md.verbose = verbose('1111111')
1403+
1404+# solve for GIA deflection
1405 md = solve(md, 'Gia')
1406
1407-#Fields and tolerances to track changes
1408-field_names = ['UGia', 'UGiaRate']
1409-field_tolerances = [1e-13, 1e-13]
1410-field_values = [md.results.GiaSolution.UGia, md.results.GiaSolution.UGiaRate]
1411+# Test Name: GiaIvinsBenchmarksAB2dD1
1412+U_AB2dD1 = md.results.GiaSolution.UGia
1413+URate_AB2dD1 = md.results.GiaSolution.UGiaRate
1414+
1415+# Test Name: GiaIvinsBenchmarksAB2dD2
1416+# different evaluation time # {{{
1417+md.timestepping.start_time = 1000.3 # for t \approx 1 kyr
1418+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1419+
1420+md = solve(md, 'Gia')
1421+
1422+U_AB2dD2 = md.results.GiaSolution.UGia
1423+URate_AB2dD2 = md.results.GiaSolution.UGiaRate
1424+# }}}
1425+
1426+# Test Name: GiaIvinsBenchmarksAB2dD3
1427+# different evaluation time # {{{
1428+md.timestepping.start_time = 2400000 # for t \approx \infty
1429+md.geometry.thickness[-1, -1] = md.timestepping.start_time
1430+
1431+md = solve(md, 'Gia')
1432+
1433+U_AB2dD3 = md.results.GiaSolution.UGia
1434+URate_AB2dD3 = md.results.GiaSolution.UGiaRate
1435+# }}}
1436+
1437+# Fields and tolerances to track changes
1438+field_names = ['U_AB2dD1', 'URate_AB2dD1', 'U_AB2dD2', 'URate_AB2dD2', 'U_AB2dD3', 'URate_AB2dD3']
1439+field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13, 1e-13, 1e-13]
1440+field_values = [U_AB2dD1, URate_AB2dD1, U_AB2dD2, URate_AB2dD2, U_AB2dD3, URate_AB2dD3]
1441+
1442Index: ../trunk-jpl/src/m/solve/WriteData.py
1443===================================================================
1444--- ../trunk-jpl/src/m/solve/WriteData.py (revision 25299)
1445+++ ../trunk-jpl/src/m/solve/WriteData.py (revision 25300)
1446@@ -1,3 +1,4 @@
1447+from copy import deepcopy
1448 from struct import pack, error
1449 import numpy as np
1450 import pairoptions
1451@@ -38,6 +39,10 @@
1452 # data = full(data)
1453 # end
1454
1455+ # Always make a copy of the the data so that we do not accidently overwrite
1456+ # any model fields.
1457+ data = deepcopy(data)
1458+
1459 #Scale data if necesarry
1460 if options.exist('scale'):
1461 data = np.array(data)
1462@@ -147,7 +152,6 @@
1463 # }}}
1464
1465 elif datatype == 'DoubleMat': # {{{
1466-
1467 if isinstance(data, (bool, int, float)):
1468 data = np.array([data])
1469 elif isinstance(data, (list, tuple)):
1470@@ -170,7 +174,7 @@
1471 try:
1472 fid.write(pack('q', recordlength))
1473 except error as Err:
1474- raise ValueError('Field {} can not be marshaled, {}, with "number" the lenght of the record.'.format(name, Err))
1475+ raise ValueError('Field {} can not be marshaled, {}, with "number" the length of the record.'.format(name, Err))
1476
1477 #write data code and matrix type:
1478 fid.write(pack('i', FormatToCode(datatype)))
1479Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.py
1480===================================================================
1481--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.py (revision 25299)
1482+++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.py (revision 25300)
1483@@ -17,7 +17,7 @@
1484 try:
1485 fid = open(filename, 'rb')
1486 except IOError as e:
1487- raise IOError("loadresultsfromdisk error message: could not open '{}' for binary reading.".format(filename))
1488+ raise IOError("parseresultsfromdisk error message: could not open {} for binary reading".format(filename))
1489
1490 #initialize results:
1491 saveres = []
1492@@ -242,16 +242,39 @@
1493 nlayer = md.materials.numlayers
1494 degmax = md.love.sh_nmax
1495 nfreq = md.love.nfreq
1496- #for numpy 1.8 + only
1497- #temp_field = np.full((degmax + 1, nfreq, nlayer + 1, 6), 0.0)
1498+ r0 = md.love.r0
1499+ g0 = md.love.g0
1500+ mu0 = md.love.mu0
1501+ rr = md.materials.radius
1502+ rho = md.materials.density
1503+ rho_avg = (rho * np.diff(np.power(rr, 3), n=1, axis=0)) / np.diff(np.power(rr, 3).sum()).sum()
1504 temp_field = np.empty((degmax + 1, nfreq, nlayer + 1, 6))
1505 temp_field.fill(0.0)
1506 for ii in range(degmax + 1):
1507 for jj in range(nfreq):
1508 for kk in range(nlayer + 1):
1509- ll = ii * (nlayer + 1) * 6 + (kk * 6 + 1)
1510- for mm in range(6):
1511- temp_field[ii, jj, kk, mm] = field[ll + mm - 1, jj]
1512+ if kk < nlayer + 1:
1513+ ll = ii * (nlayer + 1) * 6 + (kk * 6 + 1) + 3
1514+ temp_field[ii, jj, kk, 0] = field[ll + (1 - 1), jj] * r0 # mm = 4
1515+ temp_field[ii, jj, kk, 1] = field[ll + (2 - 1), jj] * mu0 # mm = 5
1516+ temp_field[ii, jj, kk, 2] = field[ll + (3 - 1), jj] * r0 # mm = 6
1517+ temp_field[ii, jj, kk, 3] = field[ll + (4 - 1), jj] * mu0 # mm = 1
1518+ temp_field[ii, jj, kk, 4] = field[ll + (5 - 1), jj] * r0 * g0 # mm = 2
1519+ temp_field[ii, jj, kk, 5] = field[ll + (6 - 1), jj] * g0 # mm = 3
1520+ print(temp_field)
1521+ else: # surface
1522+ ll = ii * (nlayer + 1) * 6 - 2
1523+ temp_field[ii, jj, kk, 0] = field[ll + (1 - 1), jj] * r0
1524+ temp_field[ii, jj, kk, 2] = field[ll + (2 - 1), jj] * r0
1525+ temp_field[ii, jj, kk, 4] = field[ll + (3 - 1), jj] * r0 * g0
1526+ # surface BC
1527+ temp_field[ii, jj, kk, 3] = 0
1528+ if md.love.forcing_type == 9:
1529+ temp_field[ii, jj, kk, 1] = 0
1530+ temp_field[ii, jj, kk, 5] = (2 * ii - 1) / r0 - ii * field[ll + (3 - 1), jj] * g0
1531+ elif md.love.forcing_type == 11:
1532+ temp_field[ii, jj, kk, 1] = -(2 * (ii - 1) + 1) * rho_avg / 3
1533+ temp_field[ii, jj, kk, 5] = (2 * ii - 1) / r0 - ii * field[ll + (3 - 1), jj] * g0
1534 field = temp_field
1535
1536 if time != -9999:
1537Index: ../trunk-jpl/src/m/solve/parseresultsfromdisk.m
1538===================================================================
1539--- ../trunk-jpl/src/m/solve/parseresultsfromdisk.m (revision 25299)
1540+++ ../trunk-jpl/src/m/solve/parseresultsfromdisk.m (revision 25300)
1541@@ -270,7 +270,6 @@
1542 end
1543 result.step=step;
1544 result.field=field;
1545-
1546 end
1547 % }}}
1548 function result=ReadDataDimensions(fid) % {{{
1549Index: ../trunk-jpl/src/m/solve/marshall.py
1550===================================================================
1551--- ../trunk-jpl/src/m/solve/marshall.py (revision 25299)
1552+++ ../trunk-jpl/src/m/solve/marshall.py (revision 25300)
1553@@ -5,11 +5,11 @@
1554 '''
1555 MARSHALL - outputs a compatible binary file from @model md, for certain solution type.
1556
1557- The routine creates a compatible binary file from @model md
1558- This binary file will be used for parallel runs in JPL - package
1559+ The routine creates a compatible binary file from @model md
1560+ This binary file will be used for parallel runs in JPL-package
1561
1562- Usage:
1563- marshall(md)
1564+ Usage:
1565+ marshall(md)
1566 '''
1567 if md.verbose.solution:
1568 print("marshalling file {}.bin".format(md.miscellaneous.name))
1569Index: ../trunk-jpl/src/m/classes/geometry.m
1570===================================================================
1571--- ../trunk-jpl/src/m/classes/geometry.m (revision 25299)
1572+++ ../trunk-jpl/src/m/classes/geometry.m (revision 25300)
1573@@ -89,8 +89,11 @@
1574
1575 end % }}}
1576 function marshall(self,prefix,md,fid) % {{{
1577+ disp(md.geometry.thickness)
1578 WriteData(fid,prefix,'object',self,'fieldname','surface','format','DoubleMat','mattype',1);
1579 WriteData(fid,prefix,'object',self,'fieldname','thickness','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts);
1580+ disp(md.geometry.thickness)
1581+ pause
1582 WriteData(fid,prefix,'object',self,'fieldname','base','format','DoubleMat','mattype',1);
1583 WriteData(fid,prefix,'object',self,'fieldname','bed','format','DoubleMat','mattype',1);
1584 WriteData(fid,prefix,'object',self,'fieldname','hydrostatic_ratio','format','DoubleMat','mattype',1);
1585Index: ../trunk-jpl/test/NightlyRun/test2052.m
1586===================================================================
1587--- ../trunk-jpl/test/NightlyRun/test2052.m (revision 25299)
1588+++ ../trunk-jpl/test/NightlyRun/test2052.m (revision 25300)
1589@@ -8,7 +8,7 @@
1590 md.gia.cross_section_shape=1; % for square-edged x-section
1591
1592 % evaluation time (termed start_time)
1593-md.timestepping.start_time=0.3; % for t \approx 0 kyr : to get eleastic response!
1594+md.timestepping.start_time=0.3; % for t \approx 0 kyr: to get elastic response!
1595 md.timestepping.final_time=2500000; % 2,500 kyr
1596
1597 %% define loading history {{{
1598@@ -22,7 +22,7 @@
1599
1600 % find out elements that have zero loads throughout the loading history.
1601 pos = find(sum(abs(md.geometry.thickness(1:end-1,:)),2)==0);
1602-md.mask.ice_levelset(pos)=1; % no-ice.
1603+md.mask.ice_levelset(pos)=1; % no ice
1604
1605 md.cluster=generic('name',oshostname(),'np',3);
1606 md.verbose=verbose('1111111');
1607@@ -30,9 +30,11 @@
1608 %% solve for GIA deflection
1609 md=solve(md,'Gia');
1610
1611+pause
1612+
1613 %Test Name: GiaIvinsBenchmarksAB2dC1
1614 U_AB2dC1 = md.results.GiaSolution.UGia;
1615-URate_AB2dC1 = md.results.GiaSolution.UGiaRate;
1616+URate_AB2dC1 = md.results.GiaSolution.UGiaRate;
1617
1618 %Test Name: GiaIvinsBenchmarksAB2dC2
1619 %% different evaluation time. {{{
Note: See TracBrowser for help on using the repository browser.