Metadata-Version: 2.4
Name: 3pc-sandfreq
Version: 1.0.0
Summary: Python library for free vibration analysis of shear deformable anisotropic sandwich plates.
Author: Omprakash Seresta
Author-email: oseresta@gmail.com
License: MIT
Project-URL: Blog, https://3pcomposites.com/blogs-1/f/3pcsolver008-free-vibration-analysis-of-sandwich-plates
Project-URL: Analysis Tools, https://3pcomposites.com/analysis-tools
Project-URL: Documentation, https://drive.google.com/drive/folders/1jDb-P5BOgJ-moVU20B7D8oVeHjHLAHTm
Keywords: sandwich-plates vibration-analysis free-vibration composites anisotropic aerospace-engineering mechanics fsdt clt
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: 3pc-material
Requires-Dist: 3pc-ply
Requires-Dist: 3pc-laminate
Requires-Dist: 3pc-panel
Requires-Dist: 3pc-sandwich
Requires-Dist: 3pc-loads
Requires-Dist: 3pc-utils
Requires-Dist: numpy
Requires-Dist: scipy
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 3pc-sandfreq

`3pc-sandfreq` is a Python library for free vibration analysis of shear deformable anisotropic sandwich plates. It provides a `Sandfreq` class to calculate natural frequencies and mode shapes, considering shear deformation effects in composite sandwich construction.

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `3pc-sandfreq`. Since the package and its dependencies are available on PyPI, you can install them directly:

```bash
pip install 3pc-sandfreq
```

Alternatively, you can install it from the local source directory:

```bash
pip install .
```

## API Reference

### `Sandfreq` Class

The primary component of this package is the `Sandfreq` class, which takes a panel, a load case, and analysis grid settings to compute natural frequencies and mode shapes.

```python
from sandfreq.sandfreq import Sandfreq
```

#### Required Parameters

When initializing `Sandfreq`, the following parameters are required:

*   **`panel`** *(Panel)*: An instance of the `Panel` class (from `3pc-panel`) representing the sandwich plate panel.
*   **`loads`** *(Loads)*: An instance of the `Loads` class (from `3pc-loads`) containing the applied in-plane loads ($N_{xx}$, $N_{yy}$, $N_{xy}$).
*   **`number_of_terms`** *(int)*: The number of terms to use in the Ritz/analytical solver.
*   **`number_of_points_x`** *(int)*: Number of reporting points along the length (x-axis).
*   **`number_of_points_y`** *(int)*: Number of reporting points along the width (y-axis).

#### Calculated Properties

The class calculates the following properties:

*   **`pairs`**: List of $(m, n)$ pairs for all $i, j = 1, 2, \dots, M$, where $M$ is the number of terms in the analysis.
*   **`K33`**: Loads dependent part of the stiffness matrix $K_{33}$ for all pairs.
*   **`lambdaEV`**: Right eigenvalues of the generalized eigenvalue problem: $K = \lambda_{EV} \cdot M$.
*   **`vr`**: Right eigenvectors of the generalized eigenvalue problem.
*   **`lambda_cr`**: Critical eigenvalue.
*   **`vr_cr`**: Critical right eigenvector.
*   **`mn_cr`**: Critical $(m, n)$ pair.
*   **`lambdaP`**: Sorted list of positive eigenvalues.
*   **`lambda1` to `lambda5`**: First to fifth critical (lowest positive) eigenvalues (natural frequencies in Hz).
*   **`mn1` to `mn5`**: Dominant $(m, n)$ mode shapes corresponding to natural frequencies `lambda1` to `lambda5`.

### Methods

#### `Sandfreq.fromDict(**kwargs)`

Initializes a `Sandfreq` instance using a dictionary of keyword arguments.

---

## Usage Examples

### Basic Initialization

Below is an example of performing a sandwich free vibration analysis.

```python
from panel.panel import Panel
from loads.loads import Loads
from sandfreq.sandfreq import Sandfreq

# Assuming pnl (Panel) and ld (Loads) are already defined
sf = Sandfreq(
    panel=pnl,
    loads=ld,
    number_of_terms=4,
    number_of_points_x=11,
    number_of_points_y=11
)

# Access natural frequencies and their dominant mode shapes
print("First Natural Frequency (Hz):", sf.lambda1)
print("Dominant (m, n) for lambda1:", sf.mn1)
```

## Commands

The package provides a command-line interface entry point. After installing, you can run the application using:

```bash
sandfreq input.cfg
```

*(This entry point is defined in `sandfreq.__main__:main`)*

### Options

*   **`config`** *(positional)*: Specify the configuration file (`.cfg`) to run the analysis.
*   **`-h, --help`**: Show the help message and exit.
*   **`-v, --version`**: Show the version number.
*   **`-s, --sample`**: Copy example files (materials, plies, cores, laminates, panels, loads, config) to the current directory.

### Configuration File (`sandfreq.cfg`)

The `sandfreq` command requires a configuration file (typically named `sandfreq.cfg`). Below is an example based on `sandfreq/examples/example001/sandfreq.cfg`:

```ini
[files]
materials = materials.json
plies = plies.json
cores = cores.json
laminates = laminates.json
panels = panels.json
loads = loads.json
output = output.txt

[analysis]
number_of_terms = 4
number_of_points_x = 11
number_of_points_y = 11
```

#### `[files]` Section

This section defines the paths to the required input JSON files and the desired output file:

*   **`materials`**: Path to the materials JSON file. Follows the format expected by [`3pc-material`](https://pypi.org/project/3pc-material/).
*   **`plies`**: Path to the plies JSON file. Follows the format expected by [`3pc-ply`](https://pypi.org/project/3pc-ply/).
*   **`cores`**: Path to the cores JSON file.
*   **`laminates`**: Path to the laminates JSON file. Follows the format expected by [`3pc-laminate`](https://pypi.org/project/3pc-laminate/).
*   **`panels`**: Path to the panels JSON file. Follows the format expected by [`3pc-panel`](https://pypi.org/project/3pc-panel/).
*   **`loads`**: Path to the loads JSON file. Follows the format expected by [`3pc-loads`](https://pypi.org/project/3pc-loads/).
*   **`output`**: Path to the text file where the sandwich free vibration analysis results will be written.

#### `[analysis]` Section

This section specifies the analysis settings:

*   **`number_of_terms`**: The number of terms to use in the Ritz/analytical solver.
*   **`number_of_points_x`**: Number of reporting points along the length (x-axis).
*   **`number_of_points_y`**: Number of reporting points along the width (y-axis).

## Citation

If you use this library in your research or work, please cite it as follows:

**APA Format:**
> Rastogi, N., & Seresta, O. (2026). *3pc-sandfreq: Python library for free vibration analysis of shear deformable anisotropic sandwich plates*. PyPI. https://pypi.org/project/3pc-sandfreq/

**BibTeX:**
```bibtex
@software{3pc_sandfreq,
  author = {Rastogi, Naveen and Seresta, Omprakash},
  title = {3pc-sandfreq: Python library for free vibration analysis of shear deformable anisotropic sandwich plates},
  year = {2026},
  url = {https://pypi.org/project/3pc-sandfreq/}
}
```
