Merge branch 'FreeCAD:main' into fem_ccx_incrementation
This commit is contained in:
@@ -163,7 +163,7 @@ def add_attributes(obj, ccx_prefs):
|
||||
"App::PropertyEnumeration",
|
||||
"MaterialNonlinearity",
|
||||
"Fem",
|
||||
"Set material nonlinearity (needs geometrical nonlinearity)"
|
||||
"Set material nonlinearity"
|
||||
)
|
||||
obj.MaterialNonlinearity = choices_material_nonlinear
|
||||
obj.MaterialNonlinearity = choices_material_nonlinear[0]
|
||||
@@ -405,6 +405,30 @@ def add_attributes(obj, ccx_prefs):
|
||||
)
|
||||
obj.BeamReducedIntegration = True
|
||||
|
||||
if not hasattr(obj, "OutputFrequency"):
|
||||
obj.addProperty(
|
||||
"App::PropertyIntegerConstraint",
|
||||
"OutputFrequency",
|
||||
"Fem",
|
||||
"Set the output frequency in increments"
|
||||
)
|
||||
obj.OutputFrequency = 1
|
||||
|
||||
if not hasattr(obj, "ModelSpace"):
|
||||
model_space_types = [
|
||||
"3D",
|
||||
"plane stress",
|
||||
"plane strain",
|
||||
"axisymmetric"
|
||||
]
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"ModelSpace",
|
||||
"Fem",
|
||||
"Type of model space"
|
||||
)
|
||||
obj.ModelSpace = model_space_types
|
||||
|
||||
"""
|
||||
Should there be some equation object for Calculix too?
|
||||
|
||||
|
||||
@@ -56,13 +56,13 @@ def write_meshdata_constraint(f, femobj, force_obj, ccxwriter):
|
||||
node_load = ref_shape[1][n]
|
||||
# the loads in ref_shape[1][n] are without unit
|
||||
if abs(direction_vec.x) > dir_zero_tol:
|
||||
v1 = "{}".format(direction_vec.x * node_load)
|
||||
v1 = "{:.13G}".format((direction_vec.x * node_load).Value)
|
||||
f.write("{},1,{}\n".format(n, v1))
|
||||
if abs(direction_vec.y) > dir_zero_tol:
|
||||
v2 = "{}".format(direction_vec.y * node_load)
|
||||
v2 = "{:.13G}".format((direction_vec.y * node_load).Value)
|
||||
f.write("{},2,{}\n".format(n, v2))
|
||||
if abs(direction_vec.z) > dir_zero_tol:
|
||||
v3 = "{}".format(direction_vec.z * node_load)
|
||||
v3 = "{:.13G}".format((direction_vec.z * node_load).Value)
|
||||
f.write("{},3,{}\n".format(n, v3))
|
||||
f.write("\n")
|
||||
f.write("\n")
|
||||
|
||||
@@ -51,11 +51,15 @@ def write_femelement_geometry(f, ccxwriter):
|
||||
if beamsec_obj.SectionType == "Rectangular":
|
||||
# see meshtools.get_beam_main_axis_m(beam_direction, defined_angle)
|
||||
# the method get_beam_main_axis_m() which calculates the beam_axis_m vector
|
||||
# returns for a line in x direction and angle 0 degree
|
||||
# the y-axis as local main direction (beam_axis_m vector)
|
||||
# in users head and in beam section object this is the Width
|
||||
len_beam_axis_m = beamsec_obj.RectWidth.getValueAs("mm").Value
|
||||
# unless rotated, this vector points towards +y axis
|
||||
# doesn't follow 1,2-direction order of CalculiX
|
||||
# ^ (n, 2-direction)
|
||||
# |
|
||||
# |
|
||||
# .----> (m, 1-direction)
|
||||
#
|
||||
len_beam_axis_n = beamsec_obj.RectHeight.getValueAs("mm").Value
|
||||
len_beam_axis_m = beamsec_obj.RectWidth.getValueAs("mm").Value
|
||||
section_type = ", SECTION=RECT"
|
||||
section_geo = "{:.13G},{:.13G}\n".format(len_beam_axis_m, len_beam_axis_n)
|
||||
section_def = "*BEAM SECTION, {}{}{}\n".format(
|
||||
@@ -109,11 +113,14 @@ def write_femelement_geometry(f, ccxwriter):
|
||||
f.write(section_geo)
|
||||
elif "shellthickness_obj" in matgeoset: # shell mesh
|
||||
shellth_obj = matgeoset["shellthickness_obj"]
|
||||
section_def = "*SHELL SECTION, {}{}\n".format(elsetdef, material)
|
||||
if ccxwriter.solver_obj.ModelSpace == "3D":
|
||||
section_def = "*SHELL SECTION, {}{}\n".format(elsetdef, material)
|
||||
else:
|
||||
section_def = "*SOLID SECTION, {}{}\n".format(elsetdef, material)
|
||||
thickness = shellth_obj.Thickness.getValueAs("mm").Value
|
||||
section_geo = "{:.13G}\n".format(thickness)
|
||||
f.write(section_def)
|
||||
f.write(section_geo)
|
||||
f.write(section_geo)
|
||||
else: # solid mesh
|
||||
section_def = "*SOLID SECTION, {}{}\n".format(elsetdef, material)
|
||||
f.write(section_def)
|
||||
|
||||
@@ -111,8 +111,10 @@ def write_femelement_material(f, ccxwriter):
|
||||
# femobj --> dict, FreeCAD document object is nlfemobj["Object"]
|
||||
nl_mat_obj = nlfemobj["Object"]
|
||||
if nl_mat_obj.LinearBaseMaterial == mat_obj:
|
||||
if nl_mat_obj.MaterialModelNonlinearity == "simple hardening":
|
||||
if nl_mat_obj.MaterialModelNonlinearity == "isotropic hardening":
|
||||
f.write("*PLASTIC\n")
|
||||
for yield_point in nl_mat_obj.YieldPoints:
|
||||
f.write("{}\n".format(yield_point))
|
||||
else:
|
||||
f.write("*PLASTIC, HARDENING=KINEMATIC\n")
|
||||
for yield_point in nl_mat_obj.YieldPoints:
|
||||
f.write("{}\n".format(yield_point))
|
||||
f.write("\n")
|
||||
|
||||
@@ -54,7 +54,15 @@ def write_mesh(ccxwriter):
|
||||
# Use reduced integration beam elements if this option is enabled in ccx solver settings
|
||||
if ccxwriter.solver_obj.BeamReducedIntegration:
|
||||
meshtools.beam_reduced_integration(ccxwriter.femmesh_file)
|
||||
|
||||
|
||||
# Use 2D elements if model space is not set to 3D
|
||||
if ccxwriter.solver_obj.ModelSpace == "plane stress":
|
||||
meshtools.plane_stress(ccxwriter.femmesh_file)
|
||||
if ccxwriter.solver_obj.ModelSpace == "plane strain":
|
||||
meshtools.plane_strain(ccxwriter.femmesh_file)
|
||||
if ccxwriter.solver_obj.ModelSpace == "axisymmetric":
|
||||
meshtools.axisymmetric(ccxwriter.femmesh_file)
|
||||
|
||||
inpfile = codecs.open(ccxwriter.file_name, "w", encoding="utf-8")
|
||||
inpfile.write("{}\n".format(59 * "*"))
|
||||
inpfile.write("** {}\n".format(write_name))
|
||||
@@ -77,6 +85,14 @@ def write_mesh(ccxwriter):
|
||||
if ccxwriter.solver_obj.BeamReducedIntegration:
|
||||
meshtools.beam_reduced_integration(ccxwriter.femmesh_file)
|
||||
|
||||
# Use 2D elements if model space is not set to 3D
|
||||
if ccxwriter.solver_obj.ModelSpace == "plane stress":
|
||||
meshtools.plane_stress(ccxwriter.femmesh_file)
|
||||
if ccxwriter.solver_obj.ModelSpace == "plane strain":
|
||||
meshtools.plane_strain(ccxwriter.femmesh_file)
|
||||
if ccxwriter.solver_obj.ModelSpace == "axisymmetric":
|
||||
meshtools.axisymmetric(ccxwriter.femmesh_file)
|
||||
|
||||
# reopen file with "append" to add all the rest
|
||||
inpfile = codecs.open(ccxwriter.femmesh_file, "a", encoding="utf-8")
|
||||
inpfile.write("\n\n")
|
||||
|
||||
@@ -83,6 +83,7 @@ def write_step_output(f, ccxwriter):
|
||||
f.write("RF\n")
|
||||
if ccxwriter.member.cons_fixed or ccxwriter.member.cons_displacement:
|
||||
f.write("\n")
|
||||
f.write("*OUTPUT, FREQUENCY={}".format(ccxwriter.solver_obj.OutputFrequency))
|
||||
|
||||
# there is no need to write all integration point results
|
||||
# as long as there is no reader for them
|
||||
|
||||
Reference in New Issue
Block a user