Esempio n. 1
0
File: run.py Progetto: rlee32/mewo
MIN_SIM_TIME = 1.0 # The minimum simulation time before checking convergence. 
UPDATE_TIME = 0.1 # The period to check convergence.
MAX_SIM_TIME = 5.0
TRAIL_CHECK = 0.1 # The amount of time to average.
STOP_THRESHOLD_PERCENT = 0.5 # percent change below which simulation is stopped.

# Prepare the case.
print "Cleaning the case."
file_operations.clean_case()
os.system("mkdir logs")
print "Converting mesh."
os.system("mv ../bridge/main.msh main.msh")
os.system("gmshToFoam main.msh > logs/gmshToFoam")
print "Modifying BC."
boundary_file = "constant/polyMesh/boundary"
boundary_conditions.modify_empty_bc(boundary_file, "front_and_back", "empty")
boundary_conditions.modify_empty_bc(boundary_file, "wing", "wall")
controlDict.set_end_time(MIN_SIM_TIME)
controlDict.set_write_interval(MIN_SIM_TIME)
os.system("mv ../bridge/geometry.dat ./geometry.dat")

# Convergence loop
current_sim_time = MIN_SIM_TIME
current_lift_measurement = None;
current_drag_measurement = None;
current_moment_measurement = None;
while current_sim_time <= MAX_SIM_TIME:
  # Run simulation.
  print "Running OpenFOAM simulation to "+str(current_sim_time)
  os.system("pimpleFoam > logs/simulation")
Esempio n. 2
0
def fix_boundary():
  print "Fixing BC."
  boundary_file = "constant/polyMesh/boundary"
  boundary_conditions.modify_empty_bc(boundary_file, "front_and_back", "empty")
  boundary_conditions.modify_empty_bc(boundary_file, "wing", "wall")
  return