|
[Sponsors] |
Got problems with USER_GET_MESHDATA and PEEKI |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 25, 2018, 11:24 |
Got problems with USER_GET_MESHDATA and PEEKI
|
#1 | |
New Member
Join Date: Sep 2018
Posts: 11
Rep Power: 8 |
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 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:
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)) 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 Emmm, this is the situation, hope I have explained it clearly. Could anyone save me from this problem? Thank you very much! |
||
September 25, 2018, 14:14 |
|
#2 |
Senior Member
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33 |
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. |
|
September 25, 2018, 22:57 |
|
#3 |
New Member
Join Date: Sep 2018
Posts: 11
Rep Power: 8 |
Yes! Awesome!
You have solved my problem totally! Thank you very much! |
|
September 27, 2018, 23:21 |
|
#4 |
New Member
Join Date: Sep 2018
Posts: 11
Rep Power: 8 |
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! |
|
September 28, 2018, 09:31 |
|
#5 |
Senior Member
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33 |
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. |
|
September 28, 2018, 23:18 |
|
#6 |
New Member
Join Date: Sep 2018
Posts: 11
Rep Power: 8 |
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! |
|
October 1, 2018, 16:05 |
|
#7 |
Senior Member
Join Date: Jun 2009
Posts: 1,865
Rep Power: 33 |
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. |
|
October 7, 2018, 10:28 |
|
#8 |
New Member
Join Date: Sep 2018
Posts: 11
Rep Power: 8 |
Thank you very much, Opaque! Thank you!
Sorry for replying you too late...... |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |