def write(self,out_file='./hurricane.data',datasource="setrun.py"): """Write out the data file to the path given""" print "Creating data file %s" % out_file out_file = open(out_file,'w') data.data_write(out_file,self,'wind_src','(Wind source term used)') data.data_write(out_file,self,'pressure_src',"(Pressure source term used)") data.data_write(out_file,self,None) data.data_write(out_file,self,'wind_tolerance','(Wind speed tolerance)') data.data_write(out_file,self,'pressure_tolerance',"(Pressure source term tolerance)") data.data_write(out_file,self,None) data.data_write(out_file,self,'max_wind_nest','(Wind strength based refinement)') data.data_write(out_file,self,'wind_refine','(Refinement ratios)') data.data_write(out_file,self,'max_speed_nest',"(Speed/Momentum based refinement levels)") data.data_write(out_file,self,'speed_nest',"(Refinement ratios)") data.data_write(out_file,self,'momentum_refinement',"(Momentum based refinement used rather than speed)") data.data_write(out_file,self,'max_R_nest',"(Hurricane location based refinement)") data.data_write(out_file,self,'R_refine',"(Refinement ratios)") data.data_write(out_file,self,None) data.data_write(out_file,self,'rho_air',"(Density of air)") data.data_write(out_file,self,"theta_0","(Center of beta-plane approximation)") data.data_write(out_file,self,None) data.data_write(out_file,self,"wind_type",'(Type of wind field)') if self.wind_type == 0: data.data_write(out_file,self,"hurricane_track_file",'(Data file containing track)') elif self.wind_type == 1: data.data_write(out_file,self,"ramp_up_t","(Ramp up time for wind field)") data.data_write(out_file,self,'hurricane_velocity',"(Speed of moving wind field)") data.data_write(out_file,self,'R_eye_init',"(Initial position of wind field)") data.data_write(out_file,self,'A',"(Hurricane model fit parameter)") data.data_write(out_file,self,'B') data.data_write(out_file,self,'Pn',"(Nominal atmospheric pressure)") data.data_write(out_file,self,'Pc',"(Pressure in the eye of the hurricane)") elif self.wind_type == 2: data.data_write(out_file,self,'A',"(Wind maximum amplitude)") data.data_write(out_file,self,None) out_file.close()
def write(self,out_file='./multilayer.data',datasource="setrun.py"): print "Creating data file %s" % out_file out_file = open(out_file,'w') data.data_write(out_file,self,'layers','(Number of layers)') data.data_write(out_file,self,'rho','(Densities of layers)') data.data_write(out_file,self,None) data.data_write(out_file,self,'eigen_method','(Method for calculating eigenspace)') data.data_write(out_file,self,'inundation_method','(Method for calculating inundation eigenspace)') data.data_write(out_file,self,'richardson_tolerance','(Tolerance for Richardson number)') data.data_write(out_file,self,'wave_tolerance','(Tolerance for wave height refinement)') data.data_write(out_file,self,'dry_limit','(Turn off limiting when near a dry state)') data.data_write(out_file,self,None) data.data_write(out_file,self,'eta','(Top surface of each layer)') data.data_write(out_file,self,'init_type','(Type of initial condition)') if self.init_type > 0: data.data_write(out_file,self,'epsilon','(Perturbation strength)') if self.init_type <= 2 or self.init_type == 5: data.data_write(out_file,self,'init_location','(Location for perturbation)') data.data_write(out_file,self,'wave_family','(Wave family of the perturbation)') if 2 == self.init_type or self.init_type == 5: data.data_write(out_file,self,'angle','(Angle of direction of travel from x-axis)') data.data_write(out_file,self,'sigma','(Gaussian width') elif self.init_type == 3: data.data_write(out_file,self,'init_location','(Location for perturbation)') data.data_write(out_file,self,'sigma','(Gaussian width') data.data_write(out_file,self,None) data.data_write(out_file,self,'bathy_type','(Type of bathymetry prescribed)') if self.bathy_type == 0: pass elif self.bathy_type == 1: data.data_write(out_file,self,'bathy_location','(Bathymetry jump location)') data.data_write(out_file,self,'bathy_left','(Depth to left of bathy_location)') data.data_write(out_file,self,'bathy_right','(Depth to right of bathy_location)') data.data_write(out_file,self,'bathy_angle','(Angle from the vertical to put jump)') elif self.bathy_type == 2 or self.bathy_type == 3: data.data_write(out_file,self,'x0','(Location of basin end)') data.data_write(out_file,self,'x1','(Location of shelf slope end)') data.data_write(out_file,self,'x2','(Location of beach slope)') data.data_write(out_file,self,'basin_depth','(Depth of basin)') data.data_write(out_file,self,'shelf_depth','(Depth of shelf)') data.data_write(out_file,self,'beach_slope','(Slope of beach)') else: print "Invalid bathy_type %s requested, aborting." % self.bathy_type out_file.close() sys.exit(1) out_file.close()
def write(self,file='./problem.data',datasource='setrun.py'): """Write out the data file to the path given""" print "Creating data file %s" % file out_file = data.open_datafile(file) data.data_write(out_file,self,'rho_air','(Density of air)') data.data_write(out_file,self,'rho','(Densities of layers)') data.data_write(out_file,self,'manning',"(Manning N coefficent for friction)") data.data_write(out_file,self,None) data.data_write(out_file,self,'dry_tolerance','(Dry state tolerance)') data.data_write(out_file,self,'eigen_method','(Method for calculating eigenspace)') data.data_write(out_file,self,'inundation_method','(Method for calculating inundation Riemann problem)') data.data_write(out_file,self,'entropy_fix','(Apply an entropy fix in Riemann solver)') data.data_write(out_file,self,None) data.data_write(out_file,self,'init_type','(Type of initial condition)') data.data_write(out_file,self,'init_location','(Location for perturbation)') data.data_write(out_file,self,'wave_family','(Wave family of the perturbation)') if self.eta_left is None: self.eta_left = self.eta data.data_write(out_file,self,'eta_left','(Left surface elevations)') if self.eta_right is None: self.eta_right = self.eta_left data.data_write(out_file,self,'eta_right','(Right surface elevations)') if self.u_left is None: self.u_left = self.u data.data_write(out_file,self,'u_left','(Left layer velocities)') if self.u_right is None: self.u_right = self.u_left data.data_write(out_file,self,'u_right','(Right layer velocities)') data.data_write(out_file,self,'epsilon','(Perturbation strength)') data.data_write(out_file,self,'sigma','(Gaussian width for init_type=2,3)') data.data_write(out_file,self,None) data.data_write(out_file,self,'bathy_type',"(Type of bathymetry to use)") if self.bathy_type == 1: data.data_write(out_file,self,'bathy_location','(Bathymetry jump location)') data.data_write(out_file,self,'bathy_left','(Depth to left of bathy_location)') data.data_write(out_file,self,'bathy_right','(Depth to right of bathy_location)') elif self.bathy_type == 2: data.data_write(out_file,self,'x0',"(Location of beginning of shelf slope)") data.data_write(out_file,self,'basin_depth',"(Depth of the basin)") data.data_write(out_file,self,'x1',"(Location of end of the shelf slope)") data.data_write(out_file,self,'shelf_depth',"(Depth of the shelf)") data.data_write(out_file,self,None) data.data_write(out_file,self,'wind_type','(Type of wind field to use)') if self.wind_type == 1: data.data_write(out_file,self,'A','(Wind speed)') elif self.wind_type == 2: data.data_write(out_file,self,'A','(Hurricane strength parameters)') data.data_write(out_file,self,'B','') data.data_write(out_file,self,'Pn','(Nominal pressure)') data.data_write(out_file,self,'Pc','(Central pressure)') self.ramp_up_time = -self.ramp_up_time data.data_write(out_file,self,'ramp_up_time','(Time over which the hurricane wind field ramps up to full strength)') data.data_write(out_file,self,'hurricane_velocity','(Speed of hurricane)') data.data_write(out_file,self,'R_eye_init','(Location of hurricane at t=0)') elif self.wind_type == 3: data.data_write(out_file,self,'A','(Amplitude of wind)') data.data_write(out_file,self,'N','(Number of periods within domain)') data.data_write(out_file,self,'omega','(Speed of modulation)') data.data_write(out_file,self,'t_length',"(Length of simulation time)") out_file.close()