diff --git a/windse/ParameterManager.py b/windse/ParameterManager.py index 3366ea49..d1e4c110 100644 --- a/windse/ParameterManager.py +++ b/windse/ParameterManager.py @@ -7,6 +7,7 @@ import __main__ import os import yaml +import warnings ### Get the name of program importing this package ### if hasattr(__main__,"__file__"): @@ -166,9 +167,9 @@ def Load(self, loc,updated_parameters=[]): ### Check if dolfin_adjoint is unnecessary or required ### optimizing = yaml_file.get("optimization",{}).get("control_types",None) is not None if optimizing and not self.dolfin_adjoint: - raise ValueError("Optimization setting provided but general:dolfin_adjoint is set to False") + warnings.warn("Optimization setting provided but general:dolfin_adjoint is set to False") elif not optimizing and self.dolfin_adjoint: - raise ValueError("general:dolfin_adjoint is set to True but no optimization parameters provided") + warnings.warn("general:dolfin_adjoint is set to True but no optimization parameters provided") # print(self.dolfin_adjoint) # for module in sys.modules: @@ -411,4 +412,4 @@ def tag_output(self, key, value, collective_output=None): ### Print the new dict ### # print(self.tagged_output) -windse_parameters = Parameters() \ No newline at end of file +windse_parameters = Parameters() diff --git a/windse/WindFarmManager.py b/windse/WindFarmManager.py index 9182d088..069f1f31 100644 --- a/windse/WindFarmManager.py +++ b/windse/WindFarmManager.py @@ -199,10 +199,10 @@ def PlotChord(self,show=False,filename="chord_profiles",power=None, bounds=None) lower.append(seg_chord/modifier) upper.append(max(min(seg_chord*modifier,max_chord),c_avg)) c_avg = (c_avg*k+seg_chord)/(k+1) - plt.plot(x,lower,"--r",label="opt_bounds") + plt.plot(x,lower,"--r",label="Optimization Boundaries") plt.plot(x,upper,"--r") else: - plt.plot(x,bounds[0][-self.blade_segments:],"--r",label="opt_bounds") + plt.plot(x,bounds[0][-self.blade_segments:],"--r",label="Optimization Boundaries") plt.plot(x,bounds[1][-self.blade_segments:],"--r") for i in range(self.numturbs): diff --git a/windse/helper_functions.py b/windse/helper_functions.py index 1238685d..0c1dc18c 100644 --- a/windse/helper_functions.py +++ b/windse/helper_functions.py @@ -366,6 +366,19 @@ def UpdateActuatorLineForce(problem, mpi_u_fluid_constant, simTime_id, dt, turb_ simTime = problem.simTime_list[simTime_id] # print("debug data:", simTime, mpi_u_fluid_constant.values()) + + fa = open(problem.aoa_files[turb_i], 'a') + fx = open(problem.force_files[turb_i][0], 'a') + fy = open(problem.force_files[turb_i][1], 'a') + fz = open(problem.force_files[turb_i][2], 'a') + + fa.write('%.5f, ' % (simTime)) + fx.write('%.5f, ' % (simTime)) + fy.write('%.5f, ' % (simTime)) + fz.write('%.5f, ' % (simTime)) + + + if verbose: print("Current Optimization Time: "+repr(simTime)+", Turbine #"+repr(turb_i)) sys.stdout.flush() @@ -500,10 +513,9 @@ def get_angle_between_vectors(a, b, n): real_cd[k] = problem.interp_drag(aoa, rdim[k]) # Write the aoa to a file for future reference - # fp.write('%.5f, ' % (aoa/np.pi*180.0)) + fa.write('%.5f, ' % (aoa/np.pi*180.0)) # fp.close() - return real_cl, real_cd, tip_loss @@ -763,6 +775,11 @@ def get_angle_between_vectors(a, b, n): # Find the component in the direction tangential to the blade tangential_actuator_force = np.dot(actuator_force, blade_unit_vec[:, 2]) + rotor_plane_force = np.dot(actuator_force, blade_unit_vec) + fx.write('%.5f, ' % (rotor_plane_force[0])) + fy.write('%.5f, ' % (rotor_plane_force[1])) + fz.write('%.5f, ' % (rotor_plane_force[2])) + # Multiply by the distance away from the hub to get a torque actuator_torque = tangential_actuator_force*rdim[k] @@ -770,6 +787,16 @@ def get_angle_between_vectors(a, b, n): rotor_torque_numpy_temp += actuator_torque ### Should this be an output? + + fx.write('\n') + fy.write('\n') + fz.write('\n') + fa.write('\n') + fx.close() + fy.close() + fz.close() + fa.close() + # Output the numpy version of rotor_torque problem.rotor_torque[turb_i] = rotor_torque_numpy_temp if rotor_torque_numpy_temp > 0: