From 9a684644c78ba7e3b3a8452913910c3b7a81cfa5 Mon Sep 17 00:00:00 2001 From: camUrban Date: Mon, 2 Dec 2024 20:23:59 -0500 Subject: [PATCH] I fixed an issue with the logger. --- ...x_lattice_method_solver_no_bar_variable.py | 7 ++--- ...teady_ring_vortex_lattice_method_no_bar.py | 31 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/examples/unsteady_ring_vortex_lattice_method_solver_no_bar_variable.py b/examples/unsteady_ring_vortex_lattice_method_solver_no_bar_variable.py index 4a9e12ea..6d3383c9 100644 --- a/examples/unsteady_ring_vortex_lattice_method_solver_no_bar_variable.py +++ b/examples/unsteady_ring_vortex_lattice_method_solver_no_bar_variable.py @@ -429,12 +429,9 @@ # Run the example solver. example_solver.run( - # This parameter determines the detail of information that the solver's logger - # will output while running. The options are, in order of detail and severity, - # "Debug", "Info", "Warning", "Error", "Critical". The default value is "Warning". - logging_level="Warning", - # Use a prescribed wake model. This is faster, but may be slightly less accurate. + logging_level="Info", prescribed_wake=True, + calculate_streamlines=False, ) # Call the software's animate function on the solver. This produces a GIF of the wake diff --git a/pterasoftware/unsteady_ring_vortex_lattice_method_no_bar.py b/pterasoftware/unsteady_ring_vortex_lattice_method_no_bar.py index 9eca82cc..790b236e 100644 --- a/pterasoftware/unsteady_ring_vortex_lattice_method_no_bar.py +++ b/pterasoftware/unsteady_ring_vortex_lattice_method_no_bar.py @@ -19,6 +19,8 @@ from . import aerodynamics from . import functions +logger = logging.getLogger("Simulator") + class UnsteadyRingVortexLatticeMethodSolverNoBar: """This is an aerodynamics solver that uses an unsteady ring vortex lattice method and runs without a progress bar. @@ -178,7 +180,7 @@ def __init__(self, unsteady_problem): def run( self, - logging_level="Warning", + logging_level="Info", prescribed_wake=True, calculate_streamlines=True, ): @@ -198,11 +200,12 @@ def run( emanating from the back of the wing after running the solver. :return: None """ - # Configure the problem's logger. + # Configure the logger's level. logging_level_value = functions.convert_logging_level_name_to_value( logging_level ) - logging.basicConfig(level=logging_level_value) + logger.setLevel(logging_level_value) + logger.info("Logger configured.") # The following loop iterates through the steps to populate currently empty # attributes with lists of pre-allocated arrays. During the simulation, @@ -262,7 +265,7 @@ def run( ) # Initialize all the airplanes' panels' vortices. - logging.info("Initializing all airplanes' panel vortices.") + logger.info("Initializing all airplanes' panel vortices.") self.initialize_panel_vortices() # Iterate through the time steps. @@ -278,7 +281,7 @@ def run( self.current_freestream_velocity_geometry_axes = ( self.current_operating_point.calculate_freestream_velocity_geometry_axes() ) - logging.info( + logger.info( "Beginning time step " + str(self.current_step) + " out of " @@ -365,43 +368,43 @@ def run( # Collapse this problem's geometry matrices into 1D arrays of # attributes. - logging.info("Collapsing the geometry.") + logger.info("Collapsing the geometry.") self.collapse_geometry() # Find the matrix of wing-wing influence coefficients associated with # the airplanes' geometries. - logging.info("Calculating the wing-wing influences.") + logger.info("Calculating the wing-wing influences.") self.calculate_wing_wing_influences() # Find the vector of freestream-wing influence coefficients associated # with this problem. - logging.info("Calculating the freestream-wing influences.") + logger.info("Calculating the freestream-wing influences.") self.calculate_freestream_wing_influences() # Find the vector of wake-wing influence coefficients associated with # this problem. - logging.info("Calculating the wake-wing influences.") + logger.info("Calculating the wake-wing influences.") self.calculate_wake_wing_influences() # Solve for each panel's vortex strength. - logging.info("Calculating vortex strengths.") + logger.info("Calculating vortex strengths.") self.calculate_vortex_strengths() # Solve for the near field forces and moments on each panel. if self.current_step >= self.first_results_step: - logging.info("Calculating near field forces and moments.") + logger.info("Calculating near field forces and moments.") self.calculate_near_field_forces_and_moments() # Solve for the near field forces and moments on each panel. - logging.info("Shedding wake vortices.") + logger.info("Shedding wake vortices.") self.populate_next_airplanes_wake(prescribed_wake=prescribed_wake) - logging.info("Calculating averaged or final forces and moments.") + logger.info("Calculating averaged or final forces and moments.") self.finalize_near_field_forces_and_moments() # Solve for the location of the streamlines if requested. if calculate_streamlines: - logging.info("Calculating streamlines.") + logger.info("Calculating streamlines.") functions.calculate_streamlines(self) def initialize_panel_vortices(self):