s_new_bed.vector()[dof] = s_bed(dofQ3_x[0], dofQ3_x[1], 0.0) + bed_diff1 #this should actually be needed as we say the surface is always bed_diff1 higher than the bed!! s_new_bed_ini.vector()[dof] = s_bed(dofQ3_x[0], dofQ3_x[1], 0.0) h_ice1.vector()[dof] = sd(dofQ3_x[0], dofQ3_x[1], 0.0) - (s_bed(dofQ3_x[0], dofQ3_x[1], 0.0) + bed_diff1) # surf_ini is the initial surface elevation before moving but on the computational mesh surf_ini = s_new.copy() # Define ice thickness and ice mass at the start of the computations hice_start = ice_mass(s_new, s_new_bed, Q3) hice_t0 = assemble(hice_start * dx) # Set mass balance rate mb_func = set_mb(s_new, Q3, dofsQ3, dofsQ3_x) # if constant value shall be set #mb_func = Function(Q3) #mb_func.assign(Constant(0.0)) # Set velocity on the computational mesh v_new = set_velocity(vel2,s_new, s_new_bed_ini, Q3, V3, dofV3_x, dofsV3, bed_diff1) v_vert = set_verticalvelocity(velocity, s_new, s_new_bed_ini, Q3, dofsQ3, dofsQ3_x, bed_diff1) # Compute exptected mass change due to mass balance rate field [mb_start, mb0_start] = mb_change(mb_func, hice_start, dt_ADV, Q3) mb_mass0 = hice_t0 - assemble(mb0_start * dx) # Save fields for visualisation # save_pvd("rmesh_hicestart", hice_start, pvd_number=tna) # save_pvd("rmesh_ft0", mb_func) # save_pvd("rmesh_snew", s_new, pvd_number=tna) # save_pvd("rmesh_vnew", v_new, pvd_number=tna) # save_pvd("rmesh_vert", v_vert, pvd_number=tna) # save_pvd("rmesh_ice", h_ice1, pvd_number=tna) # save_pvd("rmesh_bed", s_new_bed, pvd_number=tna) # Compute surface gradient
sinb2 = HDF5File(Rmesh.mpi_comm(), os.path.join(data_dir, sb2filename + ".hdf5"), 'r') sinb2.read(s_new_bed, "/const") # surf_ini is the initial surface elevation before moving surf_ini = s_new.copy() # Define ice thickness and ice mass at the start of the computations hice_start = ice_mass(s_new, s_new_bed, Q3) hice_t0 = assemble(hice_start * dx) # Set mass balance rate mb_func = set_mb(s_new, Q3, dofsQ3, dofsQ3_x) # if constant value shall be set #mb_func = Function(Q3) #mb_func.assign(Constant(0.0)) # Set velocity on the computational mesh v_new = set_velocity(velocity, s_new, s_new_bed_ini, Q3, V3, dofV3_x, dofsV3, bed_diff1) v_vert = set_verticalvelocity(velocity, s_new, s_new_bed_ini, Q3, dofsQ3, dofsQ3_x, bed_diff1) # Compute exptected mass change due to mass balance rate field [mb_start, mb0_start] = mb_change(mb_func, hice_start, dt_ADV, Q3) mb_mass0 = hice_t0 - assemble(mb0_start * dx) # Save fields for visualisation # save_pvd("rmesh_hicestart", hice_start, pvd_number=tna) # save_pvd("rmesh_ft0", mb_func) # save_pvd("rmesh_snew", s_new, pvd_number=tna) # save_pvd("rmesh_vnew", v_new, pvd_number=tna) # save_pvd("rmesh_vert", v_vert, pvd_number=tna) # save_pvd("rmesh_bed", s_new_bed, pvd_number=tna) # Compute surface gradient