Commit 3061c5f3 authored by Baptiste Durand's avatar Baptiste Durand

Homogenization of beam of pantographic cells

New cells : only pantographic effect, no shear floppy mode
parent 5baa7eed
......@@ -7,7 +7,7 @@ Created on 09/01/2019
from ho_homog import materials as mat
from ho_homog import part
from ho_homog import mesh_generate_2D
from ho_homog import mesh_generate
import matplotlib.pyplot as plt
from ho_homog import homog2d as hom
import dolfin as fe
......@@ -33,7 +33,7 @@ fe.set_log_level(20)
a = 1
b, k = a, a / 3
r = a / 1e3
panto_test = mesh_generate_2D.Gmsh2DRVE.pantograph(
panto_test = mesh_generate.pantograph.pantograph_RVE(
a, b, k, r, nb_cells=(1, 1), soft_mat=True, name="panto_with_soft"
)
panto_test.main_mesh_refinement((3 * r, a / 2), (r / 6, a / 6), True)
......
......@@ -144,8 +144,8 @@ Description: <!-- # Project Title
## Authors
- **Baptiste Durand** - *PhD student* - Laboratoire NAVIER, UMR 8205 - [@baptiste.durand](https://gitlab.enpc.fr/baptiste.durand) - [baptiste.durand@enpc.fr](mailto:baptiste.durand@enpc.fr)
- **Arthur Lebée** - *Researcher* - Laboratoire NAVIER, UMR 8205 - [@arthur.lebee](https://gitlab.enpc.fr/arthur.lebee) - [Researcher page on Laboratoire Navier website](https://navier.enpc.fr/LEBEE-ARTHUR,144)
- **Baptiste Durand** - *PhD student* - Laboratoire NAVIER, UMR 8205 - [@baptiste.durand](https://gitlab.enpc.fr/baptiste.durand) - [baptiste.durand@enpc.fr](mailto:baptiste.durand@enpc.fr) - [Student page on Laboratoire Navier website](https://navier-lab.fr/baptiste-durand/)
- **Arthur Lebée** - *Researcher* - Laboratoire NAVIER, UMR 8205 - [@arthur.lebee](https://gitlab.enpc.fr/arthur.lebee) - [Researcher page on Laboratoire Navier website](https://navier-lab.fr/arthur-lebee/)
See also the graphs of all [contributions](https://gitlab.enpc.fr/baptiste.durand/HO_homog/graphs/master) to this project.
......
......@@ -5,7 +5,6 @@ ho_homog/__init__.py
ho_homog/full_scale_pb.py
ho_homog/homog2d.py
ho_homog/materials.py
ho_homog/mesh_generate_2D.py
ho_homog/mesh_tools.py
ho_homog/part.py
ho_homog/periodicity.py
......@@ -18,4 +17,5 @@ ho_homog.egg-info/not-zip-safe
ho_homog.egg-info/requires.txt
ho_homog.egg-info/top_level.txt
test/test_cpp_expression.py
test/test_mesh_generate_2D.py
\ No newline at end of file
test/test_mesh_generate_2D.py
test/test_mesh_generate_pantograph.py
\ No newline at end of file
gmsh-sdk
matplotlib
more_itertools
numpy
gmsh-sdk
......@@ -13,7 +13,7 @@ __version__ = "0.1"
GEO_TOLERANCE = 1e-12
from . import geometry, materials, periodicity
from . import full_scale_pb, homog2d, mesh_generate_2D, mesh_tools, part, toolbox_FEniCS
from . import full_scale_pb, homog2d, mesh_generate, mesh_tools, part, toolbox_FEniCS
log_level = logging.DEBUG
log_path = Path("~/ho_homog_log/activity.log").expanduser()
......
This diff is collapsed.
......@@ -29,6 +29,18 @@ factory = model.occ
logger = logging.getLogger(__name__) # http://sametmax.com/ecrire-des-logs-en-python/
__all__ = [
"pantograph",
"duplicate_pattern",
"offset_pattern",
"Gmsh2DRVE",
"Gmsh2DPart",
"Gmsh2DPartFromRVE",
]
def duplicate_pattern(cell_ll, nb_cells, gen_vect):
"""
Propager la cellule de base dans selon les directions de l'espace.
......@@ -205,7 +217,6 @@ class Gmsh2DRVE(object):
gmsh.write(str(name.with_suffix(".brep")))
else:
gmsh.write(f"{name}.brep")
macro_bndry = macro_ll.sides
if soft_mat:
boundary = geo.AbstractSurface.get_surfs_boundary(rve_s + soft_s)
......@@ -536,3 +547,5 @@ def Gmsh2DPartFromRVE(cell: Gmsh2DRVE, nb_cells, part_name=None):
gmsh.write(str(part_path.with_suffix(".brep")))
gmsh.write(str(part_path))
return Gmsh2DPart(part_vect, nb_cells, phy_surfaces, part_path)
from . import pantograph
\ No newline at end of file
......@@ -8,6 +8,8 @@ import numpy as np
import ho_homog.geometry as geo
from . import Gmsh2DRVE, logger
# ? doc about imports : https://realpython.com/absolute-vs-relative-python-imports/#syntax-of-import-statements #noqa
model = gmsh.model
factory = model.occ
......@@ -274,3 +276,77 @@ def beam_pantograph_RVE(
fine_pts = geo.remove_duplicates(constr_pts)
return Gmsh2DRVE(pattern_ll, cell_vect, nb_cells, offset, fine_pts, soft_mat, name)
def pantograph_E11only_RVE(
a,
thickness,
fillet_r=0.0,
nb_cells=(1, 1),
offset=(0.0, 0.0),
soft_mat=False,
name="",
):
"""
Generate a RVE object for the simplified pantograph microstructure.
Only one floppy mode : E11
Junctions are obtained by creating offset curves from the microstructure contour.
+ fillets -> avoid stress concentration
Parameters
----------
a: floats
main dimension of the microstruture
thickness : float
distance of translation prescribed for the vertices of the contour
fillet_r : float
radius of the fillets for the contour
nb_cells : tuple or 1D array
nb of cells in each direction of repetition
offset : tuple or 1D array
Relative position inside a cell of the point that will coincide with the origin of the global domain
Returns
-------
Instance of the Gmsh2DRVE class.
"""
name = name if name else "pantograph"
offset = np.asarray(offset)
nb_cells = np.asarray(nb_cells)
logger.info("Start defining the pantograph geometry")
Lx = 4 * a
Ly = 4 * a
cell_vect = np.array(((Lx, 0.0), (0.0, Ly)))
e1 = np.array((a, 0.0, 0.0))
e2 = np.array((0.0, a, 0.0))
pt_O = geo.Point((0.0, 0.0, 0.0))
L = geo.Point(2 * (e1 + e2))
square = [
geo.translation(L, e1),
geo.translation(L, e2),
geo.translation(L, -1 * e1),
geo.translation(L, -1 * e2),
]
rhombus_v = [pt_O, geo.Point(e1 + 2 * e2), geo.Point(4 * e2), geo.Point(-e1 + 2 * e2)]
rhombus_h = [pt_O, geo.Point(-e2 + 2 * e1), geo.Point(4 * e1), geo.Point(e2 + 2 * e1)]
square = geo.LineLoop(square, explicit=False)
rhombus_v = geo.LineLoop(rhombus_v, explicit=False)
rhombus_h = geo.LineLoop(rhombus_h, explicit=False)
pattern = [square, rhombus_v, rhombus_h]
sym_rhombus = [geo.plane_reflection(rhombus_v, L, e1), geo.plane_reflection(rhombus_h, L, e2)]
for ll in sym_rhombus:
ll.reverse()
pattern += sym_rhombus
pattern = geo.remove_duplicates(pattern)
logger.info("Done removing of the line-loops duplicates")
constr_pts = [copy.deepcopy(pt) for ll in pattern for pt in iter((ll.vertices))]
for ll in pattern:
ll.offset(thickness)
if fillet_r:
for ll in pattern:
ll.round_corner_explicit(fillet_r)
logger.info("Done rounding all corners of pattern line-loops")
fine_pts = geo.remove_duplicates(constr_pts)
return Gmsh2DRVE(pattern, cell_vect, nb_cells, offset, fine_pts, soft_mat, name)
......@@ -10,10 +10,12 @@ Source : https://docs.python-guide.org/writing/structure/#structure-of-the-repos
import site
from pathlib import Path
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
cur_dir = Path(__file__).resolve().parent
repository_dir = cur_dir.parent
site.addsitedir(repository_dir)
# cur_dir = Path(__file__).resolve().parent
# repository_dir = cur_dir.parent
# site.addsitedir(repository_dir)
import ho_homog
# coding: utf-8
"""
Created on 12/06/2019
@author: baptiste
"""
import logging
import gmsh
from context import ho_homog
geo = ho_homog.geometry
mesh_gen = ho_homog.mesh_generate
geo.init_geo_tools()
geo.set_gmsh_option("Mesh.MshFileVersion", 4.1)
fltk = gmsh.fltk
def test_E11only_offset_RVE():
logger = logging.getLogger("test_E11only_offset_RVE")
fltk.initialize()
fltk.update()
a = 1
r = a / 2e2
thickness = a / 1e2
panto_rve = mesh_gen.pantograph.pantograph_E11only_RVE(a, thickness, r, name="panto")
lc_ratio = 1 / 2
lc_min_max = (lc_ratio * r, lc_ratio * a)
d_min_max = (2 * r, a)
panto_rve.main_mesh_refinement(d_min_max, lc_min_max, False)
panto_rve.mesh_generate()
gmsh.model.mesh.renumberNodes()
gmsh.model.mesh.renumberElements()
gmsh.write(str(panto_rve.mesh_abs_path))
test_E11only_offset_RVE()
fltk.run()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment