Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2019-01-22 15:57:12

y.s.
Member
Registered: 2019-01-22
Posts: 6

Extract coordinate of node

Hello

I'm trying to get the location X,Y,Z of nodes in mechanical analysis.

As searching through older topics and documentation, I read followings.

(1) https://code-aster.org/forum2/viewtopic.php?id=15345
(2) u4.72.04 CREA_CHAMP
(3) v1.01.266

But since I'm a beginner in CodeAster, couldn't fully understand these and build valid comm file.

(I'm able to get the DEPL of nodes in text file using POST_RELEVE_T which only indicating relative displacement from initial coordinate, not the exact coordinate.)

*******************
So, the question is follows:
which commands do I need to use to get node coordinate in text file?
(Is it CALC_CHAM_ELEM / COOR_ELGA ?)


I appreciate any comment.
y.s.

Last edited by y.s. (2019-01-22 15:58:33)

Offline

#2 2019-01-22 17:05:58

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,616

Re: Extract coordinate of node

hello

this topic among many other is treated in my book
available for free at framabook

jean pierre aubry

Offline

#3 2019-01-23 11:59:17

y.s.
Member
Registered: 2019-01-22
Posts: 6

Re: Extract coordinate of node

Dear pierre,

thanks a lot for quick reply.

I looked into your book and found
"18.3 Adding node coordinates in a result"(P.272)

Just using IMPR_COOR option in IMPR_RESU , I could get "original" node coordinate, but not the deformed position.
As the DEPL is also written, I have enough data to calculate deformed position of node in post handling in Excel etc.
But still it is convenient if deformed position can be calculated in CodeAster.

Is there a way to do this?

thank you.
y.s.

Offline

#4 2019-02-04 16:38:53

crubio
Member
From: Madrid
Registered: 2019-01-31
Posts: 6

Re: Extract coordinate of node

I don't know about CodeAster but for sure ParaVis can do what you want. Just use a "Wrap By Vector", set DEPL as a vector and factor to 1 and open a new SpreadSheetView. You can even select the nodes you're interested on and extract them to a CSV.

If you want more complex behaviour you can use some aditional paraview filters (such as "Block extraction" to get groups of nodes) or even make some script using the python VTK interface.

Last edited by crubio (2019-02-04 16:39:39)


Attachments:
paraVisNodeExtraction.png, Size: 407.96 KiB, Downloads: 107

Offline

#5 2019-02-04 21:10:54

AsterO'dactyle
Administrator
Registered: 2007-11-29
Posts: 273

Re: Extract coordinate of node

Maybe moving the nodes in the mesh with the MODI_MAILLAGE command before print it ?

MA=MODI_MAILLAGE( reuse=MA,MAILLAGE=MA, DEFORME=_F( OPTION = 'TRAN', DEPL = disp))


Code_Asterの開発者

Offline

#6 2019-02-05 09:50:07

jeanpierreaubry
Guru
From: nantes (france)
Registered: 2009-03-12
Posts: 3,616

Re: Extract coordinate of node

I don't know about CodeAster but for sure ParaVis can do what you want. Just use a "Wrap By Vector", set DEPL as a vector and factor to 1 and open a new SpreadSheetView. You can even select the nodes you're interested on and extract them to a CSV.
If you want more complex behaviour you can use some aditional paraview filters (such as "Block extraction" to get groups of nodes) or even make some script using the python VTK interface.

ParaVis is just a viewer
all what it can display comes from the med file
and is the result of a code_aster command

so anything viewable in ParaVis, or any med viewer like Gmsh
can be calculated by code_aster and printed directly from it
in ASCII, CSV or other format

Offline

#7 2019-02-05 10:00:02

crubio
Member
From: Madrid
Registered: 2019-01-31
Posts: 6

Re: Extract coordinate of node

jeanpierreaubry wrote:

I don't know about CodeAster but for sure ParaVis can do what you want. Just use a "Wrap By Vector", set DEPL as a vector and factor to 1 and open a new SpreadSheetView. You can even select the nodes you're interested on and extract them to a CSV.
If you want more complex behaviour you can use some aditional paraview filters (such as "Block extraction" to get groups of nodes) or even make some script using the python VTK interface.

ParaVis is just a viewer
all what it can display comes from the med file
and is the result of a code_aster command

so anything viewable in ParaVis, or any med viewer like Gmsh
can be calculated by code_aster and printed directly from it
in ASCII, CSV or other format

For sure there must be a way to do it within code_aster but, as I do now know enough to do it, this trick get the things done. ParaVis (as an specialication of Paraview) is a viewer and post-processor, so it have sense to use it for viewing and post-processing the results, right? I've just used what I know trying to help!

Offline

#8 2019-02-05 11:36:25

Viktor.Vlaski
Member
Registered: 2015-10-16
Posts: 16

Re: Extract coordinate of node

PyMesh   = MAIL_PY()                 ## convert CodeAster mesh to Python
PyMesh.FromAster(Mesh);
# print PyMesh,                      ## print all mesh info and details
nonu     = PyMesh.dime_maillage[0]   ## number of nodes
NodeCoord    = PyMesh.cn             ## xyz coordinates of nodes (nonu*3 matrix)
NodeList = list(PyMesh.correspondance_noeuds)
NodeGroup = PyMesh.gno               ## list of GROUP_NO groups (see help(MAIL_PY) for object methods reference)
fileR = open(WorkPath+'OutputNodes.txt','w')
fileR.write('-----------------------------------------\n')
fileR.write('Output Node     Xcoor     Ycoor     Zcoor\n')
fileR.write('-----------------------------------------\n')
NrNdes=len(NodeGroup['OUTPUT'])
Xcoor=[None]*NrNdes
Ycoor=[None]*NrNdes
Zcoor=[None]*NrNdes
for ii in xrange(NrNdes):
     NodeNumber = NodeGroup['OUTPUT'][ii]
     nodecoord= PyMesh.cn[NodeNumber]
     Xcoor[ii]=PyMesh.cn[NodeNumber,0]
     Ycoor[ii]=PyMesh.cn[NodeNumber,1]
     Zcoor[ii]=PyMesh.cn[NodeNumber,2]
     fileR.write('%11i%10.3f%10.3f%10.3f\n' % (NodeNumber,Xcoor[ii],Ycoor[ii],Zcoor[ii]))
fileR.close()

Offline

#9 2019-02-07 04:15:03

y.s.
Member
Registered: 2019-01-22
Posts: 6

Re: Extract coordinate of node

thanks everyone,

Extracting coordinate from paravis is still very helpful for my situation.

jeanpierreaubry wrote:

so anything viewable in ParaVis, or any med viewer like Gmsh
can be calculated by code_aster and printed directly from it
in ASCII, CSV or other format

that's exactly what I'm trying to do.
Its very helpful if possible without using any python scripts.

thank you.

Offline