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

Got problems with USER_GET_MESHDATA and PEEKI

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

Like Tree2Likes
  • 1 Post By Opaque
  • 1 Post By Opaque

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 25, 2018, 11:24
Talking Got problems with USER_GET_MESHDATA and PEEKI
  #1
New Member
 
Join Date: Sep 2018
Posts: 11
Rep Power: 8
ertianlang is on a distinguished road
Hi, everyone.

I'm trying to get the Element Volumes in a small range of a fluid domain ( like the range 0<x<1, 0<y<1 and 0<z<1) in order to calculate a type of source term. So I try to use CFX user CEL to do this.

In first trial, I called USER_GET_MESHDATA and I got a pointer pVAR pointing to the Element Volume I wanted ( I supoose ) in stack RZ. But when I output the results, I found that every location may correspond to several Element Volumes. The code and the result are following:

Code:
 
     CALL USER_GET_MESHDATA('Volume','Elements','RETURN','STOP',
     & CRESLT,NVAR, pVAR, CZ, DZ, IZ, LZ, RZ )
C
      CALL ElementCal( NLOC, NRET, NARG, RET(1,1),
     &                 ARGS(1,1),ARGS(1,2),ARGS(1,3), RZ(pVAR) )
C
      DO ILOC=1,NLOC
          CALL MESAGE( 'WRITE', 'X,Y,Z'//CFROMR( ARGS(ILOC,1) )//
     &     CFROMR( ARGS(ILOC,2) )//CFROMR( ARGS(ILOC,3) )//
     &     CFROMR( RZ(pVAR+ILOC-1) )  )
      END DO
................................................................................................
      SUBROUTINE ElementCal( NLOC, NRET, NARG, EVDBVGEV,
     &                        X,Y,Z, EV )
#include "MMS.h"
#include "stack_point.h"
      INTEGER NLOC, NRET, NARG, ILOC, IRET
      REAL EVDBVGEV(NLOC,NRET) ,X(NLOC),Y(NLOC),Z(NLOC), EV(NLOC)
      DO ILOC=1,NLOC
          DO IRET=1,NRET
              EVDBVGEV(ILOC,IRET) = 0.0
          END DO
      END DO
C
      END
Here is the results( the output is too HUGE so I put the result of ONE location here ):

928 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 3.2482271E-14
19778 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 1.0000000E+00
3876863 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 0.0000000E+00
3913103 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 0.0000000E+00
4074004 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 3.6953235E-14
4090538 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 1.0000000E+00
4095158 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 1.0000000E+00
4126714 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 -4.1434870E-04
4722683 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 0.0000000E+00
4741213 X,Y,Z 1.0320305E+02 3.0722320E+01 -1.9858870E+02 0.0000000E+00

As you see, for ONE location, there are several Element Volumes, and some of them equals to zero.

After search on the CFX forum, I think maybe I should get ELS*, IELG*, ISEL_S and ISEL_F before using the pointer pVAR ( although I still can't understand these variables very well. ) So I started my second trial.

In my second trial, I called USER_CALC_INFO, USER_GET_MESH_INFO and PEEKI to get IELG and etc. But PEEKI returns an error, CRESLT = DIR. According to CFX-Solver Modeling Guide, this error means
Quote:
The name passed to the subroutine represents a directory, when it should be a data area.
Well, data areas are parts of the stacks basically, but I don't know how to do with it. The code and the result are following:

Code:
      ACTION='GET'
      CRESLT='GOOD'
      CALL USER_CALC_INFO (WHO,ACTION,CVAR,LOCALE,ENTITY,WHEN,
     & CALIAS,CERACT,CRESLT,
     & CZONE,ILOCS,ILOCF,IENTS,IENTF,
     & CZ,DZ,IZ,LZ,RZ)
C
      ACTION='GET'
      CERACT='STOP'
      WHEN='LATEST'
      CDIR=' '
      CRESLT='GOOD'
      CDIR=' '
      CALL USER_GET_MESH_INFO(WHO,ACTION,CERACT,
     &         WHEN, CZONE,LOCALE, CDIR, CRESLT,
     &         CZ, DZ, IZ, LZ, RZ )
C
      CDANAM='/USER/'//CDIR//'/IELG'
      CALL PEEKI( CDANAM, JADRES, IVALUE, 'STOP', CRESLT, IZ )
      CALL MESAGE( 'WRITE', 'IELG '//CFROMI(IVALUE))
The error message is:
Code:
 Details of error:-
 ----------------
 Error detected by routine PEEKI 
 CDANAM = /USER/MESH_INFO/ZN1/IELG1 
 CRESLT = DIR 
  
 Current Directory : /FLOW/PHYSICS/ZN1/VP1/SOURCES/MOM_FL1/GENSOU/SOURCE_A
I didn't use "IONE" as the examples did because the examples didn't declare it or make it equal to 1.

Emmm, this is the situation, hope I have explained it clearly.
Could anyone save me from this problem? Thank you very much!
ertianlang is offline   Reply With Quote

Old   September 25, 2018, 14:14
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33
Opaque will become famous soon enough
From the call to USER_GET_MESH_INFO, you should have gotten the name of the CDIR

Then, the path to the directory of interest should be

CDANAM = '/USER/'//TRIM(CDIR)//'/IELG'

For your case, it seems

CDIR = 'MESH_INFO/ZN1/IELG1'

Summary: be careful when concatenating the strings. My guess is CDIR is the same size as CDANAM, and the last part of the concatenation is ignored; therefore, the use of TRIM.
ertianlang likes this.
Opaque is offline   Reply With Quote

Old   September 25, 2018, 22:57
Default
  #3
New Member
 
Join Date: Sep 2018
Posts: 11
Rep Power: 8
ertianlang is on a distinguished road
Yes! Awesome!
You have solved my problem totally!
Thank you very much!
ertianlang is offline   Reply With Quote

Old   September 27, 2018, 23:21
Default
  #4
New Member
 
Join Date: Sep 2018
Posts: 11
Rep Power: 8
ertianlang is on a distinguished road
Hi, Opaque. Thank you again for your help!

To be honest, I got another problem and I have to ask for your help.
I've get the the pointer pVAR ( pointing to the Element Volumes ), and NVAR ( Number of words in stack used for the Element Volumes ). I also got NEL( Total Number of Elements ), and NEL = Total NVAR, which is right.

But I found that NLOC = 8*(Total NVAR)= 8*NEL. My guess is NLOC counts every Element's 8 vertices and doesn't ignore the repetition. However, the size of the array which the CEL subroutine returns, is NLOC( i.e. REAL RESULT(NLOC) ). So what should I do in order to match the result array and the Element Volume arrays?

P.S: NLOC = Number of locations in space over which the calculations have to be performed

Thank you VERY MUCH!
ertianlang is offline   Reply With Quote

Old   September 28, 2018, 09:31
Default
  #5
Senior Member
 
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33
Opaque will become famous soon enough
Would you mind writing down the output from user_calc_info?

CVAR =
LOCALE =
ENTITY =
ILOC_S =
ILOC_F =
IENT_S =
IENT_F =

Similarly, corroborate output from user_get_meshdata

NVAR =

From there, we can match CEL expected output.
Opaque is offline   Reply With Quote

Old   September 28, 2018, 23:18
Talking
  #6
New Member
 
Join Date: Sep 2018
Posts: 11
Rep Power: 8
ertianlang is on a distinguished road
Sorry, I should have attached the data clearly.

CVAR = SOURCE_A
LOCALE = IELG1
ENTITY = VERTEX
ILOC_S = 1
ILOC_F = 18130
IENT_S = 1
IENT_F = 8

NVAR = 18130

NARG = 3
NRET = 1
NLOC = 145040

Here is more detailed output data:
CascadeVG_Validation_MicroRamp_Lijiabin_RealGridCFX_035.out.txt

And Here is my CEL code:
ElementVolumeLibrary.F

Thank you VERY MUCH!
ertianlang is offline   Reply With Quote

Old   October 1, 2018, 16:05
Default
  #7
Senior Member
 
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33
Opaque will become famous soon enough
Here is the read from the information provided:

You are evaluating a source term in a sub-domain. The subdomain is split into group of elements for processing, IELG1. The size of elements in that group is 18130 elements. Each element is a hex, so it contains 8 vertex per element. The total size of the array is 18130 * 8 = 145040.

You can interpret the return array as follows

RET(145040)

or

RET(1:18130, 1:8)

whichever is more convenient for you.

You can loop

DO ILOC = 1, NLOC
END DO

or

DO IENT = IENT_S, IENT_F
DO ILOC = ILOC_S, ILOC_F
Array(ILOC,IENT) =
END DO
END DO

Hope the above helps,

Now, careful on how you use the element volumes. Keep in mind the function call is requesting the contribution for each element sector to the source. The reason why the values for the same vertex can be different from neighboring elements.
ertianlang likes this.
Opaque is offline   Reply With Quote

Old   October 7, 2018, 10:28
Default
  #8
New Member
 
Join Date: Sep 2018
Posts: 11
Rep Power: 8
ertianlang is on a distinguished road
Thank you very much, Opaque! Thank you!
Sorry for replying you too late......
ertianlang is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modelling acoustic resonance with deforming mesh - PEEKI error Chris G CFX 2 October 4, 2016 05:48
CFX Solve Error in PEEKI routine Tom.Elson CFX 4 April 10, 2014 09:06
Error in Routine PEEKI FelipeLima CFX 3 March 20, 2014 03:32
Solver Error PEEKI cibo CFX 2 April 12, 2013 00:23
Error detected by routine PEEKI Hitch8 Main CFD Forum 0 May 11, 2010 08:02


All times are GMT -4. The time now is 13:51.