FEM: Add defined temperature field with CalculiX (*TEMPERATURE) (#23277)
* FEM: add write_constraint_finaltemperature.py * FEM: Update CMakeLists.txt * FEM: Update membertools.py * FEM: Update FemConstraintInitialTemperature.cpp * FEM: Update FemConstraintInitialTemperature.h * FEM: Update write_constraint_initialtemperature.py * FEM: Update write_femelement_material.py * FEM: Update writer.py * FEM: Update write_constraint_finaltemperature.py * FEM: Update write_femelement_material.py * FEM: Update write_femelement_material.py * FEM: Update box_static.inp * FEM: Update ccx_cantilever_beam_circle.inp * FEM: Update ccx_cantilever_beam_pipe.inp * FEM: Update ccx_cantilever_beam_rect.inp * FEM: Update ccx_cantilever_ele_hexa20.inp * FEM: Update ccx_cantilever_ele_quad4.inp * FEM: Update ccx_cantilever_ele_quad8.inp * FEM: Update ccx_cantilever_ele_seg2.inp * FEM: Update ccx_cantilever_ele_seg3.inp * FEM: Update ccx_cantilever_ele_tria3.inp * FEM: Update ccx_cantilever_ele_tria6.inp * FEM: Update ccx_cantilever_faceload.inp * FEM: Update ccx_cantilever_nodeload.inp * FEM: Update ccx_cantilever_prescribeddisplacement.inp * FEM: Update constraint_contact_shell_shell.inp * FEM: Update constraint_sectionprint.inp * FEM: Update constraint_selfweight_cantilever.inp * FEM: Update constraint_tie.inp * FEM: Update constraint_transform_beam_hinged.inp * FEM: Update constraint_transform_torque.inp * FEM: Update material_multiple_bendingbeam_fiveboxes.inp * FEM: Update material_multiple_bendingbeam_fivefaces.inp * FEM: Update material_multiple_tensionrod_twoboxes.inp * FEM: Update material_nonlinear.inp * FEM: Update square_pipe_end_twisted_edgeforces.inp * FEM: Update square_pipe_end_twisted_nodeforces.inp * FEM: Update write_constraint_finaltemperature.py * FEM: Update write_femelement_material.py * FEM: Update write_constraint_finaltemperature.py * FEM: Update FemConstraintInitialTemperature.cpp * FEM: Update FemConstraintInitialTemperature.h
This commit is contained in:
@@ -35,6 +35,8 @@ PROPERTY_SOURCE(Fem::ConstraintInitialTemperature, Fem::Constraint)
|
||||
ConstraintInitialTemperature::ConstraintInitialTemperature()
|
||||
{
|
||||
ADD_PROPERTY(initialTemperature, (300.0));
|
||||
ADD_PROPERTY(EnableFinalTemperature, (false));
|
||||
ADD_PROPERTY(FinalTemperature, (300.0));
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn* ConstraintInitialTemperature::execute()
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
|
||||
// Temperature parameters
|
||||
App::PropertyTemperature initialTemperature;
|
||||
|
||||
App::PropertyBool EnableFinalTemperature;
|
||||
App::PropertyTemperature FinalTemperature;
|
||||
|
||||
/// recalculate the object
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
|
||||
@@ -261,6 +261,7 @@ SET(FemSolverCalculix_SRCS
|
||||
femsolver/calculix/write_constraint_force.py
|
||||
femsolver/calculix/write_constraint_heatflux.py
|
||||
femsolver/calculix/write_constraint_initialtemperature.py
|
||||
femsolver/calculix/write_constraint_finaltemperature.py
|
||||
femsolver/calculix/write_constraint_planerotation.py
|
||||
femsolver/calculix/write_constraint_pressure.py
|
||||
femsolver/calculix/write_constraint_rigidbody.py
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2025 Jakub Michalski <jakub.j.michalski[at]gmail.com> *
|
||||
# * *
|
||||
# * This file is part of FreeCAD. *
|
||||
# * *
|
||||
# * FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
# * under the terms of the GNU Lesser General Public License as *
|
||||
# * published by the Free Software Foundation, either version 2.1 of the *
|
||||
# * License, or (at your option) any later version. *
|
||||
# * *
|
||||
# * FreeCAD 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 *
|
||||
# * Lesser General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Lesser General Public *
|
||||
# * License along with FreeCAD. If not, see *
|
||||
# * <https://www.gnu.org/licenses/>. *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "FreeCAD FEM calculix amplitude"
|
||||
__author__ = "Jakub Michalski"
|
||||
__url__ = "https://www.freecad.org"
|
||||
|
||||
|
||||
def get_analysis_types():
|
||||
return ["static"]
|
||||
|
||||
|
||||
def get_sets_name():
|
||||
return "constraints_initial_temperature_node_sets"
|
||||
|
||||
|
||||
def get_constraint_title():
|
||||
return "Final temperature constraint"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_constraint(f, femobj, inittemp_obj, ccxwriter):
|
||||
if inittemp_obj.EnableFinalTemperature:
|
||||
# floats read from ccx should use {:.13G}, see comment in writer module
|
||||
|
||||
finaltemp = inittemp_obj.FinalTemperature.getValueAs("K")
|
||||
|
||||
f.write("*TEMPERATURE\n")
|
||||
if inittemp_obj.References:
|
||||
f.write(f"{inittemp_obj.Name},{finaltemp}\n")
|
||||
else:
|
||||
f.write(f"{ccxwriter.ccx_nall},{finaltemp}\n")
|
||||
@@ -29,7 +29,7 @@ from FreeCAD import Units
|
||||
|
||||
|
||||
def get_analysis_types():
|
||||
return ["thermomech"]
|
||||
return ["thermomech", "static"]
|
||||
|
||||
|
||||
def get_sets_name():
|
||||
|
||||
@@ -93,6 +93,20 @@ def write_femelement_material(f, ccxwriter):
|
||||
KV = FreeCAD.Units.Quantity(mat_obj.Material["KinematicViscosity"])
|
||||
KV_in_mm2s = KV.getValueAs("mm^2/s").Value
|
||||
DV_in_tmms = KV_in_mm2s * density_in_tonne_per_mm3
|
||||
if ccxwriter.analysis_type == "static":
|
||||
if mat_obj.Category == "Solid":
|
||||
if "ThermalExpansionCoefficient" in mat_obj.Material:
|
||||
TEC = FreeCAD.Units.Quantity(mat_obj.Material["ThermalExpansionCoefficient"])
|
||||
TEC_in_mmK = TEC.getValueAs("mm/mm/K").Value
|
||||
else:
|
||||
TEC_in_mmK = 0.0
|
||||
if "ThermalExpansionReferenceTemperature" in mat_obj.Material:
|
||||
RT = FreeCAD.Units.Quantity(
|
||||
mat_obj.Material["ThermalExpansionReferenceTemperature"]
|
||||
)
|
||||
else:
|
||||
RT = FreeCAD.Units.Quantity("0 K")
|
||||
RT_in_K = RT.getValueAs("K").Value
|
||||
if (
|
||||
ccxwriter.analysis_type == "electromagnetic"
|
||||
and ccxwriter.solver_obj.ElectromagneticMode == "electrostatic"
|
||||
@@ -121,6 +135,10 @@ def write_femelement_material(f, ccxwriter):
|
||||
elif mat_obj.Category == "Fluid":
|
||||
f.write("*FLUID CONSTANTS\n")
|
||||
f.write(f"{SH_in_JkgK:.13G},{DV_in_tmms:.13G}\n")
|
||||
if ccxwriter.analysis_type == "static":
|
||||
if mat_obj.Category == "Solid":
|
||||
f.write(f"*EXPANSION, ZERO={RT_in_K:.13G}\n")
|
||||
f.write(f"{TEC_in_mmK:.13G}\n")
|
||||
if (
|
||||
ccxwriter.analysis_type == "electromagnetic"
|
||||
and ccxwriter.solver_obj.ElectromagneticMode == "electrostatic"
|
||||
|
||||
@@ -44,6 +44,7 @@ from . import write_constraint_fluidsection as con_fluidsection
|
||||
from . import write_constraint_force as con_force
|
||||
from . import write_constraint_heatflux as con_heatflux
|
||||
from . import write_constraint_initialtemperature as con_itemp
|
||||
from . import write_constraint_finaltemperature as con_ftemp
|
||||
from . import write_constraint_planerotation as con_planerotation
|
||||
from . import write_constraint_pressure as con_pressure
|
||||
from . import write_constraint_rigidbody as con_rigidbody
|
||||
@@ -204,6 +205,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self.write_constraints_meshsets(inpfile, self.member.cons_force, con_force)
|
||||
self.write_constraints_meshsets(inpfile, self.member.cons_pressure, con_pressure)
|
||||
self.write_constraints_propdata(inpfile, self.member.cons_temperature, con_temperature)
|
||||
self.write_constraints_propdata(inpfile, self.member.cons_finaltemperature, con_ftemp)
|
||||
self.write_constraints_meshsets(inpfile, self.member.cons_heatflux, con_heatflux)
|
||||
self.write_constraints_propdata(
|
||||
inpfile, self.member.cons_electricchargedensity, con_electricchargedensity
|
||||
|
||||
@@ -485,6 +485,8 @@ Evolumes
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -56,6 +56,8 @@ Eedges
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -56,6 +56,8 @@ Eedges
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -56,6 +56,8 @@ Eedges
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -381,6 +381,8 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -81,6 +81,8 @@ Efaces
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -69,6 +69,8 @@ Efaces
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -198,6 +198,8 @@ Eedges
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -56,6 +56,8 @@ Eedges
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -1557,6 +1557,8 @@ Efaces
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -287,6 +287,8 @@ Efaces
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -355,6 +355,8 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -355,6 +355,8 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -373,6 +373,8 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -38359,6 +38359,8 @@ Efaces
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
72000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -3397,6 +3397,8 @@ Evolumes
|
||||
*MATERIAL, NAME=Material
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -2149,6 +2149,8 @@ Evolumes
|
||||
210000,0.3
|
||||
*DENSITY
|
||||
7.9E-09
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -18602,6 +18602,8 @@ Evolumes
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -3626,6 +3626,8 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -10970,6 +10970,8 @@ Evolumes
|
||||
*MATERIAL, NAME=MechanicalMaterial
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -27618,16 +27618,22 @@ Evolumes
|
||||
*MATERIAL, NAME=FemMaterial1
|
||||
*ELASTIC
|
||||
32000,0.17
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
** FreeCAD material name: PLA
|
||||
** FemMaterial2
|
||||
*MATERIAL, NAME=FemMaterial2
|
||||
*ELASTIC
|
||||
3640,0.36
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
** FreeCAD material name: Steel-Generic
|
||||
** FemMaterial3
|
||||
*MATERIAL, NAME=FemMaterial3
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -2529,16 +2529,22 @@ Efaces
|
||||
*MATERIAL, NAME=FemMaterial1
|
||||
*ELASTIC
|
||||
32000,0.17
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
** FreeCAD material name: PLA
|
||||
** FemMaterial2
|
||||
*MATERIAL, NAME=FemMaterial2
|
||||
*ELASTIC
|
||||
3640,0.36
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
** FreeCAD material name: Steel-Generic
|
||||
** FemMaterial3
|
||||
*MATERIAL, NAME=FemMaterial3
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -1221,11 +1221,15 @@ Evolumes
|
||||
*MATERIAL, NAME=MechanicalMaterialLow
|
||||
*ELASTIC
|
||||
70000,0.35
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
** FreeCAD material name: Steel-Generic
|
||||
** MechanicalMaterialUpp
|
||||
*MATERIAL, NAME=MechanicalMaterialUpp
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -19996,6 +19996,8 @@ Evolumes
|
||||
*MATERIAL, NAME=Material_lin
|
||||
*ELASTIC
|
||||
210000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
*PLASTIC
|
||||
240.0, 0.0
|
||||
270.0, 0.025
|
||||
|
||||
@@ -2555,6 +2555,8 @@ Efaces
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -2555,6 +2555,8 @@ Efaces
|
||||
*MATERIAL, NAME=FemMaterial
|
||||
*ELASTIC
|
||||
200000,0.3
|
||||
*EXPANSION, ZERO=0
|
||||
0
|
||||
|
||||
***********************************************************
|
||||
** Sections
|
||||
|
||||
@@ -275,6 +275,7 @@ class AnalysisMember:
|
||||
self.cons_force = self.get_several_member("Fem::ConstraintForce")
|
||||
self.cons_heatflux = self.get_several_member("Fem::ConstraintHeatflux")
|
||||
self.cons_initialtemperature = self.get_several_member("Fem::ConstraintInitialTemperature")
|
||||
self.cons_finaltemperature = self.get_several_member("Fem::ConstraintInitialTemperature")
|
||||
self.cons_planerotation = self.get_several_member("Fem::ConstraintPlaneRotation")
|
||||
self.cons_pressure = self.get_several_member("Fem::ConstraintPressure")
|
||||
self.cons_sectionprint = self.get_several_member("Fem::ConstraintSectionPrint")
|
||||
|
||||
Reference in New Issue
Block a user