Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran subroutine - global variable

Status
Not open for further replies.

tundres

Industrial
Mar 30, 2009
6
Hi everybody,

I have made a heat source to model laser welding with the dflux subroutine and I would like to know, if it's possible to define some global variables.
What I am trying to accomplish is to adapt my heat source if for example any point of the model reach a defined temperature. Is that possible?

Thanks in advance!
 
Replies continue below

Recommended for you

You should be able to hard code your limiting value into your Dflux routine.
 
I am not too familiar with user defined subroutines but I think Depvar's are global (in the sense of the material anyway). Maybe that is what you need to define, then have your subroutine grab them when needed.

HTH
 
Hey, I am glad to read some ideas:
To vumat721: your solution could work if I am able to get the temperature of a determined node. In this case, I would able to define the behaviour of the routine with the limiting value, in my case the temperature of the node (hard coded).

To DanStro: I didn't know of the existence of Depvar, I have to look at the documentation but sounds promising. I will give it a try too.

Thank you very much for the Ideas, let's see what comes next :p
 
Depvar is used to specify number of state variables (statev) within a material subroutine (i.e UMAT, VUMAT, etc). I don't believe that DFLUX lets you have these kinds of state variables.

DFLUX gives you the temperature at the integration point. Perhaps you want to use UTEMP instead of DFLUX?
 
Hi vumat,

I finally found the way to accomplish that. In fact, it's possible to define global variables within a subroutine. I don't tried yet but I think you can exchange variables between subroutines with this "global variables" as well.

The solution was to read a Fortran Manual, also, in my example:
*USER SUBROUTINES
SUBROUTINE DFLUX(FLUX,SOL,KSTEP,KINC,TIME,NOEL,NPT,COORDS,
1 JLTYP,TEMP,PRESS,SNAME)
C
INCLUDE 'ABA_PARAM.INC'
C
DIMENSION COORDS(3),FLUX(2),TIME(2)
CHARACTER*80 SNAME

parameter (BoilingPoint = 2792)


real maxTemp,depth
COMMON /Control/maxTemp,depth

C###########################################
C Coordinates
C###########################################
x=COORDS(1)
y=COORDS(3)
z=COORDS(2)
C Coordinate conversion
r = sqrt(x ** 2 + y ** 2)

C Variable to store the temperature of the element. It will be used
C to check the max temperature of the Model.
tempmaxtemp = SOL

C If Statement to calc the max temperature in the Model
if(tempmaxtemp.ge.maxTemp)maxTemp=tempmaxtemp
...
---------------------------------------------------------
The variable maxTemp don't lose the value, also, global variable. With this method, I can know the max temperature of my Model.

Anyway, thanks for the help!
 
Sounds good. I know Abaqus used to warn about using common blocks with subroutines. I don't remember the details, but maybe it's only an issue if you do a multi-cpu job? It looks like you can use "UEXTERNALDB" if you ever run into a problem with the common block not working as expected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor