⚡ Campo Estático 2D (MDF)
campo-estatico-mdf es una librería Python diseñada para resolver la Ecuación de Laplace ($\nabla^2 V = 0$) en dos dimensiones utilizando el Método de Diferencias Finitas (MDF) con el método iterativo de Jacobi.
Esta herramienta permite simular el potencial eléctrico ($V$) y el campo eléctrico ($\mathbf{E}$) resultante en una región rectangular con condiciones de contorno de Dirichlet (potenciales fijos).
📦 Instalación
Puedes instalar la librería directamente desde PyPI usando pip:
pip install campo-estatico-mdf
Requisitos
Este paquete requiere:
- Python 3.9 o superior
numpy(para las operaciones matriciales)
🚀 Uso Básico (Modo Librería)
La clase principal es LaplaceSolver2D. Aquí tienes un ejemplo de cómo utilizarla para simular una región con una diferencia de potencial.
import numpy as np
from campo_estatico_mdf.solver import LaplaceSolver2D
import matplotlib.pyplot as plt
# 1. Parámetros
N = 50 # Malla 50x50
V_IZQ = 10.0 # Voltaje Izquierdo (10V)
V_DER = 0.0 # Voltaje Derecho (0V)
V_ARR = 0.0 # Voltaje Superior (0V)
V_ABJ = 0.0 # Voltaje Inferior (0V)
TOLERANCIA = 1e-5
# 2. Inicializar y Resolver
solver = LaplaceSolver2D(
N,
v_izquierda=V_IZQ,
v_derecha=V_DER,
v_arriba=V_ARR,
v_abajo=V_ABJ
)
iteraciones = solver.resolver_jacobi(tolerancia=TOLERANCIA)
print(f"Convergencia alcanzada en {iteraciones} iteraciones.")
# 3. Obtener resultados
Potencial_V = solver.V
Ex, Ey = solver.calcular_campo_e()
# 4. Visualización del Potencial
plt.figure(figsize=(8, 6))
plt.title("Potencial Eléctrico V(x, y)")
plt.imshow(Potencial_V, cmap='viridis', origin='lower')
plt.colorbar(label='Potencial (V)')
plt.show()
💻 Aplicación Streamlit (Web App)
El proyecto incluye una interfaz web interactiva (app.py) construida con Streamlit que permite a los usuarios modificar las condiciones de contorno y visualizar los resultados del Potencial ($V$) y el Campo Eléctrico ($\mathbf{E}$) en tiempo real.
Para ejecutar la aplicación web:
- Instala las dependencias adicionales (si aún no lo has hecho):
pip install streamlit matplotlib
- Ejecuta la aplicación desde el directorio que contiene
app.py:streamlit run app.py
⚙️ Características Técnicas
- Método de Diferencias Finitas (MDF) para discretizar la Ecuación de Laplace.
- Método Iterativo de Jacobi para resolver el sistema de ecuaciones.
- Criterio de convergencia basado en la diferencia máxima entre iteraciones sucesivas ($\mathbf{E}$).
- Cálculo del Campo Eléctrico ($\mathbf{E} = -\nabla V$) usando la función
numpy.gradient.
🤝 Contribución
¡Las contribuciones son bienvenidas! Si deseas mejorar el rendimiento (por ejemplo, implementando Gauss-Seidel o SOR) o añadir nuevas características:
- Haz un fork del repositorio.
- Crea una nueva branch (
git checkout -b feature/nueva-caracteristica). - Realiza tus cambios y haz commit (
git commit -am 'feat: Añadir nueva característica'). - Haz push a la branch (
git push origin feature/nueva-caracteristica). - Abre un Pull Request.
Metadata
Release files for campo-estatico-mdf-065 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| campo_estatico_mdf_065-0.1.0.tar.gz | 12.2 kB | Without provenance | Details for campo_estatico_mdf_065-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| campo_estatico_mdf_065-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for campo_estatico_mdf_065-0.1.0-py3-none-any.whl |
Total release size: 24.1 kB
Release files / campo_estatico_mdf_065-0.1.0.tar.gz
| Download URL | campo_estatico_mdf_065-0.1.0.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1da564c86d5c05bb05306a2c38abe16bc75277849f04485d2ed0ef33b0a4962
|
|
BLAKE2b-256 checksum How to use checksums |
49f34e54c22175381c64bc1b44d1f4c6b107939f50601931374c3da610d1ff02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / campo_estatico_mdf_065-0.1.0-py3-none-any.whl
| Download URL | campo_estatico_mdf_065-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d9702a638f44724cae798762d8c30f96cc27a5a598b21058beba8a7fe63900e
|
|
BLAKE2b-256 checksum How to use checksums |
98305348d10e1d41792f9120080db340328c92414efae4aa5cf41af53a678e01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for campo-estatico-mdf-065 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.