Skip to content

Commit

Permalink
update v0.2.8 --> v0.3.0
Browse files Browse the repository at this point in the history
Add pressure load and cyclic symm. boudary condicions
  • Loading branch information
avgcampos committed Jun 17, 2024
1 parent 246cb8c commit d3e1488
Show file tree
Hide file tree
Showing 19 changed files with 783 additions and 104 deletions.
14 changes: 7 additions & 7 deletions docs/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ Esta nova versão permite a inclusão de módulos e códigos escritos em C/Cytho
1. Multi-material
- [X] Interface de multi-material (multi E, v, ...)
2. Acoplamento multi-físico
- [ ] Fluid-Structure Interaction
- [ ] Thermal-Structure Interaction
- [ ] Acoustic-Structure Interaction
- [ ] Fluid-Structure interaction
- [ ] Thermal-Structure interaction
- [ ] Acoustic-Structure interaction
5. Comportamento mecânico e material:
- [X] Plane stress
- [X] Plane strain
- [X] Solid isotropic
- [ ] Solid isotropic
- [ ] Plate Kirchhoff
- [ ] Plate Reissner-Mindlin
- [ ] Cyclic symmetry boundary
- [X] Cyclic symmetry boundary
- [X] Pressure load application
- [ ] Homogeinização/ micro escala (tensor)

8. Validar a análise com a implementação seguintes tipos de elementos isoparametrico:
Expand All @@ -78,6 +79,5 @@ Esta nova versão permite a inclusão de módulos e códigos escritos em C/Cytho

10. [X] Desenvolver a saida dos resultados por meio de arquivos .vtk;

##

##
Após a nova implementação, foi feito um _merge_ no repositório **myfempy_dev** (repositório oficial para desenvolvimento e testes), e após passar por todos os teste foi feito o upload para o repositório principal **myfempy** do projeto.
202 changes: 138 additions & 64 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,69 +206,143 @@ The changelog is available

``` bash
/myfempy
├───core
│ alglin.py
│ harmonicforced.py
│ mesh.py
│ modallinear.py
│ solver.py
│ staticlinear.py
│ utils.py
├───felib
│ │
│ ├───elements
│ │ element.py
│ │ plane.py
│ │ platekc.py
│ │ solid.py
│ │
│ ├───geometry
│ │ geometry.py
│ │ rectangle.py
│ │ thickness.py
│ │
│ │
│ ├───material
│ │ material.py
│ │ planestrain.py
│ │ planestress.py
│ │ solid.py
│ │
│ ├───physic
│ │ bcstruct.py
│ │ loadstruct.py
│ │ structural.py
│ │
│ ├───shapes
│ hexa8.py
│ line.py
│ line2.py
│ quad4.py
│ shape.py
│ tetr4.py
│ tria3.py
├───io
│ iocsv.py
│ iogmsh.py
│ iovtk.py
├───misc
│ logo.png
│ logo.txt
│ path.py
│ utils.py
├───plots
meshquality.py
physics.py
plotmesh.py
plotxy.py
postplot.py

| __about__.py
| __init__.py
|
+---core
| | utilities.py
| | __init__.py
| |
| +---elements
| | | acustic2DWP.py
| | | beamEB.py
| | | beamNL.py
| | | element.py
| | | fluid1DLF.py
| | | fluid2DLF.py
| | | heat2DSS.py
| | | heat2DTR.py
| | | plane.py
| | | plateKC.py
| | | solid.py
| | | specials.py
| | | __init__.py
| |
| +---geometry
| | | geometry.py
| | | rectangle.py
| | | thickness.py
| | | __init__.py
| |
| +---material
| | | fluidplane.py
| | | material.py
| | | microscale.py
| | | planestrain.py
| | | planestress.py
| | | solid.py
| | | __init__.py
| |
| +---mesh
| | | gmsh.py
| | | legacyquad4.py
| | | legacytria3.py
| | | mesh.py
| | | __init__.py
| |
| +---physic
| | | acustic.py
| | | bcstruct.py
| | | coupling.py
| | | fluidflow.py
| | | loadstruct.py
| | | structural.py
| | | thermal.py
| |
| +---shapes
| | | hexa20.py
| | | hexa8.py
| | | line.py
| | | line2.py
| | | line3.py
| | | quad4.py
| | | quad4_tasks.c
| | | quad4_tasks.cp311-win_amd64.pyd
| | | quad4_tasks.html
| | | quad4_tasks.pyx
| | | quad8.py
| | | shape.py
| | | tetr10.py
| | | tetr4.py
| | | tria3.py
| | | tria3_tasks.c
| | | tria3_tasks.cp311-win_amd64.pyd
| | | tria3_tasks.html
| | | tria3_tasks.pyx
| | | tria6.py
| | | __init__.py
| |
| +---solver
| | | acustic.py
| | | assembler.py
| | | assemblerfull.py
| | | assemblerfull_cython_v4.c
| | | assemblerfull_cython_v4.cp311-win_amd64.pyd
| | | assemblerfull_cython_v4.html
| | | assemblerfull_cython_v4.pyx
| | | assemblerfull_numpy_v1.py
| | | assemblersymm.py
| | | assemblersymm_cython_v4.c
| | | assemblersymm_cython_v4.cp311-win_amd64.pyd
| | | assemblersymm_cython_v4.html
| | | assemblersymm_cython_v4.pyx
| | | assemblersymm_numpy_v1.py
| | | buckling.py
| | | cyclicsymm.py
| | | dynamic.py
| | | fluid.py
| | | harmoniclinear.py
| | | harmonicmodal.py
| | | modallinear.py
| | | multiphysic.py
| | | solver.py
| | | staticlinear.py
| | | staticlineariterative.py
| | | staticnonlinear.py
| | | thermal.py
| | | __init__.py
|
|
+---io
| | iocsv.py
| | iogmsh.py
| | iovtk.py
| | __init__.py
|
+---plots
| | meshquality.py
| | physics.py
| | plotmesh.py
| | plotxy.py
| | postplot.py
| | prevplot.py
| | __init__.py
|
+---setup
| | asi.py
| | fea.py
| | fsi.py
| | model.py
| | physics.py
| | results.py
| | topopt.py
| | tsi.py
| | __init__.py
|
+---utils
| | logo.png
| | logo.txt
| | utils.py
| | __init__.py

```
2 changes: 1 addition & 1 deletion myfempy/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.9"
__version__ = "0.3.0"
2 changes: 2 additions & 0 deletions myfempy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import

from .__about__ import __version__
from .core.solver.cyclicsymm import StaticLinearCyclicSymm
from .core.solver.harmoniclinear import HarmonicLinear
from .core.solver.modallinear import ModalLinear
from .core.solver.staticlinear import StaticLinear
Expand All @@ -11,6 +12,7 @@
"newAnalysis",
"StaticLinear",
"StaticLinearIterative",
"StaticLinearCyclicSymm",
"ModalLinear",
"HarmonicLinear",
"__version__",
Expand Down
26 changes: 26 additions & 0 deletions myfempy/core/physic/bcstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def getBCApply(modelinfo, bclist):
bcl = bclist[bc_index]
bcapp = BoundCondStruct.__BCDispl(modelinfo, bcl)
boncdnodeaply = np.append(boncdnodeaply, bcapp, axis=0)
elif bclist[bc_index][0] == "csymm":
bcl = bclist[bc_index]
bcapp = BoundCondStruct.__BCCS(modelinfo, bcl)
boncdnodeaply = np.append(boncdnodeaply, bcapp, axis=0)
else:
pass
boncdnodeaply = boncdnodeaply[1::][::]
Expand Down Expand Up @@ -63,3 +67,25 @@ def __BCDispl(modelinfo, bclist):

boncdnodeaply = boncdnodeaply[1::][::]
return boncdnodeaply

def __BCCS(modelinfo, bclist):
boncdnodeaply = np.zeros((1, 4))

nodelist = bclist[2:]
node_list_bc, dir_fc = get_nodes_from_list(
nodelist, modelinfo["coord"], modelinfo["regions"]
)

if bclist[1] == "left":
bcdof = 11
elif bclist[1] == "right":
bcdof = 12
else:
bcdof = 0

for j in range(len(node_list_bc)):
bcapp = np.array([[int(node_list_bc[j]), bcdof, 0.0, int(bclist[8])]])
boncdnodeaply = np.append(boncdnodeaply, bcapp, axis=0)

boncdnodeaply = boncdnodeaply[1::][::]
return boncdnodeaply
4 changes: 4 additions & 0 deletions myfempy/core/solver/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ def getConstrains():
@abstractmethod
def getDirichletNH():
pass

@abstractmethod
def getRotationMatrix():
pass
56 changes: 38 additions & 18 deletions myfempy/core/solver/assemblerfull.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,7 @@ def getConstrains(constrains, nodetot, nodedof):
elif nodedof == 2:
for ii in range(ntbc):
no = int(constrains[ii, 0])
if int(constrains[ii, 1]) == 0:
if constrains[ii, 2] == 0.0:
fixedof[nodedof * no - 2, 0] = nodedof * no - 1
fixedof[nodedof * no - 1, 0] = nodedof * no
else:
constdof[0, nodedof * no - 2, 0] = nodedof * no - 1
constdof[0, nodedof * no - 1, 0] = nodedof * no
elif int(constrains[ii, 1]) == 1:
if int(constrains[ii, 1]) == 1:
if constrains[ii, 2] == 0.0:
fixedof[nodedof * no - 2, 0] = nodedof * no - 1
else:
Expand All @@ -143,20 +136,18 @@ def getConstrains(constrains, nodetot, nodedof):
fixedof[nodedof * no - 1, 0] = nodedof * no
else:
constdof[nodedof * no - 1, 0] = nodedof * no

elif nodedof == 3:
for ii in range(ntbc):
no = int(constrains[ii, 0])
if int(constrains[ii, 1]) == 0:
else: # int(constrains[ii, 1]) == 0:
if constrains[ii, 2] == 0.0:
fixedof[nodedof * no - 3, 0] = nodedof * no - 2
fixedof[nodedof * no - 2, 0] = nodedof * no - 1
fixedof[nodedof * no - 1, 0] = nodedof * no
else:
constdof[nodedof * no - 3, 0] = nodedof * no - 2
constdof[nodedof * no - 2, 0] = nodedof * no - 1
constdof[nodedof * no - 1, 0] = nodedof * no
elif int(constrains[ii, 1]) == 1:
constdof[0, nodedof * no - 2, 0] = nodedof * no - 1
constdof[0, nodedof * no - 1, 0] = nodedof * no

elif nodedof == 3:
for ii in range(ntbc):
no = int(constrains[ii, 0])
if int(constrains[ii, 1]) == 1:
if constrains[ii, 2] == 0.0:
fixedof[nodedof * no - 3, 0] = nodedof * no - 2
else:
Expand All @@ -171,6 +162,15 @@ def getConstrains(constrains, nodetot, nodedof):
fixedof[nodedof * no - 1, 0] = nodedof * no
else:
constdof[nodedof * no - 1, 0] = nodedof * no
else: # int(constrains[ii, 1]) == 0:
if constrains[ii, 2] == 0.0:
fixedof[nodedof * no - 3, 0] = nodedof * no - 2
fixedof[nodedof * no - 2, 0] = nodedof * no - 1
fixedof[nodedof * no - 1, 0] = nodedof * no
else:
constdof[nodedof * no - 3, 0] = nodedof * no - 2
constdof[nodedof * no - 2, 0] = nodedof * no - 1
constdof[nodedof * no - 1, 0] = nodedof * no

fixedof = fixedof[np.nonzero(fixedof)]
fixedof = fixedof - np.ones_like(fixedof)
Expand Down Expand Up @@ -236,3 +236,23 @@ def getDirichletNH(constrains, nodetot, nodedof):
else:
pass
return Uc

# https://en.wikipedia.org/wiki/Rotation_matrix
def getRotationMatrix(node_list, coord, ndof):
# Initialize RM as a sparse matrix
RM = sparse.lil_matrix((ndof, ndof))
for n in range(node_list.shape[0]):
nol = int(node_list[n] - 1)
RonX = coord[nol, 1] # - Og[0]
RonY = coord[nol, 2] # - Og[1]
Ron = np.sqrt(RonX**2 + RonY**2)
S_the = RonY / Ron
C_the = RonX / Ron
# Assign values to the sparse matrix
RM[2 * n, 2 * n] = C_the
RM[2 * n, 2 * n + 1] = -S_the
RM[2 * n + 1, 2 * n] = S_the
RM[2 * n + 1, 2 * n + 1] = C_the

# Convert to CSR format for more efficient arithmetic and matrix-vector operations
return RM.tocsr()
3 changes: 3 additions & 0 deletions myfempy/core/solver/assemblersymm.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ def getConstrains(constrains, nodetot, nodedof, Uc):

def getDirichletNH(constrains, nodetot, nodedof):
return AssemblerFULL.getDirichletNH(constrains, nodetot, nodedof)

def getRotationMatrix(node_list, coord, ndof):
return AssemblerFULL.getRotationMatrix(node_list, coord, ndof)
Loading

0 comments on commit d3e1488

Please sign in to comment.