Changeset 26358
- Timestamp:
- 07/24/21 17:33:34 (4 years ago)
- Location:
- issm/trunk-jpl
- Files:
-
- 3 deleted
- 118 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/jenkins/pine_island-mac-solid_earth ¶
r26270 r26358 86 86 # - Excluding 2006 until it can be debugged (file I/O) 87 87 # 88 MATLAB_NROPTIONS="'benchmark','slc','exclude',[200 2 2003 2004 2005 2006 2007 2010 2011 2021 2051 2052 2053 2084 2085 21012424 2425]"89 PYTHON_NROPTIONS="--benchmark slc --exclude 200 2 2003 2004 2005 2006 2007 2010 2011 2021 2051 2052 2053 2084 2085 21012424 2425"88 MATLAB_NROPTIONS="'benchmark','slc','exclude',[2004 2006 2051 2052 2053 2084 2085 2424 2425]" 89 PYTHON_NROPTIONS="--benchmark slc --exclude 2004 2006 2051 2052 2053 2084 2085 2424 2425" -
TabularUnified issm/trunk-jpl/jenkins/ross-debian_linux-solid_earth ¶
r26270 r26358 86 86 # 87 87 # NOTE: 88 # - Tests 2002, 2003, 2005, 2010, 2101, and 2021 are excluded as Gmsh produces89 # different-sized meshes on macOS and Linux for 3d objects (archives are90 # generated on macOS).91 88 # - Excluding 2006 until it can be debugged (PETSc crash) 92 89 # 93 MATLAB_NROPTIONS="'benchmark','slc','exclude',[2004 200 5 2006 2007 2010 2011 2021 2051 2052 2053 2084 2085 21012424 2425]"94 PYTHON_NROPTIONS="--benchmark slc --exclude 2004 200 5 2006 2007 2010 2011 2021 2051 2052 2053 2084 2085 21012424 2425"90 MATLAB_NROPTIONS="'benchmark','slc','exclude',[2004 2006 2007 2051 2052 2053 2084 2085 2424 2425]" 91 PYTHON_NROPTIONS="--benchmark slc --exclude 2004 2006 2007 2051 2052 2053 2084 2085 2424 2425" -
TabularUnified issm/trunk-jpl/packagers/linux/package-issm-linux-binaries-matlab.sh ¶
r25902 r26358 30 30 LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself 31 31 LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it 32 MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,200 2,2003,2005,2006,2010,2020,2021,2051,2052,2053,2101,2102,3001:3200,3201,3202,3300,3480,3481,4001,4002,4003]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded32 MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2004,2006,2007,2011,2051,2052,2053,2084,2085,2424,2425,3001:3200,3201,3202,3300,3480,3481,4001,4002,4003]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded 33 33 MATLAB_PATH="/usr/local/MATLAB/R2019b" 34 34 -
TabularUnified issm/trunk-jpl/packagers/linux/package-issm-linux-binaries-python.sh ¶
r25902 r26358 30 30 LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself 31 31 LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it 32 PYTHON_NROPTIONS="--benchmark all --exclude 125 126 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 200 2 2003 2005 2006 2010 2020 2021 2051 2052 2053 2101 21023001:3200 3201 3202 3300 3480 3481 4001 4002 4003" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded32 PYTHON_NROPTIONS="--benchmark all --exclude 125 126 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 2004 2006 2007 2051 2052 2053 2084 2085 2424 2425 3001:3200 3201 3202 3300 3480 3481 4001 4002 4003" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded 33 33 34 34 ## Environment -
TabularUnified issm/trunk-jpl/packagers/mac/test-issm-mac-binaries-matlab.sh ¶
r25780 r26358 11 11 # 12 12 INSTALL_DIR=. 13 MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,200 6,2020,2021,2051,2052,2053,3001:3200,3201,3202,3300,3480,3481,4001,4002,4003]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded13 MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2004,2006,2051,2052,2053,2084,2085,2424,2425,3001:3200,3201,3202,3300,3480,3481,4001,4002,4003]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded 14 14 MATLAB_PATH="/Applications/MATLAB_R2018a.app" 15 15 PKG="ISSM-macOS-MATLAB" -
TabularUnified issm/trunk-jpl/packagers/mac/test-issm-mac-binaries-python.sh ¶
r25780 r26358 12 12 INSTALL_DIR=. 13 13 PKG="ISSM-macOS-Python" 14 PYTHON_NROPTIONS="--benchmark all --exclude 125 126 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 200 6 2020 2021 2051 2052 20533001:3200 3201 3202 3300 3480 3481 4001 4002 4003" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded14 PYTHON_NROPTIONS="--benchmark all --exclude 125 126 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 2004 2006 2007 2051 2052 2053 2084 2085 2424 2425 3001:3200 3201 3202 3300 3480 3481 4001 4002 4003" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded 15 15 16 16 COMPRESSED_PKG="${PKG}.zip" -
TabularUnified issm/trunk-jpl/src/m/archive/arch.py ¶
r24261 r26358 6 6 7 7 def archwrite(filename, *args): # {{{ 8 """ 9 ARCHWRITE - Write data to a field, given the file name, field name, and data. 10 11 8 """ARCHWRITE - Write data to a field, given the file name, field name, and data. 9 10 Usage: 11 archwrite('archive101.arch', 'variable_name', data) 12 12 """ 13 13 … … 45 45 46 46 def archread(filename, fieldname): # {{{ 47 """ 48 ARCHREAD - Given an arch file name, and a field name, find and return the data49 associated with that field name. 50 51 47 """ARCHREAD - Given an arch file name, and a field name, find and return 48 the data associated with that field name. 49 50 Usage: 51 archread('archive101.arch', 'field_var_1') 52 52 """ 53 53 try: … … 76 76 77 77 def archdisp(filename): # {{{ 78 """ 79 ARCHDISP - Given an arch filename, display the contents of that file 80 81 Usage: 82 archdisp('archive101.arch') 78 """ARCHDISP - Given an arch filename, display the contents of that file 79 80 Usage: 81 archdisp('archive101.arch') 83 82 """ 84 83 try: … … 97 96 print(('\t\tSize:\t\t{0}'.format(result['size']))) 98 97 print(('\t\tDatatype:\t{0}'.format(result['data_type']))) 99 # go to next result98 # go to next result 100 99 result = read_field(fid) 101 100 # close file … … 106 105 # Helper functions 107 106 def write_field_name(fid, data): # {{{ 108 """ 109 Routine to write field name (variable name) to an archive file. 107 """Routine to write field name (variable name) to an archive file. 110 108 """ 111 109 # write the length of the record … … 125 123 126 124 def write_scalar(fid, data): # {{{ 127 """ 128 Procedure to write a double to an arch file pointed to by fid 125 """Procedure to write a double to an arch file pointed to by fid 129 126 """ 130 127 # write length of record … … 141 138 142 139 def write_vector(fid, data): # {{{ 143 """ 144 Procedure to write a np.array to an arch file 140 """Procedure to write a np.array to an arch file 145 141 """ 146 142 # Make sure our vector is the correct shape. … … 161 157 reclen = 4 + 4 + 4 + 8 * sz[0] * sz[1] 162 158 # make sure we can fit data into file 163 if reclen > 2**31:159 if reclen > pow(2, 31): 164 160 raise ValueError("archwrite error : can not write vector to binary file because it is too large") 165 161 fid.write(struct.pack('>i', reclen)) … … 176 172 177 173 def read_field(fid): # {{{ 178 """ 179 Procedure to read a field and return a results list with the following attributes: 180 result['field_name'] -> the name of the variable that was just read 181 result['size'] -> size (dimensions) of the variable just read 182 result['data_type'] -> the type of data that was just read 183 result['data'] -> the actual data 174 """Procedure to read a field and return a results list with the following 175 attributes: 176 177 result['field_name'] -> the name of the variable that was just read 178 result['size'] -> size (dimensions) of the variable just read 179 result['data_type'] -> the type of data that was just read 180 result['data'] -> the actual data 184 181 """ 185 182 186 183 try: 187 184 # first, read the string 188 # first read the size and continue reading189 struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] # name length185 # first read the size and continue reading 186 struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] # name length 190 187 check_name = struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] 191 188 if check_name != 1: … … 194 191 fieldname = struct.unpack('>{}s'.format(namelen), fid.read(namelen))[0] 195 192 # then, read the data 196 # first read the size and continue reading197 struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] # data length193 # first read the size and continue reading 194 struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] # data length 198 195 data_type = struct.unpack('>i', fid.read(struct.calcsize('>i')))[0] 199 196 … … 235 232 236 233 237 def format_archive_code(format): # {{{ 238 """ 239 Given a variable, determine it's type and return 240 an integer value: 241 242 1 : string 243 2 : double (scalar) 244 3 : vector or matrix (of type double) 245 246 """ 247 if isinstance(format, str): 234 def format_archive_code(var): # {{{ 235 """Given a variable, determine it's type and return an integer value: 236 237 1 : string 238 2 : double (scalar) 239 3 : vector or matrix (of type double) 240 """ 241 if isinstance(var, str): 248 242 code = 1 249 elif format.shape[0] == 1 and format.shape[1] == 1:243 elif var.shape[0] == 1 and var.shape[1] == 1: 250 244 code = 2 251 elif isinstance( format, (list, tuple, np.ndarray)):245 elif isinstance(var, (list, tuple, np.ndarray)): 252 246 code = 3 253 247 else: 254 raise TypeError( "archwrite error: data type '%s' is not valid." % type(format))248 raise TypeError('archwrite error: data type {} is not valid.'.format(type(var))) 255 249 return code 256 250 # }}} -
TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py ¶
r26059 r26358 11 11 """ 12 12 13 # node on Dirichlet13 # node on Dirichlet 14 14 pos = np.nonzero(md.mesh.vertexonboundary) 15 md.stressbalance.spcvx = float('nan')* np.ones((md.mesh.numberofvertices))16 md.stressbalance.spcvy = float('nan')* np.ones((md.mesh.numberofvertices))17 md.stressbalance.spcvz = float('nan')* np.ones((md.mesh.numberofvertices))15 md.stressbalance.spcvx = np.nan * np.ones((md.mesh.numberofvertices)) 16 md.stressbalance.spcvy = np.nan * np.ones((md.mesh.numberofvertices)) 17 md.stressbalance.spcvz = np.nan * np.ones((md.mesh.numberofvertices)) 18 18 md.stressbalance.spcvx[pos] = 0 19 19 md.stressbalance.spcvy[pos] = 0 20 20 md.stressbalance.spcvz[pos] = 0 21 md.stressbalance.referential = float('nan')* np.ones((md.mesh.numberofvertices, 6))21 md.stressbalance.referential = np.nan * np.ones((md.mesh.numberofvertices, 6)) 22 22 md.stressbalance.loadingforce = 0 * np.ones((md.mesh.numberofvertices, 3)) 23 23 24 # Dirichlet Values24 # Dirichlet Values 25 25 if isinstance(md.inversion.vx_obs, np.ndarray) and np.size(md.inversion.vx_obs, axis=0) == md.mesh.numberofvertices and isinstance(md.inversion.vy_obs, np.ndarray) and np.size(md.inversion.vy_obs, axis=0) == md.mesh.numberofvertices: 26 print( " boundary conditions for stressbalance model: spc set as observed velocities")26 print(' boundary conditions for stressbalance model: spc set as observed velocities') 27 27 md.stressbalance.spcvx[pos] = md.inversion.vx_obs[pos] 28 28 md.stressbalance.spcvy[pos] = md.inversion.vy_obs[pos] 29 29 else: 30 print( " boundary conditions for stressbalance model: spc set as zero")30 print(' boundary conditions for stressbalance model: spc set as zero') 31 31 32 # No ice front -> do nothing32 # No ice front -> do nothing 33 33 34 # Initialize surface and basal forcings34 # Initialize surface and basal forcings 35 35 md.smb.initialize(md) 36 36 md.basalforcings.initialize(md) 37 37 38 # Initialize ocean forcings and sealevel38 # Initialize ocean forcings and sealevel 39 39 md.dsl.initialize(md) 40 40 41 # Deal with other boundary conditions41 # Deal with other boundary conditions 42 42 if np.all(np.isnan(md.balancethickness.thickening_rate)): 43 43 md.balancethickness.thickening_rate = np.zeros((md.mesh.numberofvertices)) 44 print( " no balancethickness.thickening_rate specified: values set as zero")45 md.masstransport.spcthickness = float('nan')* np.ones((md.mesh.numberofvertices))46 md.balancethickness.spcthickness = float('nan')* np.ones((md.mesh.numberofvertices))47 md.damage.spcdamage = float('nan')* np.ones((md.mesh.numberofvertices))44 print(' no balancethickness.thickening_rate specified: values set as zero') 45 md.masstransport.spcthickness = np.nan * np.ones((md.mesh.numberofvertices)) 46 md.balancethickness.spcthickness = np.nan * np.ones((md.mesh.numberofvertices)) 47 md.damage.spcdamage = np.nan * np.ones((md.mesh.numberofvertices)) 48 48 49 49 if isinstance(md.initialization.temperature, np.ndarray) and np.size(md.initialization.temperature, axis=0) == md.mesh.numberofvertices: 50 md.thermal.spctemperature = float('nan')* np.ones((md.mesh.numberofvertices))50 md.thermal.spctemperature = np.nan * np.ones((md.mesh.numberofvertices)) 51 51 if hasattr(md.mesh, 'vertexonsurface'): 52 52 pos = np.nonzero(md.mesh.vertexonsurface)[0] 53 md.thermal.spctemperature[pos] = md.initialization.temperature[pos] # impose observed temperature on surface53 md.thermal.spctemperature[pos] = md.initialization.temperature[pos] # impose observed temperature on surface 54 54 if not isinstance(md.basalforcings.geothermalflux, np.ndarray) or not np.size(md.basalforcings.geothermalflux) == md.mesh.numberofvertices: 55 md.basalforcings.geothermalflux = 50. * 10**-3 * np.ones((md.mesh.numberofvertices)) #50 mW /m^255 md.basalforcings.geothermalflux = 50.0 * pow(10, -3) * np.ones((md.mesh.numberofvertices)) # 50 mW/m^2 56 56 else: 57 print( " no thermal boundary conditions created: no observed temperature found")57 print(' no thermal boundary conditions created: no observed temperature found') 58 58 59 59 return md -
TabularUnified issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py ¶
r26352 r26358 24 24 #node on Dirichlet (boundary and ~icefront) 25 25 if icefrontfile: 26 # User provided Front.exp, use it26 # User provided Front.exp, use it 27 27 if not os.path.exists(icefrontfile): 28 raise IOError( "SetMarineIceSheetBC error message: ice front file '%s' not found." % icefrontfile)28 raise IOError('SetMarineIceSheetBC error message: ice front file \'{}\' not found.'.format(icefrontfile)) 29 29 incontour = ContourToMesh(md.mesh.elements, md.mesh.x, md.mesh.y, icefrontfile, 'node', 2) 30 30 vertexonicefront = np.logical_and(md.mesh.vertexonboundary, incontour.reshape(-1)) 31 31 else: 32 # Guess where the ice front is32 # Guess where the ice front is 33 33 vertexonfloatingice = np.zeros((md.mesh.numberofvertices)) 34 pos = np.nonzero(np.sum(md.mask.ocean_levelset[md.mesh.elements - 1] < 0. , axis=1) > 0.)[0]34 pos = np.nonzero(np.sum(md.mask.ocean_levelset[md.mesh.elements - 1] < 0.0, axis=1) > 0.0)[0] 35 35 vertexonfloatingice[md.mesh.elements[pos].astype(int) - 1] = 1. 36 vertexonicefront = np.logical_and(np.reshape(md.mesh.vertexonboundary, (-1, )), vertexonfloatingice > 0. )36 vertexonicefront = np.logical_and(np.reshape(md.mesh.vertexonboundary, (-1, )), vertexonfloatingice > 0.0) 37 37 38 38 #pos = find(md.mesh.vertexonboundary & ~vertexonicefront) 39 39 pos = np.nonzero(np.logical_and(md.mesh.vertexonboundary, np.logical_not(vertexonicefront)))[0] 40 40 if not np.size(pos): 41 print( "Warning: SetMarineIceSheetBC.py: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually.")41 print('Warning: SetMarineIceSheetBC.py: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually.') 42 42 43 md.stressbalance.spcvx = float('nan')* np.ones(md.mesh.numberofvertices)44 md.stressbalance.spcvy = float('nan')* np.ones(md.mesh.numberofvertices)45 md.stressbalance.spcvz = float('nan')* np.ones(md.mesh.numberofvertices)46 md.stressbalance.referential = float('nan')* np.ones((md.mesh.numberofvertices, 6))43 md.stressbalance.spcvx = np.nan * np.ones(md.mesh.numberofvertices) 44 md.stressbalance.spcvy = np.nan * np.ones(md.mesh.numberofvertices) 45 md.stressbalance.spcvz = np.nan * np.ones(md.mesh.numberofvertices) 46 md.stressbalance.referential = np.nan * np.ones((md.mesh.numberofvertices, 6)) 47 47 md.stressbalance.loadingforce = 0 * np.ones((md.mesh.numberofvertices, 3)) 48 48 49 # Position of ice front49 # Position of ice front 50 50 pos = np.nonzero(vertexonicefront)[0] 51 51 md.mask.ice_levelset[pos] = 0 52 52 53 # First find segments that are not completely on the front53 # First find segments that are not completely on the front 54 54 if md.mesh.elementtype() == 'Penta': 55 55 numbernodesfront = 4 … … 57 57 numbernodesfront = 2 58 58 else: 59 raise Exception( "Mesh type not supported")59 raise Exception('Mesh type not supported') 60 60 if any(md.mask.ice_levelset <= 0): 61 61 values = md.mask.ice_levelset[md.mesh.segments[:, 0:-1] - 1] … … 63 63 np.sum(segmentsfront, axis=1) != numbernodesfront 64 64 segments = np.nonzero(np.sum(segmentsfront, axis=1) != numbernodesfront)[0] 65 #Find all nodes for these segments and spc them65 # Find all nodes for these segments and spc them 66 66 pos = md.mesh.segments[segments, 0:-1] - 1 67 67 else: … … 71 71 md.stressbalance.spcvz[pos] = 0 72 72 73 # Dirichlet Values73 # Dirichlet Values 74 74 if isinstance(md.inversion.vx_obs, np.ndarray) and np.size(md.inversion.vx_obs, axis=0) == md.mesh.numberofvertices and isinstance(md.inversion.vy_obs, np.ndarray) and np.size(md.inversion.vy_obs, axis=0) == md.mesh.numberofvertices: 75 print( " boundary conditions for stressbalance model: spc set as observed velocities")75 print(' boundary conditions for stressbalance model: spc set as observed velocities') 76 76 md.stressbalance.spcvx[pos] = md.inversion.vx_obs[pos] 77 77 md.stressbalance.spcvy[pos] = md.inversion.vy_obs[pos] 78 78 else: 79 print( " boundary conditions for stressbalance model: spc set as zero")79 print(' boundary conditions for stressbalance model: spc set as zero') 80 80 81 81 md.hydrology.spcwatercolumn = np.zeros((md.mesh.numberofvertices, 2)) … … 90 90 if np.all(np.isnan(md.balancethickness.thickening_rate)): 91 91 md.balancethickness.thickening_rate = np.zeros((md.mesh.numberofvertices)) 92 print( " no balancethickness.thickening_rate specified: values set as zero")92 print(' no balancethickness.thickening_rate specified: values set as zero') 93 93 94 md.masstransport.spcthickness = float('nan')* np.ones((md.mesh.numberofvertices))95 md.balancethickness.spcthickness = float('nan')* np.ones((md.mesh.numberofvertices))96 md.damage.spcdamage = float('nan')* np.ones((md.mesh.numberofvertices))94 md.masstransport.spcthickness = np.nan * np.ones((md.mesh.numberofvertices)) 95 md.balancethickness.spcthickness = np.nan * np.ones((md.mesh.numberofvertices)) 96 md.damage.spcdamage = np.nan * np.ones((md.mesh.numberofvertices)) 97 97 98 98 if isinstance(md.initialization.temperature, np.ndarray) and np.size(md.initialization.temperature, axis=0) == md.mesh.numberofvertices: 99 md.thermal.spctemperature = float('nan')* np.ones((md.mesh.numberofvertices))99 md.thermal.spctemperature = np.nan * np.ones((md.mesh.numberofvertices)) 100 100 if hasattr(md.mesh, 'vertexonsurface'): 101 101 pos = np.nonzero(md.mesh.vertexonsurface)[0] 102 md.thermal.spctemperature[pos] = md.initialization.temperature[pos] # impose observed temperature on surface102 md.thermal.spctemperature[pos] = md.initialization.temperature[pos] # impose observed temperature on surface 103 103 if not isinstance(md.basalforcings.geothermalflux, np.ndarray) or not np.size(md.basalforcings.geothermalflux, axis=0) == md.mesh.numberofvertices: 104 104 md.basalforcings.geothermalflux = np.zeros((md.mesh.numberofvertices)) 105 md.basalforcings.geothermalflux[np.nonzero(md.mask.ocean_levelset > 0. )] = 50. * 10.**- 3 #50mW /m2105 md.basalforcings.geothermalflux[np.nonzero(md.mask.ocean_levelset > 0.0)] = 50.0 * pow(10.0, -3) # 50mW/m2 106 106 else: 107 print( " no thermal boundary conditions created: no observed temperature found")107 print(' no thermal boundary conditions created: no observed temperature found') 108 108 109 109 return md -
TabularUnified issm/trunk-jpl/src/m/classes/SMBcomponents.m ¶
r26209 r26358 22 22 end 23 23 end % }}} 24 function disp(self) % {{{ 25 disp(sprintf(' surface forcings parameters (SMB=accumulation-runoff-evaporation) :')); 26 fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]'); 27 fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]'); 28 fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]'); 29 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'); 30 fielddisplay(self, 'averaging', 'averaging methods from short to long steps'); 31 disp(sprintf('%51s 0: Arithmetic (default)',' ')); 32 disp(sprintf('%51s 1: Geometric',' ')); 33 disp(sprintf('%51s 2: Harmonic',' ')); 34 fielddisplay(self,'requested_outputs','additional outputs requested'); 35 end % }}} 24 36 function self = extrude(self,md) % {{{ 25 37 … … 38 50 if isnan(self.accumulation) 39 51 self.accumulation=zeros(md.mesh.numberofvertices,1); 40 disp(' 52 disp(' no smb.accumulation specified: values set as zero'); 41 53 end 42 54 if isnan(self.evaporation) 43 55 self.evaporation=zeros(md.mesh.numberofvertices,1); 44 disp(' 56 disp(' no smb.evaporation specified: values set as zero'); 45 57 end 46 58 if isnan(self.runoff) 47 59 self.runoff=zeros(md.mesh.numberofvertices,1); 48 disp(' 60 disp(' no smb.runoff specified: values set as zero'); 49 61 end 50 62 … … 66 78 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1); 67 79 end % }}} 68 function disp(self) % {{{69 disp(sprintf(' surface forcings parameters (SMB=accumulation-runoff-evaporation) :'));70 fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');71 fielddisplay(self,'runoff','amount of ice melt lost from the ice column [m/yr ice eq]');72 fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');73 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');74 fielddisplay(self, 'averaging', 'averaging methods from short to long steps');75 disp(sprintf('%51s 0: Arithmetic (default)',' '));76 disp(sprintf('%51s 1: Geometric',' '));77 disp(sprintf('%51s 2: Harmonic',' '));78 fielddisplay(self,'requested_outputs','additional outputs requested');79 end % }}}80 80 function marshall(self,prefix,md,fid) % {{{ 81 81 … … 92 92 pos = find(ismember(outputs,'default')); 93 93 if ~isempty(pos), 94 outputs(pos) = []; 94 outputs(pos) = []; %remove 'default' from outputs 95 95 outputs = [outputs defaultoutputs(self,md)]; %add defaults 96 96 end -
TabularUnified issm/trunk-jpl/src/m/classes/SMBcomponents.py ¶
r26208 r26358 21 21 self.averaging = 0 22 22 self.requested_outputs = [] 23 self.isclimatology = np.nan 23 24 24 25 nargs = len(args) … … 30 31 31 32 def __repr__(self): # {{{ 32 s = ' surface forcings parameters (SMB = accumulation-runoff-evaporation):\n'33 s = ' surface forcings parameters (SMB=accumulation-runoff-evaporation) :\n' 33 34 s += '{}\n'.format(fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]')) 34 35 s += '{}\n'.format(fielddisplay(self, 'runoff', 'amount of ice melt lost from the ice column [m/yr ice eq]')) … … 44 45 45 46 def extrude(self, md): # {{{ 46 self. mass_balance= project3d(md, 'vector', self.accumulation, 'type', 'node')47 self. mass_balance= project3d(md, 'vector', self.runoff, 'type', 'node')48 self. mass_balance= project3d(md, 'vector', self.evaporation, 'type', 'node')47 self.accumulation = project3d(md, 'vector', self.accumulation, 'type', 'node') 48 self.runoff = project3d(md, 'vector', self.runoff, 'type', 'node') 49 self.evaporation = project3d(md, 'vector', self.evaporation, 'type', 'node') 49 50 return self 50 51 # }}} … … 57 58 if np.all(np.isnan(self.accumulation)): 58 59 self.accumulation = np.zeros((md.mesh.numberofvertices)) 59 print(" no SMB.accumulation specified: values set as zero") 60 print(' no SMB.accumulation specified: values set as zero') 61 if np.all(np.isnan(self.evaporation)): 62 self.evaporation = np.zeros((md.mesh.numberofvertices)) 63 print(" no SMB.evaporation specified: values set as zero") 60 64 if np.all(np.isnan(self.runoff)): 61 65 self.runoff = np.zeros((md.mesh.numberofvertices)) 62 66 print(" no SMB.runoff specified: values set as zero") 63 64 if np.all(np.isnan(self.evaporation)):65 self.evaporation = np.zeros((md.mesh.numberofvertices))66 print(" no SMB.evaporation specified: values set as zero")67 67 return self 68 68 # }}} … … 79 79 md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1]) 80 80 md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2]) 81 md = checkfield(md, 'fieldname', ' masstransport.requested_outputs', 'stringrow', 1)81 md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1) 82 82 return md 83 83 # }}} … … 87 87 88 88 WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 2, 'format', 'Integer') 89 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)90 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoff', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)91 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)89 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 90 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'runoff', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 91 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 92 92 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer') 93 93 WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer') 94 #process requested outputs94 # Process requested outputs 95 95 outputs = self.requested_outputs 96 96 indices = [i for i, x in enumerate(outputs) if x == 'default'] -
TabularUnified issm/trunk-jpl/src/m/classes/SMBforcing.py ¶
r26208 r26358 19 19 self.requested_outputs = [] 20 20 self.averaging = 0 21 self.isclimatology = np.nan 21 22 22 23 nargs = len(args) … … 31 32 s += '{}\n'.format(fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]')) 32 33 s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 34 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 33 35 s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 34 36 s += '\t\t{}\n'.format('0: Arithmetic (default)') 35 37 s += '\t\t{}\n'.format('1: Geometric') 36 38 s += '\t\t{}\n'.format('2: Harmonic') 37 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested'))38 39 return s 39 40 #}}} … … 51 52 if np.all(np.isnan(self.mass_balance)): 52 53 self.mass_balance = np.zeros((md.mesh.numberofvertices)) 53 print(" no SMBforcing.mass_balance specified: values set as zero")54 print(" no smb.mass_balance specified: values set as zero") 54 55 return self 55 56 #}}} … … 71 72 yts = md.constants.yts 72 73 WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 1, 'format', 'Integer') 73 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'mass_balance', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)74 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'mass_balance', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 74 75 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer') 75 76 WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer') -
TabularUnified issm/trunk-jpl/src/m/classes/SMBgemb.m ¶
r26209 r26358 122 122 requested_outputs = {}; 123 123 124 %Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM. 124 %Several fields are missing from the standard GEMB model, which are 125 %captured intrinsically by ISSM. 125 126 %dateN: that's the last row of the above fields. 126 127 %dt: included in dateN. Not an input. … … 138 139 error('constructor not supported: need geometry and mesh to set defaults'); 139 140 end 140 end % }}}141 function self = extrude(self,md) % {{{142 143 self.Ta=project3d(md,'vector',self.Ta,'type','element');144 self.V=project3d(md,'vector',self.V,'type','element');145 self.dswrf=project3d(md,'vector',self.dswrf,'type','element');146 self.dslrf=project3d(md,'vector',self.dslrf,'type','element');147 self.P=project3d(md,'vector',self.P,'type','element');148 self.eAir=project3d(md,'vector',self.eAir,'type','element');149 self.pAir=project3d(md,'vector',self.pAir,'type','element');150 151 if ~isnan(self.Dzini)152 self.Dzini=project3d(md,'vector',self.Dzini,'type','element');153 end154 if ~isnan(self.Dini)155 self.Dini=project3d(md,'vector',self.Dini,'type','element');156 end157 if ~isnan(self.Reini)158 self.Reini=project3d(md,'vector',self.Reini,'type','element');159 end160 if ~isnan(self.Gdnini)161 self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element');162 end163 if ~isnan(self.Gspini)164 self.Gspini=project3d(md,'vector',self.Gspini,'type','element');165 end166 if ~isnan(self.ECini)167 self.ECini=project3d(md,'vector',self.ECini,'type','element');168 end169 if ~isnan(self.Wini)170 self.Wini=project3d(md,'vector',self.Wini,'type','element');171 end172 if ~isnan(self.Aini)173 self.Aini=project3d(md,'vector',self.Aini,'type','element');174 end175 if ~isnan(self.Adiffini)176 self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element');177 end178 if ~isnan(self.Tini)179 self.Tini=project3d(md,'vector',self.Tini,'type','element');180 end181 182 if ~isnan(self.dswdiffrf)183 self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element');184 end185 if ~isnan(self.szaValue)186 self.szaValue=project3d(md,'vector',self.szaValue,'type','element');187 end188 if ~isnan(self.cotValue)189 self.cotValue=project3d(md,'vector',self.cotValue,'type','element');190 end191 if ~isnan(self.ccsnowValue)192 self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element');193 end194 if ~isnan(self.cciceValue)195 self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element');196 end197 if (aIdx == 0) & ~isnan(self.aValue)198 self.aValue=project3d(md,'vector',self.aValue,'type','element');199 end200 if ~isnan(self.teValue)201 self.teValue=project3d(md,'vector',self.teValue,'type','element');202 end203 204 205 end % }}}206 function list = defaultoutputs(self,md) % {{{207 list = {'SmbMassBalance','SmbAccumulatedMassBalance'};208 end % }}}209 function self = setdefaultparameters(self,mesh,geometry) % {{{210 211 self.isgraingrowth=1;212 self.isalbedo=1;213 self.isshortwave=1;214 self.isthermal=1;215 self.isaccumulation=1;216 self.ismelt=1;217 self.isdensification=1;218 self.isturbulentflux=1;219 self.isconstrainsurfaceT=0;220 221 self.aIdx = 1;222 self.swIdx = 1;223 self.denIdx = 2;224 self.dsnowIdx = 1;225 self.zTop=10*ones(mesh.numberofelements,1);226 self.dzTop = .05* ones (mesh.numberofelements,1);227 self.dzMin = self.dzTop/2;228 self.InitDensityScaling = 1.0;229 self.ThermoDeltaTScaling = 1/11;230 231 self.Vmean=10.0*ones(mesh.numberofelements,1);232 233 self.zMax=250*ones(mesh.numberofelements,1);234 self.zMin=130*ones(mesh.numberofelements,1);235 self.zY = 1.025*ones(mesh.numberofelements,1);236 self.outputFreq = 30;237 238 %additional albedo parameters239 self.aSnow = 0.85;240 self.aIce = 0.48;241 self.cldFrac = 0.1;242 self.t0wet = 15;243 self.t0dry = 30;244 self.K = 7;245 self.adThresh = 1023;246 247 self.teValue = ones(mesh.numberofelements,1);248 self.aValue = self.aSnow*ones(mesh.numberofelements,1);249 250 self.dswdiffrf=0.0*ones(mesh.numberofelements,1);251 self.szaValue=0.0*ones(mesh.numberofelements,1);252 self.cotValue=0.0*ones(mesh.numberofelements,1);253 self.ccsnowValue=0.0*ones(mesh.numberofelements,1);254 self.cciceValue=0.0*ones(mesh.numberofelements,1);255 256 self.Dzini=0.05*ones(mesh.numberofelements,2);257 self.Dini=910.0*ones(mesh.numberofelements,2);258 self.Reini=2.5*ones(mesh.numberofelements,2);259 self.Gdnini=0.0*ones(mesh.numberofelements,2);260 self.Gspini=0.0*ones(mesh.numberofelements,2);261 self.ECini=0.0*ones(mesh.numberofelements,1);262 self.Wini=0.0*ones(mesh.numberofelements,2);263 self.Aini=self.aSnow*ones(mesh.numberofelements,2);264 self.Adiffini=ones(mesh.numberofelements,2);265 self.Tini=273.15*ones(mesh.numberofelements,2);266 % /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh).267 % If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp268 self.Sizeini=2*ones(mesh.numberofelements,1);269 270 end % }}}271 function md = checkconsistency(self,md,solution,analyses) % {{{272 273 md = checkfield(md,'fieldname','smb.isgraingrowth','values',[0 1]);274 md = checkfield(md,'fieldname','smb.isalbedo','values',[0 1]);275 md = checkfield(md,'fieldname','smb.isshortwave','values',[0 1]);276 md = checkfield(md,'fieldname','smb.isthermal','values',[0 1]);277 md = checkfield(md,'fieldname','smb.isaccumulation','values',[0 1]);278 md = checkfield(md,'fieldname','smb.ismelt','values',[0 1]);279 md = checkfield(md,'fieldname','smb.isdensification','values',[0 1]);280 md = checkfield(md,'fieldname','smb.isturbulentflux','values',[0 1]);281 md = checkfield(md,'fieldname','smb.isconstrainsurfaceT','values',[0 1]);282 283 md = checkfield(md,'fieldname','smb.Ta','timeseries',1,'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value284 md = checkfield(md,'fieldname','smb.V','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<',45,'size',size(self.Ta)); %max 500 km/h285 md = checkfield(md,'fieldname','smb.dswrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400,'size',size(self.Ta));286 md = checkfield(md,'fieldname','smb.dswdiffrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400);287 md = checkfield(md,'fieldname','smb.dlwrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'size',size(self.Ta));288 md = checkfield(md,'fieldname','smb.P','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',200,'size',size(self.Ta));289 md = checkfield(md,'fieldname','smb.eAir','timeseries',1,'NaN',1,'Inf',1,'size',size(self.Ta));290 291 md = checkfield(md,'fieldname','smb.Tmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value292 md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',0);293 md = checkfield(md,'fieldname','smb.Vmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0);294 md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);295 md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000);296 297 md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);298 299 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);300 md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]);301 md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5,6,7]);302 md = checkfield(md,'fieldname','smb.dsnowIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]);303 304 md = checkfield(md,'fieldname','smb.zTop','NaN',1,'Inf',1,'>=',0);305 md = checkfield(md,'fieldname','smb.dzTop','NaN',1,'Inf',1,'>',0);306 md = checkfield(md,'fieldname','smb.dzMin','NaN',1,'Inf',1,'>',0);307 md = checkfield(md,'fieldname','smb.zY','NaN',1,'Inf',1,'>=',1);308 md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max309 md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1);310 md = checkfield(md,'fieldname','smb.ThermoDeltaTScaling','NaN',1,'Inf',1,'>=',0,'<=',1);311 md = checkfield(md,'fieldname','smb.adThresh','NaN',1,'Inf',1,'>=',0);312 313 switch self.aIdx,314 case 0315 md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1);316 case {1 2}317 md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89);318 md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58);319 if self.aIdx==1320 md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90);321 md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);322 md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);323 md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0);324 end325 case 3326 md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'>=',0,'<=',1);327 case 4328 md = checkfield(md,'fieldname','smb.t0wet','NaN',1,'Inf',1,'>=',15,'<=',21.9);329 md = checkfield(md,'fieldname','smb.t0dry','NaN',1,'Inf',1,'>=',30,'<=',30);330 md = checkfield(md,'fieldname','smb.K','NaN',1,'Inf',1,'>=',7,'<=',7);331 end332 333 %check zTop is < local thickness:334 he=sum(md.geometry.thickness(md.mesh.elements),2)/size(md.mesh.elements,2);335 if any(he<self.zTop),336 error('SMBgemb consistency check error: zTop should be smaller than local ice thickness');337 end338 md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]);339 md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]);340 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1);341 342 141 end % }}} 343 142 function disp(self) % {{{ … … 444 243 445 244 end % }}} 245 function self = extrude(self,md) % {{{ 246 247 self.Ta=project3d(md,'vector',self.Ta,'type','element'); 248 self.V=project3d(md,'vector',self.V,'type','element'); 249 self.dswrf=project3d(md,'vector',self.dswrf,'type','element'); 250 self.dslrf=project3d(md,'vector',self.dslrf,'type','element'); 251 self.P=project3d(md,'vector',self.P,'type','element'); 252 self.eAir=project3d(md,'vector',self.eAir,'type','element'); 253 self.pAir=project3d(md,'vector',self.pAir,'type','element'); 254 255 if ~isnan(self.Dzini) 256 self.Dzini=project3d(md,'vector',self.Dzini,'type','element'); 257 end 258 if ~isnan(self.Dini) 259 self.Dini=project3d(md,'vector',self.Dini,'type','element'); 260 end 261 if ~isnan(self.Reini) 262 self.Reini=project3d(md,'vector',self.Reini,'type','element'); 263 end 264 if ~isnan(self.Gdnini) 265 self.Gdnini=project3d(md,'vector',self.Gdnini,'type','element'); 266 end 267 if ~isnan(self.Gspini) 268 self.Gspini=project3d(md,'vector',self.Gspini,'type','element'); 269 end 270 if ~isnan(self.ECini) 271 self.ECini=project3d(md,'vector',self.ECini,'type','element'); 272 end 273 if ~isnan(self.Wini) 274 self.Wini=project3d(md,'vector',self.Wini,'type','element'); 275 end 276 if ~isnan(self.Aini) 277 self.Aini=project3d(md,'vector',self.Aini,'type','element'); 278 end 279 if ~isnan(self.Adiffini) 280 self.Adiffini=project3d(md,'vector',self.Adiffini,'type','element'); 281 end 282 if ~isnan(self.Tini) 283 self.Tini=project3d(md,'vector',self.Tini,'type','element'); 284 end 285 286 if ~isnan(self.dswdiffrf) 287 self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element'); 288 end 289 if ~isnan(self.szaValue) 290 self.szaValue=project3d(md,'vector',self.szaValue,'type','element'); 291 end 292 if ~isnan(self.cotValue) 293 self.cotValue=project3d(md,'vector',self.cotValue,'type','element'); 294 end 295 if ~isnan(self.ccsnowValue) 296 self.ccsnowValue=project3d(md,'vector',self.ccsnowValue,'type','element'); 297 end 298 if ~isnan(self.cciceValue) 299 self.cciceValue=project3d(md,'vector',self.cciceValue,'type','element'); 300 end 301 if (aIdx == 0) & ~isnan(self.aValue) 302 self.aValue=project3d(md,'vector',self.aValue,'type','element'); 303 end 304 if ~isnan(self.teValue) 305 self.teValue=project3d(md,'vector',self.teValue,'type','element'); 306 end 307 308 309 end % }}} 310 function list = defaultoutputs(self,md) % {{{ 311 list = {'SmbMassBalance','SmbAccumulatedMassBalance'}; 312 end % }}} 313 function self = setdefaultparameters(self,mesh,geometry) % {{{ 314 315 self.isgraingrowth=1; 316 self.isalbedo=1; 317 self.isshortwave=1; 318 self.isthermal=1; 319 self.isaccumulation=1; 320 self.ismelt=1; 321 self.isdensification=1; 322 self.isturbulentflux=1; 323 self.isconstrainsurfaceT=0; 324 325 self.aIdx = 1; 326 self.swIdx = 1; 327 self.denIdx = 2; 328 self.dsnowIdx = 1; 329 self.zTop=10*ones(mesh.numberofelements,1); 330 self.dzTop = .05* ones (mesh.numberofelements,1); 331 self.dzMin = self.dzTop/2; 332 self.InitDensityScaling = 1.0; 333 self.ThermoDeltaTScaling = 1/11; 334 335 self.Vmean=10.0*ones(mesh.numberofelements,1); 336 337 self.zMax=250*ones(mesh.numberofelements,1); 338 self.zMin=130*ones(mesh.numberofelements,1); 339 self.zY = 1.025*ones(mesh.numberofelements,1); 340 self.outputFreq = 30; 341 342 %additional albedo parameters 343 self.aSnow = 0.85; 344 self.aIce = 0.48; 345 self.cldFrac = 0.1; 346 self.t0wet = 15; 347 self.t0dry = 30; 348 self.K = 7; 349 self.adThresh = 1023; 350 351 self.teValue = ones(mesh.numberofelements,1); 352 self.aValue = self.aSnow*ones(mesh.numberofelements,1); 353 354 self.dswdiffrf=0.0*ones(mesh.numberofelements,1); 355 self.szaValue=0.0*ones(mesh.numberofelements,1); 356 self.cotValue=0.0*ones(mesh.numberofelements,1); 357 self.ccsnowValue=0.0*ones(mesh.numberofelements,1); 358 self.cciceValue=0.0*ones(mesh.numberofelements,1); 359 360 self.Dzini=0.05*ones(mesh.numberofelements,2); 361 self.Dini=910.0*ones(mesh.numberofelements,2); 362 self.Reini=2.5*ones(mesh.numberofelements,2); 363 self.Gdnini=0.0*ones(mesh.numberofelements,2); 364 self.Gspini=0.0*ones(mesh.numberofelements,2); 365 self.ECini=0.0*ones(mesh.numberofelements,1); 366 self.Wini=0.0*ones(mesh.numberofelements,2); 367 self.Aini=self.aSnow*ones(mesh.numberofelements,2); 368 self.Adiffini=ones(mesh.numberofelements,2); 369 self.Tini=273.15*ones(mesh.numberofelements,2); 370 % /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh). 371 % If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp 372 self.Sizeini=2*ones(mesh.numberofelements,1); 373 374 end % }}} 375 function md = checkconsistency(self,md,solution,analyses) % {{{ 376 377 md = checkfield(md,'fieldname','smb.isgraingrowth','values',[0 1]); 378 md = checkfield(md,'fieldname','smb.isalbedo','values',[0 1]); 379 md = checkfield(md,'fieldname','smb.isshortwave','values',[0 1]); 380 md = checkfield(md,'fieldname','smb.isthermal','values',[0 1]); 381 md = checkfield(md,'fieldname','smb.isaccumulation','values',[0 1]); 382 md = checkfield(md,'fieldname','smb.ismelt','values',[0 1]); 383 md = checkfield(md,'fieldname','smb.isdensification','values',[0 1]); 384 md = checkfield(md,'fieldname','smb.isturbulentflux','values',[0 1]); 385 md = checkfield(md,'fieldname','smb.isconstrainsurfaceT','values',[0 1]); 386 387 md = checkfield(md,'fieldname','smb.Ta','timeseries',1,'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value 388 md = checkfield(md,'fieldname','smb.V','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<',45,'size',size(self.Ta)); %max 500 km/h 389 md = checkfield(md,'fieldname','smb.dswrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400,'size',size(self.Ta)); 390 md = checkfield(md,'fieldname','smb.dswdiffrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1400); 391 md = checkfield(md,'fieldname','smb.dlwrf','timeseries',1,'NaN',1,'Inf',1,'>=',0,'size',size(self.Ta)); 392 md = checkfield(md,'fieldname','smb.P','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',200,'size',size(self.Ta)); 393 md = checkfield(md,'fieldname','smb.eAir','timeseries',1,'NaN',1,'Inf',1,'size',size(self.Ta)); 394 395 md = checkfield(md,'fieldname','smb.Tmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',273-100,'<',273+100); %-100/100 celsius min/max value 396 md = checkfield(md,'fieldname','smb.C','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>',0); 397 md = checkfield(md,'fieldname','smb.Vmean','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0); 398 md = checkfield(md,'fieldname','smb.Tz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 399 md = checkfield(md,'fieldname','smb.Vz','size',[md.mesh.numberofelements 1],'NaN',1,'Inf',1,'>=',0,'<=',5000); 400 401 md = checkfield(md,'fieldname','smb.teValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 402 403 md = checkfield(md,'fieldname','smb.aIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]); 404 md = checkfield(md,'fieldname','smb.swIdx','NaN',1,'Inf',1,'values',[0,1]); 405 md = checkfield(md,'fieldname','smb.denIdx','NaN',1,'Inf',1,'values',[1,2,3,4,5,6,7]); 406 md = checkfield(md,'fieldname','smb.dsnowIdx','NaN',1,'Inf',1,'values',[0,1,2,3,4]); 407 408 md = checkfield(md,'fieldname','smb.zTop','NaN',1,'Inf',1,'>=',0); 409 md = checkfield(md,'fieldname','smb.dzTop','NaN',1,'Inf',1,'>',0); 410 md = checkfield(md,'fieldname','smb.dzMin','NaN',1,'Inf',1,'>',0); 411 md = checkfield(md,'fieldname','smb.zY','NaN',1,'Inf',1,'>=',1); 412 md = checkfield(md,'fieldname','smb.outputFreq','NaN',1,'Inf',1,'>',0,'<',10*365); %10 years max 413 md = checkfield(md,'fieldname','smb.InitDensityScaling','NaN',1,'Inf',1,'>=',0,'<=',1); 414 md = checkfield(md,'fieldname','smb.ThermoDeltaTScaling','NaN',1,'Inf',1,'>=',0,'<=',1); 415 md = checkfield(md,'fieldname','smb.adThresh','NaN',1,'Inf',1,'>=',0); 416 417 switch self.aIdx, 418 case 0 419 md = checkfield(md,'fieldname','smb.aValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',1); 420 case {1 2} 421 md = checkfield(md,'fieldname','smb.aSnow','NaN',1,'Inf',1,'>=',.64,'<=',.89); 422 md = checkfield(md,'fieldname','smb.aIce','NaN',1,'Inf',1,'>=',.27,'<=',.58); 423 if self.aIdx==1 424 md = checkfield(md,'fieldname','smb.szaValue','timeseries',1,'NaN',1,'Inf',1,'>=',0,'<=',90); 425 md = checkfield(md,'fieldname','smb.cotValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 426 md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 427 md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0); 428 end 429 case 3 430 md = checkfield(md,'fieldname','smb.cldFrac','NaN',1,'Inf',1,'>=',0,'<=',1); 431 case 4 432 md = checkfield(md,'fieldname','smb.t0wet','NaN',1,'Inf',1,'>=',15,'<=',21.9); 433 md = checkfield(md,'fieldname','smb.t0dry','NaN',1,'Inf',1,'>=',30,'<=',30); 434 md = checkfield(md,'fieldname','smb.K','NaN',1,'Inf',1,'>=',7,'<=',7); 435 end 436 437 %check zTop is < local thickness: 438 he=sum(md.geometry.thickness(md.mesh.elements),2)/size(md.mesh.elements,2); 439 if any(he<self.zTop), 440 error('SMBgemb consistency check error: zTop should be smaller than local ice thickness'); 441 end 442 md = checkfield(md,'fieldname','smb.steps_per_step','>=',1,'numel',[1]); 443 md = checkfield(md,'fieldname','smb.averaging','numel',[1],'values',[0 1 2]); 444 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1); 445 446 end % }}} 446 447 function marshall(self,prefix,md,fid) % {{{ 447 448 -
TabularUnified issm/trunk-jpl/src/m/classes/SMBgemb.py ¶
r26208 r26358 8 8 9 9 class SMBgemb(object): 10 """SMBGEMB class definition 11 12 Usage: 13 SMB = SMBgemb() 10 14 """ 11 SMBgemb Class definition12 13 Usage:14 SMB = SMBgemb()15 """16 15 17 16 def __init__(self, *args): # {{{ 18 #each one of these properties is a transient forcing to the GEMB model, loaded from meteorological data derived 19 #from an automatic weather stations (AWS). Each property is therefore a matrix, of size (numberofvertices x number 20 #of time steps. ) 17 """Each one of these properties is a transient forcing to the GEMB 18 model, loaded from meteorological data derived from an automatic 19 weather stations (AWS). Each property is therefore a matrix, of size 20 (numberofvertices x number of time steps. 21 """ 21 22 22 23 #solution choices 23 #check these:24 #self.isgraingrowth = 025 #self.issmbgradients = 026 #isalbedo27 #isshortwave28 #isthermal29 #isaccumulation30 #ismelt31 #isdensification32 #isturbulentflux33 34 # inputs:24 self.isgraingrowth 25 self.isalbedo 26 self.isshortwave 27 self.isthermal 28 self.isaccumulation 29 self.ismelt 30 self.isdensification 31 self.isturbulentflux 32 self.isconstrainsurfaceT 33 self.isclimatology = np.nan 34 35 # Inputs 35 36 self.Ta = np.nan # 2 m air temperature, in Kelvin 36 37 self.V = np.nan # wind speed (m/s-1) … … 40 41 self.eAir = np.nan # screen level vapor pressure [Pa] 41 42 self.pAir = np.nan # surface pressure [Pa] 43 42 44 self.Tmean = np.nan # mean annual temperature [K] 43 45 self.Vmean = np.nan # mean annual wind velocity [m s-1] … … 46 48 self.Vz = np.nan # height above ground at which wind (V) was sampled [m] 47 49 48 # optional inputs:49 self.aValue = np.nan # Albedo forcing at every element. Used only if aIdx == 0, or density exceeds adThresh50 # Optional inputs 51 self.aValue = np.nan # Albedo forcing at every element. Used only if aIdx == 0, or density exceeds adThresh. 50 52 self.teValue = np.nan # Outward longwave radiation thermal emissivity forcing at every element (default in code is 1) 51 53 … … 54 56 self.Dini = np.nan # snow density (kg m-3) 55 57 self.Reini = np.nan # effective grain size (mm) 56 self.Gdnini = np.nan # grain d ricity (0-1)58 self.Gdnini = np.nan # grain dendricity (0-1) 57 59 self.Gspini = np.nan # grain sphericity (0-1) 58 60 self.ECini = np.nan # evaporation/condensation (kg m-2) … … 63 65 self.Sizeini = np.nan # Number of layers 64 66 65 # settings:67 # Settings 66 68 self.aIdx = np.nan # method for calculating albedo and subsurface absorption (default is 1) 67 # 0: direct input from aValue parameter 68 # 1: effective grain radius [Gardner & Sharp, 2009] 69 # 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992) 70 # 3: density and cloud amount [Greuell & Konzelmann, 1994] 71 # 4: exponential time decay & wetness [Bougamont & Bamber, 2005] 72 73 self.swIdx = np.nan # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)) 69 # 0: direct input from aValue parameter 70 # 1: effective grain radius [Gardner & Sharp, 2009] 71 # 2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992) 72 # 3: density and cloud amount [Greuell & Konzelmann, 1994] 73 # 4: exponential time decay & wetness [Bougamont & Bamber, 2005] 74 75 self.swIdx = np.nan # apply all SW to top grid cell (0) or allow SW to penetrate surface (1) (default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)) 76 74 77 self.denIdx = np.nan # densification model to use (default is 2): 75 76 77 78 79 80 81 78 # 1 = emperical model of Herron and Langway (1980) 79 # 2 = semi-emperical model of Anthern et al. (2010) 80 # 3 = DO NOT USE: physical model from Appendix B of Anthern et al. (2010) 81 # 4 = DO NOT USE: emperical model of Li and Zwally (2004) 82 # 5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008) 83 # 6 = Antarctica semi-emperical model of Ligtenberg et al. (2011) 84 # 7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015) 82 85 83 86 self.dsnowIdx = np.nan # model for fresh snow accumulation density (default is 1): 84 85 86 87 88 87 # 0 = Original GEMB value, 150 kg/m^3 88 # 1 = Antarctica value of fresh snow density, 350 kg/m^3 89 # 2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018) 90 # 3 = Antarctica model of Kaspers et al. (2004) 91 # 4 = Greenland model of Kuipers Munneke et al. (2015) 89 92 90 93 self.zTop = np.nan # depth over which grid length is constant at the top of the snopack (default 10) [m] 91 94 self.dzTop = np.nan # initial top vertical grid spacing (default .05) [m] 92 95 self.dzMin = np.nan # initial min vertical allowable grid spacing (default dzMin/2) [m] 96 93 97 self.zY = np.nan # strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)] 94 98 self.zMax = np.nan # initial max model depth (default is min(thickness, 250)) [m] … … 96 100 self.outputFreq = np.nan # output frequency in days (default is monthly, 30) 97 101 98 # specific albedo parameters:99 # Method 1100 dswdiffrf = np.nan #downward diffusive shortwave radiation flux [W/m^2]101 s zaValue = np.nan #Solar Zenith Angle [degree]102 cotValue = np.nan #Cloud Optical Thickness103 ccsnowValue = np.nan #concentration of light absorbing carbon for snow [ppm1]104 cciceValue = np.nan #concentration of light absorbing carbon for ice [ppm1]105 # Method 1 and 2:102 # Specific albedo parameters 103 # Method 1 104 self.dswdiffrf = np.nan # downward diffusive shortwave radiation flux [W/m^2] 105 self.szaValue = np.nan # Solar Zenith Angle [degree] 106 self.cotValue = np.nan # Cloud Optical Thickness 107 self.ccsnowValue = np.nan # concentration of light absorbing carbon for snow [ppm1] 108 self.cciceValue = np.nan # concentration of light absorbing carbon for ice [ppm1] 109 # Method 1 and 2 106 110 self.aSnow = np.nan # new snow albedo (0.64 - 0.89) 107 111 self.aIce = np.nan # range 0.27-0.58 for old snow … … 116 120 # Default value is rho water (1023 kg m-3). 117 121 118 # densities:122 # Densities 119 123 self.InitDensityScaling = np.nan # initial scaling factor multiplying the density of ice, which describes the density of the snowpack. 120 124 121 # thermo:125 # Thermal 122 126 self.ThermoDeltaTScaling = np.nan # scaling factor to multiply the thermal diffusion timestep (delta t) 123 127 … … 126 130 self.requested_outputs = [] 127 131 128 #Several fields are missing from the standard GEMB model, which are capture intrinsically by ISSM. 132 #Several fields are missing from the standard GEMB model, which are 133 #captured intrinsically by ISSM. 129 134 #dateN: that's the last row of the above fields. 130 135 #dt: included in dateN. Not an input. … … 132 137 133 138 nargin = len(args) 134 if nargin: 135 if nargin == 2: 136 mesh = args[0] 137 geometry = args[1] 138 self.setdefaultparameters(mesh, geometry) 139 else: 140 raise Exception('constructor not supported: need mesh and geometry to set defaults') 139 if nargin == 2: 140 mesh = args[0] 141 geometry = args[1] 142 self.setdefaultparameters(mesh, geometry) 143 else: 144 raise Exception('constructor not supported: need mesh and geometry to set defaults') 141 145 #}}} 142 146 … … 145 149 #string = "#s\n#s"%(string, fielddisplay(self, 'mass_balance', 'surface mass balance [m/yr ice eq]')) 146 150 #string = "#s\n#s"%(string, fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 147 s tring = ' surface forcings for SMB GEMB model :'148 s tring = "%s\n%s" % (string, fielddisplay(self, 'issmbgradients', 'is smb gradients method activated (0 or 1, default is 0)'))149 s tring = "%s\n%s" % (string, fielddisplay(self, 'isgraingrowth', 'run grain growthmodule (default true)'))150 s tring = "%s\n%s" % (string, fielddisplay(self, 'isalbedo', 'run albedomodule (default true)'))151 s tring = "%s\n%s" % (string, fielddisplay(self, 'isshortwave', 'run short wavemodule (default true)'))152 s tring = "%s\n%s" % (string, fielddisplay(self, 'isthermal', 'run thermalmodule (default true)'))153 s tring = "%s\n%s" % (string, fielddisplay(self, 'isaccumulation', 'run accumulationmodule (default true)'))154 s tring = "%s\n%s" % (string, fielddisplay(self, 'ismelt', 'run meltingmodule (default true)'))155 s tring = "%s\n%s" % (string, fielddisplay(self, 'isdensification', 'run densificationmodule (default true)'))156 s tring = "%s\n%s" % (string, fielddisplay(self, 'isturbulentflux', 'run turbulant heat fluxes module (default true)'))157 s tring = "%s\n%s" % (string, fielddisplay(self, 'isconstrainsurfaceT', 'constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change'))158 s tring = "%s\n%s" % (string, fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin'))159 s tring = "%s\n%s" % (string, fielddisplay(self, 'V', 'wind speed (m s-1)'))160 s tring = "%s\n%s" % (string, fielddisplay(self, 'dswrf', 'downward shortwave radiation flux[W/m^2]'))161 s tring = "%s\n%s" % (string, fielddisplay(self, 'dswdiffrf', 'downward diffusive portion of shortwave radiation flux (default to 0)[W/m^2]'))162 s tring = "%s\n%s" % (string, fielddisplay(self, 'dlwrf', 'downward longwave radiation flux [W/m^2]'))163 s tring = "%s\n%s" % (string, fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]'))164 s tring = "%s\n%s" % (string, fielddisplay(self, 'eAir', 'screen level vaporpressure [Pa]'))165 s tring = "%s\n%s" % (string, fielddisplay(self, 'pAir', 'surface pressure [Pa]'))166 s tring = "%s\n%s" % (string, fielddisplay(self, 'Tmean', 'mean annual temperature [K]'))167 s tring = "%s\n%s" % (string, fielddisplay(self, 'C', 'mean annual snow accumulation [kg m-2 yr-1]'))168 s tring = "%s\n%s" % (string, fielddisplay(self, 'Vmean', 'mean annual temperature [m s-1] (default 10 m/s)'))169 s tring = "%s\n%s" % (string, fielddisplay(self, 'Tz', 'height above ground at which temperature (T) was sampled [m]'))170 s tring = "%s\n%s" % (string, fielddisplay(self, 'Vz', 'height above ground at which wind (V) eas sampled[m]'))171 s tring = "%s\n%s" % (string, fielddisplay(self, 'zTop', 'depth over which grid length is constant at the top of the snopack (default 10) [m]'))172 s tring = "%s\n%s" % (string, fielddisplay(self, 'dzTop', 'initial top vertical grid spacing (default .05) [m] '))173 s tring = "%s\n%s" % (string, fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin/2) [m]'))174 s tring = "%s\n%s" % (string, fielddisplay(self, 'zMax', 'initial max model depth (default is min(thickness, 500)) [m]'))175 s tring = "%s\n%s" % (string, fielddisplay(self, 'zMin', 'initial min model depth (default is min(thickness, 30)) [m]'))176 s tring = "%s\n%s" % (string, fielddisplay(self, 'zY', 'strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]'))177 s tring = "%s\n%s" % (string, fielddisplay(self, 'InitDensityScaling', ['initial scaling factor multiplying the density of ice', 'which describes the density of the snowpack.']))178 s tring = "%s\n%s" % (string, fielddisplay(self, 'ThermoDeltaTScaling', 'scaling factor to multiply the thermal diffusion timestep (delta t)'))179 s tring = "%s\n%s" % (string, fielddisplay(self, 'outputFreq', 'output frequency in days (default is monthly, 30)'))180 s tring = "%s\n%s" % (string, fielddisplay(self, 'adThresh', 'Apply aIdx method to all areas with densities below this value, ', 'or else apply direct input value from aValue, allowing albedo to be altered.'))181 string = "%s\n%s" % (string, fielddisplay(self, 'aIdx', ['method for calculating albedo and subsurface absorption (default is 1)',182 '0: direct input from aValue parameter',183 '1: effective grain radius [Gardner & Sharp, 2009]',184 '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)',185 '3: density and cloud amount [Greuell & Konzelmann, 1994]',186 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]']))187 string = "%s\n%s" % (string, fielddisplay(self, 'teValue', 'Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)')) 188 # snow properties init189 s tring = "%s\n%s" % (string,fielddisplay(self, 'Dzini', 'Initial cell depth when restart [m]'))190 s tring = "%s\n%s" % (string,fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m-3]'))191 s tring = "%s\n%s" % (string,fielddisplay(self, 'Reini', 'Initial grain size when restart [mm]'))192 s tring = "%s\n%s" % (string,fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [-]'))193 s tring = "%s\n%s" % (string,fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [-]'))194 s tring = "%s\n%s" % (string,fielddisplay(self, 'ECini', 'Initial evaporation/condensation when restart [kg m-2]'))195 s tring = "%s\n%s" % (string,fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]'))196 s tring = "%s\n%s" % (string,fielddisplay(self, 'Aini', 'Initial albedo when restart [-]'))197 s tring = "%s\n%s" % (string,fielddisplay(self, 'Adiffini', 'Initial diffusive radiation albedo when restart (default to 1) [-]'))198 s tring = "%s\n%s" % (string,fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]'))199 s tring = "%s\n%s" % (string,fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [-]'))200 201 # additional albedo parameters:202 s tring = "%s\n%s" % (string,fielddisplay(self, 'aValue', 'Albedo forcing at every element'))151 s = ' surface forcings for SMB GEMB model :\n' 152 s += '{}\n'.format(fielddisplay(self, 'isgraingrowth', 'run grain growth module (default true)')) 153 s += '{}\n'.format(fielddisplay(self, 'isalbedo', 'run albedo module (default true)')) 154 s += '{}\n'.format(fielddisplay(self, 'isshortwave', 'run short wave module (default true)')) 155 s += '{}\n'.format(fielddisplay(self, 'isthermal', 'run thermal module (default true)')) 156 s += '{}\n'.format(fielddisplay(self, 'isaccumulation', 'run accumulation module (default true)')) 157 s += '{}\n'.format(fielddisplay(self, 'ismelt', 'run melting module (default true)')) 158 s += '{}\n'.format(fielddisplay(self, 'isdensification', 'run densification module (default true)')) 159 s += '{}\n'.format(fielddisplay(self, 'isturbulentflux', 'run turbulant heat fluxes module (default true)')) 160 s += '{}\n'.format(fielddisplay(self, 'isconstrainsurfaceT', 'constrain surface temperatures to air temperature, turn off EC and surface flux contribution to surface temperature change')) 161 s += '{}\n'.format(fielddisplay(self, 'Ta', '2 m air temperature, in Kelvin')) 162 s += '{}\n'.format(fielddisplay(self, 'V', 'wind speed (m s-1)')) 163 s += '{}\n'.format(fielddisplay(self, 'dswrf', 'downward shortwave radiation flux [W/m^2]')) 164 s += '{}\n'.format(fielddisplay(self, 'dswdiffrf', 'downward diffusive portion of shortwave radiation flux (default to 0) [W/m^2]')) 165 s += '{}\n'.format(fielddisplay(self, 'dlwrf', 'downward longwave radiation flux [W/m^2]')) 166 s += '{}\n'.format(fielddisplay(self, 'P', 'precipitation [mm w.e. / m^2]')) 167 s += '{}\n'.format(fielddisplay(self, 'eAir', 'screen level vapor pressure [Pa]')) 168 s += '{}\n'.format(fielddisplay(self, 'pAir', 'surface pressure [Pa]')) 169 s += '{}\n'.format(fielddisplay(self, 'Tmean', 'mean annual temperature [K]')) 170 s += '{}\n'.format(fielddisplay(self, 'C', 'mean annual snow accumulation [kg m-2 yr-1]')) 171 s += '{}\n'.format(fielddisplay(self, 'Vmean', 'mean annual temperature [m s-1] (default 10 m/s)')) 172 s += '{}\n'.format(fielddisplay(self, 'Tz', 'height above ground at which temperature (T) was sampled [m]')) 173 s += '{}\n'.format(fielddisplay(self, 'Vz', 'height above ground at which wind (V) eas sampled [m]')) 174 s += '{}\n'.format(fielddisplay(self, 'zTop', 'depth over which grid length is constant at the top of the snopack (default 10) [m]')) 175 s += '{}\n'.format(fielddisplay(self, 'dzTop', 'initial top vertical grid spacing (default .05) [m] ')) 176 s += '{}\n'.format(fielddisplay(self, 'dzMin', 'initial min vertical allowable grid spacing (default dzMin/2) [m] ')) 177 s += '{}\n'.format(fielddisplay(self, 'zMax', 'initial max model depth (default is min(thickness, 500)) [m]')) 178 s += '{}\n'.format(fielddisplay(self, 'zMin', 'initial min model depth (default is min(thickness, 30)) [m]')) 179 s += '{}\n'.format(fielddisplay(self, 'zY', 'strech grid cells bellow top_z by a [top_dz * y ^ (cells bellow top_z)]')) 180 s += '{}\n'.format(fielddisplay(self, 'InitDensityScaling', ['initial scaling factor multiplying the density of ice', 'which describes the density of the snowpack.'])) 181 s += '{}\n'.format(fielddisplay(self, 'ThermoDeltaTScaling', 'scaling factor to multiply the thermal diffusion timestep (delta t)')) 182 s += '{}\n'.format(fielddisplay(self, 'outputFreq', 'output frequency in days (default is monthly, 30)')) 183 s += '{}\n'.format(fielddisplay(self, 'adThresh', 'Apply aIdx method to all areas with densities below this value, ', 'or else apply direct input value from aValue, allowing albedo to be altered.')) 184 s += '{}\n'.format(fielddisplay(self, 'aIdx', ['method for calculating albedo and subsurface absorption (default is 1)', 185 '0: direct input from aValue parameter', 186 '1: effective grain radius [Gardner & Sharp, 2009]', 187 '2: effective grain radius [Brun et al., 1992; LeFebre et al., 2003], with swIdx=1, SW penetration follows grain size in 3 spectral bands (Brun et al., 1992)', 188 '3: density and cloud amount [Greuell & Konzelmann, 1994]', 189 '4: exponential time decay & wetness [Bougamont & Bamber, 2005]'])) 190 s += '{}\n'.format(fielddisplay(self, 'teValue', 'Outward longwave radiation thermal emissivity forcing at every element (default in code is 1)')) 191 192 # Snow properties init 193 s += '{}\n'.format(fielddisplay(self, 'Dzini', 'Initial cell depth when restart [m]')) 194 s += '{}\n'.format(fielddisplay(self, 'Dini', 'Initial snow density when restart [kg m-3]')) 195 s += '{}\n'.format(fielddisplay(self, 'Reini', 'Initial grain size when restart [mm]')) 196 s += '{}\n'.format(fielddisplay(self, 'Gdnini', 'Initial grain dricity when restart [-]')) 197 s += '{}\n'.format(fielddisplay(self, 'Gspini', 'Initial grain sphericity when restart [-]')) 198 s += '{}\n'.format(fielddisplay(self, 'ECini', 'Initial evaporation/condensation when restart [kg m-2]')) 199 s += '{}\n'.format(fielddisplay(self, 'Wini', 'Initial snow water content when restart [kg m-2]')) 200 s += '{}\n'.format(fielddisplay(self, 'Aini', 'Initial albedo when restart [-]')) 201 s += '{}\n'.format(fielddisplay(self, 'Adiffini', 'Initial diffusive radiation albedo when restart (default to 1) [-]')) 202 s += '{}\n'.format(fielddisplay(self, 'Tini', 'Initial snow temperature when restart [K]')) 203 s += '{}\n'.format(fielddisplay(self, 'Sizeini', 'Initial number of layers when restart [-]')) 204 205 # Additional albedo parameters 206 s += '{}\n'.format(fielddisplay(self, 'aValue', 'Albedo forcing at every element')) 203 207 if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)): 204 s tring = "%s\n%s" % (string,fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)'))205 s tring = "%s\n%s" % (string,fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)'))208 s += '{}\n'.format(fielddisplay(self, 'aSnow', 'new snow albedo (0.64 - 0.89)')) 209 s += '{}\n'.format(fielddisplay(self, 'aIce', 'albedo of ice (0.27-0.58)')) 206 210 if self.aIdx == 1: 207 string = "%s\n%s" % (string, fielddisplay(self,'szaValue','Solar Zenith Angle [degree]')) 208 string = "%s\n%s" % (string, fielddisplay(self,'cotValue','Cloud Optical Thickness')) 209 string = "%s\n%s" % (string, fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]')) 210 string = "%s\n%s" % (string, fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]')) 211 211 s += '{}\n'.format(fielddisplay(self,'szaValue','Solar Zenith Angle [degree]')) 212 s += '{}\n'.format(fielddisplay(self,'cotValue','Cloud Optical Thickness')) 213 s += '{}\n'.format(fielddisplay(self,'ccsnowValue','concentration of light absorbing carbon for snow [ppm1]')) 214 s += '{}\n'.format(fielddisplay(self,'cciceValue','concentration of light absorbing carbon for snow [ppm1]')) 212 215 elif self.aIdx == 3: 213 s tring = "%s\n%s" % (string,fielddisplay(self, 'cldFrac', 'average cloud amount'))216 s += '{}\n'.format(fielddisplay(self, 'cldFrac', 'average cloud amount')) 214 217 elif self.aIdx == 4: 215 string = "%s\n%s" % (string, fielddisplay(self, 't0wet', 'time scale for wet snow (15-21.9) [d]')) 216 string = "%s\n%s" % (string, fielddisplay(self, 't0dry', 'warm snow timescale (30) [d]')) 217 string = "%s\n%s" % (string, fielddisplay(self, 'K', 'time scale temperature coef. (7) [d]')) 218 219 string = "%s\n%s" % (string, fielddisplay(self, 'swIdx', 'apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)]')) 220 string = "%s\n%s" % (string, fielddisplay(self, 'denIdx', ['densification model to use (default is 2):', 221 '1 = emperical model of Herron and Langway (1980)', 222 '2 = semi-emperical model of Anthern et al. (2010)', 223 '3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)', 224 '4 = DO NOT USE: emperical model of Li and Zwally (2004)', 225 '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)', 226 '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)', 227 '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'])) 228 string = "%s\n%s" % (string, fielddisplay(self, 'dsnowIdx', ['model for fresh snow accumulation density (default is 1):', 229 '0 = Original GEMB value, 150 kg/m^3', 230 '1 = Antarctica value of fresh snow density, 350 kg/m^3', 231 '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)', 232 '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately', 233 '4 = Greenland model of Kuipers Munneke et al. (2015)'])) 234 string = "%s\n%s" % (string, fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 235 string = "%s\n%s" % (string, fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 236 string = "%s\n\t\t%s" % (string, '0: Arithmetic (default)') 237 string = "%s\n\t\t%s" % (string, '1: Geometric') 238 string = "%s\n\t\t%s" % (string, '2: Harmonic') 239 string = "%s\n%s" % (string, fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 240 return string 218 s += '{}\n'.format(fielddisplay(self, 't0wet', 'time scale for wet snow (15-21.9) [d]')) 219 s += '{}\n'.format(fielddisplay(self, 't0dry', 'warm snow timescale (30) [d]')) 220 s += '{}\n'.format(fielddisplay(self, 'K', 'time scale temperature coef. (7) [d]')) 221 222 s += '{}\n'.format(fielddisplay(self, 'swIdx', 'apply all SW to top grid cell (0) or allow SW to penetrate surface (1) [default 1, if aIdx=2 function of effective radius (Brun et al., 1992) or else dependent on snow density (taken from Bassford, 2002)]')) 223 s += '{}\n'.format(fielddisplay(self, 'denIdx', ['densification model to use (default is 2):', 224 '1 = emperical model of Herron and Langway (1980)', 225 '2 = semi-emperical model of Anthern et al. (2010)', 226 '3 = DO NOT USE: physical model from Appix B of Anthern et al. (2010)', 227 '4 = DO NOT USE: emperical model of Li and Zwally (2004)', 228 '5 = DO NOT USE: modified emperical model (4) by Helsen et al. (2008)', 229 '6 = Antarctica semi-emperical model of Ligtenberg et al. (2011)', 230 '7 = Greenland semi-emperical model of Kuipers Munneke et al. (2015)'])) 231 s += '{}\n'.format(fielddisplay(self, 'dsnowIdx', ['model for fresh snow accumulation density (default is 1):', 232 '0 = Original GEMB value, 150 kg/m^3', 233 '1 = Antarctica value of fresh snow density, 350 kg/m^3', 234 '2 = Greenland value of fresh snow density, 315 kg/m^3, Fausto et al. (2018)', 235 '3 = Antarctica model of Kaspers et al. (2004), Make sure to set Vmean accurately', 236 '4 = Greenland model of Kuipers Munneke et al. (2015)'])) 237 238 s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 239 s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 240 s += '\t\t{}\n'.format('0: Arithmetic (default)') 241 s += '\t\t{}\n'.format('1: Geometric') 242 s += '\t\t{}\n'.format('2: Harmonic') 243 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 244 return s 241 245 #}}} 242 246 … … 245 249 self.V = project3d(md, 'vector', self.V, 'type', 'element') 246 250 self.dswrf = project3d(md, 'vector', self.dswrf, 'type', 'element') 247 self.ds wrf = project3d(md, 'vector', self.dswrf, 'type', 'element')251 self.dslrf = project3d(md, 'vector', self.dslrf, 'type', 'element') 248 252 self.P = project3d(md, 'vector', self.P, 'type', 'element') 249 253 self.eAir = project3d(md, 'vector', self.eAir, 'type', 'element') … … 270 274 if not np.isnan(self.Tini): 271 275 self.Tini=project3d(md,'vector',self.Tini,'type','element'); 276 272 277 if not np.isnan(self.dswdiffrf): 273 278 self.dswdiffrf=project3d(md,'vector',self.dswdiffrf,'type','element'); … … 295 300 def setdefaultparameters(self, mesh, geometry): # {{{ 296 301 self.isgraingrowth = 1 297 self.issmbgradients = 0298 302 self.isalbedo = 1 299 303 self.isshortwave = 1 … … 310 314 self.dsnowIdx = 1 311 315 self.zTop = 10 * np.ones((mesh.numberofelements,)) 312 self.dzTop = .05 * np.ones((mesh.numberofelements,))316 self.dzTop = 0.05 * np.ones((mesh.numberofelements,)) 313 317 self.dzMin = self.dzTop / 2 314 318 self.InitDensityScaling = 1.0 … … 322 326 self.outputFreq = 30 323 327 324 # additional albedo parameters328 # Additional albedo parameters 325 329 self.aSnow = 0.85 326 330 self.aIce = 0.48 … … 347 351 self.ECini = 0.0 * np.ones((mesh.numberofelements,)) 348 352 self.Wini = 0.0 * np.ones((mesh.numberofelements, 2)) 349 self.Aini = self.aSnow* np.ones((mesh.numberofelements, 2))353 self.Aini = 0.0 * np.ones((mesh.numberofelements, 2)) 350 354 self.Adiffini = np.ones((mesh.numberofelements, 2)) 351 355 self.Tini = 273.15 * np.ones((mesh.numberofelements, 2)) 352 # /!\ Default value of Tini must be equal to Tmean but don't know Tmean yet (computed when atmospheric forcings are interpolated on mesh). 353 # If initialization without restart, this value will be overwritten when snow parameters are retrieved in Element.cpp 356 # /!\ Default value of Tini must be equal to Tmean but don't know 357 # Tmean yet (computed when atmospheric forcings are 358 # interpolated on mesh). 359 # If initialization without restart, this value will be 360 # overwritten when snow parameters are retrieved in 361 # Element.cpp 354 362 self.Sizeini = 2 * np.ones((mesh.numberofelements,)) 355 363 #}}} … … 358 366 359 367 md = checkfield(md, 'fieldname', 'smb.isgraingrowth', 'values', [0, 1]) 360 md = checkfield(md, 'fieldname', 'smb.issmbgradients', 'values', [0, 1])361 368 md = checkfield(md, 'fieldname', 'smb.isalbedo', 'values', [0, 1]) 362 369 md = checkfield(md, 'fieldname', 'smb.isshortwave', 'values', [0, 1]) … … 398 405 md = checkfield(md, 'fieldname', 'smb.adThresh', 'NaN', 1, 'Inf', 1, '>=', 0) 399 406 400 if isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)): 407 if self.aIdx == 0: 408 md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1) 409 elif isinstance(self.aIdx, (list, type(np.array([1, 2])))) and (self.aIdx == [1, 2] or (1 in self.aIdx and 2 in self.aIdx)): 401 410 md = checkfield(md, 'fieldname', 'smb.aSnow', 'NaN', 1, 'Inf', 1, '> = ', .64, '< = ', .89) 402 411 md = checkfield(md, 'fieldname', 'smb.aIce', 'NaN', 1, 'Inf', 1, '> = ', .27, '< = ', .58) … … 406 415 md = checkfield(md,'fieldname','smb.ccsnowValue','timeseries',1,'NaN',1,'Inf',1,'>=',0) 407 416 md = checkfield(md,'fieldname','smb.cciceValue','timeseries',1,'NaN',1,'Inf',1,'>=',0) 408 409 elif self.aIdx == 0:410 md = checkfield(md, 'fieldname', 'smb.aValue', 'timeseries', 1, 'NaN', 1, 'Inf', 1, '>=', 0, '<=', 1)411 417 elif self.aIdx == 3: 412 418 md = checkfield(md, 'fieldname', 'smb.cldFrac', 'NaN', 1, 'Inf', 1, '> = ', 0, '< = ', 1) … … 416 422 md = checkfield(md, 'fieldname', 'smb.K', 'NaN', 1, 'Inf', 1, '> = ', 7, '< = ', 7) 417 423 418 # check zTop is < local thickness:424 # Check zTop is < local thickness 419 425 he = np.sum(md.geometry.thickness[md.mesh.elements - 1], axis=1) / np.size(md.mesh.elements, 1) 420 426 if np.any(he < self.zTop): … … 432 438 433 439 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isgraingrowth', 'format', 'Boolean') 434 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'issmbgradients', 'format', 'Boolean')435 440 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isalbedo', 'format', 'Boolean') 436 441 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isshortwave', 'format', 'Boolean') … … 441 446 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isturbulentflux', 'format', 'Boolean') 442 447 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'isconstrainsurfaceT', 'format', 'Boolean') 448 443 449 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'Ta', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) 444 450 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'V', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts) … … 498 504 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer') 499 505 WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer') 500 # figure out dt from forcings:506 # Figure out dt from forcings 501 507 if (np.any(self.P[-1] - self.Ta[-1] != 0) | np.any(self.V[-1] - self.Ta[-1] != 0) | np.any(self.dswrf[-1] - self.Ta[-1] != 0) | np.any(self.dlwrf[-1] - self.Ta[-1] != 0) | np.any(self.eAir[-1] - self.Ta[-1] != 0) | np.any(self.pAir[-1] - self.Ta[-1] != 0)): 502 508 raise IOError('All GEMB forcings (Ta, P, V, dswrf, dlwrf, eAir, pAir) must have the same time steps in the final row!') … … 517 523 raise IOError('If GEMB forcing cciceValue is transient, it must have the same time steps as input Ta in the final row!') 518 524 519 time = self.Ta[-1] # assume all forcings are on the same time step525 time = self.Ta[-1] # Assume all forcings are on the same time step 520 526 dtime = np.diff(time, n=1, axis=0) 521 527 dt = min(dtime) … … 525 531 # Check if smb_dt goes evenly into transient core time step 526 532 if (md.timestepping.time_step % dt >= 1e-10): 527 raise IOError('smb_dt/dt = #f. The number of SMB time steps in one transient core time step has to be an an integer', md.timestepping.time_step / dt)528 529 # process requested outputs533 raise IOError('smb_dt/dt = {}. The number of SMB time steps in one transient core time step has to be an an integer'.format(md.timestepping.time_step / dt)) 534 535 # Process requested outputs 530 536 outputs = self.requested_outputs 531 537 indices = [i for i, x in enumerate(outputs) if x == 'default'] -
TabularUnified issm/trunk-jpl/src/m/classes/SMBmeltcomponents.m ¶
r26209 r26358 10 10 melt = NaN; 11 11 refreeze = NaN; 12 steps_per_step =1;12 steps_per_step = 1; 13 13 averaging = 0; 14 requested_outputs 14 requested_outputs= {}; 15 15 isclimatology; 16 16 end … … 22 22 error('constructor not supported'); 23 23 end 24 end % }}} 25 function disp(self) % {{{ 26 disp(sprintf(' surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :')); 27 fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]'); 28 fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]'); 29 fielddisplay(self,'melt','amount of ice melt in ice column [m/yr ice eq]'); 30 fielddisplay(self,'refreeze','amount of ice melt refrozen in ice column [m/yr ice eq]'); 31 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'); 32 fielddisplay(self, 'averaging', 'averaging methods from short to long steps'); 33 disp(sprintf('%51s 0: Arithmetic (default)',' ')); 34 disp(sprintf('%51s 1: Geometric',' ')); 35 disp(sprintf('%51s 2: Harmonic',' ')); 36 fielddisplay(self,'requested_outputs','additional outputs requested'); 24 37 end % }}} 25 38 function self = extrude(self,md) % {{{ … … 72 85 md = checkfield(md,'fieldname','smb.requested_outputs','stringrow',1); 73 86 end % }}} 74 function disp(self) % {{{75 disp(sprintf(' surface forcings parameters with melt (SMB=accumulation-evaporation-melt+refreeze) :'));76 fielddisplay(self,'accumulation','accumulated snow [m/yr ice eq]');77 fielddisplay(self,'evaporation','amount of ice lost to evaporative processes [m/yr ice eq]');78 fielddisplay(self,'melt','amount of ice melt in ice column [m/yr ice eq]');79 fielddisplay(self,'refreeze','amount of ice melt refrozen in ice column [m/yr ice eq]');80 fielddisplay(self, 'steps_per_step', 'number of smb steps per time step');81 fielddisplay(self, 'averaging', 'averaging methods from short to long steps');82 disp(sprintf('%51s 0: Arithmetic (default)',' '));83 disp(sprintf('%51s 1: Geometric',' '));84 disp(sprintf('%51s 2: Harmonic',' '));85 fielddisplay(self,'requested_outputs','additional outputs requested');86 end % }}}87 87 function marshall(self,prefix,md,fid) % {{{ 88 88 -
TabularUnified issm/trunk-jpl/src/m/classes/SMBmeltcomponents.py ¶
r26208 r26358 1 import numpy as np 2 3 from checkfield import * 1 4 from fielddisplay import fielddisplay 2 from checkfield import *3 5 from project3d import * 4 6 from WriteData import * … … 6 8 7 9 class SMBmeltcomponents(object): 8 """ 9 SMBmeltcomponents Class definition 10 """SMBMELTCOMPONENTS lass definition 10 11 11 12 12 Usage: 13 SMBmeltcomponents = SMBmeltcomponents(); 13 14 """ 14 15 15 16 def __init__(self): # {{{ 16 self.accumulation = float('NaN') 17 self.runoff = float('NaN') 18 self.evaporation = float('NaN') 17 self.accumulation = np.nan 18 self.evaporation = np.nan 19 self.melt = np.nan 20 self.refreeze = np.nan 19 21 self.steps_per_step = 1 20 22 self.averaging = 0 21 23 self.requested_outputs = [] 24 self.isclimatology = np.nan 25 26 if len(args) == 0: 27 pass 28 else: 29 error('constructor not supported') 22 30 #}}} 23 31 24 32 def __repr__(self): # {{{ 25 s tring = " surface forcings parameters with melt (SMB = accumulation-evaporation-melt+refreeze) :"26 s tring = "%s\n%s" % (string,fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]'))27 s tring = "%s\n%s" % (string,fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]'))28 s tring = "%s\n%s" % (string,fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m/yr ice eq]'))29 s tring = "%s\n%s" % (string,fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m/yr ice eq]'))30 s tring = "%s\n%s" % (string,fielddisplay(self, 'steps_per_step', 'number of smb steps per time step'))31 s tring = "%s\n%s" % (string,fielddisplay(self, 'averaging', 'averaging methods from short to long steps'))32 s tring = "%s\n\t\t%s" % (string,'0: Arithmetic (default)')33 s tring = "%s\n\t\t%s" % (string,'1: Geometric')34 s tring = "%s\n\t\t%s" % (string,'2: Harmonic')35 s tring = "%s\n%s" % (string,fielddisplay(self, 'requested_outputs', 'additional outputs requested'))36 return s tring33 s = ' surface forcings parameters with melt (SMB = accumulation-evaporation-melt+refreeze) :\n' 34 s += '{}\n'.format(fielddisplay(self, 'accumulation', 'accumulated snow [m/yr ice eq]')) 35 s += '{}\n'.format(fielddisplay(self, 'evaporation', 'mount of ice lost to evaporative processes [m/yr ice eq]')) 36 s += '{}\n'.format(fielddisplay(self, 'melt', 'amount of ice melt in the ice column [m/yr ice eq]')) 37 s += '{}\n'.format(fielddisplay(self, 'refreeze', 'amount of ice melt refrozen in the ice column [m/yr ice eq]')) 38 s += '{}\n'.format(fielddisplay(self, 'steps_per_step', 'number of smb steps per time step')) 39 s += '{}\n'.format(fielddisplay(self, 'averaging', 'averaging methods from short to long steps')) 40 s += '\t\t{}\n'.format('0: Arithmetic (default)') 41 s += '\t\t{}\n'.format('1: Geometric') 42 s += '\t\t{}\n'.format('2: Harmonic') 43 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 44 return s 37 45 #}}} 38 46 … … 52 60 if np.all(np.isnan(self.accumulation)): 53 61 self.accumulation = np.zeros((md.mesh.numberofvertices)) 54 print(" no SMB.accumulation specified: values set as zero")62 print(" no smb.accumulation specified: values set as zero") 55 63 56 64 if np.all(np.isnan(self.evaporation)): 57 65 self.evaporation = np.zeros((md.mesh.numberofvertices)) 58 print(" no SMB.evaporation specified: values set as zero") 66 print(" no smb.evaporation specified: values set as zero") 67 68 if np.all(np.isnan(self.refreeze)): 69 self.refreeze = np.zeros((md.mesh.numberofvertices)) 70 print(" no smb.refreeze specified: values set as zero") 59 71 60 72 if np.all(np.isnan(self.melt)): 61 73 self.melt = np.zeros((md.mesh.numberofvertices)) 62 print(" no SMB.melt specified: values set as zero") 63 64 if np.all(np.isnan(self.refreeze)): 65 self.refreeze = np.zeros((md.mesh.numberofvertices)) 66 print(" no SMB.refreeze specified: values set as zero") 74 print(" no smb.melt specified: values set as zero") 67 75 68 76 return self 69 77 #}}} 70 78 71 def checkconsistency(self, md, solution, analyses): 79 def checkconsistency(self, md, solution, analyses): # {{{ 72 80 if 'MasstransportAnalysis' in analyses: 73 81 md = checkfield(md, 'fieldname', 'smb.accumulation', 'timeseries', 1, 'NaN', 1, 'Inf', 1) 82 md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1) 83 md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1) 74 84 md = checkfield(md, 'fieldname', 'smb.melt', 'timeseries', 1, 'NaN', 1, 'Inf', 1) 75 md = checkfield(md, 'fieldname', 'smb.refreeze', 'timeseries', 1, 'NaN', 1, 'Inf', 1)76 md = checkfield(md, 'fieldname', 'smb.evaporation', 'timeseries', 1, 'NaN', 1, 'Inf', 1)77 85 78 86 if 'BalancethicknessAnalysis' in analyses: 79 87 md = checkfield(md, 'fieldname', 'smb.accumulation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1) 88 md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1) 89 md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1) 80 90 md = checkfield(md, 'fieldname', 'smb.melt', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1) 81 md = checkfield(md, 'fieldname', 'smb.refreeze', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)82 md = checkfield(md, 'fieldname', 'smb.evaporation', 'size', [md.mesh.numberofvertices], 'NaN', 1, 'Inf', 1)83 91 84 92 md = checkfield(md, 'fieldname', 'smb.steps_per_step', '>=', 1, 'numel', [1]) 85 93 md = checkfield(md, 'fieldname', 'smb.averaging', 'numel', [1], 'values', [0, 1, 2]) 86 md = checkfield(md, 'fieldname', ' masstransport.requested_outputs', 'stringrow', 1)94 md = checkfield(md, 'fieldname', 'smb.requested_outputs', 'stringrow', 1) 87 95 return md 88 96 # }}} 89 def marshall(self, prefix, md, fid): 97 def marshall(self, prefix, md, fid): # {{{ 90 98 91 99 yts = md.constants.yts 92 100 93 101 WriteData(fid, prefix, 'name', 'md.smb.model', 'data', 3, 'format', 'Integer') 94 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)95 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)96 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'melt', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)97 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'refreeze', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 ./ yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts)102 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'accumulation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 103 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'evaporation', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 104 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'melt', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 105 WriteData(fid, prefix, 'object', self, 'class', 'smb', 'fieldname', 'refreeze', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 98 106 WriteData(fid, prefix, 'object', self, 'fieldname', 'steps_per_step', 'format', 'Integer') 99 107 WriteData(fid, prefix, 'object', self, 'fieldname', 'averaging', 'format', 'Integer') … … 106 114 outputs = outputscopy 107 115 WriteData(fid, prefix, 'data', outputs, 'name', 'md.smb.requested_outputs', 'format', 'StringArray') 108 109 116 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/basalforcings.m ¶
r21049 r26358 11 11 end 12 12 methods 13 function self = extrude(self,md) % {{{14 self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1);15 self.floatingice_melting_rate=project3d(md,'vector',self.floatingice_melting_rate,'type','node','layer',1);16 self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','node','layer',1); %bedrock only gets geothermal flux17 end % }}}18 13 function self = basalforcings(varargin) % {{{ 19 14 switch nargin … … 23 18 error('constructor not supported'); 24 19 end 20 end % }}} 21 function disp(self) % {{{ 22 disp(sprintf(' basal forcings parameters:')); 23 24 fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) [m/yr]'); 25 fielddisplay(self,'floatingice_melting_rate','basal melting rate (positive if melting) [m/yr]'); 26 fielddisplay(self,'geothermalflux','geothermal heat flux [W/m^2]'); 27 28 end % }}} 29 function self = extrude(self,md) % {{{ 30 self.groundedice_melting_rate=project3d(md,'vector',self.groundedice_melting_rate,'type','node','layer',1); 31 self.floatingice_melting_rate=project3d(md,'vector',self.floatingice_melting_rate,'type','node','layer',1); 32 self.geothermalflux=project3d(md,'vector',self.geothermalflux,'type','node','layer',1); %bedrock only gets geothermal flux 25 33 end % }}} 26 34 function self = initialize(self,md) % {{{ … … 56 64 end 57 65 end % }}} 58 function disp(self) % {{{59 disp(sprintf(' basal forcings parameters:'));60 61 fielddisplay(self,'groundedice_melting_rate','basal melting rate (positive if melting) [m/yr]');62 fielddisplay(self,'floatingice_melting_rate','basal melting rate (positive if melting) [m/yr]');63 fielddisplay(self,'geothermalflux','geothermal heat flux [W/m^2]');64 65 end % }}}66 66 function marshall(self,prefix,md,fid) % {{{ 67 67 … … 69 69 70 70 WriteData(fid,prefix,'name','md.basalforcings.model','data',1,'format','Integer'); 71 WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts', md.constants.yts)72 WriteData(fid,prefix,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts', md.constants.yts)73 WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts', md.constants.yts);71 WriteData(fid,prefix,'object',self,'fieldname','groundedice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts) 72 WriteData(fid,prefix,'object',self,'fieldname','floatingice_melting_rate','format','DoubleMat','mattype',1,'scale',1./yts,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts) 73 WriteData(fid,prefix,'object',self,'fieldname','geothermalflux','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts); 74 74 end % }}} 75 75 function savemodeljs(self,fid,modelname) % {{{ -
TabularUnified issm/trunk-jpl/src/m/classes/basalforcings.py ¶
r26241 r26358 23 23 def __repr__(self): # {{{ 24 24 s = ' basal forcings parameters:\n' 25 s += '{}\n'.format(fielddisplay(self, "groundedice_melting_rate", "basal melting rate (positive if melting) [m / yr]"))26 s += '{}\n'.format(fielddisplay(self, "floatingice_melting_rate", "basal melting rate (positive if melting) [m / yr]"))27 s += '{}\n'.format(fielddisplay(self, "geothermalflux", "geothermal heat flux [W / m^2]"))25 s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m/yr]')) 26 s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m/yr]')) 27 s += '{}\n'.format(fielddisplay(self, 'geothermalflux', 'geothermal heat flux [W/m^2]')) 28 28 return s 29 29 #}}} … … 37 37 if np.all(np.isnan(self.groundedice_melting_rate)): 38 38 self.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 39 print( " no basalforcings.groundedice_melting_rate specified: values set as zero")39 print(' no basalforcings.groundedice_melting_rate specified: values set as zero') 40 40 if np.all(np.isnan(self.floatingice_melting_rate)): 41 41 self.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 42 print( " no basalforcings.floatingice_melting_rate specified: values set as zero")42 print(' no basalforcings.floatingice_melting_rate specified: values set as zero') 43 43 return self 44 44 #}}} … … 62 62 yts = md.constants.yts 63 63 WriteData(fid, prefix, 'name', 'md.basalforcings.model', 'data', 1, 'format', 'Integer') 64 WriteData(fid, prefix, 'object', self, 'fieldname', 'groundedice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 . / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)65 WriteData(fid, prefix, 'object', self, 'fieldname', 'floatingice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 . / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)66 WriteData(fid, prefix, 'object', self, 'fieldname', 'geothermalflux', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts)64 WriteData(fid, prefix, 'object', self, 'fieldname', 'groundedice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 65 WriteData(fid, prefix, 'object', self, 'fieldname', 'floatingice_melting_rate', 'format', 'DoubleMat', 'mattype', 1, 'scale', 1 / yts, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 66 WriteData(fid, prefix, 'object', self, 'fieldname', 'geothermalflux', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) 67 67 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/clusters/generic.py ¶
r26353 r26358 57 57 58 58 def __repr__(self): # {{{ 59 # display the object59 # Display the object 60 60 s = 'class \'{}\' object \'{}\' = \n'.format(type(self), 'self') 61 61 s += ' name: {}\n'.format(self.name) … … 183 183 fid.close() 184 184 185 # in interactive mode, create a run file, and errlog and outlog file185 # In interactive mode, create a run file, and errlog and outlog file 186 186 if self.interactive: 187 187 fid = open(modelname + '.errlog', 'w') … … 192 192 193 193 def UploadQueueJob(self, modelname, dirname, filelist): # {{{ 194 # compress the files into one zip.194 # Compress the files into one zip 195 195 compressstring = 'tar -zcf {}.tar.gz '.format(dirname) 196 196 for file in filelist: … … 219 219 def Download(self, dirname, filelist): # {{{ 220 220 if ispc(): 221 # do nothing221 # Do nothing 222 222 return 223 # copy files from cluster to current directory223 # Copy files from cluster to current directory 224 224 directory = '{}/{}/'.format(self.executionpath, dirname) 225 225 issmscpin(self.name, self.login, self.port, directory, filelist) -
TabularUnified issm/trunk-jpl/src/m/classes/constants.py ¶
r26225 r26358 1 from checkfield import checkfield 1 2 from fielddisplay import fielddisplay 2 from checkfield import checkfield3 3 from WriteData import WriteData 4 4 5 5 6 6 class constants(object): 7 """ 8 CONSTANTS class definition 7 """CONSTANTS class definition 9 8 10 9 Usage: … … 23 22 #}}} 24 23 def __repr__(self): # {{{ 25 string = " constants parameters:" 26 27 string = "%s\n%s" % (string, fielddisplay(self, "g", "gravitational acceleration [m / s^2]")) 28 string = "%s\n%s" % (string, fielddisplay(self, "omega", "angular velocity of Earth [rad / s]")) 29 string = "%s\n%s" % (string, fielddisplay(self, "yts", "number of seconds in a year [s / yr]")) 30 string = "%s\n%s" % (string, fielddisplay(self, "referencetemperature", "reference temperature used in the enthalpy model [K]")) 31 string = "%s\n%s" % (string, fielddisplay(self, "gravitational_constant", "Newtonian constant of gravitation [m^3/kg/s^2]")) 32 33 return string 24 s = ' constants parameters:\n' 25 s += '{}\n'.format(fielddisplay(self, 'g', 'gravitational acceleration [m/s^2]')) 26 s += '{}\n'.format(fielddisplay(self, 'omega', 'angular velocity of Earth [rad/s]')) 27 s += '{}\n'.format(fielddisplay(self, 'yts', 'number of seconds in a year [s/yr]')) 28 s += '{}\n'.format(fielddisplay(self, 'referencetemperature', 'reference temperature used in the enthalpy model [K]')) 29 s += '{}\n'.format(fielddisplay(self, 'gravitational_constant', 'Newtonian constant of gravitation [m^3/kg/s^2]')) 30 return s 34 31 #}}} 35 32 def setdefaultparameters(self): # {{{ 36 # acceleration due to gravity (m / s^2)33 # Acceleration due to gravity (m / s^2) 37 34 self.g = 9.81 38 35 39 # Earth's rotation speed36 # Earth's rotation speed 40 37 self.omega = 7.292 * 1e-5 41 38 42 # converstion from year to seconds43 self.yts = 365. * 24. * 3600.39 # Converstion from year to seconds 40 self.yts = 365.0 * 24.0 * 3600.0 44 41 45 # the reference temperature for enthalpy model (cf Aschwanden)42 # The reference temperature for enthalpy model (cf Aschwanden) 46 43 self.referencetemperature = 223.15 47 44 48 # gravitational constant:45 # Gravitational constant: 49 46 self.gravitational_constant = 6.67259e-11 50 47 … … 52 49 #}}} 53 50 def checkconsistency(self, md, solution, analyses): # {{{ 54 md = checkfield(md, 'fieldname', 'constants.g', '>=', 0, 'size', [1]) 51 md = checkfield(md, 'fieldname', 'constants.g', '>=', 0, 'size', [1]) # We allow 0 for validation tests 55 52 md = checkfield(md, 'fieldname', 'constants.omega', '>=', 0, 'size', [1]) 56 53 md = checkfield(md, 'fieldname', 'constants.yts', '>', 0, 'size', [1]) -
TabularUnified issm/trunk-jpl/src/m/classes/dsl.m ¶
r26301 r26358 41 41 42 42 %Early return 43 if ~ismember('SealevelchangeAnalysis',analyses) , return; end44 if (strcmp(solution,'TransientSolution') & md.transient.isslc == 0), return; end45 if (md.transient.isoceantransport==0) return;end43 if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc == 0) | (md.transient.isoceantransport==0), 44 return; 45 end 46 46 md = checkfield(md,'fieldname','dsl.global_average_thermosteric_sea_level','NaN',1,'Inf',1); 47 47 md = checkfield(md,'fieldname','dsl.sea_surface_height_above_geoid','NaN',1,'Inf',1,'timeseries',1); -
TabularUnified issm/trunk-jpl/src/m/classes/dsl.py ¶
r26319 r26358 41 41 def checkconsistency(self, md, solution, analyses): #{{{ 42 42 # Early return 43 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or ( md.transient.isoceantransport == 0):43 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or (not md.transient.isoceantransport): 44 44 return md 45 45 md = checkfield(md, 'fieldname', 'dsl.global_average_thermosteric_sea_level', 'NaN', 1, 'Inf', 1) … … 56 56 yts = md.constants.yts 57 57 WriteData(fid, prefix, 'name', 'md.dsl.model', 'data', 1, 'format', 'Integer') 58 WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, ' yts', yts)# mattype 2, because we are sending a GMSL value identical everywhere on each element.58 WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'DoubleMat', 'mattype', 2, 'timeseries', 1, 'timeserieslength', 2, 'yts', yts) # mattype 2, because we are sending a GMSL value identical everywhere on each element. 59 59 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) # mattype 1 because we specify DSL at vertex locations. 60 60 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts) # mattype 1 because we specify bottom pressure at vertex locations. … … 68 68 69 69 def initialize(self, md): #{{{ 70 print('sdasa') 71 exit() 70 72 if np.isnan(self.global_average_thermosteric_sea_level): 71 73 self.global_average_thermosteric_sea_level = np.array([0, 0]).reshape(-1, 1) -
TabularUnified issm/trunk-jpl/src/m/classes/dslmme.m ¶
r26231 r26358 35 35 36 36 %Early return 37 if ~ismember('SealevelchangeAnalysis',analyses) , return; end38 if (strcmp(solution,'TransientSolution') & md.transient.isslc == 0), return; end39 if (md.transient.isoceantransport==0) return;end37 if ~ismember('SealevelchangeAnalysis',analyses) | (strcmp(solution,'TransientSolution') & md.transient.isslc == 0) | (md.transient.isoceantransport==0), 38 return; 39 end 40 40 for i=1:length(self.global_average_thermosteric_sea_level), 41 41 md = checkfield(md,'field',self.global_average_thermosteric_sea_level{i},'NaN',1,'Inf',1); -
TabularUnified issm/trunk-jpl/src/m/classes/dslmme.py ¶
r26317 r26358 13 13 14 14 def __init__(self, *args): #{{{ 15 self.modelid = 0 # Index into the multi-model ensemble 16 self.global_average_thermosteric_sea_level = [] 17 self.sea_surface_height_above_geoid = [] 18 self.sea_water_pressure_at_sea_floor = [] 15 self.modelid = 0 # Index into the multi-model ensemble, determine which field will be used 16 self.global_average_thermosteric_sea_level = [] # Corresponds to zostoga field in CMIP5 archives. Specified as a temporally variable quantity (in m) for each ensemble. 17 self.sea_surface_height_above_geoid = [] # Corresponds to zos field in CMIP5 archives. Spatial average is 0. Specified as a spatio-temporally variable quantity (in m) for each ensemble. 18 self.sea_water_pressure_at_sea_floor = [] #Corresponds to bpo field in CMIP5 archives. Specified as a spatio-temporally variable quantity (in m equivalent, not in Pa!) for each ensemble. 19 19 20 20 nargs = len(args) … … 41 41 def checkconsistency(self, md, solution, analyses): # {{{ 42 42 # Early return 43 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) :43 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc) or (not md.transient.isoceantransport): 44 44 return md 45 45 … … 60 60 WriteData(fid, prefix, 'object', self, 'fieldname', 'modelid', 'format', 'Double') 61 61 WriteData(fid, prefix, 'name', 'md.dsl.nummodels', 'data', len(self.global_average_thermosteric_sea_level), 'format', 'Integer') 62 WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'MatArray', 'timeseries', 1, 'timeserieslength', 2 , 'yts', md.constants.yts, 'scale', 1e-3 / md.constants.yts)63 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1 , 'yts', md.constants.yts, 'scale', 1e-3)64 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1 , 'yts', md.constants.yts, 'scale', 1e-3 / md.constants.yts)62 WriteData(fid, prefix, 'object', self, 'fieldname', 'global_average_thermosteric_sea_level', 'format', 'MatArray', 'timeseries', 1, 'timeserieslength', 2) 63 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_water_pressure_at_sea_floor', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1) 64 WriteData(fid, prefix, 'object', self, 'fieldname', 'sea_surface_height_above_geoid', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofvertices + 1) 65 65 #}}} 66 66 -
TabularUnified issm/trunk-jpl/src/m/classes/fourierlove.py ¶
r26301 r26358 38 38 39 39 def __repr__(self): #{{{ 40 # TODO: 41 # - Correct display to match MATLAB 42 # 40 43 s = ' Fourier Love class:\n' 41 44 s += '{}\n'.format(fielddisplay(self, 'nfreq', 'number of frequencies sampled (default: 1, elastic) [Hz]')) … … 43 46 s += '{}\n'.format(fielddisplay(self, 'sh_nmax', 'maximum spherical harmonic degree (default: 256, .35 deg, or 40 km at equator)')) 44 47 s += '{}\n'.format(fielddisplay(self, 'sh_nmin', 'minimum spherical harmonic degree (default: 1)')) 45 s += '{}\n'.format(fielddisplay(self, 'g0', 'adimensioning constant for gravity (default: 10) [m /s^2]'))46 s += '{}\n'.format(fielddisplay(self, 'r0', 'adimensioning constant for radius (default: 637 8e3) [m]'))47 s += '{}\n'.format(fielddisplay(self, 'mu0', 'adimensioning constant for stress (default: 1 .0e11) [Pa]'))48 s += '{}\n'.format(fielddisplay(self, 'g0', 'adimensioning constant for gravity (default: 10) [m/s^2]')) 49 s += '{}\n'.format(fielddisplay(self, 'r0', 'adimensioning constant for radius (default: 6371*10^3) [m]')) 50 s += '{}\n'.format(fielddisplay(self, 'mu0', 'adimensioning constant for stress (default: 10^11) [Pa]')) 48 51 s += '{}\n'.format(fielddisplay(self, 'allow_layer_deletion', 'allow for migration of the integration boundary with increasing spherical harmonics degree (default: 1)')) 49 52 s += '{}\n'.format(fielddisplay(self, 'Gravitational_Constant', 'Newtonian constant of gravitation (default: 6.67259e-11 [m^3 kg^-1 s^-2])')) … … 51 54 s += '{}\n'.format(fielddisplay(self, 'underflow_tol', 'threshold of deep to surface love number ratio to trigger the deletion of layers (default: 1e-16)')) 52 55 s += '{}\n'.format(fielddisplay(self, 'integration_steps_per_layer', 'number of radial steps to propagate the yi system from the bottom to the top of each layer (default: 100)')) 53 s += '{}\n'.format(fielddisplay(self, 'istemporal', {'1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default: 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency'}))56 s += '{}\n'.format(fielddisplay(self, 'istemporal', ['1 for time-dependent love numbers, 0 for frequency-dependent or elastic love numbers (default: 0)', 'If 1: use fourierlove function build_frequencies_from_time to meet consistency'])) 54 57 s += '{}\n'.format(fielddisplay(self, 'n_temporal_iterations', 'max number of iterations in the inverse Laplace transform. Also the number of spectral samples per time step requested (default: 8)')) 55 58 s += '{}\n'.format(fielddisplay(self, 'time', 'time vector for deformation if istemporal (default: 0) [s]')) … … 121 124 md = checkfield(md, 'fieldname', 'love.n_temporal_iterations', 'NaN', 1, 'Inf', 1, 'numel', 1, '>', 0) 122 125 md = checkfield(md, 'fieldname', 'love.time', 'NaN', 1, 'Inf', 1, 'numel', md.love.nfreq / 2 / md.love.n_temporal_iterations) 123 if md.love.sh_nmin <= 1 and (md.love.forcing_type == 1 or md.love.forcing_type == 5 or md.love.forcing_type == 9):126 if md.love.sh_nmin <= 1 and (md.love.forcing_type == 9 or md.love.forcing_type == 5 or md.love.forcing_type == 1): 124 127 raise RuntimeError('Degree 1 not supported for forcing type {}. Use sh_min >= 2 for this kind of calculation.'.format(md.love.forcing_type)) 125 128 -
TabularUnified issm/trunk-jpl/src/m/classes/geometry.py ¶
r26301 r26358 14 14 """ 15 15 16 def __init__(self, *args): #{{{16 def __init__(self, *args): # {{{ 17 17 self.surface = np.nan 18 18 self.thickness = np.nan … … 25 25 else: 26 26 raise Exception('constructor not supported') 27 # }}}27 # }}} 28 28 29 def __repr__(self): #{{{29 def __repr__(self): # {{{ 30 30 s = ' geometry parameters:\n' 31 31 s += '{}\n'.format(fielddisplay(self, 'surface', 'ice upper surface elevation [m]')) … … 34 34 s += '{}\n'.format(fielddisplay(self, 'bed', 'bed elevation [m]')) 35 35 return s 36 # }}}36 # }}} 37 37 38 def setdefaultparameters(self): #{{{38 def setdefaultparameters(self): # {{{ 39 39 return 40 # }}}40 # }}} 41 41 42 def checkconsistency(self, md, solution, analyses): #{{{42 def checkconsistency(self, md, solution, analyses): # {{{ 43 43 if solution == 'LoveSolution': 44 44 return md … … 60 60 # }}} 61 61 62 def marshall(self, prefix, md, fid): #{{{62 def marshall(self, prefix, md, fid): # {{{ 63 63 length_thickness = len(self.thickness) 64 64 if (length_thickness == md.mesh.numberofvertices) or (length_thickness == md.mesh.numberofvertices + 1): 65 65 WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 66 66 elif (length_thickness == md.mesh.numberofelements) or (length_thickness == md.mesh.numberofelements + 1): 67 WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberof vertices + 1, 'yts', md.constants.yts)67 WriteData(fid, prefix, 'object', self, 'fieldname', 'thickness', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts) 68 68 else: 69 69 raise RuntimeError('geometry thickness time series should be a vertex or element time series') … … 75 75 # }}} 76 76 77 def extrude(self, md): #{{{77 def extrude(self, md): # {{{ 78 78 self.surface = project3d(md, 'vector', self.surface, 'type', 'node') 79 79 self.thickness = project3d(md, 'vector', self.thickness, 'type', 'node') … … 82 82 self.bed = project3d(md, 'vector', self.bed, 'type', 'node') 83 83 return self 84 # }}}84 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/groundingline.py ¶
r24861 r26358 1 1 import numpy as np 2 from checkfield import checkfield 2 3 from fielddisplay import fielddisplay 3 from checkfield import checkfield 4 import MatlabFuncs as m 4 5 from WriteData import WriteData 5 import MatlabFuncs as m6 6 7 7 … … 19 19 self.melt_interpolation = '' 20 20 21 #set defaults21 # Set defaults 22 22 self.setdefaultparameters() 23 23 24 # }}}24 # }}} 25 25 26 26 def __repr__(self): # {{{ 27 string = ' grounding line migration parameters:' 28 29 string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of grounding line migration: ''SoftMigration'', ''SubelementMigration'', ''AggressiveMigration'', ''Contact'', ''None''')) 30 string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of friction interpolation on partially floating elements: ''SubelementFriction1'', ''SubelementFriction2'', ''NoFrictionOnPartiallyFloating''')) 31 string = "%s\n%s" % (string, fielddisplay(self, 'migration', 'type of melt interpolation on partially floating elements: ''SubelementMelt1'', ''SubelementMelt2'', ''NoMeltOnPartiallyFloating'', ''FullMeltOnPartiallyFloating''')) 32 return string 33 #}}} 27 s = ' grounding line migration parameters:\n' 28 s += '{}\n'.format(fielddisplay(self, 'migration', 'type of grounding line migration: \'SoftMigration\', \'SubelementMigration\', \'AggressiveMigration\', \'Contact\', \'None\'')) 29 s += '{}\n'.format(fielddisplay(self, 'migration', 'type of friction interpolation on partially floating elements: ''SubelementFriction1'', ''SubelementFriction2'', ''NoFrictionOnPartiallyFloating''')) 30 s += '{}\n'.format(fielddisplay(self, 'migration', 'type of melt interpolation on partially floating elements: \'SubelementMelt1\', \'SubelementMelt2\', \'NoMeltOnPartiallyFloating\', \'FullMeltOnPartiallyFloating\'')) 31 return s 32 # }}} 34 33 35 34 def setdefaultparameters(self): # {{{ 36 37 #Type of migration 35 # Type of migration 38 36 self.migration = 'SubelementMigration' 39 37 self.friction_interpolation = 'SubelementFriction1' … … 41 39 42 40 return self 43 # }}}41 # }}} 44 42 45 43 def checkconsistency(self, md, solution, analyses): # {{{ 46 47 44 md = checkfield(md, 'fieldname', 'groundingline.migration', 'values', ['None', 'SubelementMigration', 'AggressiveMigration', 'SoftMigration', 'Contact', 'GroundingOnly']) 48 45 md = checkfield(md, 'fieldname', 'groundingline.friction_interpolation', 'values', ['SubelementFriction1', 'SubelementFriction2', 'NoFrictionOnPartiallyFloating']) … … 53 50 md.checkmessage("requesting grounding line migration, but bathymetry is absent!") 54 51 pos = np.nonzero(md.mask.ocean_levelset > 0.)[0] 55 if any(np.abs(md.geometry.base[pos] - md.geometry.bed[pos]) > 10**-10):52 if any(np.abs(md.geometry.base[pos] - md.geometry.bed[pos]) > pow(10, -10)): 56 53 md.checkmessage("base not equal to bed on grounded ice!") 57 if any(md.geometry.bed - md.geometry.base > 10**-9):54 if any(md.geometry.bed - md.geometry.base > pow(10, -9)): 58 55 md.checkmessage("bed superior to base on floating ice!") 59 56 -
TabularUnified issm/trunk-jpl/src/m/classes/initialization.py ¶
r26302 r26358 39 39 def __repr__(self): #{{{ 40 40 s = ' initial field values:\n' 41 s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m /yr]'))42 s += '{}\n'.format(fielddisplay(self, 'vy', 'y component of velocity [m /yr]'))43 s += '{}\n'.format(fielddisplay(self, 'vz', 'z component of velocity [m /yr]'))44 s += '{}\n'.format(fielddisplay(self, 'vel', 'velocity norm [m /yr]'))41 s += '{}\n'.format(fielddisplay(self, 'vx', 'x component of velocity [m/yr]')) 42 s += '{}\n'.format(fielddisplay(self, 'vy', 'y component of velocity [m/yr]')) 43 s += '{}\n'.format(fielddisplay(self, 'vz', 'z component of velocity [m/yr]')) 44 s += '{}\n'.format(fielddisplay(self, 'vel', 'velocity norm [m/yr]')) 45 45 s += '{}\n'.format(fielddisplay(self, 'pressure', 'pressure [Pa]')) 46 46 s += '{}\n'.format(fielddisplay(self, 'temperature', 'temperature [K]')) … … 70 70 if solution == 'TransientSolution' and md.transient.isslc and md.transient.isoceantransport: 71 71 md = checkfield(md, 'fieldname', 'initialization.bottompressure', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 72 md = checkfield(md, 'fieldname', 'initialization.dsl', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) 73 md = checkfield(md, 'fieldname', 'initialization.str', 'NaN', 1, 'Inf', 1, 'size', [1]) 72 74 if 'BalancethicknessAnalysis' in analyses and solution == 'BalancethicknessSolution': 73 75 md = checkfield(md, 'fieldname', 'initialization.vx', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) … … 155 157 self.sealevel = project3d(md, 'vector', self.sealevel, 'type', 'node', 'layer', 1) 156 158 self.bottompressure = project3d(md, 'vector', self.bottompressure, 'type', 'node', 'layer', 1) 159 self.dsl = project3d(md, 'vector', self.dsl, 'type', 'node', 'layer', 1) 160 self.str = project3d(md, 'vector', self.str, 'type', 'node', 'layer', 1) 157 161 158 162 # Lithostatic pressure by default -
TabularUnified issm/trunk-jpl/src/m/classes/issmsettings.py ¶
r26353 r26358 39 39 40 40 def setdefaultparameters(self): # {{{ 41 # are we short in memory? (0 faster but requires more memory)41 # Are we short in memory? (0 faster but requires more memory) 42 42 self.lowmem = 0 43 # i / o:43 # I/O: 44 44 self.io_gather = 1 45 # results frequency by default every step45 # Results frequency by default every step 46 46 self.output_frequency = 1 47 # coupling frequency of the stress balance solver by default every step47 # Coupling frequency of the stress balance solver by default every step 48 48 self.sb_coupling_frequency = 1 49 # checkpoints frequency, by default never:49 # Checkpoints frequency, by default never: 50 50 self.checkpoint_frequency = 0 51 # this option can be activated to load automatically the results52 # onto the model after a parallel run by waiting for the lock file53 # N minutesthat is generated once the solution has converged54 # 0 to deactivate55 self.waitonlock = 2**31- 156 # throw an error if solver residue exceeds this value51 # This option can be activated to load automatically the results onto 52 # the model after a parallel run by waiting for the lock file N minutes 53 # that is generated once the solution has converged 54 # Set to 0 to deactivate 55 self.waitonlock = pow(2, 31) - 1 56 # Throw an error if solver residue exceeds this value 57 57 self.solver_residue_threshold = 1e-6 58 58 -
TabularUnified issm/trunk-jpl/src/m/classes/levelset.m ¶
r25842 r26358 9 9 spclevelset = NaN; 10 10 reinit_frequency = 5; 11 kill_icebergs 12 migration_max 13 fe 11 kill_icebergs = 0; 12 migration_max = 0.; 13 fe = 'P1'; 14 14 end 15 15 methods … … 32 32 end 33 33 end % }}} 34 function disp(self) % {{{ 35 disp(sprintf(' Level-set parameters:')); 36 fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding'); 37 fielddisplay(self,'spclevelset','Levelset constraints (NaN means no constraint)'); 38 fielddisplay(self,'reinit_frequency','Amount of time steps after which the levelset function in re-initialized'); 39 fielddisplay(self,'kill_icebergs','remove floating icebergs to prevent rigid body motions (1: true, 0: false)'); 40 fielddisplay(self,'migration_max','maximum allowed migration rate (m/a)'); 41 fielddisplay(self,'fe','Finite Element type: ''P1'' (default), or ''P2'''); 42 end % }}} 34 43 function self = extrude(self,md) % {{{ 35 44 … … 42 51 self.reinit_frequency = 5; 43 52 self.kill_icebergs = 1; 44 self.migration_max 53 self.migration_max = 1e12; % No need for general cases, unless specified 45 54 46 55 %Linear elements by default … … 58 67 md = checkfield(md,'fieldname','levelset.fe','values',{'P1','P2'}); 59 68 end % }}} 60 function disp(self) % {{{61 disp(sprintf(' Level-set parameters:'));62 fielddisplay(self,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');63 fielddisplay(self,'spclevelset','Levelset constraints (NaN means no constraint)');64 fielddisplay(self,'reinit_frequency','Amount of time steps after which the levelset function in re-initialized');65 fielddisplay(self,'kill_icebergs','remove floating icebergs to prevent rigid body motions (1: true, 0: false)');66 fielddisplay(self,'migration_max','maximum allowed migration rate (m/a)');67 fielddisplay(self,'fe','Finite Element type: ''P1'' (default), or ''P2''');68 end % }}}69 69 function marshall(self,prefix,md,fid) % {{{ 70 70 … … 72 72 73 73 WriteData(fid,prefix,'object',self,'fieldname','stabilization','format','Integer'); 74 WriteData(fid,prefix,'object',self,'fieldname','spclevelset','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts', md.constants.yts);74 WriteData(fid,prefix,'object',self,'fieldname','spclevelset','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',yts); 75 75 WriteData(fid,prefix,'object',self,'fieldname','reinit_frequency','format','Integer'); 76 76 WriteData(fid,prefix,'object',self,'fieldname','kill_icebergs','format','Boolean'); -
TabularUnified issm/trunk-jpl/src/m/classes/levelset.py ¶
r25843 r26358 1 import numpy as np 2 3 from checkfield import checkfield 1 4 from fielddisplay import fielddisplay 2 5 from project3d import project3d 3 from checkfield import checkfield4 6 from WriteData import WriteData 5 7 6 8 7 9 class levelset(object): 8 """ 9 LEVELSET class definition 10 """LEVELSET class definition 10 11 11 12 12 Usage: 13 levelset = levelset() 13 14 """ 14 15 15 16 def __init__(self): # {{{ 16 17 17 self.stabilization = 0 18 self.spclevelset = float('NaN')19 self.reinit_frequency = 018 self.spclevelset = np.nan 19 self.reinit_frequency = 5 20 20 self.kill_icebergs = 0 21 self.migration_max = 0 .21 self.migration_max = 0 22 22 self.fe = 'P1' 23 23 24 #set defaults24 # Set defaults 25 25 self.setdefaultparameters() 26 27 26 #}}} 28 27 def __repr__(self): # {{{ 29 s tring = ' Level - set parameters:'30 s tring = "%s\n%s" % (string,fielddisplay(self, 'stabilization', '0: no, 1: artificial_diffusivity, 2: streamline upwinding'))31 s tring = "%s\n%s" % (string, fielddisplay(self, 'spclevelset', 'levelset constraints (NaN means no constraint)'))32 s tring = "%s\n%s" % (string,fielddisplay(self, 'reinit_frequency', 'Amount of time steps after which the levelset function in re-initialized'))33 s tring = "%s\n%s" % (string,fielddisplay(self, 'kill_icebergs', 'remove floating icebergs to prevent rigid body motions (1: true, 0: false)'))34 s tring = "%s\n%s" % (string, fielddisplay(self, 'migration_max', 'maximum allowed migration rate (m /a)'))35 s tring = "%s\n%s" % (string, fielddisplay(self, 'fe', 'Finite Element type: ''P1'' (default), or ''P2'''))28 s = ' Level-set parameters:\n' 29 s += '{}\n'.format(fielddisplay(self, 'stabilization', '0: no, 1: artificial_diffusivity, 2: streamline upwinding')) 30 s += '{}\n'.format(fielddisplay(self, 'spclevelset', 'Levelset constraints (NaN means no constraint)')) 31 s += '{}\n'.format(fielddisplay(self, 'reinit_frequency', 'Amount of time steps after which the levelset function in re-initialized')) 32 s += '{}\n'.format(fielddisplay(self, 'kill_icebergs', 'remove floating icebergs to prevent rigid body motions (1: true, 0: false)')) 33 s += '{}\n'.format(fielddisplay(self, 'migration_max', 'maximum allowed migration rate (m/a)')) 34 s += '{}\n'.format(fielddisplay(self, 'fe', 'Finite Element type: \'P1\' (default), or \'P2\'')) 36 35 37 return string 38 #}}} 39 40 def extrude(self, md): # {{{ 41 self.spclevelset = project3d(md, 'vector', self.spclevelset, 'type', 'node') 42 return self 36 return s 43 37 #}}} 44 38 45 39 def setdefaultparameters(self): # {{{ 46 # stabilization = 1 by default40 # Stabilization = 1 by default 47 41 self.stabilization = 1 48 42 self.reinit_frequency = 5 … … 50 44 self.migration_max = 1e12 # No need for general cases, unless specified 51 45 52 #Linear elements by default46 # Linear elements by default 53 47 self.fe = 'P1' 54 48 … … 57 51 58 52 def checkconsistency(self, md, solution, analyses): # {{{ 59 # Early return53 # Early return 60 54 if (solution != 'TransientSolution') or (not md.transient.ismovingfront): 61 55 return md … … 70 64 # }}} 71 65 66 def extrude(self, md): # {{{ 67 self.spclevelset = project3d(md, 'vector', self.spclevelset, 'type', 'node') 68 return self 69 #}}} 70 72 71 def marshall(self, prefix, md, fid): # {{{ 73 72 yts = md.constants.yts … … 77 76 WriteData(fid, prefix, 'object', self, 'fieldname', 'reinit_frequency', 'format', 'Integer') 78 77 WriteData(fid, prefix, 'object', self, 'fieldname', 'kill_icebergs', 'format', 'Boolean') 79 WriteData(fid, prefix, 'object', self, 'fieldname', 'migration_max', 'format', 'Double', 'scale', 1 ./ yts)78 WriteData(fid, prefix, 'object', self, 'fieldname', 'migration_max', 'format', 'Double', 'scale', 1 / yts) 80 79 WriteData(fid, prefix, 'object', self, 'fieldname', 'fe', 'format', 'String') 81 80 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/lovenumbers.py ¶
r26317 r26358 81 81 md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.th', 'NaN', 1, 'Inf', 1) 82 82 md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tk', 'NaN', 1, 'Inf', 1) 83 md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tl', 'NaN', 1, 'Inf', 1) 83 84 md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.tk2secular', 'NaN', 1, 'Inf', 1) 84 85 md = checkfield(md, 'fieldname', 'solidearth.lovenumbers.timefreq', 'NaN', 1, 'Inf', 1) -
TabularUnified issm/trunk-jpl/src/m/classes/matdamageice.m ¶
r26065 r26358 95 95 self.rheology_law='Paterson'; 96 96 97 %SL R98 self.earth_density= 5512; % average density of the Earth,(kg/m^3)97 %SLC 98 self.earth_density= 5512; % average density of the Earth (kg/m^3) 99 99 100 100 end % }}} -
TabularUnified issm/trunk-jpl/src/m/classes/matdamageice.py ¶
r26317 r26358 6 6 7 7 class matdamageice(object): 8 """ 9 MATICE class definition 8 """MATICE class definition 10 9 11 10 Usage: … … 14 13 15 14 def __init__(self): # {{{ 16 self.rho_ice = 0 .17 self.rho_water = 0 .18 self.rho_freshwater = 0 .19 self.mu_water = 0 .20 self.heatcapacity = 0 .21 self.latentheat = 0 .22 self.thermalconductivity = 0 .23 self.temperateiceconductivity = 0 .15 self.rho_ice = 0 16 self.rho_water = 0 17 self.rho_freshwater = 0 18 self.mu_water = 0 19 self.heatcapacity = 0 20 self.latentheat = 0 21 self.thermalconductivity = 0 22 self.temperateiceconductivity = 0 24 23 self.effectiveconductivity_averaging = 0 25 self.meltingpoint = 0 .26 self.beta = 0 .27 self.mixed_layer_capacity = 0 .28 self.thermal_exchange_velocity = 0 .29 self.rheology_B = float('NaN')30 self.rheology_n = float('NaN')24 self.meltingpoint = 0 25 self.beta = 0 26 self.mixed_layer_capacity = 0 27 self.thermal_exchange_velocity = 0 28 self.rheology_B = np.nan 29 self.rheology_n = np.nan 31 30 self.rheology_law = '' 32 31 33 32 #SLC 34 self.earth_density = 5512 # average density of the Earth, (kg / m^3)33 self.earth_density = 0 35 34 36 35 self.setdefaultparameters() … … 38 37 39 38 def __repr__(self): # {{{ 40 # TODO: 41 # - Convert all formatting to calls to <string>.format (see any 42 # already converted <class>.__repr__ method for examples) 43 # 44 string = " Materials:" 45 string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg / m^3]")) 46 string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "water density [kg / m^3]")) 47 string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg / m^3]")) 48 string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s / m^2]")) 49 string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J / kg / K]")) 50 string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W / m / K]")) 51 string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W / m / K]")) 52 string = "%s\n%s" % (string, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)")) 53 string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K")) 54 string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J / m^3]")) 55 string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K / Pa]")) 56 string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W / kg / K]")) 57 string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m / s]")) 58 string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1 / n)]")) 59 string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent")) 60 string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius' or 'LliboutryDuval'")) 61 string = "%s\n%s" % (string, fielddisplay(self, "earth_density", "Mantle density [kg / m^ - 3]")) 39 s = ' Materials:\n' 40 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 41 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]')) 42 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 43 s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]')) 44 s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]')) 45 s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]')) 46 s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]')) 47 s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)')) 48 s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K')) 49 s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]')) 50 s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]')) 51 s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/ kg/K]')) 52 s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]')) 53 s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]')) 54 s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent')) 55 s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\'')) 56 s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg m^-3]')) 62 57 return string 63 58 #}}} … … 70 65 71 66 def setdefaultparameters(self): # {{{ 72 # ice density (kg /m^3)73 self.rho_ice = 917. 74 # ocean water density (kg /m^3)75 self.rho_water = 1023. 76 # fresh water density (kg /m^3)77 self.rho_freshwater = 1000. 78 # water viscosity (N.s /m^2)67 # Ice density (kg/m^3) 68 self.rho_ice = 917.0 69 # Ocean water density (kg/m^3) 70 self.rho_water = 1023.0 71 # Fresh water density (kg/m^3) 72 self.rho_freshwater = 1000.0 73 # Water viscosity (N.s/m^2) 79 74 self.mu_water = 0.001787 80 # ice heat capacity cp (J / kg /K)81 self.heatcapacity = 2093. 82 # ice latent heat of fusion L (J /kg)83 self.latentheat = 3.34 e584 # ice thermal conductivity (W / m /K)75 # Ice heat capacity cp (J/kg/K) 76 self.heatcapacity = 2093.0 77 # Ice latent heat of fusion L (J/kg) 78 self.latentheat = 3.34 * pow(10, 5) 79 # Ice thermal conductivity (W/m/K) 85 80 self.thermalconductivity = 2.4 86 # temperate ice thermal conductivity (W / m /K)81 # Temperate ice thermal conductivity (W/m/K) 87 82 self.temperateiceconductivity = 0.24 88 # computation of effective conductivity83 # Computation of effective conductivity 89 84 self.effectiveconductivity_averaging = 1 90 # the melting point of ice at 1 atmosphere of pressure in K85 # The melting point of ice at 1 atmosphere of pressure in K 91 86 self.meltingpoint = 273.15 92 # rate of change of melting point with pressure (K /Pa)93 self.beta = 9.8 e-894 # mixed layer (ice-water interface) heat capacity (J / kg /K)95 self.mixed_layer_capacity = 3974. 96 # thermal exchange velocity (ice-water interface) (m /s)87 # Rate of change of melting point with pressure (K/Pa) 88 self.beta = 9.8 * pow(10, -8) 89 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 90 self.mixed_layer_capacity = 3974.0 91 # Thermal exchange velocity (ice-water interface) (m/s) 97 92 self.thermal_exchange_velocity = 1.00e-4 98 # Rheology law: what is the temperature dependence of B with T99 # available: none, paterson and arrhenius93 # Rheology law: what is the temperature dependence of B with T 94 # available: none, paterson and arrhenius 100 95 self.rheology_law = 'Paterson' 101 96 102 # SLC103 self.earth_density = 5512 # average density of the Earth, (kg /m^3)97 # SLC 98 self.earth_density = 5512 # average density of the Earth (kg/m^3) 104 99 return self 105 100 #}}} -
TabularUnified issm/trunk-jpl/src/m/classes/matenhancedice.m ¶
r26059 r26358 64 64 65 65 %water viscosity (N.s/m^2) 66 self.mu_water=0.001787; 66 self.mu_water=0.001787; 67 67 68 68 %ice heat capacity cp (J/kg/K) … … 80 80 %computation of effective conductivity 81 81 self.effectiveconductivity_averaging=1; 82 82 83 83 %the melting point of ice at 1 atmosphere of pressure in K 84 84 self.meltingpoint=273.15; … … 97 97 self.rheology_law='Paterson'; 98 98 99 %SL R99 %SLC 100 100 self.earth_density= 5512; % average density of the Earth, (kg/m^3) 101 101 -
TabularUnified issm/trunk-jpl/src/m/classes/matenhancedice.py ¶
r26317 r26358 1 import numpy as np 2 1 3 from checkfield import checkfield 2 4 from fielddisplay import fielddisplay … … 12 14 """ 13 15 14 def __init__(self): #{{{15 self.rho_ice = 0 .16 self.rho_water = 0 .17 self.rho_freshwater = 0 .18 self.mu_water = 0 .19 self.heatcapacity = 0 .20 self.latentheat = 0 .21 self.thermalconductivity = 0 .22 self.temperateiceconductivity = 0 .16 def __init__(self): # {{{ 17 self.rho_ice = 0 18 self.rho_water = 0 19 self.rho_freshwater = 0 20 self.mu_water = 0 21 self.heatcapacity = 0 22 self.latentheat = 0 23 self.thermalconductivity = 0 24 self.temperateiceconductivity = 0 23 25 self.effectiveconductivity_averaging = 0 24 self.meltingpoint = 0 .25 self.beta = 0 .26 self.mixed_layer_capacity = 0 .27 self.thermal_exchange_velocity = 0 .28 self.rheology_E = float('NaN')29 self.rheology_B = float('NaN')30 self.rheology_n = float('NaN')26 self.meltingpoint = 0 27 self.beta = 0 28 self.mixed_layer_capacity = 0 29 self.thermal_exchange_velocity = 0 30 self.rheology_E = np.nan 31 self.rheology_B = np.nan 32 self.rheology_n = np.nan 31 33 self.rheology_law = '' 32 34 33 35 #SLC 34 self.earth_density = 0 # average density of the Earth, (kg/m^3)36 self.earth_density = 0 35 37 36 38 self.setdefaultparameters() 37 # }}}39 # }}} 38 40 39 def __repr__(self): #{{{ 40 # TODO: 41 # - Convert all formatting to calls to <string>.format (see any 42 # already converted <class>.__repr__ method for examples) 43 # 44 s = " Materials:" 45 s = "%s\n%s" % (s, fielddisplay(self, "rho_ice", "ice density [kg/m^3]")) 46 s = "%s\n%s" % (s, fielddisplay(self, "rho_water", "water density [kg/m^3]")) 47 s = "%s\n%s" % (s, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]")) 48 s = "%s\n%s" % (s, fielddisplay(self, "mu_water", "water viscosity [N s/m^2]")) 49 s = "%s\n%s" % (s, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]")) 50 s = "%s\n%s" % (s, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]")) 51 s = "%s\n%s" % (s, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]")) 52 s = "%s\n%s" % (s, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)")) 53 s = "%s\n%s" % (s, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K")) 54 s = "%s\n%s" % (s, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]")) 55 s = "%s\n%s" % (s, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]")) 56 s = "%s\n%s" % (s, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]")) 57 s = "%s\n%s" % (s, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]")) 58 s = "%s\n%s" % (s, fielddisplay(self, "rheology_E", "enhancement factor")) 59 s = "%s\n%s" % (s, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]")) 60 s = "%s\n%s" % (s, fielddisplay(self, "rheology_n", "Glen's flow law exponent")) 61 s = "%s\n%s" % (s, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius' or 'LliboutryDuval'")) 62 s = "%s\n%s" % (s, fielddisplay(self, "earth_density", "Mantle density [kg/m^-3]")) 41 def __repr__(self): # {{{ 42 s = ' Materials:\n' 43 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 44 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]')) 45 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 46 s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]')) 47 s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]')) 48 s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]')) 49 s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]')) 50 s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)')) 51 s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K')) 52 s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]')) 53 s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]')) 54 s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]')) 55 s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]')) 56 s += '{}\n'.format(fielddisplay(self, 'rheology_E', 'enhancement factor')) 57 s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]')) 58 s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent')) 59 s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\'')) 60 s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]')) 63 61 64 62 return s 65 # }}}63 # }}} 66 64 67 def extrude(self, md): #{{{65 def extrude(self, md): # {{{ 68 66 self.rheology_E = project3d(md, 'vector', self.rheology_E, 'type', 'node') 69 67 self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node') 70 68 self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element') 71 69 return self 72 # }}}70 # }}} 73 71 74 def setdefaultparameters(self): #{{{75 # ice density (kg /m^3)76 self.rho_ice = 917. 77 # ocean water density (kg /m^3)78 self.rho_water = 1023. 79 # fresh water density (kg /m^3)80 self.rho_freshwater = 1000. 81 # water viscosity (N.s /m^2)72 def setdefaultparameters(self): # {{{ 73 # Ice density (kg/m^3) 74 self.rho_ice = 917.0 75 # Ocean water density (kg/m^3) 76 self.rho_water = 1023.0 77 # Fresh water density (kg/m^3) 78 self.rho_freshwater = 1000.0 79 # Water viscosity (N.s/m^2) 82 80 self.mu_water = 0.001787 83 # ice heat capacity cp (J / kg /K)84 self.heatcapacity = 2093. 85 # ice latent heat of fusion L (J /kg)86 self.latentheat = 3.34 * 10**587 # ice thermal conductivity (W / m /K)81 # Ice heat capacity cp (J/kg/K) 82 self.heatcapacity = 2093.0 83 # Ice latent heat of fusion L (J/kg) 84 self.latentheat = 3.34 * pow(10, 5) 85 # Ice thermal conductivity (W/m/K) 88 86 self.thermalconductivity = 2.4 89 # temperate ice thermal conductivity (W / m /K)87 # Temperate ice thermal conductivity (W/m/K) 90 88 self.temperateiceconductivity = 0.24 91 # computation of effective conductivity89 # Computation of effective conductivity 92 90 self.effectiveconductivity_averaging = 1 93 # the melting point of ice at 1 atmosphere of pressure in K91 # The melting point of ice at 1 atmosphere of pressure in K 94 92 self.meltingpoint = 273.15 95 # rate of change of melting point with pressure (K /Pa)96 self.beta = 9.8 * 10**-897 # mixed layer (ice-water interface) heat capacity (J / kg /K)98 self.mixed_layer_capacity = 3974. 99 # thermal exchange velocity (ice-water interface) (m /s)100 self.thermal_exchange_velocity = 1.00 * 10**-4101 # Rheology law: what is the temperature dependence of B with T102 # available: none, paterson and arrhenius93 # Rate of change of melting point with pressure (K/Pa) 94 self.beta = 9.8 * pow(10, -8) 95 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 96 self.mixed_layer_capacity = 3974.0 97 # Thermal exchange velocity (ice-water interface) (m/s) 98 self.thermal_exchange_velocity = 1.00 * pow(10, -4) 99 # Rheology law: what is the temperature dependence of B with T 100 # available: none, paterson and arrhenius 103 101 self.rheology_law = 'Paterson' 104 102 105 #GIA 106 self.lithosphere_shear_modulus = 6.7 * 10**10 # (Pa) 107 self.lithosphere_density = 3.32 # (g / cm^ - 3) 108 self.mantle_shear_modulus = 1.45 * 10**11 # (Pa) 109 self.mantle_density = 3.34 # (g / cm^ - 3) 110 111 #SLC 112 self.earth_density = 5512 #average density of the Earth, (kg / m^3) 103 # SLC 104 self.earth_density = 5512 # average density of the Earth, (kg/m^3) 113 105 114 106 return self 115 # }}}107 # }}} 116 108 117 def checkconsistency(self, md, solution, analyses): #{{{109 def checkconsistency(self, md, solution, analyses): # {{{ 118 110 md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0) 119 111 md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0) … … 131 123 # }}} 132 124 133 def marshall(self, prefix, md, fid): #{{{125 def marshall(self, prefix, md, fid): # {{{ 134 126 WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 4, 'format', 'Integer') 135 127 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double') -
TabularUnified issm/trunk-jpl/src/m/classes/materials.m ¶
r26351 r26358 175 175 switch nat 176 176 case 'ice' 177 disp(sprintf(' \nIce:'));177 disp(sprintf('\n Ice:')); 178 178 fielddisplay(self,'rho_ice','ice density [kg/m^3]'); 179 179 fielddisplay(self,'rho_water','ocean water density [kg/m^3]'); … … 192 192 fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'', ''LliboutryDuval'', ''NyeCO2'', or ''NyeH2O''']); 193 193 case 'litho' 194 disp(sprintf(' \nLitho:'));194 disp(sprintf('\n Litho:')); 195 195 fielddisplay(self,'numlayers','number of layers (default: 2)'); 196 196 fielddisplay(self,'radius','array describing the radius for each interface (numlayers+1) [m]'); … … 211 211 fielddisplay(self,'issolid','array describing whether the layer is solid or liquid (default 1) (numlayers)'); 212 212 case 'hydro' 213 disp(sprintf(' \nHydro:'));213 disp(sprintf('\n Hydro:')); 214 214 fielddisplay(self,'rho_ice','ice density [kg/m^3]'); 215 215 fielddisplay(self,'rho_water','ocean water density [kg/m^3]'); -
TabularUnified issm/trunk-jpl/src/m/classes/materials.py ¶
r26351 r26358 76 76 nat = self.nature[i] 77 77 if nat == 'ice': 78 s += ' Ice:\n'78 s += '\n Ice:\n' 79 79 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 80 80 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]')) … … 93 93 s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\'')) 94 94 elif nat == 'litho': 95 s += ' Litho:\n'95 s += '\n Litho:\n' 96 96 s += '{}\n'.format(fielddisplay(self, 'numlayers', 'number of layers (default: 2)')) 97 97 s += '{}\n'.format(fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]')) … … 111 111 s += '{}\n'.format(fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default: 1) (numlayers)')) 112 112 elif nat == 'hydro': 113 s += ' Hydro:\n'113 s += '\n Hydro:\n' 114 114 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 115 115 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]')) … … 127 127 if nat == 'ice': 128 128 # Ice density (kg/m^3) 129 self.rho_ice = 917 129 self.rho_ice = 917.0 130 130 131 131 # Ocean water density (kg/m^3) 132 self.rho_water = 1023 132 self.rho_water = 1023.0 133 133 134 134 # Fresh water density (kg/m^3) 135 self.rho_freshwater = 1000 135 self.rho_freshwater = 1000.0 136 136 137 137 # Water viscosity (N.s/m^2) … … 139 139 140 140 # Ice heat capacity cp (J/kg/K) 141 self.heatcapacity = 2093 141 self.heatcapacity = 2093.0 142 142 143 143 # Ice latent heat of fusion L (J/kg) … … 160 160 161 161 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 162 self.mixed_layer_capacity = 3974 162 self.mixed_layer_capacity = 3974.0 163 163 164 164 # Thermal exchange velocity (ice-water interface) (m/s) … … 193 193 self.ebm_tauh = [np.nan, np.nan] 194 194 self.rheologymodel = [0, 0] 195 self.density = [5.51 e3, 5.50e3] # (Pa) # Mantle and lithosphere density [kg/m^3]195 self.density = [5.51 * 1e3, 5.50 * 1e3] # (Pa) # Mantle and lithosphere density [kg/m^3] 196 196 self.issolid = [1, 1] # Is layer solid or liquid? 197 197 elif nat == 'hydro': 198 198 # Ice density (kg/m^3) 199 self.rho_ice = 917 199 self.rho_ice = 917.0 200 200 201 201 # Ocean water density (kg/m^3) 202 self.rho_water = 1023 202 self.rho_water = 1023.0 203 203 204 204 # Fresh water density (kg/m^3) 205 self.rho_freshwater = 1000 205 self.rho_freshwater = 1000.0 206 206 else: 207 207 raise RuntimeError("materials setdefaultparameters error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") -
TabularUnified issm/trunk-jpl/src/m/classes/matestar.m ¶
r26059 r26358 24 24 rheology_law = ''; 25 25 26 % slc26 %SLC 27 27 earth_density = 0; 28 28 … … 87 87 %computation of effective conductivity 88 88 self.effectiveconductivity_averaging=1; 89 89 90 90 %the melting point of ice at 1 atmosphere of pressure in K 91 91 self.meltingpoint=273.15; … … 104 104 self.rheology_law='Paterson'; 105 105 106 %SL R107 self.earth_density= 5512; 106 %SLC 107 self.earth_density= 5512; % average density of the Earth, (kg/m^3) 108 108 109 109 end % }}} … … 118 118 md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'BuddJacka' 'Cuffey' 'CuffeyTemperate' 'Paterson' 'Arrhenius' 'LliboutryDuval'}); 119 119 md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]); 120 120 121 121 if ismember('SealevelchangeAnalysis',analyses), 122 122 md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1); -
TabularUnified issm/trunk-jpl/src/m/classes/matestar.py ¶
r26317 r26358 8 8 9 9 class matestar(object): 10 ''' 11 MATESTAR class definition 10 """MATESTAR class definition 12 11 13 14 15 '''12 Usage: 13 matestar = matestar() 14 """ 16 15 17 def __init__(self): #{{{16 def __init__(self): # {{{ 18 17 self.rho_ice = 0. 19 18 self.rho_water = 0. … … 34 33 self.rheology_law = '' 35 34 36 # slc35 # SLC 37 36 self.earth_density = 0 38 37 39 # set default parameters38 # Set default parameters 40 39 self.setdefaultparameters() 41 # }}}40 # }}} 42 41 43 def __repr__(self): #{{{44 s = " Materials:"45 s = "%s\n%s" % (s,fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]'))46 s = "%s\n%s" % (s,fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]'))47 s = "%s\n%s" % (s,fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]'))48 s = "%s\n%s" % (s,fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]'))49 s = "%s\n%s" % (s,fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]'))50 s = "%s\n%s" % (s,fielddisplay(self, 'thermalconductivity', ['ice thermal conductivity [W/m/K]']))51 s = "%s\n%s" % (s,fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]'))52 s = "%s\n%s" % (s,fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)"))53 s = "%s\n%s" % (s,fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K'))54 s = "%s\n%s" % (s, fielddisplay(self, 'latentheat', 'latent heat of fusion [J /kg]'))55 s = "%s\n%s" % (s,fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]'))56 s = "%s\n%s" % (s,fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]'))57 s = "%s\n%s" % (s,fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]'))58 s = "%s\n%s" % (s,fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/3)]'))59 s = "%s\n%s" % (s,fielddisplay(self, 'rheology_Ec', 'compressive enhancement factor'))60 s = "%s\n%s" % (s,fielddisplay(self, 'rheology_Es', 'shear enhancement factor'))61 s = "%s\n%s" % (s, fielddisplay(self, 'rheology_law', ['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', ''Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']))62 s = "%s\n%s" % (s,fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]'))42 def __repr__(self): # {{{ 43 s = ' Materials:\n' 44 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 45 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'ocean water density [kg/m^3]')) 46 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 47 s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [N s/m^2]')) 48 s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]')) 49 s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', ['ice thermal conductivity [W/m/K]'])) 50 s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]')) 51 s += '{}\n'.format(fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)")) 52 s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K')) 53 s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/kg]')) 54 s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]')) 55 s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]')) 56 s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]')) 57 s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/3)]')) 58 s += '{}\n'.format(fielddisplay(self, 'rheology_Ec', 'compressive enhancement factor')) 59 s += '{}\n'.format(fielddisplay(self, 'rheology_Es', 'shear enhancement factor')) 60 s += '{}\n'.format(fielddisplay(self, 'rheology_law', ['law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\' or \'LliboutryDuval\''])) 61 s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]')) 63 62 64 63 return s 65 # }}}64 # }}} 66 65 67 def extrude(self, md): #{{{66 def extrude(self, md): # {{{ 68 67 self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node') 69 68 self.rheology_Ec = project3d(md, 'vector', self.rheology_Ec, 'type', 'node') … … 71 70 72 71 return self 73 # }}}72 # }}} 74 73 75 def setdefaultparameters(self): #{{{76 # ice density (kg /m^3)77 self.rho_ice = 917. 78 # ocean water density (kg /m^3)79 self.rho_water = 1023. 80 # fresh water density (kg /m^3)81 self.rho_freshwater = 1000. 82 # water viscosity (N.s /m^2)74 def setdefaultparameters(self): # {{{ 75 # Ice density (kg/m^3) 76 self.rho_ice = 917.0 77 # Ocean water density (kg/m^3) 78 self.rho_water = 1023.0 79 # Fresh water density (kg/m^3) 80 self.rho_freshwater = 1000.0 81 # Water viscosity (N.s/m^2) 83 82 self.mu_water = 0.001787 84 # ice heat capacity cp (J / kg /K)85 self.heatcapacity = 2093. 86 # ice latent heat of fusion L (J /kg)87 self.latentheat = 3.34 e588 # ice thermal conductivity (W / m /K)83 # Ice heat capacity cp (J/kg/K) 84 self.heatcapacity = 2093.0 85 # Ice latent heat of fusion L (J/kg) 86 self.latentheat = 3.34 * pow(10, 5) 87 # Ice thermal conductivity (W/m/K) 89 88 self.thermalconductivity = 2.4 90 # wet ice thermal conductivity (W / m /K)89 # Wet ice thermal conductivity (W/m/K) 91 90 self.temperateiceconductivity = 0.24 92 # computation of effective conductivity91 # Computation of effective conductivity 93 92 self.effectiveconductivity_averaging = 1 94 # the melting point of ice at 1 atmosphere of pressure in K93 # The melting point of ice at 1 atmosphere of pressure in K 95 94 self.meltingpoint = 273.15 96 # rate of change of melting point with pressure (K /Pa)97 self.beta = 9.8 e-898 # mixed layer (ice-water interface) heat capacity (J / kg /K)99 self.mixed_layer_capacity = 3974. 100 # thermal exchange velocity (ice-water interface) (m /s)101 self.thermal_exchange_velocity = 1.00 e-4102 # Rheology law: what is the temperature dependence of B with T103 # available: none, paterson and arrhenius95 # Rate of change of melting point with pressure (K/Pa) 96 self.beta = 9.8 * pow(10, -8) 97 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 98 self.mixed_layer_capacity = 3974.0 99 # Thermal exchange velocity (ice-water interface) (m/s) 100 self.thermal_exchange_velocity = 1.00 * pow(10, -4) 101 # Rheology law: what is the temperature dependence of B with T 102 # available: none, paterson and arrhenius 104 103 self.rheology_law = 'Paterson' 105 # slc106 self.earth_density = 5512 # average density of the Earth, (kg /m^3)104 # SLC 105 self.earth_density = 5512 # average density of the Earth (kg/m^3) 107 106 108 107 return self 109 # }}}108 # }}} 110 109 111 def checkconsistency(self, md, solution, analyses): #{{{110 def checkconsistency(self, md, solution, analyses): # {{{ 112 111 md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0) 113 112 md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0) … … 126 125 # }}} 127 126 128 def marshall(self, prefix, md, fid): #{{{127 def marshall(self, prefix, md, fid): # {{{ 129 128 WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 2, 'format', 'Integer') 130 129 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double') -
TabularUnified issm/trunk-jpl/src/m/classes/matice.js ¶
r24092 r26358 2 2 // 3 3 // Usage: 4 // matice =matice();4 // matice = new matice(); 5 5 6 6 function matice(){ 7 //properties 8 // {{{ 9 this.rho_ice = 0; 10 this.rho_water = 0; 11 this.rho_freshwater = 0; 12 this.mu_water = 0; 13 this.heatcapacity = 0; 14 this.latentheat = 0; 15 this.thermalconductivity = 0; 16 this.temperateiceconductivity = 0; 17 this.effectiveconductivity_averaging = 0; 18 this.meltingpoint = 0; 19 this.beta = 0; 20 this.mixed_layer_capacity = 0; 21 this.thermal_exchange_velocity = 0; 22 this.rheology_B = NaN; 23 this.rheology_n = NaN; 24 this.rheology_law = ''; 25 26 //SLC 27 this.earth_density= 5512; // average density of the Earth, (kg/m^3) 28 29 this.setdefaultparameters(); 30 //}}} 31 7 32 //methods 8 33 this.setdefaultparameters = function(){ // {{{ 9 34 10 35 //ice density (kg/m^3) 11 this.rho_ice=917 .;36 this.rho_ice=917; 12 37 13 38 //ocean water density (kg/m^3) 14 this.rho_water=1023 .;39 this.rho_water=1023; 15 40 16 41 //fresh water density (kg/m^3) 17 this.rho_freshwater=1000 .;42 this.rho_freshwater=1000; 18 43 19 44 //water viscosity (N.s/m^2) 20 this.mu_water=0.001787; 45 this.mu_water=0.001787; 21 46 22 47 //ice heat capacity cp (J/kg/K) 23 this.heatcapacity=2093 .;48 this.heatcapacity=2093; 24 49 25 50 //ice latent heat of fusion L (J/kg) 26 this.latentheat=3.34*Math.pow(10, 5);51 this.latentheat=3.34*Math.pow(10, 5); 27 52 28 53 //ice thermal conductivity (W/m/K) … … 32 57 this.temperateiceconductivity=.24; 33 58 59 //computation of effective conductivity 60 this.effectiveconductivity_averaging=1; 61 34 62 //the melting point of ice at 1 atmosphere of pressure in K 35 63 this.meltingpoint=273.15; 36 64 37 65 //rate of change of melting point with pressure (K/Pa) 38 this.beta=9.8 *Math.pow(10,-8);66 this.beta=9.8e-8; 39 67 40 68 //mixed layer (ice-water interface) heat capacity (J/kg/K) 41 this.mixed_layer_capacity=3974 .;69 this.mixed_layer_capacity=3974; 42 70 43 71 //thermal exchange velocity (ice-water interface) (m/s) 44 this.thermal_exchange_velocity=1.00* Math.pow(10,-4);72 this.thermal_exchange_velocity=1.00*1e-4; 45 73 46 74 //Rheology law: what is the temperature dependence of B with T … … 48 76 this.rheology_law='Paterson'; 49 77 50 // GIA: 51 this.lithosphere_shear_modulus = 6.7*Math.pow(10,10); // (Pa) 52 this.lithosphere_density = 3.32; // (g/cm^-3) 53 this.mantle_shear_modulus = 1.45*Math.pow(10,11); // (Pa) 54 this.mantle_density = 3.34; // (g/cm^-3) 78 // Rheology for ice 79 this.rheology_B = 2.1 * 1e8 80 this.rheology_n = 3 55 81 56 //SL R57 this.earth_density= 5512; 82 //SLC 83 this.earth_density= 5512; // average density of the Earth, (kg/m^3) 58 84 59 85 … … 69 95 fielddisplay(this,'thermalconductivity','ice thermal conductivity [W/m/K]'); 70 96 fielddisplay(this,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]'); 97 fielddisplay(this,'effectiveconductivity_averaging','computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)'); 71 98 fielddisplay(this,'meltingpoint','melting point of ice at 1atm in K'); 72 99 fielddisplay(this,'latentheat','latent heat of fusion [J/kg]'); … … 75 102 fielddisplay(this,'thermal_exchange_velocity','thermal exchange velocity [m/s]'); 76 103 fielddisplay(this,'rheology_B','flow law parameter [Pa s^(1/n)]'); 77 fielddisplay(this,'rheology_n',"Glen's flow law exponent"); 78 fielddisplay(this,'rheology_law',"law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius','LliboutryDuval','NyeH2O', or 'NyeCO2'"); 79 fielddisplay(this,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]'); 80 fielddisplay(this,'lithosphere_density','Lithosphere density [g/cm^-3]'); 81 fielddisplay(this,'mantle_shear_modulus','Mantle shear modulus [Pa]'); 82 fielddisplay(this,'mantle_density','Mantle density [g/cm^-3]'); 104 fielddisplay(this,'rheology_n','Glen\'s flow law exponent'); 105 fielddisplay(this,'rheology_law','law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeH2O\', or \'NyeCO2\''); 83 106 fielddisplay(this,'earth_density','Mantle density [kg/m^-3]'); 84 107 … … 90 113 }//}}} 91 114 this.classname = function() {// {{{ 92 return "matice";115 return 'matice'; 93 116 } // }}} 94 117 this.checkconsistency = function(md,solution,analyses) { // {{{ 95 checkfield(md,'fieldname','materials.rho_ice','>',0); 96 checkfield(md,'fieldname','materials.rho_water','>',0); 97 checkfield(md,'fieldname','materials.rho_freshwater','>',0); 98 checkfield(md,'fieldname','materials.mu_water','>',0); 99 checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1,'Inf',1); 100 checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements,1]); 101 checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval','NyeH2O','NyeCO2']); 102 103 if(ArrayAnyEqual(ArrayIsMember('GiaAnalysis',analyses),1)){ 104 checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1); 105 checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1); 106 checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1); 107 checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1); 118 if (solution == 'TransientSolution' && md.transient.isslc) { 119 checkfield(md,'fieldname','materials.earth_density','>',0,'numel',[1]) 120 } else { 121 checkfield(md,'fieldname','materials.rho_ice','>',0); 122 checkfield(md,'fieldname','materials.rho_water','>',0); 123 checkfield(md,'fieldname','materials.rho_freshwater','>',0); 124 checkfield(md,'fieldname','materials.mu_water','>',0); 125 checkfield(md,'fieldname','materials.rheology_B','>',0,'universal',1,'NaN',1,'Inf',1); 126 checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1); 127 checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval','NyeH2O','NyeCO2']); 128 checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0,1,2]) 108 129 } 109 if (ArrayAnyEqual(ArrayIsMember('SealevelriseAnalysis',analyses),1)){110 checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);111 }112 113 114 130 } // }}} 115 131 this.marshall=function(md,prefix,fid) { //{{{ … … 123 139 WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermalconductivity','format','Double'); 124 140 WriteData(fid,prefix,'object',this,'class','materials','fieldname','temperateiceconductivity','format','Double'); 141 WriteData(fid,prefix,'object',this,'class','materials','fieldname','effectiveconductivity_averaging','format','Integer'); 125 142 WriteData(fid,prefix,'object',this,'class','materials','fieldname','meltingpoint','format','Double'); 126 143 WriteData(fid,prefix,'object',this,'class','materials','fieldname','beta','format','Double'); 127 144 WriteData(fid,prefix,'object',this,'class','materials','fieldname','mixed_layer_capacity','format','Double'); 128 145 WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermal_exchange_velocity','format','Double'); 129 WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts); 146 if ((shape(self.rheology_B)[0] == md.mesh.numberofvertices) || (shape(self.rheology_B)[0] == md.mesh.numberofvertices + 1) or (shape(self.rheology_B)[0] == md.mesh.numberofelements && shape(self.rheology_B)[1] > 1)) { 147 mattype = 1 148 tsl = md.mesh.numberofvertices 149 } else { 150 mattype = 2 151 tsl = md.mesh.numberofelements 152 } 153 WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',mattype,'timeserieslength',tsl+1,'yts',md.constants.yts); 130 154 WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2); 131 155 WriteData(fid,prefix,'data',this.rheology_law,'name','md.materials.rheology_law','format','String'); 132 WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');133 WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_density','format','Double','scale',Math.pow(10,3));134 WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_shear_modulus','format','Double');135 WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_density','format','Double','scale',Math.pow(10,3));136 156 WriteData(fid,prefix,'object',this,'class','materials','fieldname','earth_density','format','Double'); 137 157 … … 139 159 this.fix=function() { //{{{ 140 160 }//}}} 141 //properties142 // {{{143 this.rho_ice = 0.;144 this.rho_water = 0.;145 this.rho_freshwater = 0.;146 this.mu_water = 0.;147 this.heatcapacity = 0.;148 this.latentheat = 0.;149 this.thermalconductivity = 0.;150 this.temperateiceconductivity = 0.;151 this.meltingpoint = 0.;152 this.beta = 0.;153 this.mixed_layer_capacity = 0.;154 this.thermal_exchange_velocity = 0.;155 this.rheology_B = NaN;156 this.rheology_n = NaN;157 this.rheology_law = '';158 159 //giaivins:160 this.lithosphere_shear_modulus = 0.;161 this.lithosphere_density = 0.;162 this.mantle_shear_modulus = 0.;163 this.mantle_density = 0.;164 165 //SLR166 this.earth_density= 5512; // average density of the Earth, (kg/m^3)167 168 this.setdefaultparameters();169 //}}}170 161 } -
TabularUnified issm/trunk-jpl/src/m/classes/matice.m ¶
r26062 r26358 75 75 %wet ice thermal conductivity (W/m/K) 76 76 self.temperateiceconductivity=.24; 77 77 78 78 %computation of effective conductivity 79 79 self.effectiveconductivity_averaging=1; -
TabularUnified issm/trunk-jpl/src/m/classes/matice.py ¶
r26059 r26358 14 14 """ 15 15 16 def __init__(self): #{{{17 self.rho_ice = 0 .18 self.rho_water = 0 .19 self.rho_freshwater = 0 .20 self.mu_water = 0 .21 self.heatcapacity = 0 .22 self.latentheat = 0 .23 self.thermalconductivity = 0 .24 self.temperateiceconductivity = 0 .16 def __init__(self): # {{{ 17 self.rho_ice = 0 18 self.rho_water = 0 19 self.rho_freshwater = 0 20 self.mu_water = 0 21 self.heatcapacity = 0 22 self.latentheat = 0 23 self.thermalconductivity = 0 24 self.temperateiceconductivity = 0 25 25 self.effectiveconductivity_averaging = 0 26 self.meltingpoint = 0 .27 self.beta = 0 .28 self.mixed_layer_capacity = 0 .29 self.thermal_exchange_velocity = 0 .26 self.meltingpoint = 0 27 self.beta = 0 28 self.mixed_layer_capacity = 0 29 self.thermal_exchange_velocity = 0 30 30 self.rheology_B = np.nan 31 31 self.rheology_n = np.nan 32 32 self.rheology_law = '' 33 33 34 # slc34 # SLC 35 35 self.earth_density = 0 36 36 37 self.setdefaultparameters() 37 # }}}38 # }}} 38 39 39 def __repr__(self): #{{{ 40 s = " Materials:" 41 s = "%s\n%s" % (s, fielddisplay(self, "rho_ice", "ice density [kg/m^3]")) 42 s = "%s\n%s" % (s, fielddisplay(self, "rho_water", "water density [kg/m^3]")) 43 s = "%s\n%s" % (s, fielddisplay(self, "rho_freshwater", "fresh water density [kg/m^3]")) 44 s = "%s\n%s" % (s, fielddisplay(self, "mu_water", "water viscosity [Ns/m^2]")) 45 s = "%s\n%s" % (s, fielddisplay(self, "heatcapacity", "heat capacity [J/kg/K]")) 46 s = "%s\n%s" % (s, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W/m/K]")) 47 s = "%s\n%s" % (s, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W/m/K]")) 48 s = "%s\n%s" % (s, fielddisplay(self, "effectiveconductivity_averaging", "computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)")) 49 s = "%s\n%s" % (s, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K")) 50 s = "%s\n%s" % (s, fielddisplay(self, "latentheat", "latent heat of fusion [J/m^3]")) 51 s = "%s\n%s" % (s, fielddisplay(self, "beta", "rate of change of melting point with pressure [K/Pa]")) 52 s = "%s\n%s" % (s, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W/kg/K]")) 53 s = "%s\n%s" % (s, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m/s]")) 54 s = "%s\n%s" % (s, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1/n)]")) 55 s = "%s\n%s" % (s, fielddisplay(self, "rheology_n", "Glen's flow law exponent")) 56 s = "%s\n%s" % (s, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'")) 57 s = "%s\n%s" % (s, fielddisplay(self, "earth_density", "Mantle density [kg/m^-3]")) 40 def __repr__(self): # {{{ 41 s = ' Materials:\n' 42 s += '{}\n'.format(fielddisplay(self, 'rho_ice', 'ice density [kg/m^3]')) 43 s += '{}\n'.format(fielddisplay(self, 'rho_water', 'water density [kg/m^3]')) 44 s += '{}\n'.format(fielddisplay(self, 'rho_freshwater', 'fresh water density [kg/m^3]')) 45 s += '{}\n'.format(fielddisplay(self, 'mu_water', 'water viscosity [Ns/m^2]')) 46 s += '{}\n'.format(fielddisplay(self, 'heatcapacity', 'heat capacity [J/kg/K]')) 47 s += '{}\n'.format(fielddisplay(self, 'thermalconductivity', 'ice thermal conductivity [W/m/K]')) 48 s += '{}\n'.format(fielddisplay(self, 'temperateiceconductivity', 'temperate ice thermal conductivity [W/m/K]')) 49 s += '{}\n'.format(fielddisplay(self, 'effectiveconductivity_averaging', 'computation of effectiveconductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)')) 50 s += '{}\n'.format(fielddisplay(self, 'meltingpoint', 'melting point of ice at 1atm in K')) 51 s += '{}\n'.format(fielddisplay(self, 'latentheat', 'latent heat of fusion [J/m^3]')) 52 s += '{}\n'.format(fielddisplay(self, 'beta', 'rate of change of melting point with pressure [K/Pa]')) 53 s += '{}\n'.format(fielddisplay(self, 'mixed_layer_capacity', 'mixed layer capacity [W/kg/K]')) 54 s += '{}\n'.format(fielddisplay(self, 'thermal_exchange_velocity', 'thermal exchange velocity [m/s]')) 55 s += '{}\n'.format(fielddisplay(self, 'rheology_B', 'flow law parameter [Pa s^(1/n)]')) 56 s += '{}\n'.format(fielddisplay(self, 'rheology_n', 'Glen\'s flow law exponent')) 57 s += '{}\n'.format(fielddisplay(self, 'rheology_law', 'law for the temperature dependance of the rheology: \'None\', \'BuddJacka\', \'Cuffey\', \'CuffeyTemperate\', \'Paterson\', \'Arrhenius\', \'LliboutryDuval\', \'NyeCO2\', or \'NyeH2O\'')) 58 s += '{}\n'.format(fielddisplay(self, 'earth_density', 'Mantle density [kg/m^-3]')) 59 return s 60 # }}} 58 61 59 return s 60 #}}} 61 62 def extrude(self, md): #{{{ 62 def extrude(self, md): # {{{ 63 63 self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node') 64 64 self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element') 65 65 return self 66 # }}}66 # }}} 67 67 68 def setdefaultparameters(self): #{{{69 # ice density (kg/m^3)70 self.rho_ice = 917. 71 # ocean water density (kg/m^3)72 self.rho_water = 1023. 73 # fresh water density (kg/m^3)74 self.rho_freshwater = 1000. 75 # water viscosity (N.s/m^2)68 def setdefaultparameters(self): # {{{ 69 # Ice density (kg/m^3) 70 self.rho_ice = 917.0 71 # Ocean water density (kg/m^3) 72 self.rho_water = 1023.0 73 # Fresh water density (kg/m^3) 74 self.rho_freshwater = 1000.0 75 # Water viscosity (N.s/m^2) 76 76 self.mu_water = 0.001787 77 # ice heat capacity cp (J/kg/K)78 self.heatcapacity = 2093. 79 # ice latent heat of fusion L (J/kg)80 self.latentheat = 3.34 e581 # ice thermal conductivity (W/m/K)77 # Ice heat capacity cp (J/kg/K) 78 self.heatcapacity = 2093.0 79 # Ice latent heat of fusion L (J/kg) 80 self.latentheat = 3.34 * pow(10, 5) 81 # Ice thermal conductivity (W/m/K) 82 82 self.thermalconductivity = 2.4 83 # temperate ice thermal conductivity (W/m/K)83 # Temperate ice thermal conductivity (W/m/K) 84 84 self.temperateiceconductivity = 0.24 85 # computation of effective conductivity85 # Computation of effective conductivity 86 86 self.effectiveconductivity_averaging = 1 87 # the melting point of ice at 1 atmosphere of pressure in K87 # The melting point of ice at 1 atmosphere of pressure in K 88 88 self.meltingpoint = 273.15 89 # rate of change of melting point with pressure (K/Pa)90 self.beta = 9.8 e-891 # mixed layer (ice-water interface) heat capacity (J/kg/K)92 self.mixed_layer_capacity = 3974. 93 # thermal exchange velocity (ice-water interface) (m/s)94 self.thermal_exchange_velocity = 1.00 e-495 # Rheology law: what is the temperature dependence of B with T96 # available: none, paterson and arrhenius89 # Rate of change of melting point with pressure (K/Pa) 90 self.beta = 9.8 * pow(10, -8) 91 # Mixed layer (ice-water interface) heat capacity (J/kg/K) 92 self.mixed_layer_capacity = 3974.0 93 # Thermal exchange velocity (ice-water interface) (m/s) 94 self.thermal_exchange_velocity = 1.00 * pow(10, -4) 95 # Rheology law: what is the temperature dependence of B with T 96 # available: none, paterson and arrhenius 97 97 self.rheology_law = 'Paterson' 98 98 … … 103 103 # SLR 104 104 self.earth_density = 5512 # average density of the Earth, (kg/m^3) 105 # }}}105 # }}} 106 106 107 def checkconsistency(self, md, solution, analyses): #{{{107 def checkconsistency(self, md, solution, analyses): # {{{ 108 108 if solution == 'TransientSolution' and md.transient.isslc: 109 109 md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', [1]) … … 116 116 md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'universal',1, 'NaN', 1, 'Inf', 1) 117 117 md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', 'NyeH2O']) 118 md = checkfield(md, 'fieldname','materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2])118 md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2]) 119 119 120 120 return md 121 # }}}121 # }}} 122 122 123 def marshall(self, prefix, md, fid): #{{{123 def marshall(self, prefix, md, fid): # {{{ 124 124 WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 3, 'format', 'Integer') 125 125 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double') … … 136 136 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'mixed_layer_capacity', 'format', 'Double') 137 137 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'thermal_exchange_velocity', 'format', 'Double') 138 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) 138 # NOTE: We first have to check if we have a NumPy array here 139 if ((len(np.shape(self.rheology_B)) == 1 and (np.shape(self.rheology_B)[0] == md.mesh.numberofvertices or np.shape(self.rheology_B)[0] == md.mesh.numberofvertices + 1)) or (len(np.shape(self.rheology_B)) == 2 and np.shape(self.rheology_B)[0] == md.mesh.numberofelements and np.shape(self.rheology_B)[1] > 1)): 140 mattype = 1 141 tsl = md.mesh.numberofvertices 142 else: 143 mattype = 2 144 tsl = md.mesh.numberofelements 145 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', mattype, 'timeserieslength', tsl + 1, 'yts', md.constants.yts) 139 146 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2) 140 147 WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String') 141 148 WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double') 142 # }}}149 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/model.m ¶
r26334 r26358 235 235 disp(sprintf('%19s: %-22s -- %s','thermal' ,['[1x1 ' class(self.thermal) ']'],'parameters for thermal solution')); 236 236 disp(sprintf('%19s: %-22s -- %s','steadystate' ,['[1x1 ' class(self.steadystate) ']'],'parameters for steadystate solution')); 237 disp(sprintf('%19s: %-22s -- %s','transient' ,['[1x1 ' class(self.transient) ']'],'par Hwoameters for transient solution'));237 disp(sprintf('%19s: %-22s -- %s','transient' ,['[1x1 ' class(self.transient) ']'],'parameters for transient solution')); 238 238 disp(sprintf('%19s: %-22s -- %s','levelset' ,['[1x1 ' class(self.levelset) ']'],'parameters for moving boundaries (level-set method)')); 239 239 disp(sprintf('%19s: %-22s -- %s','calving' ,['[1x1 ' class(self.calving) ']'],'parameters for calving')); -
TabularUnified issm/trunk-jpl/src/m/classes/plumebasalforcings.py ¶
r25688 r26358 39 39 else: 40 40 error('constuctor not supported') 41 # }}}41 # }}} 42 42 43 43 def __repr__(self): # {{{ 44 44 s = ' mantle plume basal melt parameterization:\n' 45 s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m /yr]'))46 s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m /yr]'))47 s += '{}\n'.format(fielddisplay(self, 'mantleconductivity', 'mantle heat conductivity [W /m^3]'))45 s += '{}\n'.format(fielddisplay(self, 'groundedice_melting_rate', 'basal melting rate (positive if melting) [m/yr]')) 46 s += '{}\n'.format(fielddisplay(self, 'floatingice_melting_rate', 'basal melting rate (positive if melting) [m/yr]')) 47 s += '{}\n'.format(fielddisplay(self, 'mantleconductivity', 'mantle heat conductivity [W/m^3]')) 48 48 s += '{}\n'.format(fielddisplay(self, 'nusselt', 'nusselt number, ratio of mantle to plume [1]')) 49 s += '{}\n'.format(fielddisplay(self, 'dtbg', 'background temperature gradient [degree /m]'))49 s += '{}\n'.format(fielddisplay(self, 'dtbg', 'background temperature gradient [degree/m]')) 50 50 s += '{}\n'.format(fielddisplay(self, 'plumeradius', 'radius of the mantle plume [m]')) 51 51 s += '{}\n'.format(fielddisplay(self, 'topplumedepth', 'depth of the mantle plume top below the crust [m]')) … … 55 55 s += '{}\n'.format(fielddisplay(self, 'crustthickness', 'thickness of the crust [m]')) 56 56 s += '{}\n'.format(fielddisplay(self, 'uppercrustthickness', 'thickness of the upper crust [m]')) 57 s += '{}\n'.format(fielddisplay(self, 'uppercrustheat', 'volumic heat of the upper crust [w /m^3]'))58 s += '{}\n'.format(fielddisplay(self, 'lowercrustheat', 'volumic heat of the lowercrust [w /m^3]'))57 s += '{}\n'.format(fielddisplay(self, 'uppercrustheat', 'volumic heat of the upper crust [w/m^3]')) 58 s += '{}\n'.format(fielddisplay(self, 'lowercrustheat', 'volumic heat of the lowercrust [w/m^3]')) 59 59 return s 60 # }}}60 # }}} 61 61 62 62 def initialize(self, md): #{{{ … … 68 68 print(' no basalforcings.floatingice_melting_rate specified: values set as zero') 69 69 return self 70 # }}}70 # }}} 71 71 72 72 def extrude(self, md): # {{{ … … 74 74 self.floatingice_melting_rate = project3d(md, 'vector', self.floatingice_melting_rate, 'type', 'node', 'layer', 1) 75 75 return self 76 # }}}76 # }}} 77 77 78 78 def setdefaultparameters(self): # {{{ … … 80 80 self.mantleconductivity = 2.2 81 81 self.nusselt = 300 82 self.dtbg = 11 / 1000. 82 self.dtbg = 11 / 1000.0 83 83 self.plumeradius = 100000 84 84 self.topplumedepth = 10000 … … 86 86 self.crustthickness = 30000 87 87 self.uppercrustthickness = 14000 88 self.uppercrustheat = 1.7 * 10**-689 self.lowercrustheat = 0.4 * 10**-688 self.uppercrustheat = 1.7 * pow(10, -6) 89 self.lowercrustheat = 0.4 * pow(10, -6) 90 90 return self 91 # }}}91 # }}} 92 92 93 93 def checkconsistency(self, md, solution, analyses): # {{{ -
TabularUnified issm/trunk-jpl/src/m/classes/rotational.m ¶
r26307 r26358 21 21 function self = setdefaultparameters(self) % {{{ 22 22 23 %moment of inertia: 24 self.equatorialmoi =8.0077*10^37; % [kg m^2] 25 self.polarmoi =8.0345*10^37; % [kg m^2] 23 %moment of inertia: 24 self.equatorialmoi =8.0077*10^37; % [kg m^2] 25 self.polarmoi =8.0345*10^37; % [kg m^2] 26 26 27 % mean rotational velocity of earth 28 self.angularvelocity=7.2921*10^-5; % [s^-1] 27 % mean rotational velocity of earth 28 self.angularvelocity=7.2921*10^-5; % [s^-1] 29 29 end % }}} 30 30 function md = checkconsistency(self,md,solution,analyses) % {{{ -
TabularUnified issm/trunk-jpl/src/m/classes/rotational.py ¶
r26317 r26358 33 33 def setdefaultparameters(self): # {{{ 34 34 # Moment of inertia 35 self.equatorialmoi = 8.0077 e37# [kg m^2]36 self.polarmoi = 8.0345 e37# [kg m^2]35 self.equatorialmoi = 8.0077 * pow(10, 37) # [kg m^2] 36 self.polarmoi = 8.0345 * pow(10, 37) # [kg m^2] 37 37 38 38 # Mean rotational velocity of earth 39 self.angularvelocity = 7.2921 e-5# [s^-1]39 self.angularvelocity = 7.2921 * pow(10, -5) # [s^-1] 40 40 return self 41 41 #}}} -
TabularUnified issm/trunk-jpl/src/m/classes/sealevelmodel.m ¶
r26352 r26358 4 4 % slm = sealevelmodel(varargin) 5 5 % 6 % where varargin is a variable list of options: 6 % where varargin is a variable list of options: 7 7 % 8 % Example: 8 % Example: 9 9 % slm = sealevel('icecap',md_greenland,'icecap',md_antarctica,'earth',md_earth); 10 10 … … 33 33 options=pairoptions(varargin{:}); 34 34 35 %recover all the icecap models: 36 slm.icecaps=getfieldvalues(options,'ice_cap',{}); 35 %recover all the icecap models: 36 slm.icecaps=getfieldvalues(options,'ice_cap',{}); 37 37 38 38 %recover the earth model: 39 39 slm.earth = getfieldvalue(options,'earth',0); 40 40 41 %set planet type: 41 %set planet type: 42 42 slm.planet=getfieldvalue(options,'planet','earth'); 43 43 … … 47 47 function checkconsistency(slm,solutiontype) % {{{ 48 48 49 %is the coupler turned on? 49 %is the coupler turned on? 50 50 for i=1:length(slm.icecaps), 51 51 if slm.icecaps{i}.transient.iscoupler==0, … … 58 58 end 59 59 60 %check that the transition vectors have the right size: 60 %check that the transition vectors have the right size: 61 61 for i=1:length(slm.icecaps), 62 62 if slm.icecaps{i}.mesh.numberofvertices ~= length(slm.earth.solidearth.transitions{i}), … … 65 65 end 66 66 67 %check that runfrequency is the same everywhere: 67 %check that runfrequency is the same everywhere: 68 68 for i=1:length(slm.icecaps), 69 69 if slm.icecaps{i}.solidearth.settings.runfrequency~=slm.earth.solidearth.settings.runfrequency, … … 72 72 end 73 73 74 %make sure steric_rate is the same everywhere: 75 for i=1:length(slm.icecaps), 76 md= slm.icecaps{i}; 74 %make sure steric_rate is the same everywhere: 75 for i=1:length(slm.icecaps), 76 md= slm.icecaps{i}; 77 77 if ~isempty(find(md.dsl.steric_rate - slm.earth.dsl.steric_rate(slm.earth.dsl.transitions{i}))), 78 78 error(sprintf('sealevelmodel.m::checkconsistency: steric rate on ice cap %s is not the same as for the earth\n',md.miscellaneous.name)); … … 82 82 %make sure grd is the same everywhere: 83 83 for i=1:length(slm.icecaps), 84 md= slm.icecaps{i}; 84 md= slm.icecaps{i}; 85 85 if md.solidearthsettings.isgrd~=slm.earth.solidearthsettings.isgrd 86 86 error(sprintf('sealevelmodel.m::checkconsistency: isgrd on ice cap %s is not the same as for the earth\n',md.miscellaneous.name)); … … 88 88 end 89 89 90 %make sure that there is no solid earth external forcing on the basins: 91 for i=1:length(slm.icecaps), 92 md= slm.icecaps{i}; 90 %make sure that there is no solid earth external forcing on the basins: 91 for i=1:length(slm.icecaps), 92 md= slm.icecaps{i}; 93 93 if ~isempty(md.solidearth.external), 94 94 error('sealevelmodel.m::checkconsistency: cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model'); … … 96 96 97 97 end 98 %make sure that we have the right grd model for computing out sealevel patterns: 99 for i=1:length(slm.icecaps), 100 md= slm.icecaps{i}; 98 %make sure that we have the right grd model for computing out sealevel patterns: 99 for i=1:length(slm.icecaps), 100 md= slm.icecaps{i}; 101 101 if md.solidearth.settings.grdmodel~=0 102 102 error(sprintf('sealevelmodel.m::checkconsistency: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap %i',i)); … … 135 135 for k=1:length(champs), 136 136 if strcmpi(class(icecaps{1}.results.TransientSolution(j).(champs{k})),'double'), 137 %vertex or element? 137 %vertex or element? 138 138 if length(icecaps{1}.results.TransientSolution(j).(champs{k}))==icecaps{1}.mesh.numberofvertices, 139 139 md.results.TransientSolution(j).(champs{k})=zeros(md.mesh.numberofvertices,1); … … 142 142 md.results.TransientSolution(j).(champs{k})(trans{l})=resultcap; 143 143 end 144 else 144 else 145 145 if strcmpi(champs{k},'IceVolume') | strcmpi(champs{k},'IceVolumeAboveFloatation') , 146 146 md.results.TransientSolution(j).(champs{k})=0; … … 195 195 function intersections2d(self,varargin) % {{{ 196 196 197 options=pairoptions(varargin{:}); 197 options=pairoptions(varargin{:}); 198 198 force=getfieldvalue(options,'force',0); 199 199 200 %initialize, to avoid issues of having more transitions than meshes. 200 %initialize, to avoid issues of having more transitions than meshes. 201 201 self.transitions={}; 202 202 self.eltransitions={}; … … 209 209 mdi=self.icecaps{i}; 210 210 211 %for elements: 211 %for elements: 212 212 xei=mdi.mesh.x(mdi.mesh.elements)*[1;1;1]/3; 213 213 yei=mdi.mesh.y(mdi.mesh.elements)*[1;1;1]/3; … … 222 222 function intersections(self,varargin) % {{{ 223 223 224 options=pairoptions(varargin{:}); 224 options=pairoptions(varargin{:}); 225 225 force=getfieldvalue(options,'force',0); 226 226 227 %initialize, to avoid issues of having more transitions than meshes. 227 %initialize, to avoid issues of having more transitions than meshes. 228 228 self.transitions={}; 229 229 self.eltransitions={}; … … 238 238 mdi=TwoDToThreeD(mdi,self.planet); 239 239 240 %for elements: 240 %for elements: 241 241 xei=mdi.mesh.x(mdi.mesh.elements)*[1;1;1]/3; 242 242 yei=mdi.mesh.y(mdi.mesh.elements)*[1;1;1]/3; … … 265 265 end % }}} 266 266 function baslist=basinindx(self,varargin) % {{{ 267 options=pairoptions(varargin{:}); 267 options=pairoptions(varargin{:}); 268 268 continent=getfieldvalue(options,'continent','all'); 269 269 bas=getfieldvalue(options,'basin','all'); … … 273 273 if length(continent)==1, 274 274 if strcmpi(continent{1},'all'), 275 %need to transform this into a list of continents: 276 continent={}; 275 %need to transform this into a list of continents: 276 continent={}; 277 277 for i=1:length(self.basins), 278 278 continent{end+1}=self.basins{i}.continent; … … 287 287 else 288 288 if strcmpi(continent,'all'), 289 %need to transform this into a list of continents: 290 continent={}; 289 %need to transform this into a list of continents: 290 continent={}; 291 291 for i=1:length(self.basins), 292 292 continent{end+1}=self.basins{i}.continent; … … 302 302 if length(bas)==1, 303 303 if strcmpi(bas{1},'all'), 304 %need to transform this into a list of basins: 304 %need to transform this into a list of basins: 305 305 baslist=[]; 306 306 for i=1:length(self.basins), … … 323 323 end 324 324 else 325 %we have a list of basin names: 325 %we have a list of basin names: 326 326 baslist=[]; 327 327 for i=1:length(bas), … … 374 374 function caticecaps(self,varargin) % {{{ 375 375 376 %recover options: 377 options=pairoptions(varargin{:}); 376 %recover options: 377 options=pairoptions(varargin{:}); 378 378 tolerance=getfieldvalue(options,'tolerance',.65); 379 379 loneedgesdetect=getfieldvalue(options,'loneedgesdetect',0); … … 386 386 387 387 %Plug all models together: 388 md=models{1}; 388 md=models{1}; 389 389 for i=2:length(models), 390 390 md=modelmerge3d(md,models{i},'tolerance',tolerance); … … 405 405 end %}}} 406 406 407 %Plug into earth: 407 %Plug into earth: 408 408 self.earth=md; 409 409 … … 414 414 function caticecaps2d(self,varargin) % {{{ 415 415 416 %recover options: 417 options=pairoptions(varargin{:}); 416 %recover options: 417 options=pairoptions(varargin{:}); 418 418 tolerance=getfieldvalue(options,'tolerance',1e-5); 419 419 loneedgesdetect=getfieldvalue(options,'loneedgesdetect',0); … … 421 421 422 422 %Plug all models together: 423 md=models{1}; 423 md=models{1}; 424 424 for i=2:length(models), 425 425 md=modelmerge2d(md,models{i},'tolerance',tolerance); … … 437 437 end %}}} 438 438 439 %Plug into earth: 439 %Plug into earth: 440 440 self.earth=md; 441 441 … … 463 463 end % }}} 464 464 function transfer(self,string) % {{{ 465 %Recover field size in one icecap: 465 %Recover field size in one icecap: 466 466 eval(['n=size(self.icecaps{1}.' string ',1);']); 467 467 if n==self.icecaps{1}.mesh.numberofvertices, … … 471 471 end 472 472 elseif n==(self.icecaps{1}.mesh.numberofvertices+1), 473 %dealing with a transient dataset. 473 %dealing with a transient dataset. 474 474 %check that all timetags are similar between all icecaps: %{{{ 475 475 for i=1:length(self.icecaps), … … 482 482 end 483 483 end 484 eval(['capfield1= self.icecaps{1}.' string ';']); 484 eval(['capfield1= self.icecaps{1}.' string ';']); 485 485 times=capfield1(end,:); 486 486 nsteps=length(times); … … 514 514 mintimestep=Inf; 515 515 for i=1:length(self.icecaps), 516 ic=self.icecaps{i}; 516 ic=self.icecaps{i}; 517 517 mintimestep=min(mintimestep, length(ic.results.TransientSolution)); 518 518 end … … 522 522 523 523 for i=1:length(self.icecaps), 524 ic=self.icecaps{i}; 524 ic=self.icecaps{i}; 525 525 ic.results.TransientSolution=ic.results.TransientSolution(1:mintimestep); 526 526 self.icecaps{i}=ic; -
TabularUnified issm/trunk-jpl/src/m/classes/sealevelmodel.py ¶
r26352 r26358 35 35 """ 36 36 37 def __init__(self, *args): # {{{38 self.icecaps = [] 39 self.earth = 0 37 def __init__(self, *args): # {{{ 38 self.icecaps = [] # list of land/ice models; name should be changed later 39 self.earth = 0 # model for the whole earth 40 40 self.basins = [] # list of basins, matching icecaps, where shapefile info is held 41 41 self.cluster = 0 … … 61 61 # Set planet type 62 62 self.planet = options.getfieldvalue('planet', 'earth') 63 # }}}63 # }}} 64 64 65 65 def __repr__(self): # {{{ … … 71 71 72 72 return s 73 # }}}73 # }}} 74 74 75 75 def setdefaultparameters(self): # {{{ … … 83 83 self.eltransitions = [] 84 84 self.planet = 'earth' 85 # }}}85 # }}} 86 86 87 87 @staticmethod … … 102 102 # Check that run frequency is the same everywhere 103 103 for i in range(len(slm.icecaps)): 104 if slm.icecaps[i].s lr.geodetic_run_frequency != slm.earth.geodetic_run_frequency:104 if slm.icecaps[i].solidearth.settings.runfrequency != slm.earth.solidearth.settings.runfrequency: 105 105 raise Exception('sealevelmodel.py::checkconsistency: icecap model {} should have the same run frequency as earth!'.format(slm.icecaps[i].miscellaneous.name)) 106 106 … … 108 108 for i in range(len(slm.icecaps)): 109 109 md = slm.icecaps[i] 110 if np.nonzero(md. slr.steric_rate - slm.earth.slr.steric_rate[slm.earth.slr.transitions[i]]) != []:110 if np.nonzero(md.dsl.steric_rate - slm.earth.dsl.steric_rate[slm.earth.dsl.transitions[i]]) != []: 111 111 raise Exception('sealevelmodel.py::checkconsistency: steric rate on ice cap {} is not the same as for the earth'.format(md.miscellaneous.name)) 112 112 … … 116 116 if md.solidearthsettings.isgrd != slm.earth.solidearthsettings.isgrd: 117 117 raise RuntimeError('sealevelmodel.py::checkconsistency: isgrd on ice cap {} is not the same as for the earth\n'.format(md.miscellaneous.name)) 118 118 119 # Make sure that there is no solid earth external forcing on the basins 119 120 for i in range(len(slm.icecaps)): … … 126 127 if md.solidearth.settings.grdmodel != 0: 127 128 raise RuntimeError('sealevelmodel.py::checkconsistency: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap {}'.format(i)) 128 # }}}129 # }}} 129 130 130 131 def mergeresults(self): # {{{ … … 156 157 continue 157 158 self.mergedcaps[2 * i] = md 158 # }}}159 # }}} 159 160 160 161 def listcaps(self): # {{{ 161 162 for i in range(len(self.icecaps)): 162 163 print('{}: {}'.format(i, self.icecaps[i].miscellaneous.name)) 163 # }}}164 # }}} 164 165 165 166 def ncaps(self): #{{{ 166 167 return len(self.icecaps) 167 # }}}168 # }}} 168 169 169 170 def continents(self): # {{{ … … 172 173 list.append = self.basins[i].continent 173 174 return np.unique(list) 174 # }}}175 # }}} 175 176 176 177 def basinsfromcontinent(self, continent): # {{{ … … 180 181 list.append = self.basins[i].name 181 182 return np.unique(list) 182 # }}}183 # }}} 183 184 184 185 def addbasin(self, bas): # {{{ … … 186 187 raise Exception('addbasin method only takes a \'basin\' class object as input') 187 188 self.basins.append(bas) 188 # }}}189 # }}} 189 190 190 191 def intersections2d(self, *args): #{{{ … … 211 212 self.transitions.append(meshintersect2d(self.earth.mesh.x, self.earth.mesh.y, mdi.mesh.x, mdi.mesh.y, 'force', force)) 212 213 self.eltransitions.append(meshintersect2d(xe, ye, xei, yei, 'force', force)) 213 # }}}214 215 def intersections(self, *args): # {{{214 # }}} 215 216 def intersections(self, *args): # {{{ 216 217 options = pairoptions(*args) 217 218 force = options.getfieldvalue('force', 0) … … 239 240 self.transitions.append(meshintersect3d(self.earth.mesh.x, self.earth.mesh.y, self.earth.mesh.z, mdi.mesh.x, mdi.mesh.y, mdi.mesh.z, 'force', force)) 240 241 self.eltransitions.append(meshintersect3d(xe, ye, ze, xei, yei, zei, 'force', force)) 241 # }}}242 243 def checkintersections(self): # {{{242 # }}} 243 244 def checkintersections(self): # {{{ 244 245 flags = np.zeros(self.earth.mesh.numberofvertices, 1) 245 246 for i in range(len(self.basins)): 246 247 flags[self.transitions[i]] = i 247 248 plotmodel(self.earth, 'data', flags, 'coastline', 'on') 248 # }}}249 250 def checkbasinconsistency(self): # {{{249 # }}} 250 251 def checkbasinconsistency(self): # {{{ 251 252 for i in range(len(self.basins)): 252 253 self.basins[i].checkconsistency() 253 # }}}254 255 def basinindx(self, *args): # {{{254 # }}} 255 256 def basinindx(self, *args): # {{{ 256 257 options = pairoptions(*args) 257 258 continent = options.getfieldvalue('continent', 'all') … … 280 281 else: 281 282 pass # Nothing to do: assume we have a list of continents 282 # }}}283 # }}} 283 284 284 285 # Expand basins list using the continent list above and the extra bas discriminator #{{{ … … 325 326 326 327 return baslist 327 # }}}328 # }}}329 330 def addicecap(self, md): # {{{328 # }}} 329 # }}} 330 331 def addicecap(self, md): # {{{ 331 332 if not type(md) == model: 332 333 raise Exception("addicecap method only takes a 'model' class object as input") 333 334 334 335 self.icecaps.append(md) 335 # }}}336 337 def basinsplot3d(self, *args): # {{{336 # }}} 337 338 def basinsplot3d(self, *args): # {{{ 338 339 for i in range(len(self.basins)): 339 340 self.basins[i].plot3d(*args) 340 # }}}341 342 def caticecaps(self, *args): # {{{341 # }}} 342 343 def caticecaps(self, *args): # {{{ 343 344 # Recover options 344 345 options = pairoptions(*args) … … 372 373 # Create mesh radius 373 374 self.earth.mesh.r = planetradius('earth') * np.ones((md.mesh.numberofvertices, )) 374 # }}}375 376 def caticecaps2d(self, *args): # {{{375 # }}} 376 377 def caticecaps2d(self, *args): # {{{ 377 378 # Recover options 378 379 options = pairoptions(*args) … … 398 399 # Plug into earth 399 400 self.earth = md 400 # }}}401 402 def viscousiterations(self): # {{{401 # }}} 402 403 def viscousiterations(self): # {{{ 403 404 for i in range(len(self.icecaps)): 404 405 ic = self.icecaps[i] … … 407 408 mvi = np.max(mvi, ic.results.TransientSolution[j].StressbalanceConvergenceNumSteps) 408 409 print("{}, {}: {}".format(i, self.icecaps[i].miscellaneous.name, mvi)) 409 # }}}410 411 def maxtimestep(self): # {{{410 # }}} 411 412 def maxtimestep(self): # {{{ 412 413 for i in range(len(self.icecaps)): 413 414 ic = self.icecaps[i] … … 419 420 timei = self.earth.results.TransientSolution[-1].time 420 421 print("Earth: {}/{}", mvi, timei) 421 # }}}422 423 def transfer(self, string): # {{{422 # }}} 423 424 def transfer(self, string): # {{{ 424 425 # Recover field size in one icecap 425 426 n = getsubattr(self.icecaps[0], string).shape[0] … … 442 443 times = capfield1[-1, :] 443 444 nsteps = len(times) 444 # }}}445 # }}} 445 446 # Initialize #{{{ 446 447 field = np.zeros((self.earth.mesh.numberofvertices + 1, nsteps)) 447 448 field[-1, :] = times # Transfer the times only, not the values 448 # }}}449 # }}} 449 450 # Transfer all the time fields #{{{ 450 451 for i in range(len(self.icecaps)): … … 453 454 field[self.transitions[i], j] = capfieldi[0:-1, j] # Transfer only the values, not the time 454 455 setsubattr(self.earth, string, field) # Do not forget to plug the field variable into its final location 455 # }}}456 # }}} 456 457 elif n == (self.icecaps[0].mesh.numberofelements): 457 458 setsubattr(self.earth, string, np.zeros((self.earth.mesh.numberofelements, ))) # Assign array of zeros to target attribute … … 461 462 else: 462 463 raise Exception('not supported yet') 463 # }}}464 465 def homogenize(self, noearth=0): # {{{464 # }}} 465 466 def homogenize(self, noearth=0): # {{{ 466 467 mintimestep = np.inf 467 468 … … 486 487 487 488 return self 488 # }}}489 490 def initializemodels(self): # {{{489 # }}} 490 491 def initializemodels(self): # {{{ 491 492 for i in range(len(self.basins)): 492 493 md = model() 493 494 md.miscellaneous.name = self.basins[i].name 494 495 self.addicecap(md) 495 # }}}496 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/solidearth.m ¶
r26307 r26358 69 69 self.requested_outputs={'default'}; 70 70 71 %transitions should be a cell array of vectors: 71 %transitions should be a cell array of vectors: 72 72 self.transitions={}; 73 74 %no partitions requested for barystatic contribution: 73 74 %no partitions requested for barystatic contribution: 75 75 self.partitionice=[]; 76 76 self.partitionhydro=[]; 77 77 self.partitionocean=[]; 78 78 79 %no external solutions by default: 79 %no external solutions by default: 80 80 self.external=[]; 81 81 82 82 %planet radius 83 83 self.planetradius= planetradius(planet); 84 84 85 85 end % }}} 86 86 function md = checkconsistency(self,md,solution,analyses) % {{{ … … 116 116 npartice=0; 117 117 end 118 118 119 if ~isempty(self.partitionhydro), 119 120 nparthydro=max(self.partitionhydro)+2; -
TabularUnified issm/trunk-jpl/src/m/classes/solidearth.py ¶
r26317 r26358 4 4 from fielddisplay import fielddisplay 5 5 from lovenumbers import lovenumbers 6 from MatlabFuncs import * 6 7 from planetradius import planetradius 7 8 from project3d import project3d … … 9 10 from solidearthsettings import solidearthsettings 10 11 from solidearthsolution import solidearthsolution 11 from offlinesolidearthsolution import offlinesolidearthsolution12 from surfaceload import surfaceload13 12 from WriteData import WriteData 14 13 … … 25 24 """ 26 25 27 def __init__(self, *args): #{{{26 def __init__(self, *args): # {{{ 28 27 self.settings = solidearthsettings() 29 self.external = []28 self.external = None 30 29 self.lovenumbers = lovenumbers() 31 30 self.rotational = rotational() … … 44 43 else: 45 44 raise Exception('solidearth constructor error message: zero or one argument only!') 46 # }}}47 def __repr__(self): #{{{45 # }}} 46 def __repr__(self): # {{{ 48 47 s = ' solidearthinputs, forcings and settings:\n' 49 48 s += '{}\n'.format(fielddisplay(self, 'planetradius', 'planet radius [m]')) … … 58 57 print(self.lovenumbers) 59 58 print(self.rotational) 60 if self.external:59 if len(self.external): 61 60 print(self.external) 62 61 return s 63 # }}}64 def setdefaultparameters(self, planet): #{{{62 # }}} 63 def setdefaultparameters(self, planet): # {{{ 65 64 # Output default 66 65 self.requested_outputs = ['default'] … … 75 74 76 75 # No external solutions by default 77 self.external = []76 self.external = None 78 77 79 78 # Planet radius 80 79 self.planetradius = planetradius(planet) 81 # }}}82 def checkconsistency(self, md, solution, analyses): #{{{80 # }}} 81 def checkconsistency(self, md, solution, analyses): # {{{ 83 82 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc): 84 83 return md … … 90 89 self.rotational.checkconsistency(md, solution, analyses) 91 90 if self.external: 92 if (not isinstance(self.external,solidearthsolution)) and (not isinstance(self.external,offlinesolidearthsolution)):91 if not isa(self.external, solidearthsolution): 93 92 raise Exception('solidearth consistency check: external field should be a solidearthsolution') 94 93 self.external.checkconsistency(md, solution, analyses) 95 94 return md 96 # }}}97 def defaultoutputs(self, md): #{{{95 # }}} 96 def defaultoutputs(self, md): # {{{ 98 97 return ['Sealevel'] 99 # }}}100 def marshall(self, prefix, md, fid): #{{{98 # }}} 99 def marshall(self, prefix, md, fid): # {{{ 101 100 WriteData(fid, prefix, 'object', self, 'fieldname', 'planetradius', 'format', 'Double') 102 101 WriteData(fid, prefix, 'object', self, 'fieldname', 'transitions', 'format', 'MatArray') … … 133 132 WriteData(fid, prefix, 'data', 0, 'format', 'Integer', 'name', 'md.solidearth.isexternal') 134 133 135 # process requested outputs134 # Process requested outputs 136 135 outputs = self.requested_outputs 137 136 pos = np.where(np.asarray(outputs) == 'default')[0] 138 137 if len(pos): 139 outputs = np.delete(outputs, pos) 138 outputs = np.delete(outputs, pos) # remove 'default' from outputs 140 139 outputs = np.append(outputs, self.defaultoutputs(md)) # add defaults 141 140 WriteData(fid, prefix, 'data', outputs, 'name', 'md.solidearth.requested_outputs', 'format', 'StringArray') 142 # }}}143 def extrude(self, md): #{{{141 # }}} 142 def extrude(self, md): # {{{ 144 143 return self 145 # }}}144 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/solidearthsettings.m ¶
r26301 r26358 56 56 end % }}} 57 57 function self = setdefaultparameters(self) % {{{ 58 59 %Convergence criterion: absolute, relative and residual60 self.reltol=0.01; % 1 percent61 self.abstol=NaN; % default62 58 63 %maximum of non-linear iterations. 64 self.maxiter=5; 59 %Convergence criterion: absolute, relative and residual 60 self.reltol=0.01; % 1 percent 61 self.abstol=NaN; % default 65 62 66 %computational flags: 67 self.selfattraction=1; 68 self.elastic=1; 69 self.viscous=1; 70 self.rotation=1; 71 self.grdocean=1; 72 self.ocean_area_scaling=0; 73 self.compute_bp_grd=0; 74 self.isgrd=0; 75 self.sealevelloading=1; 63 %maximum of non-linear iterations. 64 self.maxiter=5; 76 65 77 %numerical discretization accuracy 78 self.degacc=.01; 79 self.timeacc=1; 66 %computational flags: 67 self.selfattraction=1; 68 self.elastic=1; 69 self.viscous=1; 70 self.rotation=1; 71 self.grdocean=1; 72 self.ocean_area_scaling=0; 73 self.compute_bp_grd=0; 74 self.isgrd=0; 75 self.sealevelloading=1; 80 76 81 %how many time steps we skip before we run solidearthsettings solver during transient 82 self.runfrequency=1; 77 %numerical discretization accuracy 78 self.degacc=.01; 79 self.timeacc=1; 83 80 84 %horizontal displacement? (not on by default)85 self.horiz=0;81 %how many time steps we skip before we run solidearthsettings solver during transient 82 self.runfrequency=1; 86 83 87 %cross section for Ivins model88 self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex)84 %horizontal displacement? (not on by default) 85 self.horiz=0; 89 86 90 %no grd model by default: 91 self.grdmodel=0; 87 %cross section for Ivins model 88 self.cross_section_shape=1; %square as default (see iedge in GiaDeflectionCorex) 89 90 %no grd model by default: 91 self.grdmodel=0; 92 92 93 93 end % }}} … … 179 179 end % }}} 180 180 function savemodeljs(self,fid,modelname) % {{{ 181 181 % TODO: Update the following fields so that coverage is complete 182 182 writejsdouble(fid,[modelname '.solidearth.settings.maxiter'],self.maxiter); 183 183 writejsdouble(fid,[modelname '.solidearth.settings.reltol'],self.reltol); -
TabularUnified issm/trunk-jpl/src/m/classes/solidearthsettings.py ¶
r26353 r26358 13 13 """ 14 14 15 def __init__(self, *args): #{{{15 def __init__(self, *args): # {{{ 16 16 self.reltol = 0 17 17 self.abstol = 0 … … 37 37 else: 38 38 raise Exception('constructor not supported') 39 # }}}39 # }}} 40 40 41 def __repr__(self): #{{{41 def __repr__(self): # {{{ 42 42 s = ' solidearth settings:\n' 43 43 s += '{}\n'.format(fielddisplay(self, 'reltol', 'sea level change relative convergence criterion (default, NaN: not applied)')) … … 59 59 s += '{}\n'.format(fielddisplay(self, 'cross_section_shape', '1: square-edged (default). 2: elliptical. See iedge in GiaDeflectionCore')) 60 60 return s 61 # }}}61 # }}} 62 62 63 def setdefaultparameters(self): #{{{63 def setdefaultparameters(self): # {{{ 64 64 # Convergence criterion: absolute, relative, and residual 65 65 self.reltol = 0.01 # 1 percent … … 81 81 82 82 # Numerical discretization accuracy 83 self.degacc = .0183 self.degacc = 0.01 84 84 self.timeacc = 1 85 85 … … 95 95 # No GRD model by default 96 96 self.grdmodel = 0 97 # }}}97 # }}} 98 98 99 def checkconsistency(self, md, solution, analyses): #{{{99 def checkconsistency(self, md, solution, analyses): # {{{ 100 100 if ('SealevelchangeAnalysis' not in analyses) or (solution == 'TransientSolution' and not md.transient.isslc): 101 101 return md … … 131 131 132 132 return md 133 # }}}133 # }}} 134 134 135 def marshall(self, prefix, md, fid): #{{{135 def marshall(self, prefix, md, fid): # {{{ 136 136 WriteData(fid, prefix, 'object', self, 'fieldname', 'reltol', 'name', 'md.solidearth.settings.reltol', 'format', 'Double'); 137 137 WriteData(fid, prefix, 'object', self, 'fieldname', 'abstol', 'name', 'md.solidearth.settings.abstol', 'format', 'Double'); … … 145 145 WriteData(fid, prefix, 'object', self, 'fieldname', 'runfrequency', 'name', 'md.solidearth.settings.runfrequency', 'format', 'Integer'); 146 146 WriteData(fid, prefix, 'object', self, 'fieldname', 'degacc', 'name', 'md.solidearth.settings.degacc', 'format', 'Double'); 147 WriteData(fid, prefix, 'object', self, 'fieldname', 'timeacc', 'name', 'md.solidearth.settings.timeacc', 'format', 'Double', 'scale', md.constants.yts);147 WriteData(fid, prefix, 'object', self, 'fieldname', 'timeacc', 'name', 'md.solidearth.settings.timeacc', 'format', 'Double', 'scale', md.constants.yts); 148 148 WriteData(fid, prefix, 'object', self, 'fieldname', 'horiz', 'name', 'md.solidearth.settings.horiz', 'format', 'Integer'); 149 149 WriteData(fid, prefix, 'object', self, 'fieldname', 'sealevelloading', 'name', 'md.solidearth.settings.sealevelloading', 'format', 'Integer'); … … 152 152 WriteData(fid, prefix, 'object', self, 'fieldname', 'grdmodel', 'name', 'md.solidearth.settings.grdmodel', 'format', 'Integer'); 153 153 WriteData(fid, prefix, 'object', self, 'fieldname', 'cross_section_shape', 'name', 'md.solidearth.settings.cross_section_shape', 'format', 'Integer'); 154 # }}}154 # }}} 155 155 156 def extrude(self, md): #{{{156 def extrude(self, md): # {{{ 157 157 return self 158 # }}}158 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/solidearthsolution.m ¶
r26317 r26358 20 20 end 21 21 end % }}} 22 function disp(self) % {{{ 23 disp(sprintf('%s',' units for time series is (yr)')); 24 fielddisplay(self,'displacementeast','solid-Earth Eastwards bedrock displacement series (m)'); 25 fielddisplay(self,'displacementnorth','solid-Earth Northwards bedrock displacement time series (m)'); 26 fielddisplay(self,'displacementup','solid-Earth bedrock uplift time series (m)'); 27 fielddisplay(self,'geoid','solid-Earth geoid time series (m)'); 28 29 end % }}} 22 30 function self = setdefaultparameters(self) % {{{ 23 31 … … 34 42 md = checkfield(md,'fieldname','solidearth.external.displacementup','Inf',1,'timeseries',1); 35 43 md = checkfield(md,'fieldname','solidearth.external.geoid','Inf',1,'timeseries',1); 36 37 end % }}}38 function disp(self) % {{{39 disp(sprintf('%s',' units for time series is (yr)'));40 fielddisplay(self,'displacementeast','solid-Earth Eastwards bedrock displacement series (m)');41 fielddisplay(self,'displacementnorth','solid-Earth Northwards bedrock displacement time series (m)');42 fielddisplay(self,'displacementup','solid-Earth bedrock uplift time series (m)');43 fielddisplay(self,'geoid','solid-Earth geoid time series (m)');44 44 45 45 end % }}} -
TabularUnified issm/trunk-jpl/src/m/classes/solidearthsolution.py ¶
r26352 r26358 13 13 """ 14 14 15 def __init__(self, *args): #{{{16 self.displacementeast = None17 self.displacementnorth = None18 self.displacementup = None19 self.geoid = None15 def __init__(self, *args): # {{{ 16 self.displacementeast = [] 17 self.displacementnorth = [] 18 self.displacementup = [] 19 self.geoid = [] 20 20 21 21 if len(args) == 0: … … 23 23 else: 24 24 raise RuntimeError('constructor not supported') 25 # }}}25 # }}} 26 26 27 def __repr__(self): #{{{27 def __repr__(self): # {{{ 28 28 s = ' units for time series is (yr)\n' 29 29 s += '{}\n'.format(fielddisplay(self, 'displacementeast', 'solid-Earth Eastwards bedrock displacement series (m)')) … … 33 33 34 34 return s 35 # }}}35 # }}} 36 36 37 def setdefaultparameters(self): #{{{37 def setdefaultparameters(self): # {{{ 38 38 self.displacementeast = [] 39 39 self.displacementnorth = [] 40 40 self.displacementup = [] 41 41 self.geoid = [] 42 # }}}42 # }}} 43 43 44 def checkconsistency(self, md, solution, analyses): #{{{44 def checkconsistency(self, md, solution, analyses): # {{{ 45 45 md = checkfield(md, 'fieldname', 'solidearth.external.displacementeast', 'Inf', 1, 'timeseries', 1) 46 46 md = checkfield(md, 'fieldname', 'solidearth.external.displacementnorth', 'Inf', 1, 'timeseries', 1) 47 47 md = checkfield(md, 'fieldname', 'solidearth.external.displacementup', 'Inf', 1, 'timeseries', 1) 48 48 md = checkfield(md, 'fieldname', 'solidearth.external.geoid', 'Inf', 1, 'timeseries', 1) 49 # }}}49 # }}} 50 50 51 def marshall(self, prefix, md, fid): #{{{51 def marshall(self, prefix, md, fid): # {{{ 52 52 yts = md.constants.yts 53 53 54 print('sadjsda') 55 exit() 56 54 57 # Transform our time series into time series rates 55 if len(np.shape(self.displacementeast))== 1:58 if np.shape(self.displacementeast)[1] == 1: 56 59 print('solidearthsolution.py::marshall: Warning: only one time step provided, assuming the values are rates per year') 57 60 displacementeast_rate = np.append(np.array(self.displacementeast).reshape(-1, 1), 0) … … 76 79 WriteData(fid, prefix, 'object', self, 'fieldname', 'displacementnorth', 'data', displacementnorth_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.displacementnorth', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts); 77 80 WriteData(fid, prefix, 'object', self, 'fieldname', 'geoid', 'data', geoid_rate,'format', 'DoubleMat', 'name', 'md.solidearth.external.geoid', 'mattype', 1, 'scale', 1 / yts,'timeserieslength', md.mesh.numberofvertices + 1, 'yts', yts); 78 # }}}81 # }}} 79 82 80 def extrude(self, md): #{{{83 def extrude(self, md): # {{{ 81 84 return self 82 # }}}85 # }}} -
TabularUnified issm/trunk-jpl/src/m/classes/stressbalance.m ¶
r25942 r26358 53 53 function self = setdefaultparameters(self) % {{{ 54 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 55 %maximum of non-linear iterations. 56 self.maxiter=100; 57 58 %Convergence criterion: absolute, relative and residual 59 self.restol=10^-4; 60 self.reltol=0.01; 61 self.abstol=10; 62 63 self.FSreconditioning=10^13; 64 self.shelf_dampening=0; 65 66 %Penalty factor applied kappa=max(stiffness matrix)*10^penalty_factor 67 self.penalty_factor=3; 68 69 %Stop the iterations of rift if below a threshold 70 self.rift_penalty_threshold=0; 71 72 %in some solutions, it might be needed to stop a run when only 73 %a few constraints remain unstable. For thermal computation, this 74 %parameter is often used. 75 self.rift_penalty_lock=10; 76 77 %output default: 78 self.requested_outputs={'default'}; 79 79 80 80 end % }}} -
TabularUnified issm/trunk-jpl/src/m/classes/stressbalance.py ¶
r25688 r26358 18 18 19 19 def __init__(self): # {{{ 20 self.spcvx = float('NaN')21 self.spcvy = float('NaN')22 self.spcvz = float('NaN')20 self.spcvx = np.nan 21 self.spcvy = np.nan 22 self.spcvz = np.nan 23 23 self.restol = 0 24 24 self.reltol = 0 … … 26 26 self.isnewton = 0 27 27 self.FSreconditioning = 0 28 self.icefront = float('NaN')28 self.icefront = np.nan 29 29 self.maxiter = 0 30 30 self.shelf_dampening = 0 31 self.vertex_pairing = float('NaN')32 self.penalty_factor = float('NaN')33 self.rift_penalty_lock = float('NaN')31 self.vertex_pairing = np.nan 32 self.penalty_factor = np.nan 33 self.rift_penalty_lock = np.nan 34 34 self.rift_penalty_threshold = 0 35 self.referential = float('NaN')36 self.loadingforce = float('NaN')35 self.referential = np.nan 36 self.loadingforce = np.nan 37 37 self.requested_outputs = [] 38 38 39 #set defaults39 # Set defaults 40 40 self.setdefaultparameters() 41 41 42 #}}} 42 # }}} 43 43 44 def __repr__(self): # {{{ 44 45 s = ' StressBalance solution parameters:\n' … … 47 48 s += '{}\n'.format(fielddisplay(self, 'reltol', 'velocity relative convergence criterion, NaN: not applied')) 48 49 s += '{}\n'.format(fielddisplay(self, 'abstol', 'velocity absolute convergence criterion, NaN: not applied')) 49 s += '{}\n'.format(fielddisplay(self, 'isnewton', "0: Picard's fixed point, 1: Newton's method, 2: hybrid"))50 s += '{}\n'.format(fielddisplay(self, 'isnewton', '0: Picard\'s fixed point, 1: Newton\'s method, 2: hybrid')) 50 51 s += '{}\n'.format(fielddisplay(self, 'maxiter', 'maximum number of nonlinear iterations')) 51 52 s += ' boundary conditions:\n' 52 s += '{}\n'.format(fielddisplay(self, 'spcvx', 'x -axis velocity constraint (NaN means no constraint) [m / yr]'))53 s += '{}\n'.format(fielddisplay(self, 'spcvy', 'y -axis velocity constraint (NaN means no constraint) [m / yr]'))54 s += '{}\n'.format(fielddisplay(self, 'spcvz', 'z -axis velocity constraint (NaN means no constraint) [m / yr]'))53 s += '{}\n'.format(fielddisplay(self, 'spcvx', 'x-axis velocity constraint (NaN means no constraint) [m / yr]')) 54 s += '{}\n'.format(fielddisplay(self, 'spcvy', 'y-axis velocity constraint (NaN means no constraint) [m / yr]')) 55 s += '{}\n'.format(fielddisplay(self, 'spcvz', 'z-axis velocity constraint (NaN means no constraint) [m / yr]')) 55 56 s += '{}\n'.format(fielddisplay(self, 'icefront', 'segments on ice front list (last column 0: Air, 1: Water, 2: Ice')) 56 s = "%s\n%s" % (s, '\n Rift options:')57 s += ' Rift options:\n' 57 58 s += '{}\n'.format(fielddisplay(self, 'rift_penalty_threshold', 'threshold for instability of mechanical constraints')) 58 59 s += '{}\n'.format(fielddisplay(self, 'rift_penalty_lock', 'number of iterations before rift penalties are locked')) 59 60 s += ' Penalty options:\n' 60 s += '{}\n'.format(fielddisplay(self, 'penalty_factor', 'offset used by penalties: penalty = Kmax * 1 .0**offset'))61 s += '{}\n'.format(fielddisplay(self, 'penalty_factor', 'offset used by penalties: penalty = Kmax * 10^offset')) 61 62 s += '{}\n'.format(fielddisplay(self, 'vertex_pairing', 'pairs of vertices that are penalized')) 62 63 s += ' Other:\n' … … 64 65 s += '{}\n'.format(fielddisplay(self, 'FSreconditioning', 'multiplier for incompressibility equation. Only for FS model')) 65 66 s += '{}\n'.format(fielddisplay(self, 'referential', 'local referential')) 66 s += '{}\n'.format(fielddisplay(self, 'loadingforce', 'loading force applied on each point [N /m^3]'))67 s += '{}\n'.format(fielddisplay(self, 'loadingforce', 'loading force applied on each point [N/m^3]')) 67 68 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'additional outputs requested')) 68 69 return s 69 # }}}70 # }}} 70 71 71 72 def extrude(self, md): # {{{ … … 77 78 78 79 return self 79 # }}}80 # }}} 80 81 81 82 def setdefaultparameters(self): # {{{ 82 # maximum of non - linear iterations.83 # Maximum of non-linear iterations 83 84 self.maxiter = 100 84 #Convergence criterion: absolute, relative and residual 85 self.restol = 1.0e-4 85 86 # Convergence criterion: absolute, relative and residual 87 self.restol = pow(10, -4) 86 88 self.reltol = 0.01 87 89 self.abstol = 10 88 self.FSreconditioning = 10**13 90 91 self.FSreconditioning = pow(10, 13) 89 92 self.shelf_dampening = 0 90 #Penalty factor applied kappa = max(stiffness matrix) * 1.0**penalty_factor 93 94 # Penalty factor applied kappa = max(stiffness matrix) * 1.0^penalty_factor 91 95 self.penalty_factor = 3 92 #Stop the iterations of rift if below a threshold 96 97 # Stop the iterations of rift if below a threshold 93 98 self.rift_penalty_threshold = 0 94 #in some solutions, it might be needed to stop a run when only 95 #a few constraints remain unstable. For thermal computation, this 96 #parameter is often used. 99 100 # In some solutions, it might be needed to stop a run when only a few 101 # constraints remain unstable. For thermal computation, this parameter 102 # is often used. 97 103 self.rift_penalty_lock = 10 98 #output default: 104 105 # Output default 99 106 self.requested_outputs = ['default'] 100 107 return self 101 # }}}108 # }}} 102 109 103 110 def defaultoutputs(self, md): # {{{ … … 107 114 list = ['Vx', 'Vy', 'Vel', 'Pressure'] 108 115 return list 109 # }}}116 # }}} 110 117 111 118 def checkconsistency(self, md, solution, analyses): # {{{ … … 131 138 if not np.any(np.isnan(self.vertex_pairing)) and len(self.vertex_pairing) > 0: 132 139 md = checkfield(md, 'fieldname', 'stressbalance.vertex_pairing', '>', 0) 133 # singular solution140 # Singular solution 134 141 # if ~any((~isnan(md.stressbalance.spcvx) + ~isnan(md.stressbalance.spcvy)) == 2), 135 142 if not np.any(np.logical_and(np.logical_not(np.isnan(md.stressbalance.spcvx)), np.logical_not(np.isnan(md.stressbalance.spcvy)))): 136 143 print("\n !!! Warning: no spc applied, model might not be well posed if no basal friction is applied, check for solution crash\n") 137 # CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES144 # CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES 138 145 # if any(sum(isnan(md.stressbalance.referential), 2)~=0 & sum(isnan(md.stressbalance.referential), 2)~=6), 139 146 if np.any(np.logical_and(np.sum(np.isnan(md.stressbalance.referential), axis=1) != 0, np.sum(np.isnan(md.stressbalance.referential), axis=1) != 6)): 140 147 md.checkmessage("Each line of stressbalance.referential should contain either only NaN values or no NaN values") 141 # CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL148 # CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL 142 149 # if any(sum(isnan(md.stressbalance.referential), 2) == 0), 143 150 if np.any(np.sum(np.isnan(md.stressbalance.referential), axis=1) == 0): … … 149 156 if np.abs(np.inner(item[0:2], item[3:5])) > sys.float_info.epsilon: 150 157 md.checkmessage("Vectors in stressbalance.referential (columns 1 to 3 and 4 to 6) must be orthogonal") 151 # CHECK THAT NO rotation specified for FS Grounded ice at base158 # CHECK THAT NO rotation specified for FS Grounded ice at base 152 159 if m.strcmp(md.mesh.domaintype(), '3D') and md.flowequation.isFS: 153 160 pos = np.nonzero(np.logical_and(md.mask.ocean_levelset, md.mesh.vertexonbase)) -
TabularUnified issm/trunk-jpl/src/m/classes/surfaceload.m ¶
r26059 r26358 65 65 end % }}} 66 66 function marshall(self,prefix,md,fid) % {{{ 67 67 68 68 %deal with ice thickness change: {{{ 69 69 if isempty(self.icethicknesschange), 70 70 self.icethicknesschange=zeros(md.mesh.numberofelements+1,1); 71 71 end 72 72 73 73 yts=md.constants.yts; 74 74 -
TabularUnified issm/trunk-jpl/src/m/classes/surfaceload.py ¶
r26317 r26358 51 51 52 52 def marshall(self, prefix, md, fid): #{{{ 53 if np.isnan(self.icethicknesschange).all(): 54 self.icethicknesschange = np.zeros((md.mesh.numberofelements + 1)) 55 if np.isnan(self.waterheightchange).all(): 56 self.waterheightchange = np.zeros((md.mesh.numberofelements + 1)) 57 if np.isnan(self.other).all(): 58 self.other = np.zeros((md.mesh.numberofelements + 1)) 59 WriteData(fid, prefix, 'object', self, 'fieldname', 'icethicknesschange', 'name', 'md.solidearth.surfaceload.icethicknesschange', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts) 60 WriteData(fid, prefix, 'object', self, 'fieldname', 'waterheightchange', 'name', 'md.solidearth.surfaceload.waterheightchange', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts) 61 WriteData(fid, prefix, 'object', self, 'fieldname', 'other', 'name', 'md.solidearth.surfaceload.other', 'format', 'DoubleMat', 'mattype', 2, 'timeserieslength', md.mesh.numberofelements + 1, 'yts', md.constants.yts) 53 # TODO 54 # - When surfaceload class is used eventually, check premarshall 55 # modifications against those done in MATLAB 56 # 57 58 # Deal with ice thickness change 59 if np.isempty(self.icethicknesschange): 60 self.icethicknesschange = np.zeros((md.mesh.numberofelements + 1, )) 61 62 yts = md.constants.yts 63 64 WriteData(fid, prefix, 'object', self, 'fieldname', 'icethicknesschange', 'name', 'md.solidearth.surfaceload.icethicknesschange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts) 65 66 # Deal with ice thickness change 67 if np.isempty(self.waterheightchange): 68 self.waterheightchange = np.zeros((md.mesh.numberofelements + 1, )) 69 70 WriteData(fid, prefix, 'object', self, 'fieldname', 'waterheightchange', 'name', 'md.solidearth.surfaceload.waterheightchange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts) 71 72 # Deal with ice thickness change 73 if np.isempty(self.otherchange): 74 self.otherchange = np.zeros((md.mesh.numberofelements + 1, )) 75 76 WriteData(fid, prefix, 'object', self, 'fieldname', 'otherchange', 'name', 'md.solidearth.surfaceload.otherchange', 'format', 'MatArray', 'timeserieslength', md.mesh.numberofelements + 1, 'yts', yts, 'scale', 1 / yts) 62 77 #}}} 63 78 -
TabularUnified issm/trunk-jpl/src/m/classes/transient.m ¶
r26059 r26358 34 34 35 35 %full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now 36 self.issmb = 0;37 self.ismasstransport = 0;38 self.isoceantransport = 0;39 self.isstressbalance = 0;40 self.isthermal = 0;41 self.isgroundingline = 0;42 self.isesa = 0;36 self.issmb = 0; 37 self.ismasstransport = 0; 38 self.isoceantransport = 0; 39 self.isstressbalance = 0; 40 self.isthermal = 0; 41 self.isgroundingline = 0; 42 self.isesa = 0; 43 43 self.isdamageevolution = 0; 44 self.ismovingfront =0;45 self.ishydrology = 0;46 self.issampling = 0;47 self.isslc = 0;48 self.isoceancoupling = 0;49 self.amr_frequency 44 self.ismovingfront = 0; 45 self.ishydrology = 0; 46 self.issampling = 0; 47 self.isslc = 0; 48 self.isoceancoupling = 0; 49 self.amr_frequency = 0; 50 50 51 51 %default output … … 55 55 56 56 %full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now 57 self.issmb = 1;58 self.ismasstransport = 1;59 self.isoceantransport = 0;60 self.isstressbalance = 1;61 self.isthermal = 1;62 self.isgroundingline = 0;63 self.isesa = 0;57 self.issmb = 1; 58 self.ismasstransport = 1; 59 self.isoceantransport = 0; 60 self.isstressbalance = 1; 61 self.isthermal = 1; 62 self.isgroundingline = 0; 63 self.isesa = 0; 64 64 self.isdamageevolution = 0; 65 self.ismovingfront = 0;66 self.ishydrology = 0;67 self.issampling = 0;68 self.isslc = 0;69 self.isoceancoupling = 0;70 self.amr_frequency 65 self.ismovingfront = 0; 66 self.ishydrology = 0; 67 self.issampling = 0; 68 self.isslc = 0; 69 self.isoceancoupling = 0; 70 self.amr_frequency = 0; 71 71 72 72 %default output -
TabularUnified issm/trunk-jpl/src/m/classes/transient.py ¶
r26064 r26358 29 29 30 30 self.setdefaultparameters() 31 # }}}31 # }}} 32 32 33 33 def __repr__(self): # {{{ … … 49 49 s += '{}\n'.format(fielddisplay(self, 'requested_outputs', 'list of additional outputs requested')) 50 50 return s 51 # }}}51 # }}} 52 52 53 53 def defaultoutputs(self, md): # {{{ … … 56 56 else: 57 57 return [] 58 # }}}58 # }}} 59 59 60 60 def deactivateall(self): #{{{ … … 77 77 self.requested_outputs = [] 78 78 return self 79 # }}}79 # }}} 80 80 81 81 def setdefaultparameters(self): # {{{ 82 #full analysis: Stressbalance, Masstransport and Thermal but no groundingline migration for now 82 # Full analysis: Stressbalance, Masstransport and Thermal but no 83 # groundingline migration for now 83 84 self.issmb = 1 84 85 self.ismasstransport = 1 … … 99 100 self.requested_outputs = ['default'] 100 101 return self 101 # }}}102 # }}} 102 103 103 104 def checkconsistency(self, md, solution, analyses): # {{{ -
TabularUnified issm/trunk-jpl/src/m/classes/verbose.py ¶
r24240 r26358 4 4 5 5 class verbose(object): 6 """ 7 VERBOSE class definition 6 """VERBOSE class definition 8 7 9 10 11 12 13 14 15 16 17 18 8 Available verbosity levels: 9 mprocessor : model processing 10 module : modules 11 solution : solution sequence 12 solver : solver info (extensive) 13 convergence : convergence criteria 14 control : control method 15 qmu : sensitivity analysis 16 autodiff : AD analysis 17 smb : SMB analysis 19 18 20 21 22 23 24 19 Usage: 20 verbose = verbose() 21 verbose = verbose(3) 22 verbose = verbose('001100') 23 verbose = verbose('module', True, 'solver', False) 25 24 26 WARNING: some parts of this file are Synchronized with src/c/shared/Numerics/Verbosity.h 27 Do not modify these sections. See src/c/shared/Numerics/README for more info 25 NOTE: 26 - Some parts of this file are Synchronized with 27 src/c/shared/Numerics/Verbosity.h. Do not modify these sections. See 28 src/c/shared/Numerics/README for more info. 28 29 """ 29 30 … … 42 43 43 44 if not len(args): 44 # Don't do anything45 # Don't do anything 45 46 self.solution = True 46 47 self.qmu = True … … 52 53 if isinstance(binary, str): 53 54 if binary.lower() == 'all': 54 binary = 2**11 - 1 #all ones55 binary = pow(2, 11) - 1 # all ones 55 56 self.BinaryToVerbose(binary) 56 self.solver = False # Do not use by default57 self.solver = False # Do not use by default 57 58 else: 58 59 binary = int(binary, 2) … … 62 63 63 64 else: 64 # Use options to initialize object65 # Use options to initialize object 65 66 self = pairoptions(*args).AssignObjectFields(self) 66 67 67 # Cast to logicals68 # Cast to logicals 68 69 listproperties = vars(self) 69 70 for fieldname, fieldvalue in list(listproperties.items()): -
TabularUnified issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.py ¶
r26318 r26358 6 6 """ 7 7 8 # initialize consistency as true8 # Initialize consistency as true 9 9 md.private.isconsistent = True 10 10 … … 12 12 # exit() 13 13 14 # Get solution and associated analyses14 # Get solution and associated analyses 15 15 solution = md.private.solution 16 16 analyses = AnalysisConfiguration(solution) 17 # Go through a model fields, check that it is a class, and call checkconsistency17 # Go through a model fields, check that it is a class, and call checkconsistency 18 18 #fields = vars(md) 19 19 #for field in fields.iterkeys(): 20 20 for field in md.properties(): 21 # Some properties do not need to be checked21 # Some properties do not need to be checked 22 22 if field in ['results', 'debug', 'radaroverlay']: 23 23 continue 24 24 25 # Check that current field is an object25 # Check that current field is an object 26 26 if not hasattr(getattr(md, field), 'checkconsistency'): 27 27 md.checkmessage('field {} is not an object.'.format(field)) 28 28 29 # Check consistency of the object30 exec( "md.{}.checkconsistency(md, '{}', {})".format(field, solution, analyses))29 # Check consistency of the object 30 exec('md.{}.checkconsistency(md, \'{}\', {})'.format(field, solution, analyses)) 31 31 32 # error message if mode is not consistent32 # Error message if mode is not consistent 33 33 if not md.private.isconsistent: 34 34 raise RuntimeError('Model not consistent, see messages above.') 35 # }}}35 # }}} 36 36 37 37 38 38 def AnalysisConfiguration(solutiontype): #{{{ 39 ''' 40 ANALYSISCONFIGURATION - return type of analyses, number of analyses 39 """ANALYSISCONFIGURATION - return type of analyses, number of analyses 41 40 42 43 44 '''41 Usage: 42 [analyses] = AnalysisConfiguration(solutiontype) 43 """ 45 44 46 45 if solutiontype == 'StressbalanceSolution': … … 86 85 87 86 return analyses 88 # }}}87 # }}} -
TabularUnified issm/trunk-jpl/src/m/coordsystems/ll2xy.py ¶
r24254 r26358 3 3 4 4 def ll2xy(lat, lon, sgn=-1, central_meridian=0, standard_parallel=71): 5 ''' 6 LL2XY - converts lat lon to polar stereographic 5 """LL2XY - converts lat lon to polar stereographic 7 6 8 Converts from geodetic latitude and longitude to Polar9 Stereographic (X, Y) coordinates for the polar regions.10 Author: Michael P. Schodlok, December 2003 (map2ll)7 Converts from geodetic latitude and longitude to Polar 8 Stereographic (X, Y) coordinates for the polar regions. 9 Author: Michael P. Schodlok, December 2003 (map2ll) 11 10 12 Usage:13 x, y = ll2xy(lat, lon, sgn)14 x, y = ll2xy(lat, lon, sgn, central_meridian, standard_parallel)11 Usage: 12 x, y = ll2xy(lat, lon, sgn) 13 x, y = ll2xy(lat, lon, sgn, central_meridian, standard_parallel) 15 14 16 - sgn = Sign of latitude 1 : north latitude (default is mer = 45 lat = 70)17 -1 : south latitude (default is mer = 0 lat = 71)18 '''15 - sgn = Sign of latitude 1 : north latitude (default is mer = 45 lat = 70) 16 -1 : south latitude (default is mer = 0 lat = 71) 17 """ 19 18 20 19 assert sgn == 1 or sgn == -1, 'error: sgn should be either 1 or -1' … … 33 32 #cde = 57.29577951 34 33 # Radius of the earth in meters 35 re = 6378.273 * 10**334 re = 6378.273 * pow(10, 3) 36 35 # Eccentricity of the Hughes ellipsoid squared 37 ex2 = .00669388336 ex2 = 0.006693883 38 37 # Eccentricity of the Hughes ellipsoid 39 38 ex = np.sqrt(ex2) -
TabularUnified issm/trunk-jpl/src/m/coordsystems/xy2ll.py ¶
r24254 r26358 4 4 5 5 def xy2ll(x, y, sgn, *args): 6 ''' 7 XY2LL - converts xy to lat long 6 """XY2LL - converts xy to lat long 8 7 9 8 Converts Polar Stereographic (X, Y) coordinates for the polar regions to … … 13 12 14 13 Usage: 15 [lat, lon] = xy2ll(x, y, sgn)16 [lat, lon] = xy2ll(x, y, sgn, central_meridian, standard_parallel)14 [lat, lon] = xy2ll(x, y, sgn) 15 [lat, lon] = xy2ll(x, y, sgn, central_meridian, standard_parallel) 17 16 18 19 20 '''17 - sgn = Sign of latitude 1 : north latitude (default is mer = 45 lat = 70) 18 -1 : south latitude (default is mer = 0 lat = 71) 19 """ 21 20 22 # Get central_meridian and standard_parallel depending on hemisphere21 # Get central_meridian and standard_parallel depending on hemisphere 23 22 if len(args) == 2: 24 23 delta = args[0] … … 47 46 #cde = 57.29577951 48 47 # Radius of the earth in meters 49 re = 6378.273 * 10**348 re = 6378.273 * pow(10, 3) 50 49 # Eccentricity of the Hughes ellipsoid squared 51 ex2 = .00669388350 ex2 = 0.006693883 52 51 # Eccentricity of the Hughes ellipsoid 53 52 ex = np.sqrt(ex2) 54 53 55 sl = slat * pi / 180. 54 sl = slat * pi / 180.0 56 55 rho = np.sqrt(x**2 + y**2) 57 56 cm = np.cos(sl) / np.sqrt(1.0 - ex2 * (np.sin(sl)**2)) -
TabularUnified issm/trunk-jpl/src/m/materials/cuffey.py ¶
r24260 r26358 3 3 4 4 def cuffey(temperature): 5 """ 6 CUFFEY - calculates ice rigidity as a function of temperature 5 """CUFFEY - calculates ice rigidity as a function of temperature 7 6 8 rigidity (in s^(1 / 3)Pa) is the flow law parameter in the flow law sigma = B * e(1 / 3) 9 (Cuffey and Paterson, p75). 10 temperature is in Kelvin degrees 7 rigidity (in s^(1/3)Pa) is the flow law parameter in the flow law 8 sigma = B * e(1/3) (Cuffey and Paterson, p75). 11 9 12 Usage: 13 rigidity = cuffey(temperature) 10 temperature is in Kelvin degrees 11 12 Usage: 13 rigidity = cuffey(temperature) 14 14 """ 15 15 16 if np.any(temperature < 0. ):17 raise RuntimeError( "input temperature should be in Kelvin (positive)")16 if np.any(temperature < 0.0): 17 raise RuntimeError('input temperature should be in Kelvin (positive)') 18 18 19 19 if np.ndim(temperature) == 2: … … 28 28 pos = np.nonzero(T <= -45) 29 29 if len(pos): 30 rigidity[pos] = 10**8* (-0.000396645116301 * (T[pos] + 50)**3 + 0.013345579471334 * (T[pos] + 50)**2 - 0.356868703259105 * (T[pos] + 50) + 7.272363035371383)30 rigidity[pos] = pow(10, 8) * (-0.000396645116301 * (T[pos] + 50)**3 + 0.013345579471334 * (T[pos] + 50)**2 - 0.356868703259105 * (T[pos] + 50) + 7.272363035371383) 31 31 pos = np.nonzero(np.logical_and(-45 <= T, T < -40)) 32 32 if len(pos): 33 rigidity[pos] = 10**8* (-0.000396645116301 * (T[pos] + 45)**3 + 0.007395902726819 * (T[pos] + 45)**2 - 0.253161292268336 * (T[pos] + 45) + 5.772078366321591)33 rigidity[pos] = pow(10, 8) * (-0.000396645116301 * (T[pos] + 45)**3 + 0.007395902726819 * (T[pos] + 45)**2 - 0.253161292268336 * (T[pos] + 45) + 5.772078366321591) 34 34 pos = np.nonzero(np.logical_and(-40 <= T, T < -35)) 35 35 if len(pos): 36 rigidity[pos] = 10**8* (0.000408322072669 * (T[pos] + 40)**3 + 0.001446225982305 * (T[pos] + 40)**2 - 0.208950648722716 * (T[pos] + 40) + 4.641588833612773)36 rigidity[pos] = pow(10, 8) * (0.000408322072669 * (T[pos] + 40)**3 + 0.001446225982305 * (T[pos] + 40)**2 - 0.208950648722716 * (T[pos] + 40) + 4.641588833612773) 37 37 pos = np.nonzero(np.logical_and(-35 <= T, T < -30)) 38 38 if len(pos): 39 rigidity[pos] = 10**8* (-0.000423888728124 * (T[pos] + 35)**3 + 0.007571057072334 * (T[pos] + 35)**2 - 0.163864233449525 * (T[pos] + 35) + 3.684031498640382)39 rigidity[pos] = pow(10, 8) * (-0.000423888728124 * (T[pos] + 35)**3 + 0.007571057072334 * (T[pos] + 35)**2 - 0.163864233449525 * (T[pos] + 35) + 3.684031498640382) 40 40 pos = np.nonzero(np.logical_and(-30 <= T, T < -25)) 41 41 if len(pos): 42 rigidity[pos] = 10**8* (0.000147154327025 * (T[pos] + 30)**3 + 0.001212726150476 * (T[pos] + 30)**2 - 0.119945317335478 * (T[pos] + 30) + 3.001000667185614)42 rigidity[pos] = pow(10, 8) * (0.000147154327025 * (T[pos] + 30)**3 + 0.001212726150476 * (T[pos] + 30)**2 - 0.119945317335478 * (T[pos] + 30) + 3.001000667185614) 43 43 pos = np.nonzero(np.logical_and(-25 <= T, T < -20)) 44 44 if len(pos): 45 rigidity[pos] = 10**8* (-0.000193435838672 * (T[pos] + 25)**3 + 0.003420041055847 * (T[pos] + 25)**2 - 0.096781481303861 * (T[pos] + 25) + 2.449986525148220)45 rigidity[pos] = pow(10, 8) * (-0.000193435838672 * (T[pos] + 25)**3 + 0.003420041055847 * (T[pos] + 25)**2 - 0.096781481303861 * (T[pos] + 25) + 2.449986525148220) 46 46 pos = np.nonzero(np.logical_and(-20 <= T, T < -15)) 47 47 if len(pos): 48 rigidity[pos] = 10**8* (0.000219771255067 * (T[pos] + 20)**3 + 0.000518503475772 * (T[pos] + 20)**2 - 0.077088758645767 * (T[pos] + 20) + 2.027400665191131)48 rigidity[pos] = pow(10, 8) * (0.000219771255067 * (T[pos] + 20)**3 + 0.000518503475772 * (T[pos] + 20)**2 - 0.077088758645767 * (T[pos] + 20) + 2.027400665191131) 49 49 pos = np.nonzero(np.logical_and(-15 <= T, T < -10)) 50 50 if len(pos): 51 rigidity[pos] = 10**8* (-0.000653438900191 * (T[pos] + 15)**3 + 0.003815072301777 * (T[pos] + 15)**2 - 0.055420879758021 * (T[pos] + 15) + 1.682390865739973)51 rigidity[pos] = pow(10, 8) * (-0.000653438900191 * (T[pos] + 15)**3 + 0.003815072301777 * (T[pos] + 15)**2 - 0.055420879758021 * (T[pos] + 15) + 1.682390865739973) 52 52 pos = np.nonzero(np.logical_and(-10 <= T, T < -5)) 53 53 if len(pos): 54 rigidity[pos] = 10**8* (0.000692439419762 * (T[pos] + 10)**3 - 0.005986511201093 * (T[pos] + 10)**2 - 0.066278074254598 * (T[pos] + 10) + 1.418983411970382)54 rigidity[pos] = pow(10, 8) * (0.000692439419762 * (T[pos] + 10)**3 - 0.005986511201093 * (T[pos] + 10)**2 - 0.066278074254598 * (T[pos] + 10) + 1.418983411970382) 55 55 pos = np.nonzero(np.logical_and(-5 <= T, T < -2)) 56 56 if len(pos): 57 rigidity[pos] = 10**8* (-0.000132282004110 * (T[pos] + 5)**3 + 0.004400080095332 * (T[pos] + 5)**2 - 0.074210229783403 * (T[pos] + 5) + 1.024485188140279)57 rigidity[pos] = pow(10, 8) * (-0.000132282004110 * (T[pos] + 5)**3 + 0.004400080095332 * (T[pos] + 5)**2 - 0.074210229783403 * (T[pos] + 5) + 1.024485188140279) 58 58 pos = np.nonzero(-2 <= T) 59 59 if len(pos): 60 rigidity[pos] = 10**8* (-0.000132282004110 * (T[pos] + 2)**3 + 0.003209542058346 * (T[pos] + 2)**2 - 0.051381363322371 * (T[pos] + 2) + 0.837883605537096)60 rigidity[pos] = pow(10, 8) * (-0.000132282004110 * (T[pos] + 2)**3 + 0.003209542058346 * (T[pos] + 2)**2 - 0.051381363322371 * (T[pos] + 2) + 0.837883605537096) 61 61 62 # Now make sure that rigidity is positive62 # Now make sure that rigidity is positive 63 63 pos = np.nonzero(rigidity < 0) 64 rigidity[pos] = 1**664 rigidity[pos] = pow(1, 6) 65 65 66 66 return rigidity -
TabularUnified issm/trunk-jpl/src/m/materials/paterson.py ¶
r24261 r26358 3 3 4 4 def paterson(temperature): 5 """ 6 PATERSON - figure out the rigidity of ice for a given temperature 5 """PATERSON - figure out the rigidity of ice for a given temperature 7 6 8 rigidity (in s^(1 / 3)Pa) is the flow law paramter in the flow law sigma = B * e(1 / 3) (Paterson, p97).9 temperature is in Kelvin degrees7 rigidity (in s^(1/3)Pa) is the flow law paramter in the flow law 8 sigma = B * e(1/3) (Paterson, p97). 10 9 11 Usage: 12 rigidity = paterson(temperature) 10 temperature is in Kelvin degrees 11 12 Usage: 13 rigidity = paterson(temperature) 13 14 """ 14 15 15 if np.any(temperature < 0. ):16 raise RuntimeError( "input temperature should be in Kelvin (positive)")16 if np.any(temperature < 0.0): 17 raise RuntimeError('input temperature should be in Kelvin (positive)') 17 18 18 19 if np.ndim(temperature) == 2: … … 24 25 T = temperature - 273.15 25 26 26 # The routine below is equivalent to:27 # The routine below is equivalent to: 27 28 28 29 # n = 3; T = temperature-273 … … 40 41 pos1 = np.nonzero(T <= -45)[0] 41 42 if len(pos1): 42 rigidity[pos1] = 10**8* (-0.000292866376675 * (T[pos1] + 50)**3 + 0.011672640664130 * (T[pos1] + 50)**2 - 0.325004442485481 * (T[pos1] + 50) + 6.524779401948101)43 rigidity[pos1] = pow(10, 8) * (-0.000292866376675 * (T[pos1] + 50)**3 + 0.011672640664130 * (T[pos1] + 50)**2 - 0.325004442485481 * (T[pos1] + 50) + 6.524779401948101) 43 44 pos2 = np.nonzero(np.logical_and(-45 <= T, T < -40))[0] 44 45 if len(pos2): 45 rigidity[pos2] = 10**8* (-0.000292866376675 * (T[pos2] + 45)**3 + 0.007279645014004 * (T[pos2] + 45)**2 - 0.230243014094813 * (T[pos2] + 45) + 5.154964909039554)46 rigidity[pos2] = pow(10, 8) * (-0.000292866376675 * (T[pos2] + 45)**3 + 0.007279645014004 * (T[pos2] + 45)**2 - 0.230243014094813 * (T[pos2] + 45) + 5.154964909039554) 46 47 pos3 = np.nonzero(np.logical_and(-40 <= T, T < -35))[0] 47 48 if len(pos3): 48 rigidity[pos3] = 10**8* (0.000072737147457 * (T[pos3] + 40)**3 + 0.002886649363879 * (T[pos3] + 40)**2 - 0.179411542205399 * (T[pos3] + 40) + 4.149132666831214)49 rigidity[pos3] = pow(10, 8) * (0.000072737147457 * (T[pos3] + 40)**3 + 0.002886649363879 * (T[pos3] + 40)**2 - 0.179411542205399 * (T[pos3] + 40) + 4.149132666831214) 49 50 pos4 = np.nonzero(np.logical_and(-35 <= T, T < -30))[0] 50 51 if len(pos4): 51 rigidity[pos4] = 10**8* (-0.000086144770023 * (T[pos4] + 35)**3 + 0.003977706575736 * (T[pos4] + 35)**2 - 0.145089762507325 * (T[pos4] + 35) + 3.333333333333331)52 rigidity[pos4] = pow(10, 8) * (-0.000086144770023 * (T[pos4] + 35)**3 + 0.003977706575736 * (T[pos4] + 35)**2 - 0.145089762507325 * (T[pos4] + 35) + 3.333333333333331) 52 53 pos5 = np.nonzero(np.logical_and(-30 <= T, T < -25))[0] 53 54 if len(pos5): 54 rigidity[pos5] = 10**8* (-0.000043984685769 * (T[pos5] + 30)**3 + 0.002685535025386 * (T[pos5] + 30)**2 - 0.111773554501713 * (T[pos5] + 30) + 2.696559088937191)55 rigidity[pos5] = pow(10, 8) * (-0.000043984685769 * (T[pos5] + 30)**3 + 0.002685535025386 * (T[pos5] + 30)**2 - 0.111773554501713 * (T[pos5] + 30) + 2.696559088937191) 55 56 pos6 = np.nonzero(np.logical_and(-25 <= T, T < -20))[0] 56 57 if len(pos6): 57 rigidity[pos6] = 10**8* (-0.000029799523463 * (T[pos6] + 25)**3 + 0.002025764738854 * (T[pos6] + 25)**2 - 0.088217055680511 * (T[pos6] + 25) + 2.199331606342181)58 rigidity[pos6] = pow(10, 8) * (-0.000029799523463 * (T[pos6] + 25)**3 + 0.002025764738854 * (T[pos6] + 25)**2 - 0.088217055680511 * (T[pos6] + 25) + 2.199331606342181) 58 59 pos7 = np.nonzero(np.logical_and(-20 <= T, T < -15))[0] 59 60 if len(pos7): 60 rigidity[pos7] = 10**8* (0.000136920904777 * (T[pos7] + 20)**3 + 0.001578771886910 * (T[pos7] + 20)**2 - 0.070194372551690 * (T[pos7] + 20) + 1.805165505978111)61 rigidity[pos7] = pow(10, 8) * (0.000136920904777 * (T[pos7] + 20)**3 + 0.001578771886910 * (T[pos7] + 20)**2 - 0.070194372551690 * (T[pos7] + 20) + 1.805165505978111) 61 62 pos8 = np.nonzero(np.logical_and(-15 <= T, T < -10))[0] 62 63 if len(pos8): 63 rigidity[pos8] = 10**8* (-0.000899763781026 * (T[pos8] + 15)**3 + 0.003632585458564 * (T[pos8] + 15)**2 - 0.044137585824322 * (T[pos8] + 15) + 1.510778053489523)64 rigidity[pos8] = pow(10, 8) * (-0.000899763781026 * (T[pos8] + 15)**3 + 0.003632585458564 * (T[pos8] + 15)**2 - 0.044137585824322 * (T[pos8] + 15) + 1.510778053489523) 64 65 pos9 = np.nonzero(np.logical_and(-10 <= T, T < -5))[0] 65 66 if len(pos9): 66 rigidity[pos9] = 10**8* (0.001676964325070 * (T[pos9] + 10)**3 - 0.009863871256831 * (T[pos9] + 10)**2 - 0.075294014815659 * (T[pos9] + 10) + 1.268434288203714)67 rigidity[pos9] = pow(10, 8) * (0.001676964325070 * (T[pos9] + 10)**3 - 0.009863871256831 * (T[pos9] + 10)**2 - 0.075294014815659 * (T[pos9] + 10) + 1.268434288203714) 67 68 pos10 = np.nonzero(np.logical_and(-5 <= T, T < -2))[0] 68 69 if len(pos10): 69 rigidity[pos10] = 10**8* (-0.003748937622487 * (T[pos10] + 5)**3 + 0.015290593619213 * (T[pos10] + 5)**2 - 0.048160403003748 * (T[pos10] + 5) + 0.854987973338348)70 rigidity[pos10] = pow(10, 8) * (-0.003748937622487 * (T[pos10] + 5)**3 + 0.015290593619213 * (T[pos10] + 5)**2 - 0.048160403003748 * (T[pos10] + 5) + 0.854987973338348) 70 71 pos11 = np.nonzero(-2 <= T)[0] 71 72 if len(pos11): 72 rigidity[pos11] = 10**8* (-0.003748937622488 * (T[pos11] + 2)**3 - 0.018449844983174 * (T[pos11] + 2)**2 - 0.057638157095631 * (T[pos11] + 2) + 0.746900791092860)73 rigidity[pos11] = pow(10, 8) * (-0.003748937622488 * (T[pos11] + 2)**3 - 0.018449844983174 * (T[pos11] + 2)**2 - 0.057638157095631 * (T[pos11] + 2) + 0.746900791092860) 73 74 74 75 #Now make sure that rigidity is positive 75 76 pos = np.nonzero(rigidity < 0)[0] 76 77 if len(pos): 77 rigidity[pos] = 1. e678 rigidity[pos] = 1.0e6 78 79 79 80 return rigidity -
TabularUnified issm/trunk-jpl/src/m/mech/mechanicalproperties.m ¶
r22997 r26358 1 1 function md=mechanicalproperties(md,vx,vy,varargin) 2 %MECHANICALPROPERTIES - compute stress and strain rate for a g oven velocity2 %MECHANICALPROPERTIES - compute stress and strain rate for a given velocity 3 3 % 4 4 % this routine computes the components of the (deviatoric) stress tensor, -
TabularUnified issm/trunk-jpl/src/m/mech/mechanicalproperties.py ¶
r24254 r26358 5 5 6 6 def mechanicalproperties(md, vx, vy, **kwargs): 7 """ 8 MECHANICALPROPERTIES - compute stress and strain rate for a govenvelocity7 """MECHANICALPROPERTIES - compute stress and strain rate for a given 8 velocity 9 9 10 this routine computes the components of the stress tensor11 strain rate tensor and their respective principal directions.12 the results are in themodel md: md.results10 This routine computes the components of the stress tensor strain rate 11 tensor and their respective principal directions. The results are in the 12 model md: md.results 13 13 14 Usage:15 md = mechanicalproperties(md, vx, vy)14 Usage: 15 md = mechanicalproperties(md, vx, vy) 16 16 17 Example:18 md = mechanicalproperties(md, md.initialization.vx, md.initialization.vy)19 md = mechanicalproperties(md, md.inversion.vx_obs, md.inversion.vy_obs)17 Example: 18 md = mechanicalproperties(md, md.initialization.vx, md.initialization.vy) 19 md = mechanicalproperties(md, md.inversion.vx_obs, md.inversion.vy_obs) 20 20 """ 21 21 … … 75 75 #some corrections 76 76 location = np.nonzero(np.logical_and(second_inv == 0, power != 0)) 77 nu[location] = 10**18#arbitrary maximum viscosity to apply where there is no effective shear77 nu[location] = pow(10, 18) #arbitrary maximum viscosity to apply where there is no effective shear 78 78 79 79 if 'matice' in md.materials.__module__: … … 83 83 nu[location] = B_bar[location] 84 84 location = np.nonzero(np.logical_and(second_inv == 0, power != 0)) 85 nu[location] = 10**1885 nu[location] = pow(10, 18) 86 86 elif 'matdamageice' in md.materials.__module__ and damage is not None: 87 87 print('computing damage-dependent properties!') -
TabularUnified issm/trunk-jpl/src/m/mesh/bamg.py ¶
r25455 r26358 23 23 Available options (for more details see ISSM website http://issm.jpl.nasa.gov/): 24 24 25 - domain : followed by an ARGUS file that prescribes the domain outline 26 - holes : followed by an ARGUS file that prescribes the holes 27 - subdomains : followed by an ARGUS file that prescribes the list of 28 subdomains (that need to be inside domain) 29 30 - hmin : minimum edge length (default is 1.0e - 100) 31 - hmax : maximum edge length (default is 1.0e100) 32 - hVertices : imposed edge length for each vertex (geometry or mesh) 33 - hminVertices : minimum edge length for each vertex (mesh) 34 - hmaxVertices : maximum edge length for each vertex (mesh) 35 36 - anisomax : maximum ratio between the smallest and largest edges (default is 1.0e30) 37 - coeff : coefficient applied to the metric (2 -> twice as many elements, default is 1) 38 - cutoff : scalar used to compute the metric when metric type 2 or 3 are applied 39 - err : error used to generate the metric from a field 40 - errg : geometric error (default is 0.1) 41 - field : field of the model that will be used to compute the metric 42 to apply several fields, use one column per field 43 - gradation : maximum ratio between two adjacent edges 44 - Hessiantype : 0 -> use double P2 projection (default) 45 1 -> use Green formula 46 - KeepVertices : try to keep initial vertices when adaptation is done on an existing mesh (default 1) 47 - NoBoundaryRefinement: do not refine boundary, only follow contour provided (default 0). Allow subdomain boundary refinement though 48 - NoBoundaryRefinementAllBoundaries: do not refine boundary, only follow contour provided (default 0) 49 - maxnbv : maximum number of vertices used to allocate memory (default is 1.0e6) 50 - maxsubdiv : maximum subdivision of exisiting elements (default is 10) 51 - metric : matrix (numberofnodes x 3) used as a metric 52 - Metrictype : 1 -> absolute error c / (err coeff^2) * Abs(H) (default) 53 2 -> relative error c / (err coeff^2) * Abs(H) / max(s, cutoff * max(s)) 54 3 -> rescaled absolute error c / (err coeff^2) * Abs(H) / (smax - smin) 55 - nbjacoby : correction used by Hessiantype = 1 (default is 1) 56 - nbsmooth : number of metric smoothing procedure (default is 3) 57 - omega : relaxation parameter of the smoothing procedure (default is 1.8) 58 - power : power applied to the metric (default is 1) 59 - splitcorners : split triangles whuch have 3 vertices on the outline (default is 1) 60 - verbose : level of verbosity (default is 1) 61 62 - rifts : followed by an ARGUS file that prescribes the rifts 63 - toltip : tolerance to move tip on an existing point of the domain outline 64 - tracks : followed by an ARGUS file that prescribes the tracks that the mesh will stick to 65 - RequiredVertices : mesh vertices that are required. [x, y, ref]; ref is optional 66 - tol : if the distance between 2 points of the domain outline is less than tol, they 67 will be merged 25 - domain : followed by an ARGUS file that 26 prescribes the domain outline 27 - holes : followed by an ARGUS file that 28 prescribes the holes 29 - subdomains : followed by an ARGUS file that 30 prescribes the list of subdomains 31 (that need to be inside domain) 32 33 - hmin : minimum edge length (default is 34 1.0e-100) 35 - hmax : maximum edge length (default is 36 1.0e100) 37 - hVertices : imposed edge length for each vertex 38 (geometry or mesh) 39 - hminVertices : minimum edge length for each vertex 40 (mesh) 41 - hmaxVertices : maximum edge length for each vertex 42 (mesh) 43 44 - anisomax : maximum ratio between the smallest 45 and largest edges (default is 46 1.0e30) 47 - coeff : coefficient applied to the metric 48 (2 -> twice as many elements, 49 default is 1) 50 - cutoff : scalar used to compute the metric 51 when metric type 2 or 3 are applied 52 - err : error used to generate the metric 53 from a field 54 - errg : geometric error (default is 0.1) 55 - field : field of the model that will be 56 used to compute the metric to apply 57 several fields, use one column per 58 field 59 - gradation : maximum ratio between two adjacent 60 edges 61 - Hessiantype : 0 -> use double P2 projection 62 (default) 63 1 -> use Green formula 64 - KeepVertices : try to keep initial vertices when 65 adaptation is done on an existing 66 mesh (default 1) 67 - NoBoundaryRefinement : do not refine boundary, only follow 68 contour provided (default 0). Allow 69 subdomain boundary refinement 70 though 71 - NoBoundaryRefinementAllBoundaries : do not refine boundary, only follow 72 contour provided (default 0) 73 - maxnbv : maximum number of vertices used to 74 allocate memory (default is 1.0e6) 75 - maxsubdiv : maximum subdivision of exisiting 76 elements (default is 10) 77 - metric : matrix (numberofnodes x 3) used as 78 a metric 79 - Metrictype : 1 -> absolute error 80 c/(err coeff^2) * Abs(H) (default) 81 2 -> relative error 82 c / (err coeff^2) * Abs(H) / 83 max(s, cutoff * max(s)) 84 3 -> rescaled absolute error 85 c / (err coeff^2) * Abs(H) / 86 (smax - smin) 87 - nbjacoby : correction used by Hessiantype = 1 88 (default is 1) 89 - nbsmooth : number of metric smoothing 90 procedure (default is 3) 91 - omega : relaxation parameter of the 92 smoothing procedure (default is 93 1.8) 94 - power : power applied to the metric 95 (default is 1) 96 - splitcorners : split triangles which have 3 97 vertices on the outline (default is 98 1) 99 - verbose : level of verbosity (default is 1) 100 101 - rifts : followed by an ARGUS file that 102 prescribes the rifts 103 - toltip : tolerance to move tip on an 104 existing point of the domain 105 outline 106 - tracks : followed by an ARGUS file that 107 prescribes the tracks that the mesh 108 will stick to 109 - RequiredVertices : mesh vertices that are required. 110 [x, y, ref]; ref is optional 111 - tol : if the distance between 2 points of 112 the domain outline is less than 113 tol, they will be merged 68 114 69 115 Examples: … … 76 122 """ 77 123 78 # process options124 # Process options 79 125 options = pairoptions(*args) 80 126 #options = deleteduplicates(options, 1) 81 127 82 # initialize the structures required as input of Bamg128 # Initialize the structures required as input of Bamg 83 129 bamg_options = OrderedDict() 84 130 bamg_geometry = bamggeom() … … 138 184 holes = holesfile 139 185 else: 140 raise Exception( "bamg error message: if 'holes' is a list, its elements must be of type dict or OrderedDict")186 raise Exception('bamg error message: if \'holes\' is a list, its elements must be of type dict or OrderedDict') 141 187 else: 142 188 holes = holesfile … … 144 190 holes = [holesfile] 145 191 else: 146 raise Exception( "'holes' type {} not supported yet".format(type(holesfile)))192 raise Exception('\'holes\' type {} not supported yet'.format(type(holesfile))) 147 193 148 194 subdomains = [] … … 151 197 if type(subdomainsfile) == str: 152 198 if not os.path.exists(subdomainsfile): 153 raise IOError( "bamg error message: file {} not found".format(subdomainsfile))199 raise IOError('bamg error message: file {} not found'.format(subdomainsfile)) 154 200 155 201 # Read subdomains accoridng to its extension … … 166 212 subdomains = subdomainsfile 167 213 else: 168 raise Exception( "bamg error message: if 'subdomains' is a list, its elements must be of type dict or OrderedDict")214 raise Exception('bamg error message: if \'subdomains\' is a list, its elements must be of type dict or OrderedDict') 169 215 else: 170 216 subdomains = subdomainsfile … … 172 218 subdomains = [subdomainsfile] 173 219 else: 174 raise Exception( "'subdomains' type {} not supported yet".format(type(subdomainsfile)))220 raise Exception('\'subdomains\' type {} not supported yet'.format(type(subdomainsfile))) 175 221 176 222 # Build geometry … … 179 225 # Check that the domain is closed 180 226 if (domain[i]['x'][0] != domain[i]['x'][-1] or domain[i]['y'][0] != domain[i]['y'][-1]): 181 raise RuntimeError( "bamg error message: all contours provided in ''domain'' should be closed")227 raise RuntimeError('bamg error message: all contours provided in \'domain\' should be closed') 182 228 183 229 # Check that all holes are INSIDE the principle domain outline … … 185 231 flags = ContourToNodes(domain[i]['x'], domain[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]' 186 232 if np.any(np.logical_not(flags)): 187 raise RuntimeError( "bamg error message: All holes should be strictly inside the principal domain")233 raise RuntimeError('bamg error message: All holes should be strictly inside the principal domain') 188 234 189 235 # Check orientation … … 221 267 # heck that the hole is closed 222 268 if (holes[i]['x'][0] != holes[i]['x'][-1] or holes[i]['y'][0] != holes[i]['y'][-1]): 223 raise RuntimeError( "bamg error message: all contours provided in ''hole'' should be closed")269 raise RuntimeError('bamg error message: all contours provided in \'hole\' should be closed') 224 270 225 271 # Check that all holes are INSIDE the principal domain (principal domain should be index 0) 226 272 flags = ContourToNodes(holes[i]['x'], holes[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]' 227 273 if np.any(np.logical_not(flags)): 228 raise RuntimeError( "bamg error message: All holes should be strictly inside the principal domain")274 raise RuntimeError('bamg error message: All holes should be strictly inside the principal domain') 229 275 230 276 # Check that hole is correctly oriented … … 249 295 # Check that the subdomain is closed 250 296 if (subdomains[i]['x'][0] != subdomains[i]['x'][-1] or subdomains[i]['y'][0] != subdomains[i]['y'][-1]): 251 raise RuntimeError( "bamg error message: all contours provided in ''subdomains'' should be closed")297 raise RuntimeError('bamg error message: all contours provided in \'subdomains\' should be closed') 252 298 253 299 # Check that all subdomains are INSIDE the principal domain (principal domain should be index 0) 254 300 flags = ContourToNodes(subdomains[i]['x'], subdomains[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]' 255 301 if np.any(np.logical_not(flags)): 256 raise RuntimeError( "bamg error message: All subdomains should be strictly inside the principal domain")302 raise RuntimeError('bamg error message: All subdomains should be strictly inside the principal domain') 257 303 258 304 # Check that subdomain is correctly oriented … … 277 323 if options.getfieldvalue('vertical', 0): 278 324 if np.size(options.getfieldvalue('Markers', [])) != np.size(bamg_geometry.Edges, 0): 279 raise RuntimeError('for 2d vertical mesh, ''Markers'' option is required, and should be of size ' + str(np.size(bamg_geometry.Edges, 0)))325 raise RuntimeError('for 2d vertical mesh, \'Markers\' option is required, and should be of size {}'.format(str(np.size(bamg_geometry.Edges, 0)))) 280 326 if np.size(options.getfieldvalue('Markers', [])) == np.size(bamg_geometry.Edges, 0): 281 327 bamg_geometry.Edges[:, 2] = options.getfieldvalue('Markers') … … 291 337 rift = shpread(riftfile) 292 338 else: 293 raise IOError( "bamg error message: file '{}' format not supported (.exp or .shp)".format(riftfile))339 raise IOError('bamg error message: file \'{}\' format not supported (.exp or .shp)'.format(riftfile)) 294 340 295 341 for i in range(len(rift)): … … 297 343 flags = ContourToNodes(rift[i]['x'], rift[i]['y'], [domain[0]], 0)[0] # NOTE: Down stack call to FetchPythonData requires contour to be a list of struct if we are not passing in a path to a file, hence the odd addressing: '[domain[0]]' 298 344 if np.all(np.logical_not(flags)): 299 raise RuntimeError( "one rift has all its points outside of the domain outline")345 raise RuntimeError('one rift has all its points outside of the domain outline') 300 346 elif np.any(np.logical_not(flags)): 301 347 # We have LOTS of work to do 302 print( "Rift tip outside of or on the domain has been detected and is being processed...")348 print('Rift tip outside of or on the domain has been detected and is being processed...') 303 349 304 350 # Check that only one point is outside (for now) 305 351 if np.sum(np.logical_not(flags).astype(int)) != 1: 306 raise RuntimeError( "bamg error message: only one point outside of the domain is supported at this time")352 raise RuntimeError('bamg error message: only one point outside of the domain is supported at this time') 307 353 308 354 # Move tip outside to the first position … … 314 360 rift[i]['y'] = np.flipud(rift[i]['y']) 315 361 else: 316 raise RuntimeError( "bamg error message: only a rift tip can be outside of the domain")362 raise RuntimeError('bamg error message: only a rift tip can be outside of the domain') 317 363 318 364 # Get coordinate of intersection point … … 341 387 342 388 if np.min(tipdis) / segdis < options.getfieldvalue('toltip', 0): 343 print( "moving tip-domain intersection point")389 print('moving tip-domain intersection point') 344 390 345 391 # Get position of the closer point … … 370 416 pos = np.nonzero(np.logical_and(bamg_geometry.Edges[:, 0] == i1, bamg_geometry.Edges[:, 1] == i2))[0] 371 417 if not pos: 372 raise RuntimeError( "bamg error message: a problem occurred...")418 raise RuntimeError('bamg error message: a problem occurred...') 373 419 bamg_geometry.Edges = np.vstack(( 374 420 bamg_geometry.Edges[0:pos - 1, :], … … 507 553 # Bamg options {{{ 508 554 bamg_options['Crack'] = options.getfieldvalue('Crack', 0) 509 bamg_options['anisomax'] = options.getfieldvalue('anisomax', 10.**18)510 bamg_options['coeff'] = options.getfieldvalue('coeff', 1. )511 bamg_options['cutoff'] = options.getfieldvalue('cutoff', 10.**-5)555 bamg_options['anisomax'] = options.getfieldvalue('anisomax', pow(10.0, 18)) 556 bamg_options['coeff'] = options.getfieldvalue('coeff', 1.0) 557 bamg_options['cutoff'] = options.getfieldvalue('cutoff', pow(10.0, -5)) 512 558 bamg_options['err'] = options.getfieldvalue('err', np.array([[0.01]])) 513 559 bamg_options['errg'] = options.getfieldvalue('errg', 0.1) … … 515 561 bamg_options['gradation'] = options.getfieldvalue('gradation', 1.5) 516 562 bamg_options['Hessiantype'] = options.getfieldvalue('Hessiantype', 0) 517 bamg_options['hmin'] = options.getfieldvalue('hmin', 10.**-100)518 bamg_options['hmax'] = options.getfieldvalue('hmax', 10.**100)563 bamg_options['hmin'] = options.getfieldvalue('hmin', pow(10.0, -100)) 564 bamg_options['hmax'] = options.getfieldvalue('hmax', pow(10.0, 100)) 519 565 bamg_options['hminVertices'] = options.getfieldvalue('hminVertices', np.empty((0, 1))) 520 566 bamg_options['hmaxVertices'] = options.getfieldvalue('hmaxVertices', np.empty((0, 1))) 521 567 bamg_options['hVertices'] = options.getfieldvalue('hVertices', np.empty((0, 1))) 522 568 bamg_options['KeepVertices'] = options.getfieldvalue('KeepVertices', 1) 523 bamg_options['maxnbv'] = options.getfieldvalue('maxnbv', 10**6)524 bamg_options['maxsubdiv'] = options.getfieldvalue('maxsubdiv', 10. )569 bamg_options['maxnbv'] = options.getfieldvalue('maxnbv', pow(10, 6)) 570 bamg_options['maxsubdiv'] = options.getfieldvalue('maxsubdiv', 10.0) 525 571 bamg_options['metric'] = options.getfieldvalue('metric', np.empty((0, 1))) 526 572 bamg_options['Metrictype'] = options.getfieldvalue('Metrictype', 0) … … 528 574 bamg_options['nbsmooth'] = options.getfieldvalue('nbsmooth', 3) 529 575 bamg_options['omega'] = options.getfieldvalue('omega', 1.8) 530 bamg_options['power'] = options.getfieldvalue('power', 1. )576 bamg_options['power'] = options.getfieldvalue('power', 1.0) 531 577 bamg_options['splitcorners'] = options.getfieldvalue('splitcorners', 1) 532 578 bamg_options['verbose'] = options.getfieldvalue('verbose', 1) … … 595 641 md.mesh.elementconnectivity = md.mesh.elementconnectivity.astype(int) 596 642 597 # Check for orphan643 # Check for orphan 598 644 if np.any(np.logical_not(np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat))): 599 raise RuntimeError( "Output mesh has orphans. Check your Domain and / or RequiredVertices")645 raise RuntimeError('Output mesh has orphans. Check your Domain and/or RequiredVertices') 600 646 601 647 return md … … 603 649 604 650 def processgeometry(geom, tol, outline): # {{{ 605 raise RuntimeError( "bamg.py::processgeometry is not complete.")651 raise RuntimeError('bamg.py::processgeometry is not complete.') 606 652 607 653 # Deal with edges 608 print( "Checking Edge crossing...")654 print('Checking Edge crossing...') 609 655 i = 0 610 656 while (i < np.size(geom.Edges, axis=0)): … … 659 705 660 706 # Check point outside 661 print( "Checking for points outside the domain...")707 print('Checking for points outside the domain...') 662 708 i = 0 663 709 num = 0 … … 687 733 688 734 if num: 689 print(( "WARNING: %d points outside the domain outline have been removed" % num))735 print(('WARNING: {} points outside the domain outline have been removed'.format(num))) 690 736 691 737 """ -
TabularUnified issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.m ¶
r26354 r26358 197 197 mesh.z=radius*sind(mesh.lat); 198 198 199 200 199 %erase files: 201 200 system('rm -rf sphere.geo sphere.msh sphere.pos'); -
TabularUnified issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py ¶
r26354 r26358 82 82 curvename = 'Curve Loop' 83 83 84 fid.write('%s(13) = {2, 8,-10};\n' % curvename)84 fid.write('%s(13) = {2,8,-10};\n' % curvename) 85 85 fid.write('Surface(14) = {13};\n') 86 fid.write('%s(15) = {10, 3,7};\n' % curvename)86 fid.write('%s(15) = {10,3,7};\n' % curvename) 87 87 fid.write('Surface(16) = {15};\n') 88 fid.write('%s(17) = {-8, -9,1};\n' % curvename)88 fid.write('%s(17) = {-8,-9,1};\n' % curvename) 89 89 fid.write('Surface(18) = {17};\n') 90 fid.write('%s(19) = {-11, -2,5};\n' % curvename)90 fid.write('%s(19) = {-11,-2,5};\n' % curvename) 91 91 fid.write('Surface(20) = {19};\n') 92 fid.write('%s(21) = {-5, -12,-1};\n' % curvename)92 fid.write('%s(21) = {-5,-12,-1};\n' % curvename) 93 93 fid.write('Surface(22) = {21};\n') 94 fid.write('%s(23) = {-3, 11,6};\n' % curvename)94 fid.write('%s(23) = {-3,11,6};\n' % curvename) 95 95 fid.write('Surface(24) = {23};\n') 96 fid.write('%s(25) = {-7, 4,9};\n' % curvename)96 fid.write('%s(25) = {-7,4,9};\n' % curvename) 97 97 fid.write('Surface(26) = {25};\n') 98 fid.write('%s(27) = {-4, 12,-6};\n' % curvename)98 fid.write('%s(27) = {-4,12,-6};\n' % curvename) 99 99 fid.write('Surface(28) = {27};\n') 100 fid.write('Surface Loop(29) = {28, 26, 16, 14, 20, 24, 22,18};\n')100 fid.write('Surface Loop(29) = {28,26,16,14,20,24,22,18};\n') 101 101 fid.write('Volume(30) = {29};\n') 102 fid.write('Physical Surface(1) = {28, 26, 16, 14, 20, 24, 22,18};\n')102 fid.write('Physical Surface(1) = {28,26,16,14,20,24,22,18};\n') 103 103 fid.write('Physical Volume(2) = 30;\n') 104 104 fid.close() … … 112 112 fid = open('sphere.pos', 'w') 113 113 114 fid.write('View "background mesh" [;\n')114 fid.write('View "background mesh" {;\n') 115 115 for i in range(meshini.numberofelements): 116 fid.write('ST(%g, %g, %g, %g, %g, %g, %g, %g, %g)[%g, %g, %g];\n',117 118 119 120 121 fid.write(' ];\n')116 fid.write('ST(%g,%g,%g,%g,%g,%g,%g,%g,%g){%g,%g,%g};\n', 117 meshini.x(meshini.elements(i, 0)), meshini.y(meshini.elements(i, 0)), meshini.z(meshini.elements(i, 0)), 118 meshini.x(meshini.elements(i, 1)), meshini.y(meshini.elements(i, 1)), meshini.z(meshini.elements(i, 1)), 119 meshini.x(meshini.elements(i, 2)), meshini.y(meshini.elements(i, 2)), meshini.z(meshini.elements(i, 2)), 120 metric(meshini.elements(i, 0)), metric(meshini.elements(i, 1)), metric(meshini.elements(i, 2))) 121 fid.write('};\n') 122 122 fid.close() 123 123 #}}} … … 182 182 #}}} 183 183 184 #figure out other fields in mesh3dsurface: 185 mesh.r = np.sqrt(mesh.x**2 + mesh.y**2 + mesh.z**2) 186 mesh.lat = np.arcsin(mesh.z / mesh.r) / np.pi * 180 187 mesh.long = np.arctan2(mesh.y, mesh.x) / np.pi * 180 184 # A little technicality here. The mesh is not exactly on the sphere. We 185 # create lat,long coordiantes, and reproject onto an exact sphere. 186 mesh.r = np.sqrt(mesh.x ** 2 + mesh.y ** 2 + mesh.z ** 2) 187 188 # Make sure we don't have south and north pole 189 pos = np.where(np.logical_and.reduce((mesh.x == 0, mesh.y == 0)))[0] 190 mesh.lat = asind(mesh.z / mesh.r) 191 mesh.long = atan2d(mesh.y, mesh.x) 192 pos = np.where(mesh.lat == 90)[0] 193 mesh.lat[pos] = 90 - 0.01 194 pos = np.where(mesh.lat == -90)[0] 195 mesh.lat[pos] = -90 + 0.01 196 197 mesh.r = radius * np.ones((mesh.numberofvertices, )) 198 mesh.x = radius * cosd(mesh.lat) * cosd(mesh.long) 199 mesh.y = radius * cosd(mesh.lat) * sind(mesh.long) 200 mesh.z = radius * sind(mesh.lat) 188 201 189 202 # Erase files -
TabularUnified issm/trunk-jpl/src/m/miscellaneous/MatlabFuncs.py ¶
r26353 r26358 1 """ 2 A collection of functions that replicate the behavior of MATLAB built-in 1 """A collection of functions that replicate the behavior of MATLAB built-in 3 2 functions of the same, respective name. 4 3 … … 8 7 """ 9 8 10 def acosd(X): # {{{11 """ 9 def acosd(X): # {{{ 10 """function acosd - Inverse cosine in degrees 12 11 13 12 Usage: … … 17 16 18 17 return np.degrees(np.arccos(X)) 19 # }}}20 21 def asind(X): # {{{22 """ 18 # }}} 19 20 def asind(X): # {{{ 21 """function asind - Inverse sine in degrees 23 22 24 23 Usage: … … 28 27 29 28 return np.degrees(np.arcsin(X)) 30 # }}}31 32 def atand(X): # {{{33 """ 29 # }}} 30 31 def atand(X): # {{{ 32 """function atand - Inverse tangent in degrees 34 33 35 34 Usage: … … 39 38 40 39 return np.degrees(np.arctan(X)) 41 # }}}42 43 44 def atan2d(Y, X): # {{{40 # }}} 41 42 43 def atan2d(Y, X): # {{{ 45 44 """function atan2d - Four-quadrant inverse tangent in degrees 46 45 … … 51 50 52 51 return np.degrees(np.arctan2(Y, X)) 53 #}}} 54 55 def det(a): #{{{ 52 # }}} 53 54 def cosd(X): # {{{ 55 """function cosd - Cosine of argument in degrees 56 57 Usage: 58 Y = cosd(X) 59 """ 60 import numpy as np 61 62 if type(X) == np.ndarray: 63 Y = np.array([]) 64 for x in X: 65 Y = np.append(Y, cosdsingle(x)) 66 return Y 67 else: 68 return cosdsingle(X) 69 # }}} 70 71 def cosdsingle(x): # {{{ 72 """function cosdsingle - Helper function for cosd to reduce repetition of 73 logic 74 75 Usage: 76 y = cosdsingle(x) 77 """ 78 import numpy as np 79 80 while x >= 360: 81 x = x - 360 82 83 if x == 0: 84 return 1 85 elif x == 90 or x == 270: 86 return 0 87 elif x == 180: 88 return -1 89 else: 90 return np.cos(np.radians(x)) 91 # }}} 92 93 def det(a): # {{{ 56 94 if a.shape == (1, ): 57 95 return a[0] … … 61 99 return a[0, 0] * a[1, 1] - a[0, 1] * a[1, 0] 62 100 else: 63 raise TypeError( "MatlabFunc.det only implemented for shape (2, 2), not for shape %s." % str(a.shape))64 # }}}65 66 def error(msg): # {{{101 raise TypeError('MatlabFunc.det only implemented for shape (2, 2), not for shape {}.'.format(a.shape)) 102 # }}} 103 104 def error(msg): # {{{ 67 105 raise Exception(msg) 68 # }}}69 70 def etime(t2, t1): # {{{106 # }}} 107 108 def etime(t2, t1): # {{{ 71 109 return t2 - t1 72 # }}}73 74 def find(*args): # {{{110 # }}} 111 112 def find(*args): # {{{ 75 113 nargs = len(args) 76 114 if nargs >= 1 or nargs <= 2: … … 86 124 else: 87 125 raise Exception('find: must have 1 or 2 arguments') 88 # }}}89 90 def floor(X): # {{{126 # }}} 127 128 def floor(X): # {{{ 91 129 import math 92 130 93 131 return int(math.floor(X)) 94 # }}}95 96 def heaviside(x): # {{{132 # }}} 133 134 def heaviside(x): # {{{ 97 135 import numpy as np 98 136 … … 102 140 103 141 return y 104 # }}}105 106 def isa(A, dataType): # {{{142 # }}} 143 144 def isa(A, dataType): # {{{ 107 145 """FUNCTION ISA 108 146 … … 112 150 """ 113 151 return type(A) == dataType 114 #}}} 115 116 def isfile(fileName): #{{{ 152 # }}} 153 154 # NOTE: Conflicts with definition of isempty in $ISSM_DIR/src/m/qmu/helpers.py 155 # 156 # def isempty(A): # {{{ 157 # return len(A) > 0 158 # # }}} 159 160 def isfile(fileName): # {{{ 117 161 import os 118 162 119 163 return os.path.exists(fileName) 120 # }}}121 122 def ismac(): # {{{164 # }}} 165 166 def ismac(): # {{{ 123 167 import platform 124 168 … … 127 171 else: 128 172 return False 129 # }}}130 131 def ismember(a, s): # {{{173 # }}} 174 175 def ismember(a, s): # {{{ 132 176 import numpy as np 133 177 … … 149 193 150 194 return b 151 # }}}152 153 def isnan(A): # {{{195 # }}} 196 197 def isnan(A): # {{{ 154 198 import numpy as np 155 199 156 200 return np.isnan(A) 157 # }}}158 159 def ispc(): # {{{201 # }}} 202 203 def ispc(): # {{{ 160 204 import platform 161 205 … … 164 208 else: 165 209 return False 166 # }}}167 168 def isprop(obj, PropertyName): # {{{210 # }}} 211 212 def isprop(obj, PropertyName): # {{{ 169 213 return hasattr(obj, PropertyName) 170 # }}}171 172 def mod(a, m): # {{{214 # }}} 215 216 def mod(a, m): # {{{ 173 217 return a % m 174 # }}}175 176 def pause(n): # {{{218 # }}} 219 220 def pause(n): # {{{ 177 221 import time 178 222 179 223 time.sleep(n) 180 # }}}181 182 def pwd(): # {{{224 # }}} 225 226 def pwd(): # {{{ 183 227 import os 184 228 185 229 return os.getcwd() 186 # }}}187 188 def oshostname(): # {{{230 # }}} 231 232 def oshostname(): # {{{ 189 233 import socket 190 234 191 235 return socket.gethostname() 192 # }}}193 194 def rem(a, b): # {{{236 # }}} 237 238 def rem(a, b): # {{{ 195 239 return a % b 196 #}}} 197 198 def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0): #{{{ 240 # }}} 241 242 def sind(X): # {{{ 243 """function sind - Sine of argument in degrees 244 245 Usage: 246 Y = sind(X) 247 """ 248 import numpy as np 249 250 if type(X) == np.ndarray: 251 Y = np.array([]) 252 for x in X: 253 Y = np.append(Y, sindsingle(x)) 254 return Y 255 else: 256 return sindsingle(X) 257 # }}} 258 259 def sindsingle(x): # {{{ 260 """function sindsingle - Helper function for sind to reduce repetition of 261 logic 262 263 Usage: 264 y = sindsingle(x) 265 """ 266 import numpy as np 267 268 while x >= 360: 269 x = x - 360 270 271 if x == 0 or x == 180: 272 return 0 273 elif x == 90: 274 return 1 275 elif x == 270: 276 return -1 277 else: 278 return np.sin(np.radians(x)) 279 # }}} 280 281 def sparse(ivec, jvec, svec, m=0, n=0, nzmax=0): # {{{ 199 282 import numpy as np 200 283 … … 210 293 211 294 return a 212 # }}}213 214 def strcmp(s1, s2): # {{{295 # }}} 296 297 def strcmp(s1, s2): # {{{ 215 298 if s1 == s2: 216 299 return True 217 300 else: 218 301 return False 219 # }}}220 221 def strcmpi(s1, s2): # {{{302 # }}} 303 304 def strcmpi(s1, s2): # {{{ 222 305 if s1.lower() == s2.lower(): 223 306 return True 224 307 else: 225 308 return False 226 # }}}227 228 def strjoin(*args): # {{{309 # }}} 310 311 def strjoin(*args): # {{{ 229 312 nargs = len(args) 230 313 if nargs >= 1 or nargs <= 2: … … 235 318 else: 236 319 raise Exception('strjoin: must have 1 or 2 arguments') 237 # }}}238 239 def strncmp(s1, s2, n): # {{{320 # }}} 321 322 def strncmp(s1, s2, n): # {{{ 240 323 if s1[0:n] == s2[0:n]: 241 324 return True 242 325 else: 243 326 return False 244 # }}}245 246 def strncmpi(s1, s2, n): # {{{327 # }}} 328 329 def strncmpi(s1, s2, n): # {{{ 247 330 if s1.lower()[0:n] == s2.lower()[0:n]: 248 331 return True 249 332 else: 250 333 return False 251 # }}}334 # }}} -
TabularUnified issm/trunk-jpl/src/m/miscellaneous/pretty_print.m ¶
r25688 r26358 30 30 if shape(2)>6 31 31 output=sprintf('[[%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',data(1,1),data(1,2),data(1,3),data(1,end-2),data(1,end-1),data(1,end)); 32 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n', data(2,1),data(2,2),data(2,3),data(2,end-2),data(2,end-1),data(2,end));33 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n', data(3,1),data(3,2),data(3,3),data(3,end-2),data(3,end-1),data(3,end));32 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(2,1),data(2,2),data(2,3),data(2,end-2),data(2,end-1),data(2,end)); 33 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(3,1),data(3,2),data(3,3),data(3,end-2),data(3,end-1),data(3,end)); 34 34 output=sprintf('%s ...\n',output); 35 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n', data(end-2,1),data(end-2,2),data(end-2,3),data(end-2,end-2),data(end-2,end-1),data(end-2,end));36 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n', data(end-1,1),data(end-1,2),data(end-1,3),data(end-1,end-2),data(end-1,end-1),data(end-1,end));37 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]]', data(end,1),data(end,2),data(end,3),data(end,end-2),data(end,end-1),data(end,end));35 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(end-2,1),data(end-2,2),data(end-2,3),data(end-2,end-2),data(end-2,end-1),data(end-2,end)); 36 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]\n',output,data(end-1,1),data(end-1,2),data(end-1,3),data(end-1,end-2),data(end-1,end-1),data(end-1,end)); 37 output=sprintf('%s [%.8f %.8f %.8f ... %.8f %.8f %.8f]]',output,data(end,1),data(end,2),data(end,3),data(end,end-2),data(end,end-1),data(end,end)); 38 38 else 39 39 output=sprintf('[[%.8f]\n',data(1,:)); -
TabularUnified issm/trunk-jpl/src/m/plot/checkplotoptions.py ¶
r24261 r26358 3 3 4 4 def checkplotoptions(md, options): 5 ''' 6 CHECKPLOTOPTIONS - build a structure that holds all plot options 5 """CHECKPLOTOPTIONS - build a structure that holds all plot options 7 6 8 9 7 Usage: 8 options = checkplotoptions(md, options) 10 9 11 10 See also: PLOTMODEL 12 11 13 14 '''12 NOTE: not fully implemented yet 13 """ 15 14 16 15 # {{{ units 17 16 if options.exist('unit'): 18 17 if 'km' in options.getfieldvalue('unit', 'km'): 19 options.changefieldvalue('unit', 10**-3)18 options.changefieldvalue('unit', pow(10, -3)) 20 19 elif '100km' in options.getfieldvalue('unit', '100km'): 21 options.changefieldvalue('unit', 10**-5)20 options.changefieldvalue('unit', pow(10, -5)) 22 21 # }}} 23 22 # {{{ density … … 62 61 textlist.extend([text] if isinstance(text, str) else text) 63 62 numtext = len(textlist) 64 # text position63 # text position 65 64 textpos = options.getfieldvalue('textposition', [0.5, 0.5]) 66 65 if not isinstance(textpos, list): … … 75 74 raise Exception('textposition should contain one list of x, y vertices for every text instance') 76 75 77 # font size76 # font size 78 77 if options.exist('textfontsize'): 79 78 textfontsize = options.getfieldvalue('textfontsize', 12) … … 85 84 sizelist = np.tile(sizelist, numtext) 86 85 87 # font color86 # font color 88 87 if options.exist('textcolor'): 89 88 textcolor = options.getfieldvalue('textcolor', 'k') … … 95 94 colorlist = np.tile(colorlist, numtext) 96 95 97 # textweight96 # textweight 98 97 if options.exist('textweight'): 99 98 textweight = options.getfieldvalue('textweight') … … 105 104 weightlist = np.tile(weightlist, numtext) 106 105 107 # text rotation106 # text rotation 108 107 if options.exist('textrotation'): 109 108 textrotation = options.getfieldvalue('textrotation', 0) … … 152 151 if options.exist('northarrow'): 153 152 if 'on' in options.getfieldvalue('northarrow', 'on'): 154 # default values153 # default values 155 154 Lx = max(md.mesh.x) - min(md.mesh.x) 156 155 Ly = max(md.mesh.y) - min(md.mesh.y) -
TabularUnified issm/trunk-jpl/src/m/solve/loadresultfromdisk.py ¶
r25817 r26358 4 4 5 5 def loadresultfromdisk(filename, step, name, *args): # {{{ 6 """ 7 LOADRESULTFROMDISK - load specific result of solution sequence from disk 6 """LOADRESULTFROMDISK - load specific result of solution sequence from disk 8 7 file "filename" 9 8 10 11 9 Usage: 10 variable = loadresultsfromdisk(filename, step, name) 12 11 13 14 12 TODO: 13 - Test this module against output of src/m/solve/loadresultsfromdisk.m 15 14 """ 16 print('Got hwrwefew') 17 exit() 15 18 16 # Open file 19 17 try: … … 59 57 for i in range(M): 60 58 field[i, :] = struct.unpack('{}i'.format(N), fid.read(N * struct.calcsize('i'))) 59 elif datatype == 5: 60 # TODO: 61 # - Check that the following results in the same output as 62 # MATLAB 63 # 64 N = struct.unpack('i', fid.read(struct.calcsize('i')))[0] 65 fieldr = np.zeros(shape=(M, N), dtype=float) 66 fieldi = np.zeros(shape=(M, N), dtype=float) 67 for i in range(M): 68 fieldr[i, :] = struct.unpack('{}d'.format(N), fid.read(N * struct.calcsize('d'))) 69 fieldi[i, :] = struct.unpack('{}d'.format(N), fid.read(N * struct.calcsize('d'))) 70 field = np.vectorize(complex)(fieldr, fieldi) 71 print(field) 61 72 else: 62 73 raise TypeError("cannot read data of type {}".format(datatype)) -
TabularUnified issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py ¶
r26332 r26358 1 1 import os 2 import subprocess 3 2 4 from helpers import * 3 5 from loadresultsfromdisk import loadresultsfromdisk -
TabularUnified issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py ¶
r25817 r26358 16 16 # Check number of inputs/outputs 17 17 if not md or not filename: 18 raise ValueError( "loadresultsfromdisk: error message.")18 raise ValueError('loadresultsfromdisk: error message.') 19 19 20 20 if not md.qmu.isdakota: … … 31 31 return 32 32 33 # Initialize md.results if not a structure yet33 # Initialize md.results if it is not a structure yet 34 34 if not isinstance(md.results, results): 35 35 md.results = results() … … 38 38 structure = parseresultsfromdisk(md, filename, not md.settings.io_gather) 39 39 if not structure: 40 raise RuntimeError( "No result found in binary file '{}'. Check for solution crash.".format(filename))40 raise RuntimeError('No result found in binary file \'{}\'. Check for solution crash.'.format(filename)) 41 41 if not hasattr(structure[0], 'SolutionType'): 42 42 if hasattr(structure[-1], 'SolutionType'): … … 64 64 65 65 if getattr(md.results, structure[0].SolutionType)[0].errlog: 66 print( "loadresultsfromdisk info message: error during solution. Check your errlog and outlog model fields.")66 print('loadresultsfromdisk info message: error during solution. Check your errlog and outlog model fields.') 67 67 68 68 # If only one solution, extract it from list for user friendliness -
TabularUnified issm/trunk-jpl/src/m/solve/marshall.m ¶
r26301 r26358 44 44 st=fclose(fid); 45 45 46 % Uncomment the following to make a copy of the binary input file for debugging47 % purposes (can be fed into scripts/BinRead.py).48 % copyfile([md.miscellaneous.name '.bin'], [md.miscellaneous.name '.m.bin'])49 50 46 if st==-1, 51 47 error(['marshall error message: could not close file ' [md.miscellaneous.name '.bin']]); 52 48 end 49 50 % Uncomment the following to make a copy of the binary input file for debugging 51 % purposes (can be fed into scripts/BinRead.py). 52 copyfile([md.miscellaneous.name '.bin'], [md.miscellaneous.name '.m.bin']) -
TabularUnified issm/trunk-jpl/src/m/solve/marshall.py ¶
r26301 r26358 17 17 print("marshalling file {}.bin".format(md.miscellaneous.name)) 18 18 19 # open file for binary writing19 # Open file for binary writing 20 20 try: 21 21 fid = open(md.miscellaneous.name + '.bin', 'wb') … … 26 26 fields.sort() # sort fields so that comparison of binary files is easier 27 27 for field in fields: 28 # Some properties do not need to be marshalled28 # Some properties do not need to be marshalled 29 29 if field in ['results', 'radaroverlay', 'toolkits', 'cluster', 'private']: 30 30 continue 31 31 32 # Check that current field is an object32 # Check that current field is an object 33 33 if not hasattr(getattr(md, field), 'marshall'): 34 34 raise TypeError("field '{}' is not an object.".format(field)) 35 35 36 # Marshall current object37 #print "marshalling %s ..." % field #Uncomment for debugging38 exec( "md.{}.marshall('md.{}', md, fid)".format(field, field))36 # Marshall current object 37 #print('marshalling {} ...'.format(field) # Uncomment for debugging 38 exec('md.{}.marshall(\'md.{}\', md, fid)'.format(field, field)) 39 39 40 40 #Last, write "md.EOF" to make sure that the binary file is not corrupt … … 45 45 fid.close() 46 46 47 # Uncomment the following to make a copy of the binary input file for 48 # debugging purposes (can be fed into scripts/BinRead.py). 49 # copy_cmd = "cp {}.bin {}.py.bin".format(md.miscellaneous.name, md.miscellaneous.name) 50 # subprocess.call(copy_cmd, shell=True) 47 except IOError as e: 48 print('marshall error message: could not close file \'{}.bin\' due to:'.format(md.miscellaneous.name), e) 51 49 52 except IOError as e: 53 print("marshall error message: could not close file '{}.bin' due to:".format(md.miscellaneous.name), e) 50 # Uncomment the following to make a copy of the binary input file for 51 # debugging purposes (can be fed into scripts/BinRead.py). 52 copy_cmd = 'cp {}.bin {}.py.bin'.format(md.miscellaneous.name, md.miscellaneous.name) 53 subprocess.call(copy_cmd, shell=True) -
TabularUnified issm/trunk-jpl/src/m/solve/parseresultsfromdisk.py ¶
r26271 r26358 80 80 fid = open(filename, 'rb') 81 81 except IOError as e: 82 raise IOError( "parseresultsfromdisk error message: could not open {} for binary reading".format(filename))82 raise IOError('parseresultsfromdisk error message: could not open {} for binary reading'.format(filename)) 83 83 84 84 # Collect all results in a list … … 127 127 """ 128 128 129 # read field129 # Read field 130 130 try: 131 131 length = struct.unpack('i', fid.read(struct.calcsize('i')))[0] 132 132 fieldname = struct.unpack('{}s'.format(length), fid.read(length))[0][:-1] 133 fieldname = fieldname.decode() #strings are binaries when stored so need to be converted back133 fieldname = fieldname.decode() # strings are binaries when stored so need to be converted back 134 134 time = struct.unpack('d', fid.read(struct.calcsize('d')))[0] 135 135 step = struct.unpack('i', fid.read(struct.calcsize('i')))[0] … … 145 145 elif datatype == 3: 146 146 N = struct.unpack('i', fid.read(struct.calcsize('i')))[0] 147 #field = transpose(fread(fid, [N M], 'double'))147 #field = transpose(fread(fid, [N M], 'double')) 148 148 field = np.zeros(shape=(M, N), dtype=float) 149 149 for i in range(M): … … 152 152 elif datatype == 4: 153 153 N = struct.unpack('i', fid.read(struct.calcsize('i')))[0] 154 #field = transpose(fread(fid, [N M], 'int'))154 #field = transpose(fread(fid, [N M], 'int')) 155 155 field = np.zeros(shape=(M, N), dtype=int) 156 156 for i in range(M): … … 158 158 159 159 else: 160 raise TypeError( "cannot read data of datatype {}".format(datatype))161 162 # Process units here FIXME: this should not be done here!160 raise TypeError('cannot read data of datatype {}'.format(datatype)) 161 162 # Process units here FIXME: this should not be done here! 163 163 yts = md.constants.yts 164 164 if fieldname == 'BalancethicknessThickeningRate': … … 193 193 field = field * yts 194 194 elif fieldname == 'TotalFloatingBmb': 195 field = field / 10.**12 * yts #(GigaTon/year)195 field = field / pow(10.0, 12) * yts # (GigaTon/year) 196 196 elif fieldname == 'TotalFloatingBmbScaled': 197 field = field / 10.**12 * yts #(GigaTon/year)197 field = field / pow(10.0, 12) * yts # (GigaTon/year) 198 198 elif fieldname == 'TotalGroundedBmb': 199 field = field / 10.**12 * yts #(GigaTon/year)199 field = field / pow(10.0, 12) * yts # (GigaTon/year) 200 200 elif fieldname == 'TotalGroundedBmbScaled': 201 field = field / 10.**12 * yts #(GigaTon/year)201 field = field / pow(10.0, 12) * yts # (GigaTon/year) 202 202 elif fieldname == 'TotalSmb': 203 field = field / 10.**12 * yts #(GigaTon/year)203 field = field / pow(10.0, 12) * yts # (GigaTon/year) 204 204 elif fieldname == 'TotalSmbScaled': 205 field = field / 10.**12 * yts #(GigaTon/year)205 field = field / pow(10.0, 12) * yts # (GigaTon/year) 206 206 elif fieldname == 'GroundinglineMassFlux': 207 field = field / 10.**12 * yts #(GigaTon/year)207 field = field / pow(10.0, 12) * yts # (GigaTon/year) 208 208 elif fieldname == 'IcefrontMassFlux': 209 field = field / 10.**12 * yts #(GigaTon/year)209 field = field / pow(10.0, 12) * yts # (GigaTon/year) 210 210 elif fieldname == 'IcefrontMassFluxLevelset': 211 field = field / 10.**12 * yts #(GigaTon/year)211 field = field / pow(10.0, 12) * yts # (GigaTon/year) 212 212 elif fieldname == 'SmbMassBalance': 213 213 field = field * yts -
TabularUnified issm/trunk-jpl/src/m/solve/solve.m ¶
r26353 r26358 47 47 elseif strcmpi(solutionstring,'mt') || strcmpi(solutionstring,'Masstransport') 48 48 solutionstring = 'MasstransportSolution'; 49 elseif strcmpi(solutionstring,'ocean mt') || strcmpi(solutionstring,'Oceantransport')49 elseif strcmpi(solutionstring,'oceant') || strcmpi(solutionstring,'Oceantransport') 50 50 solutionstring = 'OceantransportSolution'; 51 51 elseif strcmpi(solutionstring,'th') || strcmpi(solutionstring,'Thermal') -
TabularUnified issm/trunk-jpl/src/m/solve/solve.py ¶
r26353 r26358 84 84 solutionstring = 'SamplingSolution' 85 85 else: 86 raise ValueError( "solutionstring '%s' not supported!" % solutionstring)86 raise ValueError('solutionstring {} not supported!'.format(solutionstring)) 87 87 options = pairoptions('solutionstring', solutionstring, *args) 88 88 … … 101 101 ismodelselfconsistent(md) 102 102 103 # If we are restarting, actually use the provided runtime name 104 restart = options.getfieldvalue('restart', '') 103 105 # First, build a runtime name that is unique 104 restart = options.getfieldvalue('restart', '')105 106 if restart == 1: 106 pass # do nothing107 pass # Leave the runtimename as is 107 108 else: 108 109 if not isempty(restart): … … 130 131 cluster.BuildQueueScript(md.private.runtimename, md.miscellaneous.name, md.private.solution, md.settings.io_gather, md.debug.valgrind, md.debug.gprof, md.qmu.isdakota, md.transient.isoceancoupling) # queue file 131 132 132 # Stop here if batch mode 133 if options.getfieldvalue('batch', 'no') == 'yes': 134 print('batch mode requested: not launching job interactively') 135 print('launch solution sequence on remote cluster by hand') 136 return md 133 # Upload all required files 134 modelname = md.miscellaneous.name 135 filelist = [modelname + '.bin', modelname + '.toolkits'] 137 136 138 # Upload all required files: 139 modelname = md.miscellaneous.name 140 filelist = [modelname + '.bin ', modelname + '.toolkits ', modelname + '.queue '] 137 if ispc(): 138 filelist.append(modelname + '.bat') 139 else: 140 filelist.append(modelname + '.queue') 141 141 142 if md.qmu.isdakota: 142 143 filelist.append(modelname + '.qmu.in') 143 144 144 if not restart:145 if isempty(restart): 145 146 cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist) 146 147 147 148 # Launch job 148 149 cluster.LaunchQueueJob(md.miscellaneous.name, md.private.runtimename, filelist, restart, batch) 150 151 # Return if batch 152 if batch: 153 if md.verbose.solution: 154 print('batch mode requested: not launching job interactively') 155 print('launch solution sequence on remote cluster by hand') 156 return md 149 157 150 158 # Wait on lock -
TabularUnified issm/trunk-jpl/src/m/solve/solveslm.m ¶
r26059 r26358 3 3 % 4 4 % Usage: 5 % slm=solve (slm,solutionstring,varargin)5 % slm=solveslm(slm,solutionstring,varargin) 6 6 % where varargin is a lit of paired arguments of string OR enums 7 7 % … … 9 9 % - 'Transient' 10 10 % 11 % extra options:11 % extra options: 12 12 % 13 13 % Examples: 14 % slm=solve (slm,'Transient');14 % slm=solveslm(slm,'Transient'); 15 15 16 16 %recover and process solve options -
TabularUnified issm/trunk-jpl/src/m/solve/solveslm.py ¶
r26059 r26358 13 13 14 14 Usage: 15 slm=solve (slm,solutionstring,varargin)15 slm=solveslm(slm,solutionstring,varargin) 16 16 where varargin is a lit of paired arguments of string OR enums 17 17 … … 22 22 23 23 Examples: 24 slm=solve (slm,'Transient');24 slm=solveslm(slm,'Transient'); 25 25 """ 26 27 print('Yep') 28 exit() 26 29 27 30 # Recover and process solve options -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2001.py ¶
r26299 r26358 1 1 #Test Name: SquareSheetConstrainedGia2d 2 2 #GIA test, based off of test101. Running default GIA Ivins class. 3 from socket import gethostname4 5 3 import numpy as np 6 4 7 5 from materials import * 6 from MatlabFuncs import * 8 7 from model import * 9 8 from parameterize import * … … 29 28 md.materials.viscosity = [1e21, 0] 30 29 md.initialization.sealevel = np.zeros(md.mesh.numberofvertices) 31 md.solidearth.settings.cross_section_shape = 1 # for square-edged x-section 30 md.solidearth.settings.cross_section_shape = 1 # for square-edged x-section 32 31 md.solidearth.settings.grdocean = 0 # do not compute sea level, only deformation 33 32 md.solidearth.settings.sealevelloading = 0 # do not compute sea level, only deformation … … 57 56 58 57 #Solve for GIA deflection 59 md.cluster = generic('name', gethostname(), 'np', 3) 60 md.verbose = verbose('11111111111') 58 md.cluster = generic('name', oshostname(), 'np', 3) 61 59 md.verbose.solver = 0 62 60 md = solve(md, 'Transient') -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2002.m ¶
r26303 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 100: … … 25 24 longe=atan2d(ye,xe); 26 25 pos=find(late < -80); 27 md.masstransport.spcthickness(md.mesh.elements(pos,:))= 26 md.masstransport.spcthickness(md.mesh.elements(pos,:))=md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 28 27 posant=pos; 29 28 30 29 %greenland 31 30 pos=find(late>60 & late<90 & longe>-75 & longe<-15); 32 md.masstransport.spcthickness(md.mesh.elements(pos,:))= 31 md.masstransport.spcthickness(md.mesh.elements(pos,:))=md.masstransport.spcthickness(md.mesh.elements(pos,:))-100; 33 32 posgre=pos; 34 33 -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2002.py ¶
r26303 r26358 1 1 #Test Name: EarthSlc 2 2 import numpy as np 3 4 from MatlabFuncs import *5 3 6 4 from gmshplanet import * … … 9 7 from materials import * 10 8 from model import * 11 from parameterize import *12 9 from paterson import * 13 10 from solve import * 14 11 15 12 16 # Mesh earth17 #18 # NOTE: In MATLAB, we currently use cached mesh to account for differences in19 # mesh generated under Linux versus under macOS20 #21 13 md = model() 22 14 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700.) # 700 km resolution mesh … … 41 33 longe = atan2d(ye, xe) 42 34 pos = np.where(late < -80)[0] 43 md.masstransport.spcthickness[md.mesh.elements[pos ]] = md.masstransport.spcthickness[md.mesh.elements[pos]] - 10035 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 44 36 posant = pos 45 37 46 38 # Greenland 47 39 pos = np.where(np.logical_and.reduce((late > 60, late < 90, longe > -75, longe < -15)))[0] 48 md.masstransport.spcthickness[md.mesh.elements[pos ]] = md.masstransport.spcthickness[md.mesh.elements[pos]] - 10040 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 49 41 posgre = pos 50 42 … … 60 52 61 53 icemask = np.ones((md.mesh.numberofvertices, )) 62 icemask[md.mesh.elements[posant]] = -1 63 icemask[md.mesh.elements[posgre]] = -1 54 # NOTE: Need to be careful here: when using multidimensional array elements to 55 # address a one-dimensional array in MATLAB, only first column is used 56 # 57 icemask[md.mesh.elements[posant][:, 0] - 1] = -1 58 icemask[md.mesh.elements[posgre][:, 0] - 1] = -1 64 59 65 60 md.mask.ice_levelset = icemask -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2003.m ¶
r26303 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 1000: … … 24 23 late=asind(ze./re); 25 24 longe=atan2d(ye,xe); 25 26 26 %greenland 27 27 pos=find(late>60 & late<90 & longe>-75 & longe<-15); … … 31 31 %elastic loading from love numbers: 32 32 md.solidearth.lovenumbers=lovenumbers('maxdeg',100); 33 34 33 %}}} 35 34 %mask: {{{ … … 70 69 71 70 %Physics: 72 md.transient.issmb=0; 71 md.transient.issmb=0; 73 72 md.transient.isstressbalance=0; 74 73 md.transient.isthermal=0; 75 74 md.transient.ismasstransport=1; 76 75 md.transient.isslc=1; 77 76 78 77 md.timestepping.start_time=0; 79 78 md.timestepping.time_step=1; -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2003.py ¶
r26303 r26358 1 1 #Test Name: EarthSlc_rotationalFeedback 2 2 import numpy as np 3 4 from socket import gethostname5 3 6 4 from gmshplanet import * 7 5 from gmtmask import * 8 6 from lovenumbers import * 7 from MatlabFuncs import * 9 8 from model import * 10 9 from paterson import * … … 12 11 13 12 14 # Mesh earth15 #16 # NOTE: In MATLAB, we currently use cached mesh to account for differences in17 # mesh generated under Linux versus under macOS18 #19 13 md = model() 20 14 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700.) # 700 km resolution mesh 21 15 22 16 # Geometry for the bed, arbitrary thickness of 100 23 md.geometry.bed = -1 * np.ones( md.mesh.numberofvertices)17 md.geometry.bed = -1 * np.ones((md.mesh.numberofvertices, )) 24 18 md.geometry.base = md.geometry.bed 25 md.geometry.thickness = 1000 * np.ones( md.mesh.numberofvertices)19 md.geometry.thickness = 1000 * np.ones((md.mesh.numberofvertices, )) 26 20 md.geometry.surface = md.geometry.bed + md.geometry.thickness 27 21 … … 38 32 late = asind(ze / re) 39 33 longe = atan2d(ye, xe) 34 40 35 # Greenland 41 36 pos = np.where(np.logical_and.reduce((late > 60, late < 90, longe > -75, longe < -15)))[0] 42 md.masstransport.spcthickness[md.mesh.elements[pos ]] = md.masstransport.spcthickness[md.mesh.elements[pos]] - 100037 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 1000 43 38 posice = pos 44 39 … … 50 45 mask = gmtmask(md.mesh.lat, md.mesh.long) 51 46 icemask = np.ones(md.mesh.numberofvertices) 52 icemask[md.mesh.elements[posice ]] = -147 icemask[md.mesh.elements[posice, :] - 1] = -1 53 48 md.mask.ice_levelset = icemask 54 49 oceanmask = -1 * np.ones(md.mesh.numberofvertices) … … 100 95 md.solidearth.settings.rotation = 0 101 96 md.solidearth.settings.viscous = 0 102 md.cluster = generic('name', gethostname(), 'np', 3)97 md.cluster = generic('name', oshostname(), 'np', 3) 103 98 #md.verbose = verbose('111111111') 104 99 md = solve(md, 'Transient') … … 113 108 md.solidearth.settings.rotation = 1 114 109 md.solidearth.settings.viscous = 0 115 md.cluster = generic('name', gethostname(), 'np', 3)110 md.cluster = generic('name', oshostname(), 'np', 3) 116 111 #md.verbose = verbose('111111111') 117 112 md = solve(md, 'Transient') -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2004.m ¶
r26296 r26358 72 72 %meshing parameters: {{{ 73 73 hmin=500; hmax=700; hmin=hmin*1000; hmax=hmax*1000; 74 tolerance=100; %tolerance of 100m on Earth position when mergin 3d meshes74 tolerance=100; %tolerance of 100m on Earth position when merging 3d meshes 75 75 threshold=5; 76 76 defaultoptions={'KeepVertices',0,'MaxCornerAngle',0.0000000001,'NoBoundaryRefinement',1}; … … 269 269 latGIS=delH(:,2); 270 270 delHGIS=delH(:,3); 271 % points=[longGIS,latGIS];272 % index=delaunayn(points);273 271 index=BamgTriangulate(longGIS, latGIS); 274 272 lat=md.mesh.lat; … … 277 275 long(pos)=long(pos)-360; 278 276 delHGIS=InterpFromMeshToMesh2d(index,longGIS,latGIS,delHGIS,long,lat); 279 delHGISe=delHGIS(md.mesh.elements)*[1;1;1]/3;280 277 281 278 delH=textread('../Data/GLA_delH_trend_15regions.txt'); … … 283 280 latGLA=delH(:,2); 284 281 delHGLA=sum(delH(:,3:end),2); 285 % points=[longGLA,latGLA];286 % index=delaunayn(points);287 282 index=BamgTriangulate(longGLA, latGLA); 288 283 lat=md.mesh.lat; … … 291 286 long(pos)=long(pos)-360; 292 287 delHGLA=InterpFromMeshToMesh2d(index,longGLA,latGLA,delHGLA,long,lat); 293 delHGLAe=delHGLA(md.mesh.elements)*[1;1;1]/3;294 288 295 289 pos=find(delHGIS); 296 md.masstransport.spcthickness(pos) = md.masstransport.spcthickness(pos)-delHGIS(pos)/100;290 md.masstransport.spcthickness(pos) = md.masstransport.spcthickness(pos)-delHGIS(pos)/100; 297 291 pos=find(delHGLA); 298 292 md.masstransport.spcthickness(pos)= md.masstransport.spcthickness(pos)-delHGLA(pos)/100; … … 376 370 377 371 % }}} 378 %Solve Sea-level eq uation on Earth only: {{{372 %Solve Sea-level eqEricuation on Earth only: {{{ 379 373 md=sl.earth; %we don't do computations on ice sheets or land. 380 374 … … 426 420 md.solidearth.settings.elastic=0; 427 421 md.solidearth.settings.rotation=0; 422 md.solidearth.settings.viscous=0; 428 423 md.solidearth.requested_outputs= {'default',... 429 424 'DeltaIceThickness','Sealevel','SealevelUGrd',... … … 436 431 md.solidearth.settings.elastic=0; 437 432 md.solidearth.settings.rotation=0; 433 md.solidearth.settings.viscous=0; 438 434 md=solve(md,'Transient'); 439 435 Sselfattraction=md.results.TransientSolution.Sealevel; … … 443 439 md.solidearth.settings.elastic=1; 444 440 md.solidearth.settings.rotation=0; 441 md.solidearth.settings.viscous=0; 445 442 md=solve(md,'Transient'); 446 443 Selastic=md.results.TransientSolution.Sealevel; … … 450 447 md.solidearth.settings.elastic=1; 451 448 md.solidearth.settings.rotation=1; 449 md.solidearth.settings.viscous=0; 452 450 md=solve(md,'Transient'); 453 451 Srotation=md.results.TransientSolution.Sealevel; -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2004.py ¶
r25763 r26358 114 114 hmin = hmin * 1000 115 115 hmax = hmax * 1000 116 tolerance = 100 116 tolerance = 100 # tolerance of 100m on Earth position when merging 3d meshes 117 117 threshold = 5 118 118 defaultoptions = [ … … 145 145 # Vertex connectivity 146 146 md.mesh.vertexconnectivity = NodeConnectivity(md.mesh.elements, md.mesh.numberofvertices) 147 147 148 # Add model to sl icecaps 148 149 sl.addicecap(md) … … 178 179 print(' reading bedrock') 179 180 md.geometry.bed = -np.ones((md.mesh.numberofvertices, )) 180 #}}} 181 182 # SLR #{{{ 181 md.geometry.base = md.geometry.bed 182 md.geometry.thickness = 1000 * np.ones((md.mesh.numberofvertices, )) 183 md.geometry.surface = md.geometry.bed + md.geometry.thickness 184 #}}} 185 186 # SLC #{{{ 183 187 if bas.iscontinentany('antarctica'): 184 188 if testagainst2002: 185 189 # TODO: Check if the following works as expected: 'pos' is empty, so nothing is assigned to 'md.solidearth.surfaceload.icethicknesschange[pos]' 186 md. solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, ))190 md.masstransport.spcthickness = np.zeros((md.mesh.numberofvertices, )) 187 191 # Antarctica 188 192 late = np.sum(md.mesh.lat[md.mesh.elements - 1], axis=1) / 3 … … 190 194 pos = np.where(late < -85)[0] 191 195 ratio = 0.225314032985172 / 0.193045366574523 192 md. solidearth.surfaceload.icethicknesschange[pos] = -100 * ratio196 md.masstransport.spcthickness[md.mesh.elements[pos]] = md.masstransport.spcthickness[md.mesh.elements[pos]] - 100 * ratio 193 197 else: 194 198 delH = np.loadtxt('../Data/AIS_delH_trend.txt') … … 201 205 pos = np.where(longe > 360)[0] 202 206 longe[pos] = longe[pos] - 360 203 delHAIS = InterpFromMesh2d(index, longAIS, latAIS, delHAIS, longe, late) 207 delHAIS = InterpFromMesh2d(index, longAIS, latAIS, delHAIS, longe, late) # NOTE: Compare to corresponding output under MATLAB to understand why we offset triangle indices by 1 (only caught because Triangle.cpp was producing triangles with negative areas) 204 208 northpole = find_point(md.mesh.long, md.mesh.lat, 0, 90) 205 209 delHAIS[northpole] = 0 206 md. solidearth.surfaceload.icethicknesschange = np.mean(delHAIS[md.mesh.elements - 1], axis=1)/ 100207 208 md. solidearth.initialsealevel = np.zeros((md.mesh.numberofvertices, ))209 210 md.dsl.global_average_thermost atic_sea_level_change= np.zeros((2, 1))211 md.dsl.sea_surface_height_ change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1))212 md.dsl.sea_water_pressure_ change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1))210 md.masstransport.spcthickness = delHAIS / 100 211 212 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices, )) 213 214 md.dsl.global_average_thermosteric_sea_level = np.zeros((2, 1)) 215 md.dsl.sea_surface_height_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 216 md.dsl.sea_water_pressure_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 213 217 #}}} 214 218 … … 226 230 # Parameterize continents #{{{ 227 231 for ind in sl.basinindx('continent', ['hemisphereeast', 'hemispherewest']): 228 print( "Masks for basin {}".format(sl.icecaps[ind].miscellaneous.name))232 print('Masks for basin {}'.format(sl.icecaps[ind].miscellaneous.name)) 229 233 md = sl.icecaps[ind] 230 234 bas = sl.basins[ind] … … 283 287 #}}} 284 288 285 # SL Rloading/calibration #{{{286 md. solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, ))289 # SLC loading/calibration #{{{ 290 md.masstransport.spcthickness = np.zeros((md.mesh.numberofvertices, )) 287 291 288 292 if testagainst2002: … … 293 297 pos = np.where(np.logical_and.reduce((late > 70, late < 80, longe > -60, longe < -30)))[0] 294 298 ratio = .3823 / .262344 299 md.masstransport.spcthickness[md.mesh.elements[pos]] = md.masstransport.spcthickness[md.mesh.elements[pos]] - 100 * ratio 295 300 296 301 # Correct mask … … 307 312 pos = np.where(longe > 360)[0] 308 313 longe[pos] = longe[pos] - 360 309 delHGIS = InterpFromMeshToMesh2d(index, longGIS, latGIS, delHGIS, longe, late) # NOTE: Compare to corresponding ouptut under MATLAB to understand why we offset triangle indices by 1 (only caught because Triangle.cpp was producing triangles with negative areas) 310 delHGISe = np.mean(delHGIS[md.mesh.elements - 1], axis=1).flatten() 314 delHGIS = InterpFromMeshToMesh2d(index, longGIS, latGIS, delHGIS, longe, late) 311 315 312 316 delH = np.loadtxt('../Data/GLA_delH_trend_15regions.txt') … … 319 323 pos = np.where(longe > 360)[0] 320 324 longe[pos] = longe[pos] - 360 321 delHGLA = InterpFromMeshToMesh2d(index, longGLA, latGLA, delHGLA, longe, late) # NOTE: Compare to corresponding ouptut under MATLAB to understand why we offset triangle indices by 1 (only caught because Triangle.cpp was producing triangles with negative areas) 322 delHGLAe = np.mean(delHGLA[md.mesh.elements - 1], axis=1).flatten() 323 324 pos = np.nonzero(delHGISe)[0] 325 md.solidearth.surfaceload.icethicknesschange[pos] = delHGISe[pos] / 100 326 pos = np.nonzero(delHGLAe)[0] 327 md.solidearth.surfaceload.icethicknesschange[pos] = delHGLAe[pos] / 100 325 delHGLA = InterpFromMeshToMesh2d(index, longGLA, latGLA, delHGLA, longe, late) 326 327 # NOTE: For some reason, cannot apply pos to multiple arrays in a 328 # singlelike we might do in MATLAB. Instead, we iterate over 329 # elements of pos. 330 # 331 pos = np.nonzero(delHGIS)[0] 332 for p in pos: 333 md.masstransport.spcthickness[p] = md.masstransport.spcthickness[p] - delHGIS[p] / 100 334 pos = np.nonzero(delHGLA)[0] 335 for p in pos: 336 md.masstransport.spcthickness[p] = md.masstransport.spcthickness[p] - delHGLA[p] / 100 328 337 329 338 # Adjust mask accordingly 330 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 331 flags = np.zeros((md.mesh.numberofvertices, )) 332 flags[md.mesh.elements[pos, :] - 1] = 1 333 pos = np.nonzero(flags)[0] 339 pos = np.nonzero(md.masstransport.spcthickness)[0] 334 340 md.mask.ice_levelset[pos] = -1 335 341 md.mask.ocean_levelset[pos] = 1 336 342 337 md.solidearth.initialsealevel = np.zeros((md.mesh.numberofvertices, )) 338 339 md.dsl.global_average_thermostatic_sea_level_change = np.zeros((2, 1)) 340 md.dsl.sea_surface_height_change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 341 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 342 #}}} 343 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices, )) 344 345 md.dsl.global_average_thermosteric_sea_level = np.zeros((2, 1)) 346 md.dsl.sea_surface_height_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 347 md.dsl.sea_water_pressure_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 348 #}}} 349 343 350 # Geometry #{{{ 344 351 di = md.materials.rho_ice / md.materials.rho_water 345 352 md.geometry.bed = -np.ones((md.mesh.numberofvertices, )) 353 md.geometry.base = md.geometry.bed 354 md.geometry.thickness = 1000 * np.ones((md.mesh.numberofvertices, )) 355 md.geometry.surface = md.geometry.bed + md.geometry.thickness 346 356 #}}} 347 357 # Materials #{{{ … … 375 385 sl.transfer('mask.ocean_levelset') 376 386 sl.transfer('geometry.bed') 387 sl.transfer('geometry.surface') 388 sl.transfer('geometry.thickness') 389 sl.transfer('geometry.base') 377 390 sl.transfer('mesh.lat') 378 391 sl.transfer('mesh.long') 379 sl.transfer(' solidearth.surfaceload.icethicknesschange') #380 sl.transfer(' solidearth.initialsealevel')381 sl.transfer('dsl.sea_surface_height_ change_above_geoid')382 sl.transfer('dsl.sea_water_pressure_ change_at_sea_floor')392 sl.transfer('masstransport.spcthickness') # 393 sl.transfer('initialization.sealevel') 394 sl.transfer('dsl.sea_surface_height_above_geoid') 395 sl.transfer('dsl.sea_water_pressure_at_sea_floor') 383 396 384 397 # Radius … … 398 411 399 412 # Solve Sea-level equation on Earth only #{{{ 400 md = sl.earth # we don't do computations on ice sheets or land413 md = sl.earth # we don't do computations on ice sheets or land 401 414 402 415 #Materials 403 md.materials =materials('hydro')416 md.materials = materials('hydro') 404 417 405 418 # Elastic loading from love numbers … … 411 424 412 425 # New stuff 413 md.dsl.global_average_thermosteric_sea_level _change= np.array([[(1.1 + .38)], [0]]) # steric + water storage AR5426 md.dsl.global_average_thermosteric_sea_level = np.array([[(1.1 + .38)], [0]]) # steric + water storage AR5 414 427 415 428 # Solutuion parameters 416 429 md.solidearth.settings.reltol = np.nan 417 430 md.solidearth.settings.abstol = 1e-3 418 md.solidearth.settings.computesealevelchange = 1 431 md.solidearth.settings.sealevelloading = 1 432 md.solidearth.settings.isgrd = 1 433 md.solidearth.settings.ocean_area_scaling = 1 434 md.solidearth.settings.grdmodel = 1 419 435 md.timestepping.time_step = 1 436 437 # Physics 438 md.transient.issmb = 0 439 md.transient.isstressbalance = 0 440 md.transient.isthermal = 0 441 md.transient.ismasstransport = 1 442 md.transient.isslc = 1 443 444 # Initializations 445 md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices,)) 446 md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices,)) 447 md.initialization.vx = np.zeros((md.mesh.numberofvertices,)) 448 md.initialization.vy = np.zeros((md.mesh.numberofvertices,)) 449 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices,)) 450 md.initialization.bottompressure = np.zeros((md.mesh.numberofvertices,)) 451 md.initialization.dsl = np.zeros((md.mesh.numberofvertices,)) 452 md.initialization.str = 0 453 md.smb.mass_balance = np.zeros((md.mesh.numberofvertices,)) 420 454 421 455 # Max number of iterations reverted back to 10 (i.e. the original default value) … … 423 457 424 458 # Eustatic run: 425 md.solidearth.settings. rigid= 0459 md.solidearth.settings.selfattraction = 0 426 460 md.solidearth.settings.elastic = 0 427 461 md.solidearth.settings.rotation = 0 462 md.solidearth.settings.viscous = 0 428 463 md.solidearth.requested_outputs = [ 429 464 'default', 430 ' SurfaceloadIceThicknessChange',465 'DeltaIceThickness', 431 466 'Sealevel', 432 'SealevelRSLRate', 433 'SealevelriseCumDeltathickness', 434 'SealevelNEsaRate', 435 'SealevelUEsaRate', 436 'NGiaRate', 437 'UGiaRate', 438 'SealevelEustaticMask', 439 'SealevelEustaticOceanMask' 467 'SealevelUGrd', 468 'SealevelchangeBarystaticMask', 469 'SealevelchangeBarystaticOceanMask', 440 470 ] 441 md = solve(md, ' Sealevelrise')442 Seustatic = md.results. SealevelriseSolution.Sealevel443 444 # Eustatic + rigidrun445 md.solidearth.settings. rigid= 1471 md = solve(md, 'Transient') 472 Seustatic = md.results.TransientSolution.Sealevel 473 474 # Eustatic + selfattraction run 475 md.solidearth.settings.selfattraction = 1 446 476 md.solidearth.settings.elastic = 0 447 477 md.solidearth.settings.rotation = 0 448 md = solve(md, 'Sealevelrise') 449 Srigid = md.results.SealevelriseSolution.Sealevel 450 451 # Eustatic + rigid + elastic run 452 md.solidearth.settings.rigid = 1 478 md.solidearth.settings.viscous = 0 479 md = solve(md, 'Transient') 480 Sselfattraction = md.results.TransientSolution.Sealevel 481 482 # Eustatic + selfattraction + elastic run 483 md.solidearth.settings.selfattraction = 1 453 484 md.solidearth.settings.elastic = 1 454 485 md.solidearth.settings.rotation = 0 455 md = solve(md, 'Sealevelrise') 456 Selastic = md.results.SealevelriseSolution.Sealevel 457 458 # Eustatic + rigid + elastic + rotation run 459 md.solidearth.settings.rigid = 1 486 md.solidearth.settings.viscous = 0 487 md = solve(md, 'Transient') 488 Selastic = md.results.TransientSolution.Sealevel 489 490 # Eustatic + selfattraction + elastic + rotation run 491 md.solidearth.settings.selfattraction = 1 460 492 md.solidearth.settings.elastic = 1 461 493 md.solidearth.settings.rotation = 1 462 md = solve(md, 'Sealevelrise') 463 Srotation = md.results.SealevelriseSolution.Sealevel 494 md.solidearth.settings.viscous = 0 495 md = solve(md, 'Transient') 496 Srotation = md.results.TransientSolution.Sealevel 464 497 465 498 #Fields and tolerances to track changes 466 499 field_names = ['Eustatic', 'Rigid', 'Elastic', 'Rotation'] 467 500 field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13] 468 field_values = [Seustatic, S rigid, Selastic, Srotation]501 field_values = [Seustatic, Sselfattraction, Selastic, Srotation] -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2005.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 100: -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2005.py ¶
r26054 r26358 16 16 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700.) #700 km resolution mesh 17 17 18 # Parameterize solidearth solution 18 # Geometry for the bed, arbitrary thickness of 100 19 md.geometry.bed = np.zeros((md.mesh.numberofvertices, )) 20 md.geometry.base = md.geometry.bed 21 md.geometry.thickness = 100 * np.ones((md.mesh.numberofvertices, )) 22 md.geometry.surface = md.geometry.bed + md.geometry.thickness 23 19 24 # Solidearth loading #{{{ 20 md.solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, 1)) 21 md.solidearth.initialsealevel = np.zeros((md.mesh.numberofvertices, 1)) 22 md.dsl.global_average_thermosteric_sea_level_change = np.zeros((2, 1)) 23 md.dsl.sea_surface_height_change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 24 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 25 md.masstransport.spcthickness = np.append(md.geometry.thickness, 0) 26 md.smb.mass_balance = np.zeros((md.mesh.numberofvertices, )) 27 # Antarctica 28 xe = md.mesh.x[md.mesh.elements - 1].sum(axis=1) / 3 29 ye = md.mesh.y[md.mesh.elements - 1].sum(axis=1) / 3 30 ze = md.mesh.z[md.mesh.elements - 1].sum(axis=1) / 3 31 re = pow((pow(xe, 2) + pow(ye, 2) + pow(ze, 2)), 0.5) 25 32 26 # Antarctica 27 late = md.mesh.lat[md.mesh.elements - 1].sum(axis=1) / 3 28 longe = md.mesh.long[md.mesh.elements - 1].sum(axis=1) / 3 33 late = asind(ze / re) 34 longe = atan2d(ye, xe) 29 35 pos = np.where(late < -80)[0] 30 md.solidearth.surfaceload.icethicknesschange[pos] = -100 36 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 37 posant = pos 31 38 # Greenland 32 pos = np.where(np.logical_and.reduce((late > 70, late < 80, longe > -60, longe < -30)))[0] 33 md.solidearth.surfaceload.icethicknesschange[pos] = -100 39 pos = np.where(np.logical_and.reduce((late > 60, late < 90, longe > -75, longe < -15)))[0] 40 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 41 posgre = pos 34 42 35 43 # Elastic loading from love numbers 36 md.solidearth.lovenumbers = lovenumbers('maxdeg', 100 )44 md.solidearth.lovenumbers = lovenumbers('maxdeg', 1000) 37 45 #}}} 38 46 39 47 # Mask #{{{ 40 48 mask = gmtmask(md.mesh.lat, md.mesh.long) 49 oceanmask = -1 * np.ones((md.mesh.numberofvertices, 1)) 50 pos = np.where(mask == 0)[0] 51 oceanmask[pos] = 1 52 41 53 icemask = np.ones((md.mesh.numberofvertices, 1)) 42 pos = np.where(mask == 0)[0] 43 icemask[pos] = -1 44 pos = np.where(mask[md.mesh.elements - 1].sum(axis=1) < 3)[0] 45 icemask[md.mesh.elements[pos, :] - 1] = -1 54 # NOTE: Need to be careful here: when addressing with multidimensional array in 55 # MATLAB, only first column of values are used as indices 56 # 57 icemask[md.mesh.elements[posant][:,0] - 1] = -1 58 icemask[md.mesh.elements[posgre][:,0] - 1] = -1 59 46 60 md.mask.ice_levelset = icemask 47 md.mask.ocean_levelset = -icemask61 md.mask.ocean_levelset = oceanmask 48 62 49 # Make sure that the elements that have loads are fully grounded 50 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 51 md.mask.ocean_levelset[md.mesh.elements[pos, :] - 1] = 1 63 # Time stepping 64 md.timestepping.start_time = 0 65 md.timestepping.time_step = 1 66 md.timestepping.final_time = 10 52 67 53 # Make sure wherever there is an ice load, that the mask is set to ice: 54 #pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] # TODO: Do we need to do this twice? 55 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = -1 56 # }}} 57 58 md.solidearth.settings.ocean_area_scaling = 0 59 60 # Geometry for the bed; arbitrary 61 md.geometry.bed = -np.ones((md.mesh.numberofvertices, 1)) 68 # Masstransport 69 md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 70 md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 71 md.initialization.vx = np.zeros((md.mesh.numberofvertices, )) 72 md.initialization.vy = np.zeros((md.mesh.numberofvertices, )) 73 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices, )) 74 md.initialization.str = 0 62 75 63 76 # Materials … … 68 81 69 82 # Solution parameters 83 md.cluster.np = 3 70 84 md.solidearth.settings.reltol = np.nan 71 85 md.solidearth.settings.abstol = 1e-3 72 md.solidearth.settings.computesealevelchange = 1 86 md.solidearth.settings.sealevelloading = 1 87 md.solidearth.settings.isgrd = 1 88 md.solidearth.settings.ocean_area_scaling = 0 89 md.solidearth.settings.grdmodel = 1 73 90 74 # Max number of iterations reverted back to 10 (i.e. the original default value) 75 md.solidearth.settings.maxiter = 10 76 77 # Eustatic + rigid + elastic + rotation run 78 md.solidearth.settings.rigid = 1 91 md.solidearth.settings.selfattraction = 1 79 92 md.solidearth.settings.elastic = 1 80 93 md.solidearth.settings.rotation = 1 94 md.solidearth.settings.viscous = 0 81 95 82 # Transient settings 83 md.timestepping.start_time = 0 84 md.timestepping.final_time = 10 85 md.timestepping.time_step = 1 86 md.transient.isslc = 1 96 # Physics 87 97 md.transient.issmb = 0 88 md.transient.ismasstransport = 089 98 md.transient.isstressbalance = 0 90 99 md.transient.isthermal = 0 91 dh = np.asarray(md.solidearth.surfaceload.icethicknesschange).T 92 deltathickness = np.zeros((md.mesh.numberofelements + 1, 10)) 93 for i in range(10): 94 deltathickness[0:-1, i] = dh * (i + 1) 95 deltathickness[-1, :] = np.arange(0, 10, 1) 96 md.solidearth.surfaceload.icethicknesschange = deltathickness 100 md.transient.ismasstransport = 1 101 md.transient.isslc = 1 102 md.solidearth.requested_outputs = ['Sealevel'] 97 103 104 dh = md.masstransport.spcthickness 105 deltathickness = np.zeros((md.mesh.numberofvertices + 1, 10 + 1)) # NOTE: Need to add another row as it is added in loop in MATLAB, which causes a RuntimeError in Python 106 for i in range(10 + 1): 107 deltathickness[0:-1, i] = md.geometry.thickness + dh[0:-1] * i 108 deltathickness[-1, :] = np.arange(0, 10 + 1, 1) 109 md.masstransport.spcthickness = deltathickness 98 110 # Hack 99 111 md.geometry.surface = np.zeros((md.mesh.numberofvertices, 1)) … … 110 122 Seus10 = md.results.TransientSolution[10 - 1].Bslc 111 123 112 # Fields and tolerances to track changes124 # Fields and tolerances to track changes 113 125 field_names = ['Sealevel1', 'Sealevel5', 'Sealevel10', 'Seustatic10'] 114 126 field_tolerances = [1e-13, 1e-13, 1e-13, 1e-13] -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2006.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 100: -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2006.py ¶
r26054 r26358 7 7 from lovenumbers import * 8 8 from materials import * 9 from MatlabFuncs import * 9 10 from model import * 10 11 from nodalvalue import * … … 19 20 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700.) #700 km resolution mesh 20 21 21 # Parameterize solidearth solution 22 # Geometry for the bed, arbitrary thickness of 100 23 md.geometry.bed = np.zeros((md.mesh.numberofvertices, )) 24 md.geometry.base = md.geometry.bed 25 md.geometry.thickness = 100 * np.ones((md.mesh.numberofvertices, )) 26 md.geometry.surface = md.geometry.bed + md.geometry.thickness 27 22 28 # Solidearth loading #{{{ 23 md.solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, 1)) 24 md.solidearth.initialsealevel = np.zeros((md.mesh.numberofvertices, 1)) 25 md.dsl.global_average_thermosteric_sea_level_change = np.zeros((2, 1)) 26 md.dsl.sea_surface_height_change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 27 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1)) 28 29 md.masstransport.spcthickness = np.append(md.geometry.thickness, 0) 30 md.smb.mass_balance = np.zeros((md.mesh.numberofvertices, )) 29 31 # Antarctica 30 late = md.mesh.lat[md.mesh.elements - 1].sum(axis=1) / 3 31 longe = md.mesh.long[md.mesh.elements - 1].sum(axis=1) / 3 32 xe = md.mesh.x[md.mesh.elements - 1].sum(axis=1) / 3 33 ye = md.mesh.y[md.mesh.elements - 1].sum(axis=1) / 3 34 ze = md.mesh.z[md.mesh.elements - 1].sum(axis=1) / 3 35 re = pow((pow(xe, 2) + pow(ye, 2) + pow(ze, 2)), 0.5) 36 37 late = asind(ze / re) 38 longe = atan2d(ye, xe) 32 39 pos = np.where(late < -80)[0] 33 md.solidearth.surfaceload.icethicknesschange[pos] = -100 40 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 41 posant = pos 34 42 # Greenland 35 pos = np.where(np.logical_and.reduce((late > 70, late < 80, longe > -60, longe < -30)))[0] 36 md.solidearth.surfaceload.icethicknesschange[pos] = -100 43 pos = np.where(np.logical_and.reduce((late > 60, late < 90, longe > -75, longe < -15)))[0] 44 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 45 posgre = pos 37 46 38 47 # Elastic loading from love numbers … … 42 51 # Mask #{{{ 43 52 mask = gmtmask(md.mesh.lat, md.mesh.long) 53 oceanmask = -1 * np.ones((md.mesh.numberofvertices, 1)) 54 pos = np.where(mask == 0)[0] 55 oceanmask[pos] = 1 56 44 57 icemask = np.ones((md.mesh.numberofvertices, 1)) 45 pos = np.where(mask == 0)[0] 46 icemask[pos] = -1 47 pos = np.where(mask[md.mesh.elements - 1].sum(axis=1) < 3)[0] 48 icemask[md.mesh.elements[pos, :] - 1] = -1 58 # NOTE: Need to be careful here: when addressing with multidimensional array in 59 # MATLAB, only first column of values are used as indices 60 # 61 icemask[md.mesh.elements[posant][:,0] - 1] = -1 62 icemask[md.mesh.elements[posgre][:,0] - 1] = -1 63 49 64 md.mask.ice_levelset = icemask 50 md.mask.ocean_levelset = -icemask 51 52 # Make sure that the elements that have loads are fully grounded 53 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 54 md.mask.ocean_levelset[md.mesh.elements[pos, :] - 1] = 1 55 56 # Make sure wherever there is an ice load, that the mask is set to ice: 57 #pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] # TODO: Do we need to do this twice? 58 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = -1 59 # }}} 60 61 md.solidearth.settings.ocean_area_scaling = 0 62 63 # Geometry for the bed; arbitrary 64 md.geometry.bed = -np.ones((md.mesh.numberofvertices, 1)) 65 md.mask.ocean_levelset = oceanmask 66 67 # Time stepping 68 md.timestepping.start_time = 0 69 md.timestepping.time_step = 1 70 md.timestepping.final_time = 10 71 72 # Masstransport 73 md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 74 md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 75 md.initialization.vx = np.zeros((md.mesh.numberofvertices, )) 76 md.initialization.vy = np.zeros((md.mesh.numberofvertices, )) 77 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices, )) 78 md.initialization.str = 0 65 79 66 80 # Materials … … 71 85 72 86 # Solution parameters 87 md.cluster.np = 3 73 88 md.solidearth.settings.reltol = np.nan 74 89 md.solidearth.settings.abstol = 1e-3 75 md.solidearth.settings.computesealevelchange = 1 76 77 # Max number of iterations reverted back to 10 (i.e. the original default value) 78 md.solidearth.settings.maxiter = 10 79 80 # Eustatic + rigid + elastic + rotation run 81 md.solidearth.settings.rigid = 1 90 md.solidearth.settings.sealevelloading = 1 91 md.solidearth.settings.isgrd = 1 92 md.solidearth.settings.ocean_area_scaling = 0 93 md.solidearth.settings.grdmodel = 1 94 95 md.solidearth.settings.selfattraction = 1 82 96 md.solidearth.settings.elastic = 1 83 97 md.solidearth.settings.rotation = 1 84 85 # Transient settings 86 md.timestepping.start_time = 0 87 md.timestepping.final_time = 10 88 md.timestepping.time_step = 1 89 md.transient.isslc = 1 98 md.solidearth.settings.viscous = 0 99 100 # Physics 90 101 md.transient.issmb = 0 91 md.transient.ismasstransport = 092 102 md.transient.isstressbalance = 0 93 103 md.transient.isthermal = 0 94 dh = np.asarray(md.solidearth.surfaceload.icethicknesschange).T 95 deltathickness = np.zeros((md.mesh.numberofelements + 1, 10)) 96 for i in range(10): 97 deltathickness[0:-1, i] = dh * (i + 1) 98 deltathickness[-1, :] = np.arange(0, 10, 1) 99 md.solidearth.surfaceload.icethicknesschange = deltathickness 104 md.transient.ismasstransport = 1 105 md.transient.isslc = 1 106 md.solidearth.requested_outputs = ['Sealevel'] 107 108 dh = md.masstransport.spcthickness 109 deltathickness = np.zeros((md.mesh.numberofvertices + 1, 10 + 1)) # NOTE: Need to add another row as it is added in loop in MATLAB, which causes a RuntimeError in Python 110 for i in range(10 + 1): 111 deltathickness[0:-1, i] = md.geometry.thickness + dh[0:-1] * i 112 deltathickness[-1, :] = np.arange(0, 10 + 1, 1) 113 md.masstransport.spcthickness = deltathickness 100 114 101 115 # Hack … … 109 123 npart = 1 110 124 nt = 1 111 partition = - np.ones((md.mesh.numberofelements, 1))125 partition = -1 * np.ones((md.mesh.numberofelements, 1)) 112 126 pos = np.where(late < -80)[0] 113 127 partition[pos] = 0 -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2007.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary … … 50 49 md.solidearth.settings.horiz=1; 51 50 52 %Physics: 51 %Physics: bary 53 52 md.transient.issmb=0; 54 53 md.transient.isstressbalance=0; -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2008.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 100: -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2010.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 %Geometry for the bed, arbitrary thickness of 100 0:7 %Geometry for the bed, arbitrary thickness of 100: 9 8 md.geometry.bed=-ones(md.mesh.numberofvertices,1); 10 9 md.geometry.base=md.geometry.bed; … … 12 11 md.geometry.surface=md.geometry.bed+md.geometry.thickness; 13 12 14 15 13 %parameterize slc solution: 16 14 %solidearth loading: {{{ 17 15 md.masstransport.spcthickness=[md.geometry.thickness;0]; 18 16 md.smb.mass_balance=zeros(md.mesh.numberofvertices,1); 19 20 17 21 18 xe=md.mesh.x(md.mesh.elements)*[1;1;1]/3; … … 46 43 md.mask.ocean_levelset=oceanmask; 47 44 48 % use model representation of oce n area (not the true area)45 % use model representation of ocean area (not the true area) 49 46 md.solidearth.settings.ocean_area_scaling = 0; 50 47 … … 71 68 md.solidearth.settings.grdmodel=1; 72 69 md.solidearth.settings.horiz=1; 73 md.solidearth.requested_outputs={'Sealevel','SealevelBarystaticIceArea','SealevelBarystaticIceLoad','SealevelBarystaticIceMask','SealevelBarystaticIceLatbar' 70 md.solidearth.requested_outputs={'Sealevel','SealevelBarystaticIceArea','SealevelBarystaticIceLoad','SealevelBarystaticIceMask','SealevelBarystaticIceLatbar','SealevelBarystaticIceLongbar'}; 74 71 75 72 %Physics: … … 79 76 md.transient.ismasstransport=1; 80 77 md.transient.isslc=1; 81 78 82 79 md.timestepping.start_time=0; 83 80 md.timestepping.time_step=1; … … 117 114 moi_yz = sum(-loadice.*areaice.*rad_e^2.*sin(lat).*cos(lat).*sin(lon)); 118 115 moi_zz = sum(-loadice.*areaice.*rad_e^2.*(1.0-sin(lat).^2)); 119 theoretical_value_check=[moixz/moi_xz moiyz/moi_yz moizz/moi zz]116 theoretical_value_check=[moixz/moi_xz moiyz/moi_yz moizz/moi_zz] 120 117 % }}} 121 118 122 119 %Fields and tolerances to track changes 123 120 field_names ={'eus','slc','moixz','moiyz','moizz'}; 124 field_tolerances={1e-13,1e-13,1e-13,1e-13 };121 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13}; 125 122 field_values={eus,slc,moixz,moiyz,moizz}; 126 123 -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2010.py ¶
r25956 r26358 1 1 #Test Name: MomentOfIntertia 2 from socket import gethostname3 4 2 import numpy as np 5 3 … … 7 5 from gmtmask import * 8 6 from lovenumbers import * 7 from MatlabFuncs import * 9 8 from model import * 10 9 from paterson import * … … 12 11 13 12 14 # mesh earth:13 # Mesh earth 15 14 md = model() 16 rad_e = 6.371012 * 1e3 # mean radius of Earth, km 17 md.mesh = gmshplanet('radius', rad_e, 'resolution', 1000.0) # km resolution 15 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700.) #700 km resolution mesh 18 16 19 #parameterize solidearth solution: 20 #solidearth loading: {{{ 21 late = md.mesh.lat[md.mesh.elements - 1].sum(axis=1) / 3 22 longe = md.mesh.long[md.mesh.elements - 1].sum(axis=1) / 3 17 # Geometry for the bed, arbitrary thickness of 100 18 md.geometry.bed = -1 * np.ones((md.mesh.numberofvertices, )) 19 md.geometry.base = md.geometry.bed 20 md.geometry.thickness = 100 * np.ones((md.mesh.numberofvertices, )) 21 md.geometry.surface = md.geometry.bed + md.geometry.thickness 23 22 24 md.solidearth.surfaceload.icethicknesschange = np.zeros((md.mesh.numberofelements, 1)) 25 pos = np.intersect1d(np.array(np.where(late < -75)), np.array(np.where(longe > 0))) 26 #NOTE: Python does not include last element in array slices: (6:7) -> [5:7] 27 md.s olidearth.surfaceload.icethicknesschange[pos[5:7]] = -123 # Parameterize SLC solution 24 # Solidearth loading {{{ 25 md.masstransport.spcthickness = np.append(md.geometry.thickness, 0) 26 md.smb.mass_balance = np.zeros((md.mesh.numberofvertices, )) 28 27 29 md.solidearth.initialsealevel = np.zeros(md.mesh.numberofvertices) 30 md.dsl.global_average_thermosteric_sea_level_change = np.zeros((2, 1)) 31 md.dsl.sea_surface_height_change_above_geoid = np.zeros((md.mesh.numberofvertices + 1, 1)) 32 md.dsl.sea_water_pressure_change_at_sea_floor = np.zeros((md.mesh.numberofvertices + 1, 1))28 xe = md.mesh.x[md.mesh.elements - 1].sum(axis=1) / 3 29 ye = md.mesh.y[md.mesh.elements - 1].sum(axis=1) / 3 30 ze = md.mesh.z[md.mesh.elements - 1].sum(axis=1) / 3 31 re = pow((pow(xe, 2) + pow(ye, 2) + pow(ze, 2)), 0.5) 33 32 34 md.solidearth.settings.ocean_area_scaling = 1 33 late = asind(ze / re) 34 longe = atan2d(ye, xe) 35 # Greenland 36 pos = np.where(np.logical_and.reduce((late > 60, late < 90, longe > -75, longe < -15)))[0] 37 md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] = md.masstransport.spcthickness[md.mesh.elements[pos, :] - 1] - 100 38 posice = pos 35 39 36 # elastic loading from love numbers:37 md.solidearth.lovenumbers = lovenumbers('maxdeg', 100 0)40 # Elastic loading from love numbers 41 md.solidearth.lovenumbers = lovenumbers('maxdeg', 100) 38 42 39 43 #}}} … … 41 45 mask = gmtmask(md.mesh.lat, md.mesh.long) 42 46 icemask = np.ones((md.mesh.numberofvertices, 1)) 47 icemask[md.mesh.elements[posice, :] - 1] = -0.5 48 49 oceanmask = -1 * np.ones((md.mesh.numberofvertices, 1)) 43 50 pos = np.where(mask == 0)[0] 44 icemask[pos] = -145 pos = np.where(mask[md.mesh.elements - 1].sum(axis=1) < 3)[0] 46 icemask[md.mesh.elements[pos, :] - 1] = -1 51 oceanmask[pos] = 1 52 icemask[np.logical_not(pos).astype(int)] = 1 53 47 54 md.mask.ice_levelset = icemask 48 md.mask.ocean_levelset = -icemask55 md.mask.ocean_levelset = oceanmask 49 56 50 #make sure that the elements that have loads are fully grounded 51 pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] 52 md.mask.ocean_levelset[md.mesh.elements[pos, :] - 1] = 1 57 # Use model representation of ocean area (not the true area) 58 md.solidearth.settings.ocean_area_scaling = 0 53 59 54 #make sure wherever there is an ice load, that the mask is set to ice: 55 md.mask.ice_levelset = np.ones((md.mesh.numberofvertices, 1)) 56 #pos = np.nonzero(md.solidearth.surfaceload.icethicknesschange)[0] # Do we need to do this twice? 57 md.mask.ice_levelset[md.mesh.elements[pos, :] - 1] = -1 58 # }}} 60 # Materials 61 md.initialization.temperature = 273.25 * np.ones((md.mesh.numberofvertices, 1)) 62 md.initialization.sealevel = np.zeros((md.mesh.numberofvertices, 1)) 63 md.initialization.str = 0 59 64 60 #geometry {{{ 61 di = md.materials.rho_ice / md.materials.rho_water 62 md.geometry.thickness = np.ones((md.mesh.numberofvertices, 1)) 63 md.geometry.surface = (1 - di) * np.zeros((md.mesh.numberofvertices, 1)) 64 md.geometry.base = md.geometry.surface - md.geometry.thickness 65 md.geometry.bed = md.geometry.base 66 # }}} 67 #materials {{{ 68 md.initialization.temperature = 273.25 * np.ones((md.mesh.numberofvertices, 1)) 69 md.materials.rheology_B = paterson(md.initialization.temperature) 70 md.materials.rheology_n = 3 * np.ones((md.mesh.numberofelements, 1)) 71 # }}} 72 #Miscellaneous {{{ 65 md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 66 md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices, )) 67 md.initialization.vx = np.zeros((md.mesh.numberofvertices, )) 68 md.initialization.vy = np.zeros((md.mesh.numberofvertices, )) 69 70 # Miscellaneous 73 71 md.miscellaneous.name = 'test2010' 74 # }}} 75 # Solution parameters {{{72 73 # Solution parameters 76 74 md.solidearth.settings.reltol = np.nan 77 75 md.solidearth.settings.abstol = 1e-3 78 md.solidearth.settings.computesealevelchange = 1 79 # }}} 76 md.solidearth.settings.sealevelloading = 0 77 md.solidearth.settings.grdocean = 1 78 md.solidearth.settings.isgrd = 1 79 md.solidearth.settings.ocean_area_scaling = 0 80 md.solidearth.settings.grdmodel = 1 81 md.solidearth.settings.horiz = 1 82 md.solidearth.requested_outputs = [ 83 'Sealevel', 84 'SealevelBarystaticIceArea', 85 'SealevelBarystaticIceLoad', 86 'SealevelBarystaticIceMask', 87 'SealevelBarystaticIceLatbar', 88 'SealevelBarystaticIceLongbar' 89 ] 80 90 81 #eustatic + rigid + elastic run: 82 md.solidearth.settings.rigid = 1 91 # Physics 92 md.transient.issmb = 0 93 md.transient.isstressbalance = 0 94 md.transient.isthermal = 0 95 md.transient.ismasstransport = 1 96 md.transient.isslc = 1 97 98 md.timestepping.start_time = 0 99 md.timestepping.time_step = 1 100 md.timestepping.final_time = 1 101 102 # Eustatic + selfattraction + elastic + rotation run 103 md.solidearth.settings.selfattraction = 1 83 104 md.solidearth.settings.elastic = 1 84 105 md.solidearth.settings.rotation = 1 85 md.cluster = generic('name', gethostname(), 'np', 3) 106 md.solidearth.settings.viscous = 0 107 md.cluster = generic('name', oshostname(), 'np', 3) 108 md = solve(md, 'Transient') 86 109 110 moi_p = md.solidearth.rotational.polarmoi 111 moi_e = md.solidearth.rotational.equatorialmoi 112 tide_love_k2 = md.solidearth.lovenumbers.tk[2] 113 load_love_k2 = md.solidearth.lovenumbers.k[2] 114 tide_love_k2secular = md.solidearth.lovenumbers.tk2secular 87 115 # uncomment following 2 lines for 88 md = solve(md, 'Sealevelrise') 89 eus = md.results.SealevelriseSolution.Bslc 90 slc = md.results.SealevelriseSolution.Sealevel 91 moixz = md.results.SealevelriseSolution.SealevelInertiaTensorXZ 92 moiyz = md.results.SealevelriseSolution.SealevelInertiaTensorYZ 93 moizz = md.results.SealevelriseSolution.SealevelInertiaTensorZZ 116 eus = md.results.TransientSolution.Bslc 117 slc = md.results.TransientSolution.Sealevel 118 moixz = md.results.TransientSolution.SealevelInertiaTensorXZ / (1 / (1 - tide_love_k2 / tide_love_k2secular) * (1 + load_love_k2) / (moi_p - moi_e)) 119 moiyz = md.results.TransientSolution.SealevelInertiaTensorYZ / (1 / (1 - tide_love_k2 / tide_love_k2secular) * (1 + load_love_k2) / (moi_p - moi_e)) 120 moizz = md.results.TransientSolution.SealevelInertiaTensorZZ / ( -(1 + load_love_k2) / moi_p) 121 122 areaice = md.results.TransientSolution.SealevelBarystaticIceArea 123 loadice = md.results.TransientSolution.SealevelBarystaticIceLoad 94 124 95 125 # analytical moi = > just checking FOR ICE only!!! {{{ 96 # ...have to mute**solidearth induced MOI in Tria.cpp**prior to the comparison 97 #rad_e = rad_e * 1e3 # now in meters 98 #areas = GetAreasSphericalTria(md.mesh.elements, md.mesh.lat, md.mesh.long, rad_e) 99 #lat = late * pi / 180 lon = longe * pi / 180 100 #moi_xz = sum(-md.materials.rho_freshwater. * md.solidearth.deltathickness. * areas. * rad_e^2. * sin(lat). * cos(lat). * cos(lon)) 101 #moi_yz = sum(-md.materials.rho_freshwater. * md.solidearth.deltathickness. * areas. * rad_e^2. * sin(lat). * cos(lat). * sin(lon)) 126 # ...have to mute ** slc induced MOI in Tria.cpp**prior to the comparison 127 rad_e = md.solidearth.planetradius 128 129 lat = md.results.TransientSolution.SealevelBarystaticIceLatbar * np.pi / 180 130 lon = md.results.TransientSolution.SealevelBarystaticIceLongbar * np.pi / 180 131 moi_xz = sum(-loadice * areaice * pow(rad_e, 2) * np.sin(lat) * np.cos(lat) * np.cos(lon)) 132 moi_yz = sum(-loadice * areaice * pow(rad_e, 2) * np.sin(lat) * np.cos(lat) * np.sin(lon)) 133 moi_zz = sum(-loadice * areaice * pow(rad_e, 2) * (1 - np.sin(lat) ** 2)) 134 theoretical_value_check = [moixz / moi_xz, moiyz / moi_yz, moizz / moi_zz] 135 print('\ntheoretical_value_check =\n') 136 print('\t{}\n'.format(theoretical_value_check)) 102 137 # }}} 103 138 -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2011.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 1000: -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2021.m ¶
r25956 r26358 1 %Test Name: SESAWslc 2 % SESAW method of solving GRD slc 3 % reference: Adhikari et al., 2016, GMD, https://doi.org/10.5194/gmd-9-1087-2016 1 %Test Name: SESAWslc 2 % SESAW method of solving GRD slc 3 % reference: Adhikari et al., 2016, GMD, https://doi.org/10.5194/gmd-9-1087-2016 4 4 5 5 md=model; 6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution', 500); %500 km resolution mesh6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); %700 km resolution mesh 7 7 8 % read in love numbers. 8 % read in love numbers. 9 9 love_numbers = lovenumbers('maxdeg',10000); 10 10 11 % compute Green's functions 12 disp(['Computing Greens functions...']); 13 [Grigid,Gelastic,Uelastic]=greensfunctions(md.mesh.elements,md.mesh.lat,md.mesh.long,love_numbers); 11 % compute Green's functions 12 disp(['Computing Greens functions...']); 13 [Grigid,Gelastic,Uelastic]=greensfunctions(md.mesh.elements,md.mesh.lat,md.mesh.long,love_numbers); 14 14 greens.Grigid = Grigid; 15 15 greens.Gelast = Gelastic; … … 17 17 clearvars Grigid Gelastic Uelastic 18 18 19 % compute lat,long at elemental centroids. 20 [late,longe] = latelonge(md.mesh.elements,md.mesh.lat,md.mesh.long); 19 % compute lat,long at elemental centroids. 20 [late,longe] = latelonge(md.mesh.elements,md.mesh.lat,md.mesh.long); 21 21 22 % load GRACE data. Same as used in test2020. 23 load('../Data/GRACE_JPL_April2002_WEH.mat'); 22 % load GRACE data. Same as used in test2020. 23 load('../Data/GRACE_JPL_April2002_WEH.mat'); 24 24 lat = repmat(lat',720,1); 25 25 lon = repmat(lon,1,360); 26 F = scatteredInterpolant(lat(:),lon(:),weh(:)); 26 F = scatteredInterpolant(lat(:),lon(:),weh(:)); 27 27 28 % map GRACE data onto elemental centorids. 28 % map GRACE data onto elemental centorids. 29 29 loads_element = F(late,longe); 30 30 loads_element(isnan(loads_element))=0; 31 31 32 % ocean mask mapped onto the elemental centroids. 33 ocean_element = gmtmask(late,longe); 32 % ocean mask mapped onto the elemental centroids. 33 ocean_element = gmtmask(late,longe); 34 34 35 35 % Area of individual elements 36 area_element=GetAreasSphericalTria(md.mesh.elements,md.mesh.lat,md.mesh.long,md.solidearth.planetradius); 36 area_element=GetAreasSphericalTria(md.mesh.elements,md.mesh.lat,md.mesh.long,md.solidearth.planetradius); 37 37 38 % Parameters input for SESAWslc solver. 39 para.ocean_element = ocean_element; 40 para.loads_element = loads_element; 41 para.area_element = area_element; 42 para.earth_density = md.materials.earth_density; 38 % Parameters input for SESAWslc solver. 39 para.ocean_element = ocean_element; 40 para.loads_element = loads_element; 41 para.area_element = area_element; 42 para.earth_density = md.materials.earth_density; 43 43 para.ocean_density = md.materials.rho_water; 44 para.loads_density = md.materials.rho_freshwater; % if land loads are ice, use ice density. 44 para.loads_density = md.materials.rho_freshwater; % if land loads are ice, use ice density. 45 45 46 para.rel_tol = 1e-5; 46 para.rel_tol = 1e-5; 47 47 48 % solid earth rheology. 49 para.solidearth = 'rigid'; % 'rigid' or 'elastic'; 48 % solid earth rheology. 49 para.solidearth = 'rigid'; % 'rigid' or 'elastic'; 50 50 51 % rotational feedbacks. 52 para.rotational.flag = 0; % Rotational flag on (1) or off (0) 53 para.rotational.earth_radius = md.solidearth.planetradius; 54 para.rotational.load_love_k2 = love_numbers.k(3); 55 para.rotational.tide_love_k2 = love_numbers.tk(3); 56 para.rotational.tide_love_h2 = love_numbers.th(3); 57 para.rotational.tide_love_k2secular = love_numbers.tk2secular; 58 para.rotational.moi_p = md.solidearth.rotational.polarmoi; 59 para.rotational.moi_e = md.solidearth.rotational.equatorialmoi; 51 % rotational feedbacks. 52 para.rotational.flag = 0; % Rotational flag on (1) or off (0) 53 para.rotational.earth_radius = md.solidearth.planetradius; 54 para.rotational.load_love_k2 = love_numbers.k(3); 55 para.rotational.tide_love_k2 = love_numbers.tk(3); 56 para.rotational.tide_love_h2 = love_numbers.th(3); 57 para.rotational.tide_love_k2secular = love_numbers.tk2secular; 58 para.rotational.moi_p = md.solidearth.rotational.polarmoi; 59 para.rotational.moi_e = md.solidearth.rotational.equatorialmoi; 60 60 para.rotational.omega = md.solidearth.rotational.angularvelocity; 61 61 62 % solve: Rigid without rotational feedbacks. 63 disp(['Solving sesaw-slc for Rigid Earth WITHOUT rotational feedback...']); 64 [eus_rigid,rsl_rigid] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 62 % solve: Rigid without rotational feedbacks. 63 disp(['Solving sesaw-slc for Rigid Earth WITHOUT rotational feedback...']); 64 [eus_rigid,rsl_rigid] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 65 65 66 % solve: Rigid with rotational feedbacks. 67 para.rotational.flag = 1; 68 disp(['Solving sesaw-slc for Rigid Earth WITH rotational feedback...']); 69 [eus_rigid_rot,rsl_rigid_rot] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 66 % solve: Rigid with rotational feedbacks. 67 para.rotational.flag = 1; 68 disp(['Solving sesaw-slc for Rigid Earth WITH rotational feedback...']); 69 [eus_rigid_rot,rsl_rigid_rot] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 70 70 71 % solve: Elastic with rotational feedbacks. 72 para.solidearth = 'elastic'; 73 disp(['Solving sesaw-slc for Elastic Earth WITH rotational feedback...']); 74 [eus_elast_rot,rsl_elast_rot] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 71 % solve: Elastic with rotational feedbacks. 72 para.solidearth = 'elastic'; 73 disp(['Solving sesaw-slc for Elastic Earth WITH rotational feedback...']); 74 [eus_elast_rot,rsl_elast_rot] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 75 75 76 % solve: Elastic with rotational feedbacks. 77 para.rotational.flag = 0; 78 disp(['Solving sesaw-slc for Elastic Earth WITHOUT rotational feedback...']); 79 [eus_elast,rsl_elast] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 76 % solve: Elastic with rotational feedbacks. 77 para.rotational.flag = 0; 78 disp(['Solving sesaw-slc for Elastic Earth WITHOUT rotational feedback...']); 79 [eus_elast,rsl_elast] = SESAWslr(md.mesh.elements,md.mesh.lat,md.mesh.long,greens,para); 80 80 81 81 %Fields and tolerances to track changes 82 82 field_names={'eus_rigid','eus_rigid_rot','eus_elast','eus_elast_rot',... 83 83 'rsl_rigid','rsl_rigid_rot','rsl_elast','rsl_elast_rot'}; 84 84 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13}; 85 85 field_values={eus_rigid,eus_rigid_rot,eus_elast,eus_elast_rot,... 86 86 rsl_rigid,rsl_rigid_rot,rsl_elast,rsl_elast_rot}; 87 87 -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2084.m ¶
r26242 r26358 9 9 md.cluster=generic('name',oshostname(),'np',1); 10 10 11 % set validation=1 for comparing against the Spada benchark. 11 % set validation=1 for comparing against the Spada benchark. 12 12 validation=0; 13 13 … … 26 26 md.materials.lame_lambda=md.materials.lame_mu*0+5e17; 27 27 md.materials.issolid=[1 0 1 1 1 1]'; 28 md.materials.rheologymodel= 0*ones(md.materials.numlayers,1);28 md.materials.rheologymodel=zeros(md.materials.numlayers,1); 29 29 md.materials.burgers_mu=md.materials.lame_mu/3; 30 30 md.materials.burgers_viscosity=md.materials.viscosity/10; … … 44 44 md.love.integration_steps_per_layer=200; 45 45 46 47 46 md.love.istemporal=1; 48 47 md.love.n_temporal_iterations=8; … … 51 50 md.love.love_kernels=1; 52 51 if md.love.istemporal 53 md.love=md.love.build_frequencies_from_time;52 md.love=md.love.build_frequencies_from_time; 54 53 end 55 54 … … 64 63 %hs=permute(hs,[3 2 1]); 65 64 %[ht,h,hsig,hconv]=postwidder_love(md,md.love.n_temporal_iterations,t,hs,1e-5); 66 67 68 65 69 66 %Fields and tolerances to track changes … … 76 73 (md.results.LoveSolution.LoveLr(:,1)),... 77 74 }; 78 79 75 80 76 % validate elastic loading solutions against the Spada benchmark. {{{ -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2084.py ¶
r24256 r26358 1 1 #Test Name: GiaCaron 2 #Forward Love number solution for a viscoelastic earth, 3 #model M3 - L70 - V01 from Spada, G., Barletta, V. R., Klemann, V., Riva, R. E. M., 4 #Martinec, Z., Gasperini, P., Lund, B., Wolf, D., Vermeersen, L. L. A. 5 #and King, M. A. (2011), A benchmark study for glacial isostatic 6 #adjustment codes. Geophysical Journal International, 7 #185: 106 - 132. doi:10.1111 / j.1365 - 246X.2011.04952.x 8 9 from model import * 10 from socket import gethostname 11 from solve import * 12 from numpy import * 2 # Forward Love number solution for a viscoelastic earth, model M3-L70-V01 from 3 # Spada, G., Barletta, V. R., Klemann, V., Riva, R. E. M., Martinec, Z., 4 # Gasperini, P., Lund, B., Wolf, D., Vermeersen, L. L. A. and King, M. A. 5 # (2011), A benchmark study for glacial isostatic adjustment codes. Geophysical 6 # Journal International, 185: 106--132. doi:10.1111/j.1365-246X.2011.04952.x 7 8 import numpy as np 9 13 10 from generic import generic 14 11 from materials import * 12 from MatlabFuncs import * 13 from model import * 14 from solve import * 15 15 16 16 md = model() 17 md.cluster = generic('name', gethostname(), 'np', 1) 17 md.cluster = generic('name', oshostname(), 'np', 1) 18 19 # Set validation=1 for comparing against the Spada benchark 20 validation = 0 18 21 19 22 md.materials = materials('litho') … … 33 36 md.materials.viscosity = np.array([0, 0, 2.0000e+00, 1.0000e+00, 1.0000e+00, 34 37 1.0000e+25]).reshape(-1, 1) * 1e21 35 md.materials.lame_lambda = np.array(md.materials.lame_mu) * 0 + 5e1 438 md.materials.lame_lambda = np.array(md.materials.lame_mu) * 0 + 5e17 36 39 md.materials.issolid = np.array([1, 0, 1, 1, 1, 1]).reshape(-1, 1) 37 md.materials.isburgers = np.zeros((md.materials.numlayers, 1)) 40 md.materials.rheologymodel = np.zeros((md.materials.numlayers, 1)) 41 md.materials.burgers_mu = md.materials.lame_mu / 3 42 md.materials.burgers_viscosity = md.materials.viscosity / 10 43 md.materials.ebm_alpha = np.ones((md.materials.numlayers, 1)) * 0.9 44 md.materials.ebm_delta = np.ones((md.materials.numlayers, 1)) * 0.2 45 md.materials.ebm_taul = np.ones((md.materials.numlayers, 1)) * 54 * 60 # 54 min 46 md.materials.ebm_tauh = np.ones((md.materials.numlayers, 1)) * 18.6 * cst / 1e3 # 18.6 yr 47 #setlitho2prem(md.materials) 38 48 39 49 md.love.allow_layer_deletion = 1 40 md.love.frequencies = (np.array([0]) * 2 * pi).reshape(-1, 1) / cst 41 md.love.nfreq = len(md.love.frequencies) 50 md.love.frequencies = (np.array([0]) * 2 * np.pi).reshape(-1, 1) / cst 51 md.love.nfreq = len(md.love.frequencies) 52 md.love.sh_nmin = 1 42 53 md.love.sh_nmax = 256 43 44 md.materials.burgers_mu = md.materials.lame_mu 45 md.materials.burgers_viscosity = md.materials.viscosity 46 47 md = solve(md, 'lv') 54 md.love.underflow_tol = 1e-20 55 md.love.Gravitational_Constant = 6.6732e-11 56 md.love.integration_steps_per_layer = 200 57 58 md.love.istemporal = 1 59 md.love.n_temporal_iterations = 8 60 #md.love.time = np.logspace(-4, 5, 2).reshape(-1, 1) * cst 61 md.love.time = np.logspace(-1, 2, 50).reshape(-1, 1) * cst 62 md.love.love_kernels = 1 63 if md.love.istemporal: 64 md.love = md.love.build_frequencies_from_time 65 66 md = solve(md, 'lv') 67 68 ht2 = md.results.LoveSolution.LoveHr 69 lt2 = md.results.LoveSolution.LoveLr 70 kt2 = md.results.LoveSolution.LoveKr 71 t = md.love.time / cst * 1e3 48 72 49 73 #Fields and tolerances to track changes 50 74 #loading love numbers 51 75 field_names = ['LoveH_loading_elastic', 'LoveK_loading_elastic', 'LoveL_loading_elastic'] 52 field_tolerances = [4.3e-9, 4.3e-9, 4.3e-9] 53 field_values = [np.array(md.results.LoveSolution.LoveHr)[:, 0], 54 np.array(md.results.LoveSolution.LoveKr)[:, 0], 55 np.array(md.results.LoveSolution.LoveLr)[:, 0]] 56 57 md.love.frequencies = (np.array([1e-3, 1e-2, 1e-1, 1, -1e-3, -1e-2, -1e-1, -1]) * 2 * pi).reshape(-1, 1) / cst 76 field_tolerances = [2.0e-8, 2.0e-8, 2.0e-8] 77 field_values = [ 78 np.array(md.results.LoveSolution.LoveHr)[:, 0], 79 np.array(md.results.LoveSolution.LoveKr)[:, 0], 80 np.array(md.results.LoveSolution.LoveLr)[:, 0] 81 ] 82 83 # Validate elastic loading solutions against the Spada benchmark {{{ 84 85 # TODO: 86 # - Implement read from file and comparison 87 # - Implement plot 88 # 89 90 #}}} 91 92 md.love.frequencies = (np.array([1e-3, 1e-2, 1e-1, 1, -1e-3, -1e-2, -1e-1, -1]) * 2 * np.np.pi).reshape(-1, 1) / cst 58 93 md.love.nfreq = len(md.love.frequencies) 59 94 md.love.sh_nmax = 256 … … 64 99 65 100 #Fields and tolerances to track changes 66 #loading love numbers67 101 field_names += ['LoveH_loading_realpart', 'LoveK_loading_realpart', 'LoveL_loading_realpart', 'LoveH_loading_imagpart', 'LoveK_loading_imagpart', 'LoveL_loading_imagpart'] 68 102 field_tolerances += [5e-7, 5e-7, 5e-7, 5e-7, 5e-7, 5e-7] 69 field_values += [np.array(md.results.LoveSolution.LoveHr), 70 np.array(md.results.LoveSolution.LoveKr), 71 np.array(md.results.LoveSolution.LoveLr), 72 np.array(md.results.LoveSolution.LoveHi), 73 np.array(md.results.LoveSolution.LoveKi), 74 np.array(md.results.LoveSolution.LoveLi)] 103 field_values += [ 104 np.array(md.results.LoveSolution.LoveHr), 105 np.array(md.results.LoveSolution.LoveKr), 106 np.array(md.results.LoveSolution.LoveLr), 107 np.array(md.results.LoveSolution.LoveHi), 108 np.array(md.results.LoveSolution.LoveKi), 109 np.array(md.results.LoveSolution.LoveLi) 110 ] 75 111 76 112 md.love.forcing_type = 9 77 113 md.love.sh_nmin = 2 78 md.love.frequencies = ((np.array([0, 1e-3, 1e-2, 1e-1, 1, -1e-3, -1e-2, -1e-1, -1]) * 2 * pi).reshape(-1, 1) / cst) 79 md.love.nfreq = len(md.love.frequencies) 80 81 md = solve(md, 'lv') 114 md.love.frequencies = ((np.array([0, 1e-3, 1e-2, 1e-1, 1, -1e-3, -1e-2, -1e-1, -1]) * 2 * np.pi).reshape(-1, 1) / cst) 115 md.love.nfreq = len(md.love.frequencies) 116 md = solve(md, 'lv') 117 118 # Validate elastic tidal solutions against the Spada benchmark #{{{ 119 120 # TODO: 121 # - Implement read from file and comparison 122 # - Implement plot 123 # 124 125 #}}} 82 126 83 127 #tidal love numbers, check 84 128 field_names += ['LoveH_tidal_elastic', 'LoveK_tidal_elastic', 'LoveL_tidal_elastic', 'LoveH_tidal_realpart', 'LoveK_tidal_realpart', 'LoveL_tidal_realpart', 'LoveH_tidal_imagpart', 'LoveK_tidal_imagpart', 'LoveL_tidal_imagpart'] 85 129 field_tolerances += [8e-6, 8e-6, 8e-6, 8e-6, 8e-6, 8e-6, 8e-6, 8e-6, 8e-6] 86 field_values += [np.array(md.results.LoveSolution.LoveHr)[:, 0], 87 np.array(md.results.LoveSolution.LoveKr)[:, 0], 88 np.array(md.results.LoveSolution.LoveLr)[:, 0], 89 np.array(md.results.LoveSolution.LoveHr)[:, 1:], 90 np.array(md.results.LoveSolution.LoveKr)[:, 1:], 91 np.array(md.results.LoveSolution.LoveLr)[:, 1:], 92 np.array(md.results.LoveSolution.LoveHi)[:, 1:], 93 np.array(md.results.LoveSolution.LoveKi)[:, 1:], 94 np.array(md.results.LoveSolution.LoveLi)[:, 1:]] 95 96 #Many layers PREM - based model 130 field_values += [ 131 np.array(md.results.LoveSolution.LoveHr)[:, 0], 132 np.array(md.results.LoveSolution.LoveKr)[:, 0], 133 np.array(md.results.LoveSolution.LoveLr)[:, 0], 134 np.array(md.results.LoveSolution.LoveHr)[:, 1:], 135 np.array(md.results.LoveSolution.LoveKr)[:, 1:], 136 np.array(md.results.LoveSolution.LoveLr)[:, 1:], 137 np.array(md.results.LoveSolution.LoveHi)[:, 1:], 138 np.array(md.results.LoveSolution.LoveKi)[:, 1:], 139 np.array(md.results.LoveSolution.LoveLi)[:, 1:] 140 ] 141 142 # Many layers PREM-based model 97 143 #data = load('../Data/PREM_500layers') 98 144 #md.love.sh_nmin = 1 … … 115 161 #md.materials.burgers_mu = md.materials.lame_mu 116 162 #md.materials.burgers_viscosity = md.materials.viscosity 117 #md.materials. isburgers= md.materials.issolid * 0163 #md.materials.rheologymodel = md.materials.issolid * 0 118 164 #md.love.forcing_type = 11 119 165 #md.materials.numlayers = len(md.materials.viscosity) … … 133 179 # (md.results.LoveSolution.LoveLi[:][1:]), 134 180 # ] 135 #Model VSS96 from Vermeersen, L.L.A., Sabadini, R. & Spada, G., 1996a. Analytical visco - elastic relaxation models, Geophys. Res. Lett., 23, 697 - 700. 136 181 182 # Model VSS96 from Vermeersen, L.L.A., Sabadini, R. & Spada, G., 1996a. Analytical visco-elastic relaxation models, Geophys. Res. Lett., 23, 697-700. 137 183 md.materials.radius = np.array([10, 1222.5, 3480., 3600., 3630.5, 3700., 3900., 4000., 138 184 4200., 4300., 4500., 4600., 4800., 4900., 5100., 5200., … … 168 214 md.materials.burgers_mu = md.materials.lame_mu 169 215 md.materials.burgers_viscosity = md.materials.viscosity 170 md.materials. isburgers= md.materials.issolid * 0216 md.materials.rheologymodel = md.materials.issolid * 0 171 217 md.love.forcing_type = 11 172 218 md.love.sh_nmin = 1 173 219 md.love.sh_nmax = 100 174 175 md = solve(md, 'lv') 176 177 md.love.frequencies = (np.array([0, 1e-3, 1e-2, 1, -1e-3, -1e-2, 178 -1]) * 2 * pi).reshape(-1, 1) / cst 179 md.love.nfreq = len(md.love.frequencies) 180 181 field_names += ['LoveH_loadingVSS96_elastic', 'LoveK_loadingVSS96_elastic', 'LoveL_loadingVSS96_elastic', 'LoveH_loadingVSS96_realpart', 'LoveK_loadingVSS96_realpart', 'LoveL_loadingVSS96_realpart', 'LoveH_loadingVSS96_imagpart', 'LoveK_loadingVSS96_imagpart', 'LoveL_loadingVSS96_imagpart'] 220 md = solve(md, 'lv') 221 md.love.frequencies = (np.array([0, 1e-3, 1e-2, 1, -1e-3, -1e-2, -1]) * 2 * np.pi).reshape(-1, 1) / cst 222 md.love.nfreq = len(md.love.frequencies) 223 224 field_names += [ 225 'LoveH_loadingVSS96_elastic', 226 'LoveK_loadingVSS96_elastic', 227 'LoveL_loadingVSS96_elastic', 228 'LoveH_loadingVSS96_realpart', 229 'LoveK_loadingVSS96_realpart', 230 'LoveL_loadingVSS96_realpart', 231 'LoveH_loadingVSS96_imagpart', 232 'LoveK_loadingVSS96_imagpart', 233 'LoveL_loadingVSS96_imagpart' 234 ] 182 235 field_tolerances += [2e-6, 2e-6, 2e-6, 2e-6, 2e-6, 2e-6, 2e-6, 2e-6, 2e-6] 183 field_values += [np.array(md.results.LoveSolution.LoveHr)[:, 0], 184 np.array(md.results.LoveSolution.LoveKr)[:, 0], 185 np.array(md.results.LoveSolution.LoveLr)[:, 0], 186 np.array(md.results.LoveSolution.LoveHr)[:, 1:], 187 np.array(md.results.LoveSolution.LoveKr)[:, 1:], 188 np.array(md.results.LoveSolution.LoveLr)[:, 1:], 189 np.array(md.results.LoveSolution.LoveHi)[:, 1:], 190 np.array(md.results.LoveSolution.LoveKi)[:, 1:], 191 np.array(md.results.LoveSolution.LoveLi)[:, 1:]] 236 field_values += [ 237 np.array(md.results.LoveSolution.LoveHr)[:, 0], 238 np.array(md.results.LoveSolution.LoveKr)[:, 0], 239 np.array(md.results.LoveSolution.LoveLr)[:, 0], 240 np.array(md.results.LoveSolution.LoveHr)[:, 1:], 241 np.array(md.results.LoveSolution.LoveKr)[:, 1:], 242 np.array(md.results.LoveSolution.LoveLr)[:, 1:], 243 np.array(md.results.LoveSolution.LoveHi)[:, 1:], 244 np.array(md.results.LoveSolution.LoveKi)[:, 1:], 245 np.array(md.results.LoveSolution.LoveLi)[:, 1:] 246 ] -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2090.m ¶
r26296 r26358 3 3 %mesh earth: 4 4 md=model; 5 load ../Data/SlcTestMesh.mat; 6 md.mesh=SlcMesh; %700 km resolution mesh 5 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700.); 7 6 8 7 %Geometry for the bed, arbitrary thickness of 1000: -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2101.m ¶
r25166 r26358 4 4 %mesh earth: 5 5 md=model; 6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution', 1000);6 md.mesh=gmshplanet('radius',6.371012*10^3,'resolution',700); 7 7 8 8 % define load -
TabularUnified issm/trunk-jpl/test/NightlyRun/test2101.py ¶
r25158 r26358 15 15 #mesh earth: 16 16 md = model() 17 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 1000)17 md.mesh = gmshplanet('radius', 6.371012 * 1e3, 'resolution', 700) 18 18 19 19 #define load -
TabularUnified issm/trunk-jpl/test/Par/SquareSheetConstrained.py ¶
r26066 r26358 1 import inspect 1 2 import os.path 2 3 import numpy as np 3 import inspect 4 from verbose import verbose 4 from arch import * 5 5 from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d 6 6 from paterson import paterson 7 7 from SetIceSheetBC import SetIceSheetBC 8 from arch import *8 from verbose import verbose 9 9 10 10 #Start defining model parameters here 11 11 12 # Geometry13 hmin = 300. 14 hmax = 1000. 12 # Geometry 13 hmin = 300.0 14 hmax = 1000.0 15 15 ymin = np.min(md.mesh.y) 16 16 ymax = np.max(md.mesh.y) … … 18 18 xmax = np.max(md.mesh.x) 19 19 md.geometry.thickness = hmax + (hmin - hmax) * (md.mesh.y - ymin) / (ymax - ymin) + 0.1 * (hmin - hmax) * (md.mesh.x - xmin) / (xmax - xmin) 20 md.geometry.base = -md.materials.rho_ice / md.materials.rho_water * md.geometry.thickness + 20. 20 md.geometry.base = -md.materials.rho_ice / md.materials.rho_water * md.geometry.thickness + 20.0 21 21 md.geometry.bed = md.geometry.base 22 22 md.geometry.surface = md.geometry.base + md.geometry.thickness … … 35 35 36 36 #Materials 37 md.initialization.temperature = (273. - 20.) * np.ones((md.mesh.numberofvertices))37 md.initialization.temperature = (273.0 - 20.0) * np.ones((md.mesh.numberofvertices)) 38 38 md.materials.rheology_B = paterson(md.initialization.temperature) 39 md.materials.rheology_n = 3. * np.ones((md.mesh.numberofelements))39 md.materials.rheology_n = 3.0 * np.ones((md.mesh.numberofelements)) 40 40 41 41 #Calving … … 44 44 45 45 #Friction 46 md.friction.coefficient = 20. * np.ones((md.mesh.numberofvertices))47 md.friction.coefficient[np.where(md.mask.ocean_levelset < 0. )[0]] = 0.46 md.friction.coefficient = 20.0 * np.ones((md.mesh.numberofvertices)) 47 md.friction.coefficient[np.where(md.mask.ocean_levelset < 0.0)[0]] = 0.0 48 48 md.friction.p = np.ones((md.mesh.numberofelements)) 49 49 md.friction.q = np.ones((md.mesh.numberofelements)) 50 50 51 51 #Numerical parameters 52 md.masstransport.stabilization = 1. 53 md.thermal.stabilization = 1. 52 md.masstransport.stabilization = 1.0 53 md.thermal.stabilization = 1.0 54 54 md.verbose = verbose(0) 55 55 md.settings.waitonlock = 30 … … 58 58 md.stressbalance.reltol = 0.05 59 59 md.stressbalance.abstol = np.nan 60 md.timestepping.time_step = 1. 61 md.timestepping.final_time = 3. 60 md.timestepping.time_step = 1.0 61 md.timestepping.final_time = 3.0 62 62 md.groundingline.migration = 'None' 63 63
Note:
See TracChangeset
for help on using the changeset viewer.