adjust dynamic solver
@@ -31,7 +31,7 @@ import h5py as h5
import sharpy.utils.h5utils as h5utils
import sharpy.utils.multibody as mb
import sharpy.utils.utils_ams as uams
-import sharpy.utils.lagrangemultipliers as lagrangemultipliers
+import sharpy.structure.utils.lagrangeconstraints as lagrangeconstraints
import matplotlib.pyplot as plt
@solver
@@ -83,6 +83,7 @@ class NonLinearDynamicMultibody(BaseSolver):
self.sys_size = None
# Total number of equations associated to the Lagrange multipliers
+ self.lc_list = None
self.num_LM_eq = None
def initialise(self, data, custom_settings=None):
@@ -111,7 +112,9 @@ class NonLinearDynamicMultibody(BaseSolver):
self.beta = 0.25*(self.gamma + 0.5)*(self.gamma + 0.5)
# Define the number of equations
- self.num_LM_eq = lagrangemultipliers.define_num_LM_eq(self.data.structure.mb_dict)
+ self.lc_list = lagrangeconstraints.initialize_constraints(self.data.structure.mb_dict)
+ self.num_LM_eq = lagrangeconstraints.define_num_LM_eq(self.lc_list)
+
# Define the number of dofs
self.define_sys_size()
@@ -247,7 +250,7 @@ class NonLinearDynamicMultibody(BaseSolver):
# Generate matrices associated to Lagrange multipliers
- LM_C, LM_K, LM_Q = lagrangemultipliers.generate_lagrange_matrix(MBdict, MB_beam, MB_tstep, ts, self.num_LM_eq, self.sys_size, dt, Lambda, Lambda_dot)
+ LM_C, LM_K, LM_Q = lagrangeconstraints.generate_lagrange_matrix(self.lc_list, MBdict, MB_beam, MB_tstep, ts, self.num_LM_eq, self.sys_size, dt, Lambda, Lambda_dot, "dynamic")
#LM_C, LM_K, LM_Q = self.generate_lagrange_matrix(MB_beam, MB_tstep, dt, Lambda, Lambda_dot)
@@ -397,7 +400,7 @@ class NonLinearDynamicMultibody(BaseSolver):
# End of Newmark-beta iterations
self.integrate_position(MB_beam, MB_tstep, dt)
- lagrangemultipliers.postprocess(MB_beam, MB_tstep, MBdict)
+ lagrangeconstraints.postprocess(self.lc_list, MB_beam, MB_tstep, MBdict, "dynamic")
if self.settings['gravity_on']:
for ibody in range(len(MB_beam)):
xbeamlib.cbeam3_correct_gravity_forces(MB_beam[ibody], MB_tstep[ibody], self.settings)
@@ -422,4 +425,3 @@ class NonLinearDynamicMultibody(BaseSolver):
del(MBdict[k])
MBdict['num_constraints'] = 0
-
