CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > CFX

User_get_mesh_info

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By Antanas
  • 1 Post By Antanas

Reply
 
LinkBack Thread Tools Display Modes
Old   October 28, 2013, 21:48
Default User_get_mesh_info
  #1
New Member
 
Araz
Join Date: Feb 2011
Location: Canada
Posts: 22
Rep Power: 5
Araz is on a distinguished road
Dear All,

I'm working on a 3D blade having structured mesh around blade wall. In my work I'm using a Fortran subroutine that is compiled to CFX (User CEL).
I need to get access to the elements coordinates or Element-to-vertex Connectivity. Based on CFX documentation it is possible by calling "USER_GET_MESHDATA" subroutine where the array shape is defined as CrdFc (ISFC_S:ISFC_F, NDIM) or KVxEl (ISEL_S:ISEL_F,NVxEl).


However, I think first I need to call "USER_GET_MESH_INFO" subroutine to obtain the values of integer variables defining these arrays. As you know

The general form of this subroutine is :


SUBROUTINE USER_GET_MESH_INFO (WHO,ACTION,CERACT, & WHEN,CZONE,LOCALE,CDIR,CRESLT, & CZ,DZ,IZ,LZ,RZ)


By calling "USER_CALC_INFO", I find that in my case:

CZONE='ZN1'

LOCALE='BELG3'

moreover I set ACTION='GET', CERACT = 'STOP', WHEN = 'LATEST' and CDIR = ' '.
So the code generates a directory name of "MESH_INFO/ZN1/BELG3" in which to place the data. So, finally this is what I'm trying to run:


#include "stack_point.h"
#include "MMS.h"



call USER_GET_MESH_INFO ('YDISP','GET','STOP',
& 'LATEST','ZN1','BELG3',CDIR,CRESLT,
& CZ,DZ,IZ,LZ,RZ)


I suppose I need to use PEEK facilities at this step in order to obtain the
integer values (as stated in documentation) such as : NEL,NVX,NDIM,ISFC_S,ISFC_F etc.




But I have not been able to use these facilities properly. unfortunately the available examples couldn't help me much as they were not clear to me.Could you please help me through? is my procedure right? if so, Which PEEK facility I need to use and how?

Thanks in advance.

Araz

Last edited by Araz; October 28, 2013 at 21:50. Reason: typo in title
Araz is offline   Reply With Quote

Old   October 28, 2013, 23:37
Default
  #2
Member
 
Join Date: Feb 2011
Posts: 84
Rep Power: 5
Antanas is on a distinguished road
Hello.

As I understand to get NEL, NVX, NDIM you need to call USER_GET_MESH_INFO with empty locale, because these are zonal parameters.

Next, as all values that you want are integer, call PEEKI to get them. For example:

Code:
CALL USER_GET_MESH_INFO ('YDISP','GET','STOP','LATEST','ZN1','',CDIR,CRESLT,CZ,DZ,IZ,LZ,RZ)
CALL PEEKI('USER'//CDIR//'/NEL',IONE,MY_NEL,'STOP',CRESLT,IZ)
CALL PEEKI('USER'//CDIR//'/NVX',IONE,MY_NVX,'STOP',CRESLT,IZ)
CALL PEEKI('USER'//CDIR//'/NDIM',IONE,MY_NDIM,'STOP',CRESLT,IZ)

CALL USER_GET_MESH_INFO ('YDISP','GET','STOP','LATEST','ZN1','BELG3',CDIR,CRESLT,CZ,DZ,IZ,LZ,RZ)
CALL PEEKI('USER'//CDIR//'/ISFC_S',IONE,MY_ISFC_S,'STOP',CRESLT,IZ)
CALL PEEKI('USER'//CDIR//'/ISFC_F',IONE,MY_ISFC_F,'STOP',CRESLT,IZ)
Hope I'm correct, try this!
Araz likes this.
Antanas is offline   Reply With Quote

Old   October 29, 2013, 22:57
Default
  #3
New Member
 
Araz
Join Date: Feb 2011
Location: Canada
Posts: 22
Rep Power: 5
Araz is on a distinguished road
Dear Antanas,

Thanks a lot for your reply, it was quit useful and by doing a very little modification I could run your suggestion successfully.
However, I think I have problem in identifying the variables and parameters to be called by these subroutines, for example consider the general form of "PEEKI" subroutine:

SUBROUTINE PEEKI (CDANAM, JADRES, IVALUE, CERACT, CRESLT, IZ)

where according to CFX documentation, "CDANAM" is the name of the data area. assume I want to obtain "NVX".
So I replace "CDANAM" with: "/USER/'//CDIR//'/NVX" which is the place where the value of "NVX" is stored. I get it.
Then is "JADRES" which is defined as array entry. In my case we replaced it by "IONE" (=1). Is that the number at which CFX starts to count the value (or number) of the integer variable (here the number of nodes)? and it should always be 1?

Now, apart from this, USER_GET_MESH_INFO is useful to obtain integer, scalar data and not arrays which is my actual purpose of following this procedure. Are the arrays and REAL parameters such as coordinates already stored at the same data area (CDANAM= "/USER/'//CDIR//')?
or they need to be stored separately using other functions?

So, for me, to find the face coordinates i.e., CrdFc (ISFC_S:ISFC_F, NDIM), it is not just enough to call "USER_GET_MESHDATA" since pointers to faces are not obtained yet. Is that correct?
I suppose, before calling "USER_GET_MESHDATA", it is necessary to call "PEEKR" and/or "LOCDAT" subroutines.

General form of LOCDAT:
SUBROUTINE LOCDAT (CDANAM, CDTYPE, CERACT, ISIZE, JADRES, CRESLT)

I tried "CALL LOCDAT('/USER/'//CDIR//'/CrdFc',CDTYPE,'STOP',ISIZE,CrdFc
&,CRESLT)

but it ddin;t work and got the following error message:

"Error detected by routine LOCDAT
CDANAM = /USER/MESH_INFO /CrdFc
CRESLT = NONE

Current Directory : /FLOW/BOUNDCON/ZN1/BCP1/VARIABLES/MESHDISP"

I also tried "CALL LOCDAT('CrdFc',CDTYPE,'STOP',ISIZE,CrdFc
&,CRESLT)"

but didn't work as well and I got the message:
"Error detected by routine LOCDAT
CDANAM = CrdFc
CRESLT = NONE"

Then I tried "PEEKR":

CALL PEEKR('/USER/'//CDIR//'/CrdFc',1,CrdFc,'STOP',
&CRESLT,IZ)

but again error:

Error detected by routine PEEKR
CDANAM = /USER/MESH_INFO /CrdFc
CRESLT = NONE


Any advice and suggestions is highly appreciated.
Thanks for your time.

Regards,
Araz
Araz is offline   Reply With Quote

Old   October 30, 2013, 21:03
Default
  #4
New Member
 
Araz
Join Date: Feb 2011
Location: Canada
Posts: 22
Rep Power: 5
Araz is on a distinguished road
In order to squeeze my previous post:

1- How could I obtain the values of "CrdFc (ISFC_S:ISFC_F, NDIM)" and "KVxEl (ISEL_S:ISEL_F,NVxEl)" using USER_GET_MESHDATA? (considering that I have already obtained all the integer variables which identify these arrays)

2- Do I need to call PEEKR and/or LOCDAT and/or any other specific routine to identify these arrays?

3- What strings do I need to to choose when calling these routines? e.g., CDANAM, NVAR,pVAR ...

Thank you again,
Araz
Araz is offline   Reply With Quote

Old   November 3, 2013, 00:47
Default
  #5
Member
 
Join Date: Feb 2011
Posts: 84
Rep Power: 5
Antanas is on a distinguished road
Quote:
Originally Posted by Araz View Post
In order to squeeze my previous post:

1- How could I obtain the values of "CrdFc (ISFC_S:ISFC_F, NDIM)" and "KVxEl (ISEL_S:ISEL_F,NVxEl)" using USER_GET_MESHDATA? (considering that I have already obtained all the integer variables which identify these arrays)

2- Do I need to call PEEKR and/or LOCDAT and/or any other specific routine to identify these arrays?

3- What strings do I need to to choose when calling these routines? e.g., CDANAM, NVAR,pVAR ...

Thank you again,
Araz
As far as I understand you should do like this:
Code:
CALL USER_GET_MESHDATA ('Coordinates','Vertices','RETURN','STOP',CRESLT,NVAR,pVERTCOORD, CZ,DZ,IZ,LZ,RZ)
It gives you a value of pointer pVERTCOORD in RZ stack which you may use to obtain array coordinates. You don't need to call any PEEK routine for that. You may do it in a loop:
Code:
DO I = 1,NVX
 DO J = 1,NDIM
  MYCOORDS(J,I) = RZ(pVERTCOORD+(I-1)*NDIM+J-1)
 ENDDO
ENDDO
Or you may pass RZ(pVERTCOORD) to another subroutine which will return your array (recommended by ANSYS because pointer arithmetics is error prone):

Code:
CALL SET_MY_ARRAY(MYCOORDS,RZ(pVERTCOORD),NVX,NDIM)
Where SET_MY_ARRAY routine is something like:

Code:
SUBROUTINE SET_MY_ARRAY(OUTP,INP,NVX,NDIM)
 REAL, INTENT(IN) :: INP(NDIM,NVX)
 INTEGER, INTENT(IN) :: NVX,NDIM
 REAL, INTENT(OUT) :: OUTP(NDIM,NVX)
C USER_GET_MESHDATA GIVES YOU A POINTER TO ACTUAL SOLVER ARRAY
C SO YOU DON'T WANT TO DO SOMETHING WRONG WITH IT
 OUTP = INP
ENDSUBROUTINE SET_MY_ARRAY
Note that USER_GET_MESHDATA only available in user CEL routines, that means that if your routine is Junction Box you can't call USER_GET_MESHDATA. Also note that while you may call USER_GET_MESHDATA for vertices coordinates from any solver locale, Element-to-vertex Connectivity is only available when you are at ELS*, IELG*,BELG*. To know exactly where you are and what arrays are available to you at the moment in USER_GET_MESHDATA you must prior call USER_CALC_INFO. If you try to access a variable on an invalid solver locale, then USER_GET_MESHDATA returns CRESLT = ‘BADL’.
Araz likes this.
Antanas is offline   Reply With Quote

Old   November 8, 2013, 21:57
Default
  #6
New Member
 
Araz
Join Date: Feb 2011
Location: Canada
Posts: 22
Rep Power: 5
Araz is on a distinguished road
Dear Antanas,

I apologize because of not being able to reply and thank you earlier for your time and help.

I implemented what you said and got the result. the only difference is that, (based on the result that I got and plotted), the first "NVX" number of values corresponds to the X coordinate of nodes, the next "NVX" number of values represent the Y coordinates and the last "NVX" numbers are the Z coordinates. In my case which was obtaining the face centers:

RZ(pFACECOORD +(0:ISFC_F-1)) = X coordinate of face centers
RZ(pFACECOORD +(ISFC_F:ISFC_F*2-1)) = Y coordinate of face centers
RZ(pFACECOORD +(ISFC_F*2:ISFC_F*3-1)) = Z coordinate of face centers


However, I will need one more mesh related information to reach my goal. The final purpose is to get access to the nodal values of the nodes located on each streamwise gridline.
For example consider the attached figure. As you see There are 14 streamwise grid lines (in Z direction) over the blade from hub to tip. I need to get access to the nodal values of each one of these gridlines separately.


So far, I have obtained the coordinates of the nodes and face centers. However, I have not been able to capture which 4 nodes belong to which face (in the other word each face is consisted of which nodes), or which node belongs to which gridline.


Do you have any suggestions for this too?

Again thank you so much,

Regards,
Araz
Attached Images
File Type: jpg AxialTest.jpg (39.0 KB, 4 views)
Araz is offline   Reply With Quote

Reply

Tags
connectivity, elements, mesh_info, peek facility

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:26.