diff --git a/LoadCase/LoadsAndBCs.py b/LoadCase/LoadsAndBCs.py index 17fdf4ebc9953ae27a9ef03d05bf5005f04ea5cd..48add7cb426392da2467d33c0da6fc5d32650fbb 100644 --- a/LoadCase/LoadsAndBCs.py +++ b/LoadCase/LoadsAndBCs.py @@ -54,35 +54,6 @@ def create_load(data, **kwargs): field='', localCsys=None) - # ipMTnames = kwargs['ipMTnames'] - # StepName = kwargs['StepName'] - # LoadVal = kwargs['CompressiveLoad'] - # for i in range(len(ipMTnames)): - # if i % 2 == 0: # Right pole - # v = a.instances[ipMTnames[i]].vertices - # loc = v[-1].pointOn - # verts = v.findAt(loc, ) - # region = a.Set(vertices=verts, name='ipMTtip-' + str(i)) - # mdb.models[modelname].ConcentratedForce(name='Load-' + str(i), - # createStepName=StepName, - # region=region, - # cf3=-LoadVal, - # distributionType=UNIFORM, - # field='', - # localCsys=None) - # else: # Left pole - # v = a.instances[ipMTnames[i]].vertices - # loc = v[-1].pointOn - # verts = v.findAt(loc, ) - # region = a.Set(vertices=verts, name='ipMTtip-' + str(i)) - # mdb.models[modelname].ConcentratedForce(name='Load-' + str(i), - # createStepName=StepName, - # region=region, - # cf3=LoadVal, - # distributionType=UNIFORM, - # field='', - # localCsys=None) - def create_bc(**kwargs): """ @@ -108,5 +79,3 @@ def create_bc(**kwargs): createStepName='Initial', region=region, localCsys=None) - -# TODO: Apply load at the points linking connectors and ipMTs diff --git a/SpindleAssembly/PositionIpMTs.py b/SpindleAssembly/PositionIpMTs.py index 2848d73d7bd9799c7ca947beac7a73e99be1a03e..ac6bf32a5989aff73fcd6671c01aeadbb6514f56 100644 --- a/SpindleAssembly/PositionIpMTs.py +++ b/SpindleAssembly/PositionIpMTs.py @@ -4,16 +4,26 @@ import numpy as np import math -def generate_separation(): +def generate_separation(**kwargs): """ - Calculate distance and angle between interpolar mts based on the given random distribution + Calculate distance and angle between ipMTs based on the Gaussian distribution with a given mean and standard + deviation - :return: s -> (float) distance between ipMTs - alpha -> (float) angle between ipMTs in degrees + :param kwargs: model parameters + + :type kwargs: object + + :return: s: distance between ipMTs + + :rtype: s: float + + :return: alpha: angle between ipMTs in degrees + + :rtype: float """ - s = np.random.normal(loc=0.035, scale=0.008) + s = np.random.normal(loc=kwargs['separation'][0], scale=kwargs['separation'][1]) # Generate angle between MTs - alpha = np.random.normal(loc=90, scale=10) + alpha = np.random.normal(loc=kwargs['angle'][0], scale=kwargs['angle'][1]) return s, alpha @@ -126,7 +136,7 @@ def add_second_ipMT( pos, alpha1, i, **kwargs ): :rtype: str, tuple, float, dict """ # Generate position of the ipMT - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) x = pos[0] + s * math.cos(math.radians(alpha1)) y = pos[1] + s * math.sin(math.radians(alpha1)) pos = (x, y) @@ -137,7 +147,7 @@ def add_second_ipMT( pos, alpha1, i, **kwargs ): if counter > 1000: raise ValueError('Some MTs are located outside of the centrosomes. Consider restarting calculation') break - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) # Position MT x = pos[0] + s * math.cos(math.radians(alpha1)) y = pos[1] + s * math.sin(math.radians(alpha1)) @@ -180,7 +190,7 @@ def add_third_ipMT( pos2, alpha2, i, **kwargs ): :rtype: str, tuple, float, dict """ # Generate position of the ipMT - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) x = pos2[0] - s * math.cos(math.radians(alpha2)) y = pos2[1] + s * math.sin(math.radians(alpha2)) pos = (x, y) @@ -235,7 +245,7 @@ def add_fourth_ipMT( pos3, alpha2, alpha3, i, **kwargs ): :rtype: str, tuple, float, dict """ # Generate position of the ipMT - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) y, newalpha = condition_for_fourth_ipMT(alpha2, alpha3, s, pos3) x = pos3[0] - s * math.cos(newalpha) pos = (x, y) @@ -286,7 +296,7 @@ def add_fifth_ipMT( pos4, alpha4, i, **kwargs ): :rtype: str, tuple, float, dict """ # Generate position of the ipMT - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) x = pos4[0] - s * math.cos(-math.radians(alpha4)) y = pos4[1] + s * math.sin(-math.radians(alpha4)) pos = (x, y) @@ -343,7 +353,7 @@ def add_sixth_ipMT( pos5, alpha4, alpha5, i, **kwargs ): :rtype: str, tuple, float, dict """ # Generate position of the ipMT - s, alpha = generate_separation() + s, alpha = generate_separation(**kwargs) x = pos5[0] + s * math.cos(-math.radians(alpha5) + math.radians(alpha4)) y = pos5[1] + s * math.sin(-math.radians(alpha5) + math.radians(alpha4)) pos = (x, y) diff --git a/job.py b/job.py index ddbdc82b96eaa77716833a23b7416ae1fb4404b0..771a7b7451799ed62a3d88538424e4e0ea2cf4f5 100644 --- a/job.py +++ b/job.py @@ -12,12 +12,14 @@ kwargs = {'x' : 0, 'index' : 0, 'modelname' : 'test', 'assembly' : 0, - 'CentrosomeRadius': 0.06, + 'CentrosomeRadius': 0.12, 'CentrosomeLength': 0.12, 'CentrosomeE' : 1500000000.0, 'CentrosomeNu' : 0.3, 'ipMTnumber' : 6, 'lengthInterval' : [2, 7], + 'separation' : [0.02876, 0.0414], + 'angle' : [96.39, 11.12], 'r1' : 0.015, 'r2' : 0.025, 'ElasticModulus' : 1500000000.0,