source: issm/oecreview/Archive/21724-22754/ISSM-22270-22271.diff@ 22755

Last change on this file since 22755 was 22755, checked in by Mathieu Morlighem, 7 years ago

CHG: added 21724-22754

File size: 8.4 KB
  • ../trunk-jpl/test/NightlyRun/test703.py

     
    1 #Test Name: FlowbandFSsheetshelfTrans
    2 import numpy as np
    3 from scipy.interpolate import interp1d
    4 import copy
    5 from model import  *
    6 from socket import gethostname
    7 from triangle import  *
    8 from meshconvert import  *
    9 from setmask import  *
    10 from parameterize import  *
    11 from setflowequation import  *
    12 from solve import  *
    13 from NowickiProfile import *
    14 from bamgflowband import *
    15 from paterson import *
    16 
    17 #mesh parameters
    18 x  = np.arange(-5,5.5,.5).T
    19 [b,h,sea] = NowickiProfile(x)
    20 x = x * 10**3
    21 h = h * 10**3
    22 b = (b-sea) * 10**3
    23 
    24 #mesh domain
    25 md = bamgflowband(model(),x,b+h,b,'hmax',150)
    26 print md.mesh.numberofvertices
    27 
    28 #geometry
    29 md.geometry.surface = interp1d(x,b+h)(md.mesh.x)
    30 md.geometry.base = interp1d(x,b)(md.mesh.x)
    31 md.geometry.thickness = md.geometry.surface - md.geometry.base
    32 
    33 #mask
    34 md.mask.ice_levelset = -np.ones((md.mesh.numberofvertices,))
    35 md.mask.ice_levelset[np.where(md.mesh.vertexflags(2))] = 0
    36 md.mask.groundedice_levelset = np.zeros((md.mesh.numberofvertices,)) - 0.5
    37 
    38 #materials
    39 md.initialization.temperature = (273. - 20.) * np.ones((md.mesh.numberofvertices,))
    40 md.materials.rheology_B = paterson(md.initialization.temperature)
    41 md.materials.rheology_n = 3 * np.ones((md.mesh.numberofelements,))
    42 
    43 #friction
    44 md.friction.coefficient = np.zeros((md.mesh.numberofvertices,))
    45 md.friction.coefficient[np.where(md.mesh.vertexflags(1))] = 20
    46 md.friction.p = np.ones((md.mesh.numberofelements,))
    47 md.friction.q = np.ones((md.mesh.numberofelements,))
    48 
    49 #boundary conditions
    50 md.stressbalance.spcvx = float('NaN') * np.ones((md.mesh.numberofvertices,))
    51 md.stressbalance.spcvy = float('NaN') * np.ones((md.mesh.numberofvertices,))
    52 md.stressbalance.spcvz = float('NaN') * np.ones((md.mesh.numberofvertices,))
    53 md.stressbalance.referential = float('NaN') * np.ones((md.mesh.numberofvertices,6))
    54 md.stressbalance.loadingforce = 0 * np.ones((md.mesh.numberofvertices,3))
    55 md.stressbalance.spcvx[np.where(md.mesh.vertexflags(4))] = 800.
    56 md.stressbalance.spcvy[np.where(md.mesh.vertexflags(4))] = 0.
    57 
    58 #print md.stressbalance.referential
    59 #print md.stressbalance.loadingforce
    60 #print md.stressbalance.spcvx
    61 #print md.stressbalance.spcvy
    62 #print md.stressbalance.spcvz
    63 #print np.shape(md.stressbalance.referential)
    64 #print np.shape(md.stressbalance.loadingforce)
    65 #print np.shape(md.stressbalance.spcvx)
    66 #print np.shape(md.stressbalance.spcvy)
    67 #print np.shape(md.stressbalance.spcvz)
    68 
    69 #Misc
    70 md = setflowequation(md,'FS','all')
    71 md.flowequation.fe_FS = 'TaylorHood'
    72 md.stressbalance.abstol = float('NaN')
    73 md.miscellaneous.name = 'test703'
    74 
    75 #Transient settings
    76 md.timestepping.time_step = 0.000001
    77 md.timestepping.final_time = 0.000005
    78 md.stressbalance.shelf_dampening = 1.
    79 md.smb.mass_balance = np.zeros((md.mesh.numberofvertices,))
    80 md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices,))
    81 md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices,))
    82 md.basalforcings.geothermalflux = np.zeros((md.mesh.numberofvertices,))
    83 posb = np.intersect1d(np.where(md.mesh.x > 0.), np.where(md.mesh.vertexonbase))
    84 md.basalforcings.groundedice_melting_rate[posb] = 18.
    85 md.basalforcings.floatingice_melting_rate[posb] = 18.
    86 md.initialization.vx = np.zeros((md.mesh.numberofvertices,))
    87 md.initialization.vy = np.zeros((md.mesh.numberofvertices,))
    88 md.initialization.pressure = np.zeros((md.mesh.numberofvertices,))
    89 md.masstransport.spcthickness = float('NaN') * np.ones((md.mesh.numberofvertices,))
    90 md.thermal.spctemperature = float('NaN') * np.ones((md.mesh.numberofvertices,))
    91 md.transient.isthermal = 0
    92 md.masstransport.isfreesurface = 1
    93 
    94 #Go solve
    95 md.cluster = generic('np',3)
    96 md.stressbalance.shelf_dampening = 1
    97 md1 = solve(md,'Transient')
    98 
    99 md.stressbalance.shelf_dampening = 0
    100 md = solve(md,'Transient')
    101 
    102 #Fields and tolerances to track changes
    103 field_names      = [
    104         'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1',
    105         'Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2',
    106         'Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3',
    107         'Vx1_damp','Vy1_damp','Vel1_damp','Pressure1_damp','Bed1_damp','Surface1_damp','Thickness1_damp',
    108         'Vx2_damp','Vy2_damp','Vel2_damp','Pressure2_damp','Bed2_damp','Surface2_damp','Thickness2_damp',
    109         'Vx3_damp','Vy3_damp','Vel3_damp','Pressure3_damp','Bed3_damp','Surface3_damp','Thickness3_damp']
    110 field_tolerances = [
    111         2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,
    112         2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,
    113         2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,
    114         5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,
    115         5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,
    116         5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10]
    117 field_values = [
    118         md.results.TransientSolution[0].Vx,
    119         md.results.TransientSolution[0].Vy,
    120         md.results.TransientSolution[0].Vel,
    121         md.results.TransientSolution[0].Pressure,
    122         md.results.TransientSolution[0].Base,
    123         md.results.TransientSolution[0].Surface,
    124         md.results.TransientSolution[0].Thickness,
    125         md.results.TransientSolution[1].Vx,
    126         md.results.TransientSolution[1].Vy,
    127         md.results.TransientSolution[1].Vel,
    128         md.results.TransientSolution[1].Pressure,
    129         md.results.TransientSolution[1].Base,
    130         md.results.TransientSolution[1].Surface,
    131         md.results.TransientSolution[1].Thickness,
    132         md.results.TransientSolution[2].Vx,
    133         md.results.TransientSolution[2].Vy,
    134         md.results.TransientSolution[2].Vel,
    135         md.results.TransientSolution[2].Pressure,
    136         md.results.TransientSolution[2].Base,
    137         md.results.TransientSolution[2].Surface,
    138         md.results.TransientSolution[2].Thickness,
    139         md1.results.TransientSolution[0].Vx,
    140         md1.results.TransientSolution[0].Vy,
    141         md1.results.TransientSolution[0].Vel,
    142         md1.results.TransientSolution[0].Pressure,
    143         md1.results.TransientSolution[0].Base,
    144         md1.results.TransientSolution[0].Surface,
    145         md1.results.TransientSolution[0].Thickness,
    146         md1.results.TransientSolution[1].Vx,
    147         md1.results.TransientSolution[1].Vy,
    148         md1.results.TransientSolution[1].Vel,
    149         md1.results.TransientSolution[1].Pressure,
    150         md1.results.TransientSolution[1].Base,
    151         md1.results.TransientSolution[1].Surface,
    152         md1.results.TransientSolution[1].Thickness,
    153         md1.results.TransientSolution[2].Vx,
    154         md1.results.TransientSolution[2].Vy,
    155         md1.results.TransientSolution[2].Vel,
    156         md1.results.TransientSolution[2].Pressure,
    157         md1.results.TransientSolution[2].Base,
    158         md1.results.TransientSolution[2].Surface,
    159         md1.results.TransientSolution[2].Thickness,
    160         ]
  • ../trunk-jpl/src/m/mesh/bamg.py

     
    11import os.path
    22import numpy as  np
     3from mesh2d import *
    34from mesh2dvertical import *
     5from mesh3dsurface import *
    46from collections import OrderedDict
    57from pairoptions import pairoptions
    68from bamggeom import bamggeom
     
    9193                for i,domaini in enumerate(domain):
    9294
    9395                        #Check that the domain is closed
    94                         if (domaini.x[0]!=domaini.x[-1] or domaini.y[0]!=domaini.y[-1]):
     96                        if (domaini['x'][0]!=domaini['x'][-1] or domaini['y'][0]!=domaini['y'][-1]):
    9597                                raise RuntimeError("bamg error message: all contours provided in ''domain'' should be closed")
    9698
    9799                        #Checks that all holes are INSIDE the principle domain outline
    98100                        if i:
    99                                 flags=ContourToNodes(domaini.x,domaini.y,domainfile,0)[0]
     101                                flags=ContourToNodes(domaini['x'],domaini['y'],domainfile,0)[0]
    100102                                if np.any(np.logical_not(flags)):
    101103                                        raise RuntimeError("bamg error message: All holes should be strictly inside the principal domain")
    102104
    103105                        #Add all points to bamg_geometry
    104                         nods=domaini.nods-1    #the domain are closed 0=end
    105                         bamg_geometry.Vertices=np.vstack((bamg_geometry.Vertices,np.vstack((domaini.x[0:nods],domaini.y[0:nods],np.ones((nods)))).T))
     106                        nods=domaini['nods']-1    #the domain are closed 0=end
     107                        bamg_geometry.Vertices=np.vstack((bamg_geometry.Vertices,np.vstack((domaini['x'][0:nods],domaini['y'][0:nods],np.ones((nods)))).T))
    106108                        bamg_geometry.Edges   =np.vstack((bamg_geometry.Edges,np.vstack((np.arange(count+1,count+nods+1),np.hstack((np.arange(count+2,count+nods+1),count+1)),1.*np.ones((nods)))).T))
    107109                        if i:
    108110                            bamg_geometry.SubDomains=np.vstack((bamg_geometry.SubDomains,[2,count+1,1,-subdomain_ref]))
Note: See TracBrowser for help on using the repository browser.