Metadata-Version: 2.1
Name: metamaterialanalysiscode
Version: 0.1
Summary: Package for generating FEM models based on cells
Author-email: Manuel Sanchez Garcia <msg.aerospace@gmail.com>
License: Copyright 2023 Manuel Sánchez García
        
        The following license affect the code but not the intellectual property of the patents used in the code.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
        documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
        rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
        persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of
        the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
        WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
        COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
        OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Keywords: mac,Preprocessing,FEM,Metamaterial
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# Metamaterial Analysis Code

## 1. Introduction

This code is the core of the TFM (Final Master Project) "Simulación Mediante  Elementos Finitos Del Comportamiento No
Lineal De Metamateriales Auxéticos En Grandes Desplazamientos Para Uso Ingenieril." It is an OOP pacakage that
allows the user to generate .fem files with the mesh of components based on metamaterial structure.
This means that the material is not solid but consists of cells. Only works for Optistruct.

## 2. Version update

As this is the first version, there are no updates.

## 3. Property and License

The code is property of Manuel Sanchez and the ETSIAE. It follows the MIT license.

The Patent used in the code is exclusively property of their creators. Copy or modifying are not allowed
without permission of their owners.

## 4. Documentation

The package can be used by calling the functions that gets the different objects that are instances of
the different "MACClasses" defined in the code.

Importing the package:
````python
import metamaterialanalysiscode as mac
````

An example of generating a model:
````python
material1 = mac.set_material(id=1, type="MATS1", stressstrain=tabla_strainstress1, nonlinearity="PLASTIC",
                             yieldstress=0.02)

material2 = mac.set_material(id=2, type="MAT1", e=70000, nu=0.3)

beam2 = mac.set_property(id=2, type="PBEAM", material=[material2], area=2000, i1=0.0001, i2=1, i12=1, j=1)

beam1 = mac.set_property(id=1, type="PBEAML", material=[material2], section="ROD", dim1=1.0)

cellstructure1 = mac.set_structure(type="Auxetic", djoint=5.3, dstar=-0.3, heightstar=0.3, hcapas=3,
                                   hprisma=15, stepx=10, stepy=10, nelem=4)


modelo1 = mac.set_model(modeldimensions=(150, 300, 70), cellstructure=cellstructure1, cellmaterial=[material2],
                        cellproperty=[beam1])
````
 Printing the model into a .fem file:

````python
modelo1.write_fem(r"C:\Users\admin\Desktop\test1_model.fem")
````

Generating and printing an analyisis:
````python
enforcedispl1 = MAC.set_load(id=1, type="SPC", nodes=nodesdisp, components=[3], displacement=-0.5, load=True)

constraint1 = MAC.set_constraint(id=2, nodes=nodesdisp, components=[3], displacement=-0.5)

constraint2 = MAC.set_constraint(id=2, nodes=nodespc, components=[1, 2, 3, 4, 5, 6], displacement=0)

subcase1 = MAC.set_subcase(id=1, label="linear", loads=[enforcedispl1], constraints=[constraint1, constraint2])

analysis2 = MAC.set_analysis(model=modelo1, subcases=[subcase1])

analysis2.write_fem(r"C:\Users\admin\Desktop\test1_analysis.fem")
````

As all the nodes and elements are saved in two dictionaries, the user can modify coords, properties, materials,
etc. 

A basic knowledge of OOP is needed to understand and use the advance functionalities that the package brings

Example:
```python
elementtodel = set()
nodetodel = set()
for elementkey in modelo1.ElementDict.keys():
    for node in modelo1.ElementDict[elementkey].Nodes:
        if node.Coords[2] < (minz+0.1) or node.Coords[2] > (maxz-0.1):
            nodetodel.add(node.ID)
            elementtodel.add(elementkey)

for elementkey in elementtodel:
    del modelo1.ElementDict[elementkey]

for nodekey in nodetodel:
    del modelo1.NodeDict[nodekey]
```
