Fem: Change ConstraintPressure::Pressure property to App::PropertyPressure

This commit is contained in:
Uwe
2023-10-03 01:38:23 -03:00
committed by marioalexis
parent d8636dd058
commit 6845cb66f8
10 changed files with 72 additions and 56 deletions

View File

@@ -25,6 +25,7 @@ __title__ = "FreeCAD FEM calculix constraint pressure"
__author__ = "Bernd Hahnebach"
__url__ = "https://www.freecad.org"
import FreeCAD
def get_analysis_types():
return ["buckling", "static", "thermomech"]
@@ -47,7 +48,9 @@ def write_meshdata_constraint(f, femobj, prs_obj, ccxwriter):
# floats read from ccx should use {:.13G}, see comment in writer module
rev = -1 if prs_obj.Reversed else 1
press_rev = rev * prs_obj.Pressure
# the pressure has to be output in MPa
pressure_quantity = FreeCAD.Units.Quantity(prs_obj.Pressure.getValueAs("MPa"))
press_rev = rev * pressure_quantity
f.write("*DLOAD\n")
for ref_shape in femobj["PressureFaces"]:
@@ -57,12 +60,12 @@ def write_meshdata_constraint(f, femobj, prs_obj, ccxwriter):
f.write("** " + ref_shape[0] + "\n")
for face, fno in ref_shape[1]:
if fno > 0: # solid mesh face
f.write("{},P{},{:.13G}\n".format(face, fno, press_rev))
f.write("{},P{},{}\n".format(face, fno, press_rev))
# on shell mesh face: fno == 0
# normal of element face == face normal
elif fno == 0:
f.write("{},P,{:.13G}\n".format(face, press_rev))
f.write("{},P,{}\n".format(face, press_rev))
# on shell mesh face: fno == -1
# normal of element face opposite direction face normal
elif fno == -1:
f.write("{},P,{:.13G}\n".format(face, -1 * press_rev))
f.write("{},P,{}\n".format(face, -1 * press_rev))

View File

@@ -82,7 +82,7 @@ class DeformationWriter:
for obj in self.write.getMember("Fem::ConstraintPressure"):
if obj.References:
for name in obj.References[0][1]:
pressure = self.write.getFromUi(obj.Pressure, "MPa", "M/(L*T^2)")
pressure = float(obj.Pressure.getValueAs("Pa"))
if not obj.Reversed:
pressure *= -1
self.write.boundary(name, "Normal Force", pressure)

View File

@@ -298,7 +298,7 @@ class ElasticityWriter:
for obj in self.write.getMember("Fem::ConstraintPressure"):
if obj.References:
for name in obj.References[0][1]:
pressure = self.write.getFromUi(obj.Pressure, "MPa", "M/(L*T^2)")
pressure = float(obj.Pressure.getValueAs("Pa"))
if not obj.Reversed:
pressure *= -1
self.write.boundary(name, "Normal Force", pressure)

View File

@@ -261,7 +261,7 @@ class Flowwriter:
for obj in self.write.getMember("Fem::ConstraintPressure"):
if obj.References:
for name in obj.References[0][1]:
pressure = self.write.getFromUi(obj.Pressure, "MPa", "M/(L*T^2)")
pressure = float(obj.Pressure.getValueAs("Pa"))
if obj.Reversed:
pressure *= -1
self.write.boundary(name, "External Pressure", pressure)