# script for testing/comparing CPU and GPU count of fluid # whether gpu 0 - no, 1 - yes if { $argc != 3 } { puts "3 arguments are expected, in this order:" puts "gpu_yes/no, forceDens, sim_no" puts " " exit; } else { set gpu_yes [expr [lindex $argv 0]] set force_density [expr [lindex $argv 1]] set sim_no [expr [lindex $argv 2]] } set directory "output" exec mkdir $directory/sim[expr $sim_no] #GEOMETRY set boxX 100 set boxY 50 set boxZ 30 #LBFLUID set friction_coeff 0.00928 set fluid_density 1.0 set fluid_viscosity 1.5 #set force_density 0.00002 set timestep 0.2 set lbtimestep 0.2 set lb_agrid 1.0 #iterations parameters set cycle 0 set n_steps 3000 ;# argument of integrate command set max_ncycle 15000 ######################################################################################################### puts "sim_no = $sim_no" setmd time_step $timestep setmd skin 0.2 thermostat off setmd box_l $boxX $boxY $boxZ # fluid if { $gpu_yes == 1 } { lbfluid gpu grid $lb_agrid dens $fluid_density visc $fluid_viscosity tau $lbtimestep friction $friction_coeff ext_force $force_density 0 0 } else { lbfluid cpu grid $lb_agrid dens $fluid_density visc $fluid_viscosity tau $lbtimestep friction $friction_coeff ext_force $force_density 0 0 } puts "fluid loaded" puts "loading fluid boundaries" #boundary puts "wall bottom" # bottom of the channel set corX -1; set corY -1; set corZ 0; set aX $boxX; set aY 0; set aZ 0; set bX 0; set bY $boxY; set bZ 0; set cX 0; set cY 0; set cZ 1; lbboundary rhomboid corner $corX $corY $corZ a $aX $aY $aZ b $bX $bY $bZ c $cX $cY $cZ direction 1 puts "wall top" # top of the channel set corX 0; set corY 0; set corZ [expr ($boxZ - 1)]; set aX $boxX; set aY 0; set aZ 0; set bX 0; set bY $boxY; set bZ 0; set cX 0; set cY 0; set cZ 1; lbboundary rhomboid corner $corX $corY $corZ a $aX $aY $aZ b $bX $bY $bZ c $cX $cY $cZ direction 1 ##### main loop ##### while { $cycle < $max_ncycle} { puts "time: [expr $cycle*$timestep]" ;# I don't see cycle, I see "time" lbfluid print vtk velocity "$directory/sim[expr $sim_no]/fluid_vel_[expr $cycle].vtk" integrate $n_steps set cycle [expr $cycle + $n_steps] ###################### }