Skip to content

Commit 99530df

Browse files
committed
update laminate definitions
1 parent a8f37d6 commit 99530df

File tree

2 files changed

+34
-29
lines changed

2 files changed

+34
-29
lines changed

src/Mod/Fem/femsolver/codeaster/add_femelement_geometry.py

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,27 @@ def add_femelement_geometry(commtxt, ca_writer):
7171

7272
geoms =[]
7373
i=0
74-
for ref in shelllam_obj.References: #TODO: work out how to create group of all elements and apply to that in case where len(shelllam_obj.References) == 0.
75-
for geom in ref[1]:
76-
geoms.append(geom)
77-
matname = "LAYUP"+str(i)
78-
i+=1
79-
commtxt += "# Composite layup detected, added to shell\n"
80-
commtxt += "{} = DEFI_COMPOSITE(COUCHE=(_F(EPAIS={},\n".format(matname,thicknesses[0])
81-
commtxt += " MATER={},\n".format(matnames[0])
82-
commtxt += " ORIENTATION = {}),\n".format(orientations[0])
83-
for j in range(1,len(thicknesses)):
84-
commtxt += " _F(EPAIS={},\n".format(thicknesses[j])
85-
commtxt += " MATER={},\n".format(matnames[j])
86-
commtxt += " ORIENTATION = {}),\n".format(orientations[j])
87-
commtxt += " ))\n\n"
88-
89-
ca_writer.elemprops.append("elemprop{}".format(len(ca_writer.elemprops)))
90-
commtxt += "# Shell elements detected, thickness {}mm on item {}\n".format(thicktot, (ref[0].Name,geom))
91-
commtxt += "{} = AFFE_CARA_ELEM(COQUE=_F(COQUE_NCOU = {},\n".format(ca_writer.elemprops[-1], len(thicknesses))
92-
commtxt += " EPAIS={},\n".format(thicktot)
93-
commtxt += " GROUP_MA=('{}', ),\n".format(ref[0].Name)
94-
commtxt += " VECTEUR=(1.0, 0.0, 0.0)),\n"
95-
commtxt += " MODELE=model)\n\n"
74+
if len(shelllam_obj.Windall['elements']) > 0:
75+
print('*********************OI**********************')
76+
print('TODO WINDING STUFF')
77+
else:
78+
for ref in shelllam_obj.References:
79+
#TODO: work out how to create group of all elements and apply to that in case where len(shelllam_obj.References) == 0.
80+
for geom in ref[1]:
81+
geoms.append(geom)
82+
matname = "LAYUP"+str(i)
83+
i+=1
84+
commtxt += add_layup(matname, matnames, thicknesses, orientations)
9685

97-
98-
ca_writer.tools.group_elements[ref[0].Name] = [g for g in geoms]
86+
commtxt += "# Shell elements detected, thickness {}mm on item {}\n".format(thicktot, (ref[0].Name,geom))
87+
commtxt += "elemprop = AFFE_CARA_ELEM(COQUE=_F(COQUE_NCOU = {},\n".format(len(thicknesses))
88+
commtxt += " EPAIS={},\n".format(thicktot)
89+
commtxt += " GROUP_MA=('{}', ),\n".format(ref[0].Name)
90+
commtxt += " VECTEUR=(1.0, 0.0, 0.0)),\n"
91+
commtxt += " MODELE=model)\n\n"
92+
93+
94+
ca_writer.tools.group_elements[ref[0].Name] = [g for g in geoms]
9995
FreeCAD.Console.PrintMessage("Shell of thickness {}mm added.\n".format(thicktot))
10096

10197
elif ca_writer.member.geos_shellthickness:
@@ -128,4 +124,15 @@ def add_femelement_geometry(commtxt, ca_writer):
128124

129125
return commtxt, matname
130126

127+
def add_layup(LUname, matnames, thicknesses, orientations):
128+
commtxt = "# Composite layup detected, added to shell\n"
129+
commtxt += "{} = DEFI_COMPOSITE(COUCHE=(_F(EPAIS={},\n".format(LUname,thicknesses[0])
130+
commtxt += " MATER={},\n".format(matnames[0])
131+
commtxt += " ORIENTATION = {}),\n".format(orientations[0])
132+
for j in range(1,len(thicknesses)):
133+
commtxt += " _F(EPAIS={},\n".format(thicknesses[j])
134+
commtxt += " MATER={},\n".format(matnames[j])
135+
commtxt += " ORIENTATION = {}),\n".format(orientations[j])
136+
commtxt += " ))\n\n"
137+
return commtxt
131138
## @}

src/Mod/Fem/femsolver/codeaster/writer.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ def __init__(
7272
self.geo_file = join(self.dir_name, self.basename + ".geo")
7373
self.IPmesh_file = join(self.dir_name, self.basename + ".med")
7474
self.OPmesh_file = join(self.dir_name, self.basename + ".rmed")
75-
self.elemprops = []
76-
self.fieldmats = []
7775
self.fixes = []
7876
self.forces = []
7977
FreeCAD.Console.PrintLog(f"FemInputWriterCodeAster --> self.dir_name --> {self.dir_name}\n")
@@ -101,13 +99,13 @@ def write_solver_input(self):
10199
commtxt = add_femelement_material.assign_femelement_material(commtxt,matname, self)
102100
commtxt = add_con_fixed.add_con_fixed(commtxt, self)
103101
commtxt = add_con_force.add_con_force(commtxt, self)
104-
commtxt += "reslin = MECA_STATIQUE(CARA_ELEM={},\n".format(self.elemprops[0])
105-
commtxt += " CHAM_MATER={},\n".format(self.fieldmats[0])
102+
commtxt += "reslin = MECA_STATIQUE(CARA_ELEM=elemprop,\n"
103+
commtxt += " CHAM_MATER=fieldmat,\n"
106104
commtxt += " EXCIT=(_F(CHARGE={}),\n".format(self.fixes[0])
107105
commtxt += " _F(CHARGE={})),\n".format(self.forces[0])
108106
commtxt += " MODELE=model)\n\n"
109107

110-
commtxt += "IMPR_RESU(RESU=_F(CARA_ELEM={},\n".format(self.elemprops[0])
108+
commtxt += "IMPR_RESU(RESU=_F(CARA_ELEM=elemprop,\n"
111109
commtxt += " INFO_MAILLAGE='OUI',\n"
112110
commtxt += " MAILLAGE=mesh,\n"
113111
commtxt += " RESULTAT=reslin),\n"

0 commit comments

Comments
 (0)