radius_pure_fiber = 0.05441 form = 'ellipse' eccentricity = 0.7 nrlayers = 2 mean_deviation = 0.0 [fiberlayer_0] thickness = 0.001 [fiberlayer_1] thickness = 0.001 [plot] plotevery = 10 """ from stick.fiber.config import FiberConfigManager from stick.yarn.config import YarnConfigManager from stick.lib.utils.utils import set_outputdir cfgf1 = FiberConfigManager.get_instance('tmpfiber1.ini', realdatastr=ini_fiber1) cfgf2 = FiberConfigManager.get_instance('tmpfiber2.ini', realdatastr=ini_fiber2) cfg = YarnConfigManager.get_instance('tmpyarn.ini', realdatastr=ini_yarn) if not os.path.isdir('temp'): os.mkdir('temp') set_outputdir('temp') #create a 2D grid for simulate DEET diffusion process from stick.yarn2d.yarn2dmodel import Yarn2DModel Yarn2DModel(cfg) print 'calculate DEET diffusion' raw_input('Press key to quit the calculation')
#create outputdir if not existing if not os.path.isdir(outputdir): os.mkdir(outputdir) #create outputdir for this run, remove if existing outputdir = outputdir + os.sep + os.path.basename(inifile) #determine whether we make a new file for yarn2d or read the old file; the #default value is 'False', which means the new file will be generated when #the programme runs read_old_file = cfg.get('general.read') if not read_old_file: if not os.path.isdir(outputdir): os.mkdir(outputdir) else: shutil.rmtree(outputdir) os.mkdir(outputdir) set_outputdir(outputdir) #store the ini file in the outputdir so the experiment can be repeated shutil.copy(inifile, outputdir) else: set_outputdir(outputdir) print "ready to read the old file" if writeini: print "Writing out ini file cleaned.ini to outputdir %s" % outputdir cfg.save(outputdir + os.sep + 'cleaned.ini') sys.exit() if not hasattr(cfg, 'onlymesh'): cfg.onlymesh = onlymesh #create the correct model, and run it from stick.yarn2d.yarn2dmodel import Yarn2DModel