Skip to content

Commit

Permalink
I fixed an issue with the logger.
Browse files Browse the repository at this point in the history
  • Loading branch information
camUrban committed Dec 3, 2024
1 parent df8e12a commit 9a68464
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 17 additions & 14 deletions pterasoftware/unsteady_ring_vortex_lattice_method_no_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -178,7 +180,7 @@ def __init__(self, unsteady_problem):

def run(
self,
logging_level="Warning",
logging_level="Info",
prescribed_wake=True,
calculate_streamlines=True,
):
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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 "
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 9a68464

Please sign in to comment.