YADE 썸네일형 리스트형 MPI의 이해 YADE에서는 Distribued memeory를 이용한 병렬 가속화를 지원한다. 명령어는 mpirun이다. mpirun을 실행하면 신기한 현상이 하나 생기는데, body가 증가하는 것이다. 오잉? 예를 들어보자. 초기생성모델이다. 박스를 먼저, Sphere를 다음에, 그리고 Topcap을 생성하였다. 그렇다면 O.bodies로 body object가 어떻게 생성되었는지 확인해 보자. In [1]: len(O.bodies) Out[1]: 613 body는 총 613개가 생성되었다. In [2]: O.bodies[0].dict() Out[2]: {'id': 0, 'groupMask': 1, 'flags': 1, 'subdomain': 0, 'material': , 'state': , 'shape': , '.. 더보기 O.interactions의 이해 YADE에서 Sphere간의 Contact list는 O.interactions에 정보가 저장되어 있다. In [43]: type(O.interactions) Out[43]: yade.wrapper.InteractionContainer 확인해 보면, O.interactions는 C로 만들어 Python으로 wrapping된 custom container이다. custom container의 attribute는 다음과 같이 확인 가능하다. In [36]: dir(O.interactions) Out[36]: ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute_.. 더보기 matplotlib.pyplot 사용법 YADE에서 matplotlib.pyplot을 이용하여 그래프를 그리는 경우, import matplotlib.pyplot as plt plt.show() plt.close() 그래프가 그려진 이후 무한루프에 걸린다. 이럴때는 Ctrl + C로 빠져나오면 YADE command line에서 작업이 가능하다. 더보기 YADE의 Material YADE는 기본적으로 Defaul Material이 지정되어 있다. 그래서, YADE를 실행 후 확인을 해 보면, In [2]: len(O.materials) Out[2]: 0 material container가 비어있다. 오잉? 그렇다면 body를 만들어 보자 O.bodies.append(utils.facet(vertices=[(0,0,0),(0,1,0),(1,1,1)], wire=True, highlight=False)) Facet을 하나 만들어다. 이제 다시 확인해 보면 In [7]: len(O.materials) Out[7]: 1 material container가 채워졌다. 이때 채워지는 것은 Default값으로 들어가는데, 확인해 보면 In [8]: O.materials[0].dict() Ou.. 더보기 Interaction 확인방법 YADE에서 Body간의 interaction은 O.interaction에 존재 한다. In [41]: type(O.interactions) Out[41]: yade.wrapper.InteractionContainer InteractionContainer 클래스로 분류된다. 컨테이너 내의 내용을 보려면, In [38]: InteractionContainer.withBody(O.interactions,100) Out[38]: [, , ] 100번째 Body의 interaction은 3개이고, 각각의 인스턴스 주소를 확인할 수 있다. 100번째 interaction을 구성하고 있는 첫번째 body의 id는 53이다. In [8]: InteractionContainer.nth(O.interactions,100.. 더보기 Body의 종류 확인방법 In [75]: isinstance(O.bodies[1].shape,Facet) Out[75]: True In [76]: isinstance(O.bodies[1].shape,Sphere) Out[76]: False 더 쉬운방법은 In [10]: O.bodies[10].dict() Out[10]: {'id': 10, 'groupMask': 1, 'flags': 1, 'subdomain': 4, 'material': , 'state': , 'shape': , 'bound': , 'clumpId': -1, 'chain': -1, 'iterBorn': 0, 'timeBorn': 0.0} 더보기 Body의 상태 확인방법 YADE에서 Bodies (Sphere, Facet 등)의 현재 상태(State : 속도, 변위, 방향 등)을 알기위한 방법 In [8]: O.bodies[4].state.vel Out[8]: Vector3(0,0,0) 종종 Method 형태로 곤란하게 만드는 경우가 있다. 예를 들어 In [23]: O.bodies[12623].state.displ Out[23]: 이지랄을 할 때가 있는데, 이럴 때는 Method로 확인하자 In [24]: O.bodies[12623].state.displ() Out[24]: Vector3(0,0.0006749257958451500283,-0.005600050000161033159) 한방에 보시려면, In [25]: O.bodies[12623].state.dict() O.. 더보기 O.engines 내용 확인방법 O.engines는 List type 컨테이너 이다. 예를 들어, O.engines = [ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()], # collision geometry [Ip2_FrictMat_FrictMat_FrictPhys()], # collision "physics" [Law2_ScGeom_FrictPhys_CundallStrack()] # contact law -- apply forces ), NewtonIntegrator(gravity=(0, 0, -9.81), d.. 더보기 이전 1 2 다음 목록 더보기