Skip to content

Commit

Permalink
Update write_constraint_rigidbody.py
Browse files Browse the repository at this point in the history
  • Loading branch information
FEA-eng authored Mar 15, 2024
1 parent e2bc756 commit 613dd5c
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def write_constraint(f, femobj, rb_obj, ccxwriter):
is_ref_bc_defined = any((rb_obj.xDisplacement,
rb_obj.yDisplacement,
rb_obj.zDisplacement,
rb_obj.xLoad,
rb_obj.yLoad,
rb_obj.zLoad))
rb_obj.xForce,
rb_obj.yForce,
rb_obj.zForce))

is_rot_bc_defined = any((rb_obj.xRotation,
rb_obj.yRotation,
Expand All @@ -78,10 +78,14 @@ def write_constraint(f, femobj, rb_obj, ccxwriter):
rb_obj.zMoment))

# FIXME: This needs to be implemented

Check warning on line 80 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

FIXME: This needs to be implemented (fixme)
ref_node_idx = -1
rot_node_idx = -1
ref_node_idx = 10000000
rot_node_idx = 20000000

kw_line = "*RIGID BODY,NSET={}".format(rb_obj.Name)
f.write("NODE\n")
f.write("{},{},{},{}\n".format(ref_node_idx, rb_obj.xRefNode, rb_obj.yRefNode, rb_obj.zRefNode))

Check warning on line 85 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Formatting a regular string which could be an f-string (consider-using-f-string)
f.write("{},{},{},{}\n".format(rot_node_idx, rb_obj.xRefNode, rb_obj.yRefNode, rb_obj.zRefNode))

Check warning on line 86 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Formatting a regular string which could be an f-string (consider-using-f-string)

kw_line = "*RIGID BODY, NSET={}, REF NODE={}, ROT NODE={}".format(rb_obj.Name, ref_node_idx, rot_node_idx)

Check warning on line 88 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (110/100) (line-too-long)

Check warning on line 88 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Formatting a regular string which could be an f-string (consider-using-f-string)

if is_ref_bc_defined:
kw_line = kw_line + ",REF NODE={}".format(ref_node_idx)
Expand All @@ -91,15 +95,3 @@ def write_constraint(f, femobj, rb_obj, ccxwriter):

f.write(kw_line + "\n")

Check warning on line 97 in src/Mod/Fem/femsolver/calculix/write_constraint_rigidbody.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Trailing newlines (trailing-newlines)
# TODO: Displacement definitions need fixing
if is_ref_bc_defined:
f.write("*CLOAD\n")
f.write("{},1,{}\n".format(ref_node_idx, rb_obj.xLoad))
f.write("{},2,{}\n".format(ref_node_idx, rb_obj.yLoad))
f.write("{},3,{}\n".format(ref_node_idx, rb_obj.zLoad))

if is_rot_bc_defined:
f.write("*CLOAD\n")
f.write("{},1,{}\n".format(rot_node_idx, rb_obj.xMoment))
f.write("{},2,{}\n".format(rot_node_idx, rb_obj.yMoment))
f.write("{},3,{}\n".format(rot_node_idx, rb_obj.zMoment))

0 comments on commit 613dd5c

Please sign in to comment.