def generate_wall_nonst_results( mainDir, model_input, PBSnameRun, simulation_duration, steady_state_ac = 0, temperature = 0.999, flow_velocity = 0.0, flow_profile = 'parabolic_profile', phase_at_center = 'vapor', ratio_bubble_interface = 2.0, gravity_ac = 0, gravity_amp = 0, wall_surface_type = 'uniform_surface', wall_heater_center = 0.0, wall_heater_length = 1.0, wall_heater_variation_angle_length = 0.1, wall_heater_micro_contact_angle = 90.0, wall_micro_contact_angle = 90.0, wall_heat_source_choice = 'no_heat_source', wall_maximum_heat_flux = 0.0, wall_extra_heat_source_choice = 'no_heat_source', wall_maximum_extra_heat_flux = 0.0, total_nb_files = total_nb_files_default, spherical_cap = False, nucleation_in_flow = False, extra_domain = 'None', adapt_domain = False): ''' @description create the directory to save the simulation results, generate the input file needed to run the simulations of non steady drop/bubble at a wall, generate the executable, create the PBS scripts file, and run the simulation ''' #1) test whether 'mainDir' can be used as a reference # directory where the directory to save the simulation # is created if(not os.path.isdir(mainDir)): print 'library_wall_nonst_results' print 'generate_wall_nonst_results' sys.exit('*** '+mainDir+' is not a directory***') #2) create the directory to save the simulation destDir = get_simulation_dir(temperature, wall_micro_contact_angle, phase_at_center, collapse_ratio = ratio_bubble_interface, gravity_amp = gravity_amp, wall_surface_type = wall_surface_type, wall_heater_micro_contact_angle = wall_heater_micro_contact_angle, wall_maximum_heat_flux = wall_maximum_heat_flux, wall_maximum_extra_heat_flux = wall_maximum_extra_heat_flux, flow_velocity = flow_velocity, flow_profile = flow_profile, spherical_cap = spherical_cap) destDir = os.path.join(mainDir,destDir) # if there is already an existing directory, the function # throws an error if(os.path.isdir(destDir)): print 'library_wall_nonst_results' print 'generate_wall_nonst_results' sys.exit('*** '+destDir+' already exists***') os.mkdir(destDir) #3) create the inputs for the simulation inputPath = 'inputs_wall.txt' # remove old input files if(os.path.isfile(inputPath)): os.remove(inputPath) #create input create_wall_nonst_inputs( model_input, simulation_duration, inputs_wall_modified = inputPath, steady_state_ac = steady_state_ac, spherical_cap = spherical_cap, nucleation_in_flow = nucleation_in_flow, extra_domain = extra_domain, temperature = temperature, flow_velocity = flow_velocity, flow_profile = flow_profile, phase_at_center = phase_at_center, gravity_ac = gravity_ac, gravity_amp = gravity_amp, ratio_bubble_interface = ratio_bubble_interface, wall_surface_type = wall_surface_type, wall_micro_contact_angle = wall_micro_contact_angle, wall_heater_center = wall_heater_center, wall_heater_length = wall_heater_length, wall_heater_variation_angle_length = wall_heater_variation_angle_length, wall_heater_micro_contact_angle = wall_heater_micro_contact_angle, wall_heat_source_choice = wall_heat_source_choice, wall_maximum_heat_flux = wall_maximum_heat_flux, wall_extra_heat_source_choice = wall_extra_heat_source_choice, wall_maximum_extra_heat_flux = wall_maximum_extra_heat_flux, total_nb_files = total_nb_files) #4) create dir, generate executable, # create PBS script file [pbsScriptPath,nameRun] = create_simulation(destDir, inputPath, PBSnameRun, adapt_domain=adapt_domain) #5) run the simulation run_simulation(pbsScriptPath) return [destDir,nameRun]
str(temperature)+\ '_'+str(flow_velocity)+\ '_sep'+str(ratio_interface_separation) destDir = os.path.join(mainDir,destDir) # if there is already an existing directory, the function # throws an error if(os.path.isdir(destDir)): raise OSError('library_wall_nonst_results', 'generate_wall_nonst_results', '*** '+destDir+' already exists***') os.mkdir(destDir) # choose the name for the run in PBS script PBSnameRun = 'dim2d_sep'+str(ratio_interface_separation)+'_'+str(temperature) # create the PBS script to run the simulation [pbsScriptPath,nameRun] = create_simulation(destDir, inputPath, PBSnameRun, adapt_domain=adapt_domain) # run the simulation run_simulation(pbsScriptPath)
def generate_wall_st_results(mainDir, steady_state_ac, temperature, micro_contact_angle, phase_at_center, model_input, gravity_ac=0, gravity_amp=0, spherical_cap=False): ''' @description create the directory to save the simulation results, generate the input file needed to run the wall steady state simulations, generate the executable, create the PBS scripts file, and run the simulation ''' #1) test whether 'mainDir' can be used as a reference # directory where the directory to save the simulation # is created if(not os.path.isdir(mainDir)): print 'library_wall_st_results' print 'generate_wall_st_results' sys.exit('*** '+mainDir+' is not a directory***') #2) create the directory to save the simulation destDir = get_simulation_dir(temperature, micro_contact_angle, phase_at_center, gravity_amp=gravity_amp, spherical_cap = spherical_cap) destDir = os.path.join(mainDir,destDir) # if there is already an existing directory, the function # throws an error if(os.path.isdir(destDir)): print 'library_wall_st_results' print 'generate_wall_st_results' sys.exit('*** '+destDir+' already exists***') os.mkdir(destDir) #3) create the inputs for the simulation inputPath = 'inputs_wall.txt' # remove old input files if(os.path.isfile(inputPath)): os.remove(inputPath) #create input create_wall_st_inputs(steady_state_ac, temperature, micro_contact_angle, phase_at_center, gravity_ac, gravity_amp, model_input, spherical_cap = spherical_cap, inputs_wall_modified = inputPath) #4) create dir, generate executable, # create PBS script file [pbsScriptPath,nameRun] = create_simulation(destDir, inputPath) #5) run the simulation run_simulation(pbsScriptPath) return [destDir,nameRun]