# set the flow equation of type `mdl_odr` defined above : md = im.setflowequation(md, mdl_odr, 'all') md.flowequation.fe_HO = 'P1' ## set for no-slip basal velocity BC (replaced with high friction above) : #basal_v = md.mesh.vertexonbase #md.stressbalance.spcvx[basal_v] = 0.0 #md.stressbalance.spcvy[basal_v] = 0.0 #md.stressbalance.spcvz[basal_v] = 0.0 #=============================================================================== # solve : print_text('::: issm -- solving :::', 'red') md.cluster = im.generic('name', im.gethostname(), 'np', 1) md.verbose = im.verbose('convergence', True) if tmc: md = im.solve(md, 'SteadyState') else: md = im.solve(md, 'StressBalance') #=============================================================================== # plot the results : print_text('::: issm -- plotting :::', 'red') p = md.results.StressbalanceSolution.Pressure[md.mesh.vertexonbase] u_x = md.results.StressbalanceSolution.Vx[md.mesh.vertexonsurface] u_y = md.results.StressbalanceSolution.Vy[md.mesh.vertexonsurface] u_z = md.results.StressbalanceSolution.Vz[md.mesh.vertexonsurface] u = np.array([u_x.flatten(), u_y.flatten(), u_z.flatten()]) # save the mesh coordinates and data for interpolation with CSLVR : np.savetxt(out_dir + 'x.txt', md.mesh.x2d)
md = im.SetMarineIceSheetBC(md) # create placeholder arrays for indicies # extrude the mesh so that there are 5 cells in height : md.extrude(6, 1.0) # set the flow equation of type `mdl_odr` defined above : md = im.setflowequation(md, mdl_odr, 'all') md.flowequation.fe_HO = 'P1' #=============================================================================== # solve : print_text('::: issm -- solving initial velocity :::', 'red') md.cluster = im.generic('name', im.gethostname(), 'np', 1) md.verbose = im.verbose('convergence', True) md = im.solve(md, 'Stressbalance') #=============================================================================== # FIXME: since the model was extruded, we have to re-define the element-wise # multiplicative identities. This is not ideal : # rank-zero tensor vertex ones vector : v_ones = np.ones(md.mesh.numberofvertices) # rank-zero tensor element ones vector : e_ones = np.ones(md.mesh.numberofelements) # rank-two tensor ones vector : A_ones = np.ones((md.mesh.numberofvertices, 6))