FEM: calculix writer, move write mesh in separate module
This commit is contained in:
@@ -203,6 +203,7 @@ SET(FemSolverCalculix_SRCS
|
||||
femsolver/calculix/write_constraint_tie.py
|
||||
femsolver/calculix/write_constraint_transform.py
|
||||
femsolver/calculix/write_footer.py
|
||||
femsolver/calculix/write_mesh.py
|
||||
femsolver/calculix/write_step_equation.py
|
||||
femsolver/calculix/write_step_output.py
|
||||
femsolver/calculix/writer.py
|
||||
|
||||
76
src/Mod/Fem/femsolver/calculix/write_mesh.py
Normal file
76
src/Mod/Fem/femsolver/calculix/write_mesh.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2021 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This file is part of the FreeCAD CAx development system. *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "FreeCAD FEM calculix write inpfile mesh"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "https://www.freecadweb.org"
|
||||
|
||||
|
||||
import codecs
|
||||
from os.path import join
|
||||
|
||||
from femmesh import meshtools
|
||||
|
||||
|
||||
def write_mesh(ccxwriter):
|
||||
|
||||
element_param = 1 # highest element order only
|
||||
group_param = False # do not write mesh group data
|
||||
if ccxwriter.split_inpfile is True:
|
||||
write_name = "femesh"
|
||||
file_name_split = ccxwriter.mesh_name + "_" + write_name + ".inp"
|
||||
ccxwriter.femmesh_file = join(ccxwriter.dir_name, file_name_split)
|
||||
|
||||
ccxwriter.femmesh.writeABAQUS(
|
||||
ccxwriter.femmesh_file,
|
||||
element_param,
|
||||
group_param
|
||||
)
|
||||
|
||||
# Check to see if fluid sections are in analysis and use D network element type
|
||||
if ccxwriter.fluidsection_objects:
|
||||
meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file)
|
||||
|
||||
inpfile = codecs.open(ccxwriter.file_name, "w", encoding="utf-8")
|
||||
inpfile.write("{}\n".format(59 * "*"))
|
||||
inpfile.write("** {}\n".format(write_name))
|
||||
inpfile.write("*INCLUDE,INPUT={}\n".format(file_name_split))
|
||||
|
||||
else:
|
||||
ccxwriter.femmesh_file = ccxwriter.file_name
|
||||
ccxwriter.femmesh.writeABAQUS(
|
||||
ccxwriter.femmesh_file,
|
||||
element_param,
|
||||
group_param
|
||||
)
|
||||
|
||||
# Check to see if fluid sections are in analysis and use D network element type
|
||||
if ccxwriter.fluidsection_objects:
|
||||
# inpfile is closed
|
||||
meshtools.write_D_network_element_to_inputfile(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")
|
||||
|
||||
return inpfile
|
||||
@@ -29,7 +29,6 @@ __url__ = "https://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import codecs
|
||||
import six
|
||||
import time
|
||||
from os.path import join
|
||||
@@ -53,10 +52,10 @@ from . import write_constraint_temperature as con_temperature
|
||||
from . import write_constraint_tie as con_tie
|
||||
from . import write_constraint_transform as con_transform
|
||||
from . import write_footer
|
||||
from . import write_mesh
|
||||
from . import write_step_equation
|
||||
from . import write_step_output
|
||||
from .. import writerbase
|
||||
from femmesh import meshtools
|
||||
from femtools import constants
|
||||
|
||||
|
||||
@@ -159,7 +158,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self.split_inpfile = False
|
||||
|
||||
# mesh
|
||||
inpfile = self.write_mesh()
|
||||
inpfile = write_mesh.write_mesh(self)
|
||||
|
||||
# element sets for materials and element geometry
|
||||
# self.write_element_sets_material_and_femelement_geometry(inpfile)
|
||||
@@ -219,51 +218,6 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
write_footer.write_footer(inpfile, self)
|
||||
inpfile.close()
|
||||
|
||||
# ********************************************************************************************
|
||||
# mesh
|
||||
def write_mesh(self):
|
||||
# write mesh to file
|
||||
element_param = 1 # highest element order only
|
||||
group_param = False # do not write mesh group data
|
||||
if self.split_inpfile is True:
|
||||
write_name = "femesh"
|
||||
file_name_split = self.mesh_name + "_" + write_name + ".inp"
|
||||
self.femmesh_file = join(self.dir_name, file_name_split)
|
||||
|
||||
self.femmesh.writeABAQUS(
|
||||
self.femmesh_file,
|
||||
element_param,
|
||||
group_param
|
||||
)
|
||||
|
||||
# Check to see if fluid sections are in analysis and use D network element type
|
||||
if self.fluidsection_objects:
|
||||
meshtools.write_D_network_element_to_inputfile(self.femmesh_file)
|
||||
|
||||
inpfile = codecs.open(self.file_name, "w", encoding="utf-8")
|
||||
inpfile.write("***********************************************************\n")
|
||||
inpfile.write("** {}\n".format(write_name))
|
||||
inpfile.write("*INCLUDE,INPUT={}\n".format(file_name_split))
|
||||
|
||||
else:
|
||||
self.femmesh_file = self.file_name
|
||||
self.femmesh.writeABAQUS(
|
||||
self.femmesh_file,
|
||||
element_param,
|
||||
group_param
|
||||
)
|
||||
|
||||
# Check to see if fluid sections are in analysis and use D network element type
|
||||
if self.fluidsection_objects:
|
||||
# inpfile is closed
|
||||
meshtools.write_D_network_element_to_inputfile(self.femmesh_file)
|
||||
|
||||
# reopen file with "append" to add all the rest
|
||||
inpfile = codecs.open(self.femmesh_file, "a", encoding="utf-8")
|
||||
inpfile.write("\n\n")
|
||||
|
||||
return inpfile
|
||||
|
||||
# ********************************************************************************************
|
||||
# write constraint node sets, constraint face sets, constraint element sets
|
||||
def write_constraints_sets(
|
||||
|
||||
Reference in New Issue
Block a user