×

Notice

The forum is in read only mode.

Define Nodes in .comm file

  • Christian
  • Topic Author
  • Offline
  • New Member
  • New Member
More
10 years 11 months ago #7560 by Christian
Define Nodes in .comm file was created by Christian
Hi all,

since the forum was a big help for me concerning writing out matrices with Code_Aster, I now have an other question for you.

With the help of the MAIL_PY() command, I know the coordinates and the 'node number' (eg N1, N2,...) of certain nodes. To apply a force for those nodes, I now need to define them in my .comm file as part of the model. Does anyone know how to define nodes with the help of coordinates or the 'node number'?

Thanks for your help!
Cheers!
More
10 years 11 months ago #7562 by kwou
Replied by kwou on topic Re: Define Nodes in .comm file
Hoi Hefti

the part below is used to apply boundary conditions to a node.
A small modification and it can be used for forces (I guess, and small is relative).
See eg www.caelinux.org/wiki/index.php/Contrib:...outers/bc/pythonlist

Kees
PyMesh   = MAIL_PY()                 ## convert CodeAster mesh to Python
PyMesh.FromAster(mesh);
nonu     = PyMesh.dime_maillage[0]   ## number of nodes
elnu     = PyMesh.dime_maillage[2]   ## number of elements
test=CmeshCA.dime_maillage[5]        ## [min,max] dimension: [0,5]
NodeCoord    = PyMesh.cn             ## xyz coordinates of nodes (nonu*3 matrix)
ElemConnect  = PyMesh.co             ## node numbers of elements (elnu*x matrix)
NodeList = list(PyMesh.correspondance_noeuds)
ElemList = list(PyMesh.correspondance_mailles)
ElemType = list(PyMesh.tm)
NodeGroup = PyMesh.gno               ## list of GROUP_NO groups (see help(MAIL_PY) for object methods reference)
ElemGroup = PyMesh.gma               ## list of GROUP_MA groups, eg groupstr

This part of the script extracts the nodes and coordinates of the cylinder area that need to have the rotational degrees of freedom. Note that the group of nodes has already been defined in Salome and is called 'Ncyl'.

  NodeCount = 0 
  groupstr = 'Ncyl'
  ddl_condition=[]                   ## initialise ddl_condition list 
  for ii in xrange(len(NodeGroup[groupstr])):
     NodeNumber = NodeGroup[groupstr][ii]
     #print 'NodeGroup: ',ii,NodeNumber,NodeCount
     NodeCount+=1
     NNxyz = NodeCoord[NodeNumber]
     nx,ny,nz = cylinder_normal(P1,P2,NNxyz)
     NodeCount+=1

     NNp1 = NodeNumber+1         # node numbers are increased by 1: Salome <--> Code Aster
     ddl_condition.append({'NOEUD': ['N%d'%(NNp1),'N%d'%(NNp1),'N%d'%(NNp1)], 'DDL':['DX','DY','DZ'], 'COEF_MULT': [nx,ny,nz],'COEF_IMPO':0.00})
     if info>1:
        #print {'NOEUD': ['N%d'%(NNp1),'N%d'%(NNp1),'N%d'%(NNp1)], 'DDL':['DX','DY','DZ'], 'COEF_MULT': [nx,ny,nz],'COEF_IMPO':0.00}
        print ddl_condition[ii]

  if info>0:
    # check format of bc_list
    print ic,countntop,': ',ddl_condition[0]
    print '::::::::::::::::::::::::::'
    print ic,countntop,': ',ddl_condition[-1]

Interest: structural mechanics, solar energy (picture at 'my location' shows too little pv panels)

--
kind regards - kees
Moderators: catux
Time to create page: 0.107 seconds
Powered by Kunena Forum