Damping

Understanding the DampingManager

The DampingManager is a core component of the Femora library that serves as a centralized system for creating, retrieving, tracking, and managing damping objects. It implements the Singleton pattern to ensure a single, consistent point of damping management across the entire application.

Damping models defined in Femora are automatically tracked, tagged, and organized by the DampingManager, simplifying the process of creating models with appropriate energy dissipation mechanisms.

Accessing the DampingManager

There are two ways to access the DampingManager in your code:

  1. Direct Access: Import and use the DampingManager class directly

    from Femora.components.Damping import DampingManager
    
    # Get the singleton instance
    damping_manager = DampingManager()
    
    # Use the damping manager directly
    damping_manager.create_damping(...)
    
  2. Through Femora (Recommended): Access via the Femora class’s .damping property

    import Femora as fm
    
    # Create a Femora instance
    
    
    # Access the DampingManager through the .damping property
    fm.damping.create_damping(...)
    

The second approach is recommended as it provides a unified interface to all of Femora’s components and ensures proper initialization of all dependencies.

How DampingManager Works

The DampingManager provides several key capabilities:

  1. Damping Creation: Creates damping objects of various types with appropriate parameters

  2. Damping Tracking: Keeps track of all damping instances by tag

  3. Damping Tagging: Automatically assigns sequential tags to damping models

  4. Damping Management: Provides methods to retrieve, update, and delete damping instances

When a damping model is created, the DampingManager:

  1. Assigns a unique numeric tag automatically

  2. Validates that all required parameters are present and valid

  3. Registers it for use in dynamic analyses

Damping Tagging System

The DampingManager implements an intelligent tagging system that:

  • Assigns sequential tags to damping instances starting from 1

  • Automatically retags instances when one is deleted to maintain sequential numbering

  • Ensures uniqueness of tags across the model

DampingManager API Reference

class femora.components.Damping.dampingBase.DampingManager[source]

Bases: object

A centralized manager for all damping instances in MeshMaker.

The DampingManager implements the Singleton pattern to ensure a single, consistent point of damping management across the entire application. It provides methods for creating, retrieving, and managing damping objects used in dynamic structural analysis.

All damping objects created through this manager are automatically tracked and tagged, simplifying the process of creating models with appropriate energy dissipation mechanisms.

Usage:

# Direct access from femora.components.Damping import DampingManager damping_manager = DampingManager()

# Through MeshMaker (recommended) from femora.components.MeshMaker import MeshMaker mk = MeshMaker() damping_manager = mk.damping

# Creating a damping instance rayleigh_damping = damping_manager.create_damping(‘rayleigh’, alphaM=0.05, betaK=0.001)

__init__()[source]

Initialize the DampingManager.

This method is called only once when the first instance of DampingManager is created. It sets up the necessary attributes and prepares the manager for use.

clear_all_dampings()[source]

Remove all damping instances managed by this DampingManager.

This method clears all damping instances from the manager, effectively resetting the damping system.

Return type:

None

create_damping(damping_type, **kwargs)[source]

Create a new damping instance of the specified type.

This method delegates the damping creation to the DampingRegistry, which maintains a dictionary of available damping types and their corresponding classes.

Parameters:
  • damping_type (str) – The type of damping to create. Available types include: - ‘rayleigh’: Classical Rayleigh damping - ‘modal’: Modal damping for specific modes - ‘frequency rayleigh’: Rayleigh damping specified by target frequencies - ‘uniform’: Uniform damping across a frequency range - ‘secant stiffness proportional’: Damping proportional to secant stiffness

  • **kwargs – Specific parameters for the damping type being created (see documentation for each damping type for details)

Returns:

A new instance of the requested damping type

Return type:

DampingBase

Raises:

ValueError – If the damping type is unknown or if required parameters are missing or invalid

get_all_dampings()[source]

Get all damping instances currently managed by this DampingManager.

Returns:

A dictionary mapping tags to damping instances

Return type:

Dict[int, DampingBase]

get_available_types()[source]

Get a list of available damping types that can be created.

Returns:

A list of damping type names that can be used with create_damping()

Return type:

List[str]

get_damping(tag)[source]

Get a damping instance by its tag.

Parameters:

tag (int) – The unique identifier of the damping instance

Returns:

The damping instance with the specified tag

Return type:

DampingBase

Raises:

KeyError – If no damping with the given tag exists

classmethod get_instance()[source]

Get the singleton instance of the DampingManager.

This method ensures that only one instance of DampingManager exists throughout the application, following the Singleton design pattern.

Returns:

The singleton instance of the DampingManager

Return type:

DampingManager

remove_damping(tag)[source]

Remove a damping instance by its tag.

This method removes the specified damping instance and automatically updates the tags of the remaining damping instances to maintain sequential numbering.

Parameters:

tag (int) – The unique identifier of the damping instance to remove

Return type:

None

Damping Creation

Creating damping models is one of the primary functions of the DampingManager. When creating a damping model, you need to specify:

  1. damping_type: Specifies the damping model to create. Available types include: - rayleigh: Classical Rayleigh damping - modal: Modal damping for specific modes - frequency rayleigh: Rayleigh damping specified by target frequencies - uniform: Uniform damping across a frequency range - secant stiffness proportional: Damping proportional to secant stiffness

  2. Damping-specific parameters: Each damping type requires specific parameters (like alphaM, betaK for Rayleigh damping)

The DampingManager handles all the details of creating the appropriate damping object based on these parameters, ensuring type safety and parameter validation.

Usage Example

from Femora.components.Damping import DampingManager

# Get the damping manager instance
damping_manager = DampingManager()

# Create a Rayleigh damping instance
rayleigh_damping = damping_manager.create_damping(
    'rayleigh',
    alphaM=0.1,
    betaK=0.2,
    betaKInit=0.0,
    betaKComm=0.0
)

# Create a modal damping instance
modal_damping = damping_manager.create_damping(
    'modal',
    numberofModes=3,
    dampingFactors="0.02,0.03,0.04"
)

# Access an existing damping instance by tag
damping = damping_manager.get_damping(1)

# Remove a damping instance
damping_manager.remove_damping(2)

# Get all available damping types
available_types = damping_manager.get_available_types()
print(available_types)  # ['frequency rayleigh', 'rayleigh', 'modal', ...]

Available Damping Types

The damping models available in Femora provide various approaches to energy dissipation in dynamic analysis. Follow the link above to explore the different damping models available.

Each damping type has its own documentation page with detailed parameter descriptions and usage examples.