FEM: Fix invalid CLOAD formatting

Existing code was producing invalid results:

a = 9876543212346789864323456.9543234578986432345678
>>> print "{:.13}".format(repr(a))
9.87654321234
>>> a
9.87654321234679e+24
The new converision should work fine:
>>> print "{:.13E}".format(a)
9.8765432123468E+24

Reported & fixed by ulrich1a
This commit is contained in:
Przemo Firszt
2015-05-06 22:40:49 +01:00
committed by wmayer
parent 09921c9bb7
commit 29205f7f4d

View File

@@ -166,9 +166,9 @@ class inp_writer:
vec = frc_obj.DirectionVector
f.write('*CLOAD\n')
f.write('** force: ' + str(node_load) + ' N, direction: ' + str(vec) + '\n')
v1 = "{:.15}".format(repr(vec.x * node_load))
v2 = "{:.15}".format(repr(vec.y * node_load))
v3 = "{:.15}".format(repr(vec.z * node_load))
v1 = "{:.13E}".format(vec.x * node_load)
v2 = "{:.13E}".format(vec.y * node_load)
v3 = "{:.13E}".format(vec.z * node_load)
f.write(frc_obj_name + ',1,' + v1 + '\n')
f.write(frc_obj_name + ',2,' + v2 + '\n')
f.write(frc_obj_name + ',3,' + v3 + '\n\n')