Changeset 25161
- Timestamp:
- 06/25/20 21:09:13 (5 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/boundaryconditions/getlovenumbers.py
r25158 r25161 10047 10047 #cut off series at maxdeg 10048 10048 love_numbers = np.delete(love_numbers, range(maxdeg + 1, len(love_numbers)), axis=0) 10049 # print(len(love_numbers))10050 # print(love_numbers[-1,:])10051 # exit()10052 10049 10053 10050 #retrieve right type -
issm/trunk-jpl/src/m/classes/friction.m
r24666 r25161 1 1 %FRICTION class definition 2 2 % 3 % 4 % 3 % Usage: 4 % friction=friction(); 5 5 6 6 classdef friction -
issm/trunk-jpl/src/m/classes/friction.py
r24668 r25161 1 from checkfield import checkfield 1 2 from fielddisplay import fielddisplay 2 3 from project3d import project3d 3 from checkfield import checkfield4 4 from WriteData import WriteData 5 5 6 6 7 7 class friction(object): 8 """8 ''' 9 9 FRICTION class definition 10 10 11 Usage:12 friction = friction()13 """11 Usage: 12 friction = friction() 13 ''' 14 14 15 15 def __init__(self): # {{{ … … 22 22 #set defaults 23 23 self.setdefaultparameters() 24 self.requested_outputs = []24 #self.requested_outputs = [] 25 25 #}}} 26 26 … … 34 34 string = "%s\n%s" % (string, fielddisplay(self, 'effective_pressure', 'Effective Pressure for the forcing if not coupled [Pa]')) 35 35 string = "%s\n%s" % (string, fielddisplay(self, 'effective_pressure_limit', 'Neff do not allow to fall below a certain limit: effective_pressure_limit * rho_ice * g * thickness (default 0)')) 36 string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested'))36 #string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 37 37 return string 38 38 #}}} … … 51 51 52 52 def setdefaultparameters(self): # {{{ 53 self.requested_outputs = ['default']53 #self.requested_outputs = ['default'] 54 54 self.effective_pressure_limit = 0 55 55 return self … … 62 62 63 63 def checkconsistency(self, md, solution, analyses): # {{{ 64 65 64 #Early return 66 65 if 'StressbalanceAnalysis' not in analyses and 'ThermalAnalysis' not in analyses: … … 76 75 elif self.coupling > 4: 77 76 raise ValueError('md.friction.coupling larger than 4, not supported yet') 78 md = checkfield(md, 'fieldname', 'friction.requested_outputs', 'stringrow', 1)77 #md = checkfield(md, 'fieldname', 'friction.requested_outputs', 'stringrow', 1) 79 78 return md 80 79 # }}} … … 94 93 raise ValueError('md.friction.coupling larger than 4, not supported yet') 95 94 96 # process requested outputs97 outputs = self.requested_outputs98 indices = [i for i, x in enumerate(outputs) if x == 'default']99 if len(indices) > 0:100 outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:]101 outputs = outputscopy102 WriteData(fid, prefix, 'data', outputs, 'name', 'md.friction.requested_outputs', 'format', 'StringArray')95 # #process requested outputs 96 # outputs = self.requested_outputs 97 # indices = [i for i, x in enumerate(outputs) if x == 'default'] 98 # if len(indices) > 0: 99 # outputscopy = outputs[0:max(0, indices[0] - 1)] + self.defaultoutputs(md) + outputs[indices[0] + 1:] 100 # outputs = outputscopy 101 # WriteData(fid, prefix, 'data', outputs, 'name', 'md.friction.requested_outputs', 'format', 'StringArray') 103 102 # }}} -
issm/trunk-jpl/src/m/classes/model.py
r25158 r25161 148 148 'initialization', 149 149 'rifts', 150 'dsl', 150 151 'solidearth', 151 'dsl',152 152 'debug', 153 153 'verbose', -
issm/trunk-jpl/src/m/classes/solidearth.py
r25160 r25161 88 88 outputs = self.requested_outputs 89 89 pos = np.where(np.asarray(outputs) == 'default')[0] 90 for i in pos: 91 outputs[i] = '' #remove 'default' from outputs 92 outputs.extend(self.defaultoutputs(md)) #add defaults 93 90 if len(pos): 91 outputs = np.delete(outputs, pos) #remove 'default' from outputs 92 outputs = np.append(outputs, self.defaultoutputs(md)) #add defaults 94 93 WriteData(fid, prefix, 'data', outputs, 'name', 'md.solidearth.requested_outputs', 'format', 'StringArray') 95 94 #}}} -
issm/trunk-jpl/src/m/coordsystems/gmtmask.py
r25011 r25161 1 from MatlabFuncs import *2 from model import *3 import numpy as np4 1 from os import getenv, putenv 5 2 import subprocess 6 3 4 import numpy as np 7 5 8 def gmtmask(lat, long, *varargin): 9 '''GMTMASK - figure out which lat, long points are on the ocean 6 from MatlabFuncs import * 7 from model import * 10 8 11 Usage: 12 mask.ocean = gmtmask(md.mesh.lat, md.mesh.long) 9 10 def gmtmask(lat, long, *args): 11 ''' 12 GMTMASK - figure out which lat, long points are on the ocean 13 14 Usage: 15 mask.ocean = gmtmask(md.mesh.lat, md.mesh.long) 13 16 ''' 14 17 lenlat = len(lat) … … 16 19 17 20 #are we doing a recursive call? 18 if len( varargin) == 3:21 if len(args) == 3: 19 22 recursive = 1 20 23 else: … … 24 27 print((' recursing: num vertices #' + str(lenlat))) 25 28 else: 26 print(('gmtmask: num vertices #' + str(lenlat)))29 print(('gmtmask: num vertices ' + str(lenlat))) 27 30 28 #Check lat and long size is not more than 50, 000 If so, recursively call gmtmask: 29 31 #Check lat and long size is not more than 50,000. If so, recursively call gmtmask: 30 32 if lenlat > 50000: 31 33 for i in range(int(ceil(lenlat / 50000))): -
issm/trunk-jpl/src/m/solve/marshall.m
r21097 r25161 34 34 35 35 %Marshall current object 36 %disp(['marshalling ' field '...']); 36 %disp(['marshalling ' field '...']); %Uncomment for debugging 37 37 marshall(md.(field),['md.' field],md,fid); 38 38 end -
issm/trunk-jpl/src/m/solve/marshall.py
r25158 r25161 13 13 ''' 14 14 if md.verbose.solution: 15 print( ("marshalling file '%s.bin'." %md.miscellaneous.name))15 print("marshalling file {}.bin".format(md.miscellaneous.name)) 16 16 17 17 #open file for binary writing -
issm/trunk-jpl/src/m/solve/solve.m
r24541 r25161 151 151 return; 152 152 end 153 153 154 %wait on lock 154 155 if isnan(md.settings.waitonlock), -
issm/trunk-jpl/test/NightlyRun/test2002.m
r25147 r25161 15 15 late=sum(md.mesh.lat(md.mesh.elements),2)/3; 16 16 longe=sum(md.mesh.long(md.mesh.elements),2)/3; 17 pos=find(late < -80);17 pos=find(late < -80); 18 18 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 19 19 %greenland 20 pos=find(late > 70 & late <80 & longe>-60 & longe<-30);20 pos=find(late>70 & late<80 & longe>-60 & longe<-30); 21 21 md.solidearth.surfaceload.icethicknesschange(pos)=-100; 22 22 … … 28 28 mask=gmtmask(md.mesh.lat,md.mesh.long); 29 29 icemask=ones(md.mesh.numberofvertices,1); 30 pos=find(mask==0); icemask(pos)=-1; 31 pos=find(sum(mask(md.mesh.elements),2)<3); icemask(md.mesh.elements(pos,:))=-1; 30 pos=find(mask==0); 31 icemask(pos)=-1; 32 pos=find(sum(mask(md.mesh.elements),2)<3); 33 icemask(md.mesh.elements(pos,:))=-1; 32 34 md.mask.ice_levelset=icemask; 33 35 md.mask.ocean_levelset=-icemask; -
issm/trunk-jpl/test/NightlyRun/test2003.m
r25147 r25161 3 3 %mesh earth: 4 4 md=model; 5 6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',1000.); %500 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',1000.); %1000 km resolution mesh 7 6 8 7 %parameterize slr solution: 9 %s lrloading: {{{8 %solidearth loading: {{{ 10 9 md.solidearth.surfaceload.icethicknesschange=zeros(md.mesh.numberofelements,1); 11 10 md.solidearth.sealevel=zeros(md.mesh.numberofvertices,1); … … 27 26 mask=gmtmask(md.mesh.lat,md.mesh.long); 28 27 icemask=ones(md.mesh.numberofvertices,1); 29 pos=find(mask==0); icemask(pos)=-1; 30 pos=find(sum(mask(md.mesh.elements),2)<3); icemask(md.mesh.elements(pos,:))=-1; 28 pos=find(mask==0); 29 icemask(pos)=-1; 30 pos=find(sum(mask(md.mesh.elements),2)<3); 31 icemask(md.mesh.elements(pos,:))=-1; 31 32 md.mask.ice_levelset=icemask; 32 33 md.mask.ocean_levelset=-icemask; … … 41 42 % }}} 42 43 43 % use model representation of oce a area (not the ture area)44 % use model representation of ocen area (not the true area) 44 45 md.solidearth.settings.ocean_area_scaling = 0; 45 46 … … 65 66 66 67 %eustatic + rigid + elastic run: 67 md.solidearth.settings.rigid=1; md.solidearth.settings.elastic=1; md.solidearth.settings.rotation=0; 68 md.solidearth.settings.rigid=1; 69 md.solidearth.settings.elastic=1; 70 md.solidearth.settings.rotation=0; 68 71 md.cluster=generic('name',oshostname(),'np',3); 69 72 %md.verbose=verbose('111111111'); … … 72 75 73 76 %eustatic + rigid + elastic + rotation run: 74 md.solidearth.settings.rigid=1; md.solidearth.settings.elastic=1; md.solidearth.settings.rotation=1; 77 md.solidearth.settings.rigid=1; 78 md.solidearth.settings.elastic=1; md.solidearth.settings.rotation=1; 75 79 md.cluster=generic('name',oshostname(),'np',3); 76 80 %md.verbose=verbose('111111111'); -
issm/trunk-jpl/test/NightlyRun/test2003.py
r25158 r25161 14 14 #mesh earth: 15 15 md = model() 16 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 1000.) # 500 km resolution mesh16 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 1000.) #1000 km resolution mesh 17 17 18 18 #parameterize solidearth solution: 19 19 #solidearth loading: {{{ 20 md.solidearth. deltathickness= np.zeros((md.mesh.numberofelements, ))20 md.solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, )) 21 21 md.solidearth.sealevel = np.zeros((md.mesh.numberofvertices, )) 22 22 md.dsl.global_average_thermosteric_sea_level_change=np.zeros((2, )) … … 30 30 longe = sum(md.mesh.long[md.mesh.elements - 1], 1) / 3 31 31 pos = np.intersect1d(np.array(np.where(late < -75)), np.array(np.where(longe < 0))) 32 md.solidearth. deltathickness[pos] = -132 md.solidearth.surfaceload.icethicknesschange[pos] = -1 33 33 34 34 #elastic loading from love numbers: … … 38 38 #mask: {{{ 39 39 mask = gmtmask(md.mesh.lat, md.mesh.long) 40 icemask = np.ones((md.mesh.numberofvertices, )) 41 pos = np.where(mask == 0) 42 #pos[0] because np.where(mask = 0) returns a 2d array, the latter parts of which are all array / s of 0s 43 icemask[pos[0]] = -1 44 pos = np.where(sum(mask[md.mesh.elements - 1], 1) < 3) 40 icemask = np.ones(md.mesh.numberofvertices) 41 pos = np.where(mask == 0)[0] 42 icemask[pos] = -1 43 pos = np.where(np.sum(mask[md.mesh.elements - 1], axis=1) < 3) 45 44 icemask[md.mesh.elements[pos, :] - 1] = -1 46 45 md.mask.ice_levelset = icemask 47 46 md.mask.ocean_levelset = -icemask 48 47 49 #make sure that the ice level set is all inclusive: 50 md.mask.land_levelset = np.zeros((md.mesh.numberofvertices, )) 51 md.mask.ocean_levelset = -np.ones((md.mesh.numberofvertices, )) 52 53 #make sure that the elements that have loads are fully grounded: 54 pos = np.nonzero(md.solidearth.deltathickness)[0] 48 #make sure that the elements that have loads are fully grounded 49 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 55 50 md.mask.ocean_levelset[md.mesh.elements[pos, :] - 1] = 1 56 51 57 52 #make sure wherever there is an ice load, that the mask is set to ice: 58 icemask[md.mesh.elements[pos, :] - 1] = -1 59 md.mask.ice_levelset = icemask53 #pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] # Do we need to do this twice? 54 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = 1 60 55 # }}} 61 56 62 # use model representation of oce a area (not the ture area)63 md.solidearth. ocean_area_scaling = 057 # use model representation of ocen area (not the true area) 58 md.solidearth.settings.ocean_area_scaling = 0 64 59 65 60 #geometry 66 61 di = md.materials.rho_ice / md.materials.rho_water 67 md.geometry.thickness = np.ones( (md.mesh.numberofvertices, ))68 md.geometry.surface = (1 - di) * np.zeros( (md.mesh.numberofvertices, ))62 md.geometry.thickness = np.ones(md.mesh.numberofvertices) 63 md.geometry.surface = (1 - di) * np.zeros(md.mesh.numberofvertices) 69 64 md.geometry.base = md.geometry.surface - md.geometry.thickness 70 65 md.geometry.bed = md.geometry.base … … 78 73 md.miscellaneous.name = 'test2003' 79 74 80 #New stuff81 md.solidearth.spcthickness = np.nan * np.ones((md.mesh.numberofvertices, ))82 md.solidearth.Ngia = np.zeros((md.mesh.numberofvertices, ))83 md.solidearth.Ugia = np.zeros((md.mesh.numberofvertices, ))84 md.solidearth.hydro_rate = np.zeros((md.mesh.numberofvertices, ))85 86 75 #Solution parameters 87 md.solidearth. reltol = float('NaN')88 md.solidearth. abstol = 1e-389 md.solidearth. geodetic= 176 md.solidearth.settings.reltol = np.nan 77 md.solidearth.settings.abstol = 1e-3 78 md.solidearth.settings.computesealevelchange = 1 90 79 91 80 #eustatic + rigid + elastic run: 92 md.solidearth. rigid = 193 md.solidearth. elastic = 194 md.solidearth. rotation = 081 md.solidearth.settings.rigid = 1 82 md.solidearth.settings.elastic = 1 83 md.solidearth.settings.rotation = 0 95 84 md.cluster = generic('name', gethostname(), 'np', 3) 96 85 #md.verbose = verbose('111111111') 97 #print md.calving98 #print md.gia99 #print md.love100 #print md.esa101 #print md.autodiff102 86 md = solve(md, 'Sealevelrise') 103 87 SnoRotation = md.results.SealevelriseSolution.Sealevel 104 88 105 89 #eustatic + rigid + elastic + rotation run: 106 md.solidearth. rigid = 1107 md.solidearth. elastic = 1108 md.solidearth. rotation = 190 md.solidearth.settings.rigid = 1 91 md.solidearth.settings.elastic = 1 92 md.solidearth.settings.rotation = 1 109 93 md.cluster = generic('name', gethostname(), 'np', 3) 110 94 #md.verbose = verbose('111111111')
Note:
See TracChangeset
for help on using the changeset viewer.