from DLO_basic import DLO as DLO_basic from DLO import DLO as DLO from DLO import BD def report(name, obj, ref, tol=1e-3): status = "OK" if abs(obj - ref) < ref * tol else "Fail" print('>> %s: %f --- %s\n' % (name, obj, status) ) def Extrusion12(): vt = [[0,0],[15,0],[15,12],[10,12],[5,12],[0,12]] edgebd = [BD.Load, BD.Fix, BD.Fix, BD.Free, BD.Fix, BD.Fix] material = {'cohesive':1} obj = DLO_basic(vt, edgebd, material) report('Extrusion12', obj, 4.237) def Extrusion15(): vt = [[0,0],[15,0],[15,15],[10,15],[5,15],[0,15]] edgebd = [BD.Load, BD.Fix, BD.Fix, BD.Free, BD.Fix, BD.Fix] material = {'cohesive':1} obj = DLO_basic(vt, edgebd, material) report('Extrusion15', obj, 4.841) def Extrusion18(): vt = [[0,0],[15,0],[15,18],[10,18],[5,18],[0,18]] edgebd = [BD.Load, BD.Fix, BD.Fix, BD.Free, BD.Fix, BD.Fix] material = {'cohesive':1} obj = DLO_basic(vt, edgebd, material) report('Extrusion18', obj, 5.319) def Prandtl(): vt =[[0,0],[10,0],[10,5],[3,5],[0,5]] edgebd = [BD.Fix, BD.Fix, BD.Free, BD.Load, BD.Symmetry] material = {'cohesive':1} obj = DLO_basic(vt, edgebd, material) report('Prandtl', obj, 5.222) def Metal10(): vt = [[0,0],[10,0],[10,10],[0,10]] edgebd = [BD.Symmetry, BD.Symmetry, BD.Lat_load, BD.Free] material = {'phi':0, 'cohesive':1, 'weight':0} obj = DLO(vt, edgebd, material) report('Metal10x10', obj, 2.000) def Metal36(): vt = [[0,0],[36,0],[36,10],[0,10]] edgebd = [BD.Symmetry, BD.Symmetry, BD.Lat_load, BD.Free] material = {'phi':0, 'cohesive':1, 'weight':0} obj = DLO(vt, edgebd, material) report('Metal36x10', obj, 3.322) def Metal67(): vt = [[0,0],[67,0],[67,10],[0,10]] edgebd = [BD.Symmetry, BD.Symmetry, BD.Lat_load, BD.Free] material = {'phi':0, 'cohesive':1, 'weight':0} obj = DLO(vt, edgebd, material) report('Metal67x10', obj, 4.899) def Extrusion30(): vt = [[0,0],[30,0],[30,30],[20,30],[10,30],[0,30]] edgebd = [BD.Rigid_load, BD.Fix, BD.Fix, BD.Free, BD.Fix, BD.Fix] material = {'phi':0, 'cohesive':1, 'weight':0} obj = DLO(vt, edgebd, material) report('Extrusion30', obj, 4.880) def Extrusion60(): vt = [[0,0],[60,0],[60,60],[40,60],[20,60],[0,60]] edgebd = [BD.Rigid_load, BD.Fix, BD.Fix, BD.Free, BD.Fix, BD.Fix] material = {'phi':0, 'cohesive':1, 'weight':0} obj = DLO(vt, edgebd, material) report('Extrusion60', obj, 4.861) def Bearing(): vt = [[0,0],[48,0],[48,16],[5,16],[0,16]] edgebd = [BD.Fix, BD.Fix, BD.Free, BD.Rigid_load, BD.Symmetry] material = {'phi': 25, 'cohesive': 1, 'weight': 0} obj = DLO(vt, edgebd, material) report('Bearing', obj, 21.024) def Retaining(): vt = [[0,0],[40,0],[40,20],[0,20]] edgebd = [BD.Fix, BD.Fix, BD.Free, BD.Rigid_load] material = {'phi': 20, 'cohesive': 1, 'weight': 1} obj = DLO(vt, edgebd, material) report('Retaining', obj, 23.254) def Slope(): vt = [[0,0],[20,0],[20,12],[18,12],[14,12],[13,12],[11,8],[5,8],[3,4],[0,4]] edgebd = [BD.Fix, BD.Fix, BD.Free, BD.Rigid_load, BD.Free, BD.Free, BD.Free, BD.Free, BD.Free, BD.Free] material = {'phi':25, 'cohesive':1, 'weight':1} obj = DLO(vt, edgebd, material) report('Slope', obj, 9.170) if __name__ =='__main__': Prandtl() Extrusion12() Extrusion15() Extrusion18() Metal10() Metal36() Metal67() Extrusion30() Extrusion60() Bearing() Retaining() Slope()