Skip to content

Commit

Permalink
Cosas varias
Browse files Browse the repository at this point in the history
  • Loading branch information
ZibraMax committed Apr 3, 2024
1 parent c8b9ffe commit 7e5c2c7
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 45 deletions.
1 change: 1 addition & 0 deletions Examples/Mesh_tests/Ejemplo_axial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"nodes": [[0.0], [1.5], [3.0], [4.0], [5.0]], "dictionary": [[0, 1], [1, 2], [2, 3], [3, 4]], "types": ["L1V", "L1V", "L1V", "L1V"], "regions": [], "ebc": [[0, 0]], "nbc": [[-1, -850]], "nvn": 1, "ngdl": 5, "holes": [], "fillets": [], "solutions": [{"info": {"solver-type": "lineal"}, "U": [[0.0], [-8.116902097686659e-05], [-0.00016233804195373317], [-0.0003126510437627454], [-0.0004629640455717576]]}], "properties": {"verbose": false, "name": "", "problem": "EDO1D", "a": null, "b": null, "c": null, "WARNING": "It's not possible lo save callables", "duration": 0.756277, "description": "FEM problem using the Generic 1D second order diferential equation formulation.,DOF: 5,Elements: 4,Solver: lineal,EBC: 1,NBC: 1"}}
34 changes: 34 additions & 0 deletions Examples/example_axial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
if __name__ == '__main__':
from FEM import EDO1D
from FEM.Geometry import Geometry1D
import matplotlib.pyplot as plt
import numpy as np
E = 20000000
r1 = 0.5
r2 = 0.3
A1 = r1**2*np.pi
A2 = r2**2*np.pi

def EA(x):
EE = (x <= 3)*E*A1
EE += (x > 3)*E*A2
return EE

geo = Geometry1D([[0, 1],
[1, 2],
[2, 3],
[3, 4]],

[[0.0],
[1.5],
[3],
[4],
[5]],

["L1V"]*4, 1)
geo.setCbe([[0, 0]])
geo.cbn = [[-1, -850]]
O = EDO1D(geo, EA, lambda x: 0, lambda x: 0)
O.solve(plot=True)
O.exportJSON("Ejemplo_axial.json")
plt.show()
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
- [x] Brick orden 2.
- [x] Pirámide orden 1.
- [x] Pirámide orden 2.
- [ ] Los elementos deben agruparse en un solo paquete.
- [x] Modificar geometría para que sea una clase mas general.
- [x] La clase gemoetría 2D debe tener los métodos que se tienen en la clase geometría actualmente.
- [x] Se deben agregar métodos equivalentes en la clase geometría 1D y 3D.
Expand Down
40 changes: 0 additions & 40 deletions a.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/FEM/Elements/Element.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def __init__(self, coords: np.ndarray, _coords: np.ndarray, gdl: np.ndarray, bor
self._x, self._p = self.T(self.Z.T)
self.jacs, self.dpz = self.J(self.Z.T)
self._xcenter = self.T(self.center.T)[0].flatten()
if not self.border:
if not self.fast:
if not self.border: # Border elements do not satisfy coordinate transformation requirements
if not self.fast: # Fast elements are for sparse matrix assembly
self.Ke = np.zeros([self.n, self.n])
self.Fe = np.zeros([self.n, 1])
self.Qe = np.zeros([self.n, 1])
Expand All @@ -59,7 +59,7 @@ def __init__(self, coords: np.ndarray, _coords: np.ndarray, gdl: np.ndarray, bor
self.Ue = np.zeros(self.gdl.shape)

def restartMatrix(self) -> None:
"""Sets all element matrices and vectors to 0 state
"""Sets all element matrices and vectors to 0
"""
if not self.border:
self.Ke[:, :] = 0.0
Expand Down
2 changes: 1 addition & 1 deletion src/FEM/Geometry/Region.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Region2D(Region):
"""

def __init__(self, coords: np.ndarray, **kargs) -> None:
"""Creates a 2D region using a 2D Element. The number of coordinates definesthe type of element.
"""Creates a 2D region using a 2D Element. The number of coordinates defines the type of element.
Args:
coords (np.ndarray): Coordinate matrix. Must be of four rows and 3 columns.
Expand Down

0 comments on commit 7e5c2c7

Please sign in to comment.