CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   'USER_GET_GVAR' usage (https://www.cfd-online.com/Forums/cfx/82147-user_get_gvar-usage.html)

hosseinhgf November 18, 2010 04:49

'USER_GET_GVAR' usage
 
hello
I want to use just 'USER_GET_GVAR'.
can somebody give me real and complete example of it uses.
for example i want to use this in my 'name.F' file:
CALL USER_GET_GVAR('pabs','Default Domain',' ', CRESLT,VAR, CZ,DZ,IZ,LZ,RZ)
IF (pabs.LE.0) THEN
pabs=0
ENDIF
what must be in the '.F' file?
thanks

hosseinhgf November 18, 2010 09:01

what is wrong in this
#include "cfx5ext.h"
dllexport(stopinteg)
SUBROUTINE STOPINTEG (CZ,DZ,IZ,LZ,RZ)
#include "MMS.h"
#include "cfd_constants.h"
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
INTEGER IZ(*)
LOGICAL LZ(*)
REAL RZ(*)
CHARACTER*(4) CRESLT
REAL VAR,newpressure
CALL USER_GET_GVAR ('pabs','JBEARING',
& CRESLT,newpressure,CZ,DZ,IZ,LZ,RZ)
IF (pabs.LE.0) THEN
pabs=0
ENDIF
END

hosseinhgf November 18, 2010 11:10

when i use this, no error occur in solver:
#include "cfx5ext.h"
dllexport(stopinteg)
SUBROUTINE STOPINTEG (CZ,DZ,IZ,LZ,RZ)
#include "MMS.h"
#include "cfd_constants.h"
#include "stack_point.h"
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
INTEGER IZ(*)
LOGICAL LZ(*)
REAL RZ(*)
CHARACTER*(4) CRESLT
CALL USER_GET_GVAR ('pabs','bearingu','ave',
& CRESLT,newpressure,CZ,DZ,IZ,LZ,RZ)
IF(pabs.LE.0) THEN
newpressure=0
ENDIF
END
and noting happend in results.
i want to set pressure of all cell with negative absolute pressure to zero and i don t want use 'ave' or any Operation.
for example when using if(pabs<0, ,) cel expression , cfx compare all cell pressure.

ghorrocks November 18, 2010 18:21

I am no expert in CFX fortran but crudely setting all negative absolute pressures to zero sounds like a bad idea to me.

Firstly because this will break mass conservation as it is not incorporated into the mass conservation equations.
Secondly because there is no way this will ever converge
Thirdly because negative absolute pressures are usually caused by some problem in your simulation setup. Fix the problem at the root cause.

hosseinhgf November 19, 2010 02:28

thank you Glenn Horrocks
we discuss about it in 'pressure calculation-junction box' Thread.
and i have to use it.

ghorrocks November 19, 2010 03:40

I can't find the thread you refer to.

Can you explain why you have to use it?

ousegui November 19, 2010 11:18

Hi
I have not used fortran since long time Fortran in CFX, but if I remember try to add __stack_point__ newpressure before calling GetVar


Quote:

Originally Posted by hosseinhgf (Post 283926)
when i use this, no error occur in solver:
#include "cfx5ext.h"
dllexport(stopinteg)
SUBROUTINE STOPINTEG (CZ,DZ,IZ,LZ,RZ)
#include "MMS.h"
#include "cfd_constants.h"
#include "stack_point.h"
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
INTEGER IZ(*)
LOGICAL LZ(*)
REAL RZ(*)
CHARACTER*(4) CRESLT
CALL USER_GET_GVAR ('pabs','bearingu','ave',
& CRESLT,newpressure,CZ,DZ,IZ,LZ,RZ)
IF(pabs.LE.0) THEN
newpressure=0
ENDIF
END
and noting happend in results.
i want to set pressure of all cell with negative absolute pressure to zero and i don t want use 'ave' or any Operation.
for example when using if(pabs<0, ,) cel expression , cfx compare all cell pressure.


hosseinhgf November 20, 2010 03:33

thank you
one of the B.C that use for 'journal bearing' is 'half sommerfeld' and i
must be use it in my thesis.
that thread now is in page 3.

________________________________________
I use '__stack_point__ newpressure' but nothing change.
why when i use 'CALL MESAGE ( 'WRITE','nv=',nv)' there is nothing in opposite of nv= at solver out file.

#include "cfx5ext.h"
dllexport(stopinteg)
SUBROUTINE STOPINTEG (CZ,DZ,IZ,LZ,RZ)
#include "MMS.h"
#include "cfd_constants.h"
#include "stack_point.h"
__stack_point__ newpressure
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
INTEGER IZ(*)
LOGICAL LZ(*)
REAL RZ(*),nv
CHARACTER*(4) CRESLT
CALL USER_GET_GVAR ('pabs','JBEARING','ave',
& CRESLT,newpressure,CZ,DZ,IZ,LZ,RZ)
IF (CRESLT.NE.'GOOD') STOP
nv=1
CALL MESAGE ( 'WRITE','nv=',nv)
END

cfdgremlin November 20, 2010 07:28

If I understand your previous comments, you are going about this the wrong way.

You have created a Junction Box Routine within which you call USER_GET_GVAR to get the average pressure on your location. What you then do is try to set some real variable pabs to zero, but this variable is a local one to the routine - the solver knows nothing about it. What you would have to do as well is POKE the values into the correct MMS directories to replace the values the solver is using.

If you really do want to set the pressure on some location, based on the result of a call to USER_GET_GVAR, then you are better off using a User CEL Function. You can then loop through all the vertices/integration points/face centres to set the desired value.

There are several examples in the user documentation of how to set values on boundaries and other locations with User CEL Routines.

hosseinhgf November 20, 2010 12:29

thanks for your information

you mean i use
SUBROUTINE POKER (CDANAM, JADRES, RVALUE, CERACT, CRESLT, RZ)

i want to set negative absolute pressure to zero in my domain not boundary but because of very thin fluid film thickness i can use it in boundary.

my boundary is wall and i dont know where use 'User CEL Routines' to set pressure.
for example in 'User CEL Example 1: User Defined Momentum Source'
user CEL function used to set the momentum source components within the subdomain.

"There are several examples in the user documentation of how to set values on boundaries and other locations with User CEL Routines."--> what are these values?

hosseinhgf November 21, 2010 10:10

with which routine can get the cell(node,element) data like cell pressure.

hosseinhgf November 26, 2010 03:27

in fluent there are macros that can

Loop over all cell threads in domain d:
"thread_loop_c(ct,d)"

and

Loop over all cells in a cell thread t:
"begin_c_loop(c, t)
end_c_loop (c,t)"

which subroutine or how can do this in cfx?

joey2007 November 26, 2010 13:34

Did you attend a user fortran training by ANSYS?

hosseinhgf November 26, 2010 13:55

if you mean "training manual" for CFX 12 yes i use it but it has a Lectures about CEL and nothing about fortran.
thank you

joey2007 November 28, 2010 13:49

On request ANSYS may offer you a special training for user fortran. Guess it is really difficult to implement a such a complicated project like yours without the help opf ANSYS.

ghorrocks November 28, 2010 17:09

I have said it before and I will say it again.

What are proposing to do will not work so I would not waste your time trying to do it. You will loose mass conservation and it will not converge.

You said:
Quote:

i want to set negative absolute pressure to zero in my domain not boundary but because of very thin fluid film thickness i can use it in boundary.
I do not understand what you are saying here. Can you explain that further?

Quote:

my boundary is wall and i dont know where use 'User CEL Routines' to set pressure.
You do not set pressure at a wall. The pressure is determined by conservation of mass, momentum and energy (ie the Navier Stokes equations). This is why I say if you arbitrarily set the pressure at a wall to a value you will break the solver.

hosseinhgf November 29, 2010 03:35

thank you
after one week that i switch to fluent finally i wrote a udf and it work very good look like this journal :
"CFD analysis of journal bearing hydrodynamic lubrication by bingham lubricant"
but the bad things is it can work with one processor.
I think CEL expression is the best things in cfx because in fluent i must write a new udf for dynamic mesh.i think JBR is not very good to compare of udf. fluent udf Manual is very complete to compare of user fortran.

"You do not set pressure at a wall" --> yes,it is write.
Cfdgremlin said "There are several examples in the user documentation of how to set values on boundaries and other locations with User CEL Routines." ---> yes it is.for example you can set your velocity data to inlet boundary whit user cel routines. but with user cel routines how we can set pressure.

in one journal(Application of CFD Analysis for Rotating Machinery—Part I Hydrodynamic_ Hydrostatic Bearings and Squeeze Film Damper) Authors use CFX-TASCflow to simulation and use "half sommerfeld" boundary condition.what is different between cfx and CFX-TASCflow?

can i use "FSI" to set my condition?

ghorrocks November 29, 2010 17:02

Fluent gives more access to this sort of stuff that CFX.

Quote:

for example you can set your velocity data to inlet boundary whit user cel routines. but with user cel routines how we can set pressure.
You can set the velocity at an inlet boundary as that boundary uses velocity as an input. Unless you are using a pressure boundary you will not be able to set pressure - so you will not be able to set pressure at a wall.

Quote:

can i use "FSI" to set my condition?
No.

hosseinhgf December 1, 2010 08:47

Tank you Glenn Horrocks.


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