492, outputdir= '../../../outputs/6.yaw_environment/Paper3/Zhoushan_mesh_30min/restart_30min-e&v' ) # Operation of tidal turbine farm through a callback cb = turbines.TurbineFunctionalCallback(solver_obj) solver_obj.add_callback(cb, 'timestep') #Effected area location E_area_centre_point = [(xmin + xmax) / 2, ymax + 800] E_area_circle = 60 # Operation of tidal turbine farm about each turbine output through a callback cb2 = rmse_r2.RMSECallback( solver_obj, '../../../outputs/6.yaw_environment/Paper3/Zhoushan_mesh_30min/optimisation/intermediate-forward', E_area_centre_point, E_area_circle) solver_obj.add_callback(cb2, 'timestep') # start computer forward model solver_obj.iterate(update_forcings=update_forcings) # ###set up interest functional and control### power_output = sum(cb.average_power) maxoutput, maxeffect = 2027.5361102533254, 1218.9462261767894 interest_functional = (P_factor * (power_output / maxoutput) - (1 - P_factor) * (cb2.RMSEaverage / maxeffect)) * maxoutput print(interest_functional, power_output, cb2.RMSEaverage) # specifies the control we want to vary in the optimisation c = [Control(x) for x in farm_options.turbine_axis
solver_obj.load_state( 492, outputdir= '../../../outputs/6.yaw_environment/Paper3/Zhoushan_mesh/restart_5min-e&v') # Operation of tidal turbine farm through a callback cb = turbines.TurbineFunctionalCallback(solver_obj) solver_obj.add_callback(cb, 'timestep') #Effected area location E_area_centre_point = [(xmin + xmax) / 2, (ymax + ymin) / 2 + (214 + 400)] E_area_circle = 60 # Operation of tidal turbine farm about each turbine output through a callback cb2 = rmse_r2.RMSECallback( solver_obj, '../../../outputs/6.yaw_environment/Paper3/Zhoushan_mesh/forward', E_area_centre_point, E_area_circle) solver_obj.add_callback(cb2, 'timestep') #Effected area location E_area_centre_point = [(xmin + xmax) / 2, (ymax + ymin) / 2 - (214 + 400)] E_area_circle = 60 # Operation of tidal turbine farm about each turbine output through a callback cb3 = rmse_r2.RMSECallback( solver_obj, '../../../outputs/6.yaw_environment/Paper3/Zhoushan_mesh/forward', E_area_centre_point, E_area_circle) solver_obj.add_callback(cb3, 'timestep') # start computer forward model
def update_forcings(t): print_output("Updating tidal elevation at t = {}".format(t)) ramp = tanh(t / 2000.) tidal_vel.project(Constant(-ramp * 2)) #set initial condition # solver_obj.assign_initial_conditions(uv=as_vector((1e-7, 0.0)), elev=tidal_elev) solver_obj.load_state(60, '../../../outputs/3.environment/restart') # Operation of tidal turbine farm through a callback cb = turbines.TurbineFunctionalCallback(solver_obj) solver_obj.add_callback(cb, 'timestep') cb2 = rmse_r2.RMSECallback(solver_obj, '../../../outputs/3.environment/restart', 3) solver_obj.add_callback(cb2, 'timestep') # start computer forward model solver_obj.iterate(update_forcings=update_forcings) ###set up interest functional and control### power_output = sum(cb.integrated_power) interest_functional = -cb2.RMSEaverage print(interest_functional) # specifies the control we want to vary in the optimisation optimise_angle_only = False # if farm_options.considering_yaw: # if optimise_angle_only: # if farm_options.considering_yaw:
solver_obj.assign_initial_conditions(uv=as_vector((-Constant(speed), 0.0)), elev=tidal_elev) # Operation of tidal turbine farm through a callback cb = turbines.TurbineFunctionalCallback(solver_obj) solver_obj.add_callback(cb, 'timestep') #Effected area location E_area_centre_point = [450, 250] E_area_circle = 40 # Operation of tidal turbine farm about each turbine output through a callback cb2 = rmse_r2.RMSECallback( solver_obj, '../../../outputs/6.yaw_environment/Yaw_Ideal/restart-conference_mesh2_with_effected_area', E_area_centre_point, E_area_circle) solver_obj.add_callback(cb2, 'timestep') # start computer forward model solver_obj.iterate(update_forcings=update_forcings) # ###set up interest functional and control### power_output = sum(cb.current_power) maxoutput, maxeffect = 10567.419789875763, 6277.669515955079 interest_functional = (P_factor * (power_output / maxoutput) - (1 - P_factor) * (cb2.RMSE_current[-1] / maxeffect)) * maxoutput print(interest_functional, power_output, cb2.RMSE_current[-1]) # specifies the control we want to vary in the optimisation optimise_angle_only = False
solver_obj.assign_initial_conditions(uv=as_vector((-Constant(speed), 0.0)), elev=tidal_elev) # Operation of tidal turbine farm through a callback cb = turbines.TurbineFunctionalCallback(solver_obj) solver_obj.add_callback(cb, 'timestep') #Effected area location E_area_centre_point = [600, 250] E_area_circle = 40 # Operation of tidal turbine farm about each turbine output through a callback cb2 = rmse_r2.RMSECallback( solver_obj, '../../../outputs/6.yaw_environment/Yaw_Ideal/test_yaw_effect_restart', E_area_centre_point, E_area_circle) solver_obj.add_callback(cb2, 'timestep') # start computer forward model solver_obj.iterate(update_forcings=update_forcings) # ###set up interest functional and control### power_output = sum(cb.current_power) interest_functional = (P_factor * (power_output / 7643.52) - (1 - P_factor) * (cb2.RMSE_current[-1] / 7040.53)) * 7643.52 # print(interest_functional,power_output,cb2.RMSE_current[-1]) # specifies the control we want to vary in the optimisation optimise_angle_only = True optimise_layout_only = False