×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Running multiple subroutines for analysis

Running multiple subroutines for analysis

Running multiple subroutines for analysis

(OP)
I am trying to find some advice on running multiple subroutines for an abaqus analysis.

Should each subroutine have a seperate file or should be subroutines be placed in the same .for file? How should the subroutines be structured within the subroutine. Thanks.

RE: Running multiple subroutines for analysis

Put all subroutines in the same file

RE: Running multiple subroutines for analysis

(OP)
So is the following format correct... as I want to make sure my methodology is correct. As I can not find a standard for this. I appreciate any input. Thanks

Subroutine One(args)
CODING  
Return
End Subroutine One   

Subroutine Two(args)   
CODING   
Return  
End Subroutine Two

END   

RE: Running multiple subroutines for analysis

your subroutine is correct, but you need one conditional that use the subroutine in every case that you need, for example

if (mat="mat1") then
subroutine One
else (mat="mat2")
subrotuine Two
endif

I use this form and this run...i hope can help you!

RE: Running multiple subroutines for analysis

(OP)
Thanks lanavi017,

Do you place this about the two subroutines? As when I run this with my input file, it seems that the subroutine fails. I would appreciate some advice on the structure.

e.g.

PROGRAM PROG1

if (mat="mat1") then
subroutine One
else (mat="mat2")
subrotuine Two
endif

Subroutine One(args)
CODING  
Return
End Subroutine One   

Subroutine Two(args)   
CODING   
Return  
End Subroutine Two

END

Also can this be done without a conditional statement, i.e. I would like both subroutines to run throughout the analysis.

RE: Running multiple subroutines for analysis

Hi,

I would like join to discussion about multiply subroutine.
At the beginning we need to distinguish what kind of subroutine we want to use.
Is it abaqus subroutine (UDISP, UMAT, ...) or is it user subroutine wrote to perform specific tasks?

For Abaqus subroutine we have following limitation:
1. each subroutine can be call only one time (all distinguish between different materials
must be perform inside abaqus subroutine with conditional statements (IF, SELECT CASE).

We can do it like this:

CODE

subroutine UMAT(args)
...
if (cmname == 'MAT1') then
  code for mat1 ...
else if (cmname == 'MAT2') then
  code for mat2 ...
end if
...
end subroutine UMAT
We cannot do it like this:

CODE

subroutine UMAT(args)
...
if (cmname == 'MAT1') then
  code for mat1
end if
...
end subroutine UMAT

subroutine UMAT(args)
...
if (cmname == 'MAT2') then
  code for mat2
end if
...
end subroutine UMAT
Here is obvious error since FORTRAN does not allow us to have two subroutines with the same name.

2. we must not call one abaqus subroutine from another abaqus subroutine
Following source code is wrong, even FORTRAN compilator will not give us an error. Results for this combination are unpredictable.

CODE

subroutine UMAT(args)
...
call USDFLD(args)
...
end subroutine UMAT

subroutine USDFLD(args)
...
code for USDFLD
...
end subroutine USDFLD
Of course we can have more than one abaqus subroutine in one file.
Abaqus himself will call both subroutines.

CODE

subroutine UMAT(args)
...
code for UMAT
...
end subroutine UMAT

subroutine USDFLD(args)
...
code for USDFLD
...
end subroutine USDFLD(args)
With user subroutines is easier, we do not have such limitation. We can define both internal and external subroutines.

CODE

subroutine UMAT(args)
...
if (cmname=='MAT1') then
  call mySubMat1(args) ! call internal subroutine
else if (cmname=='MAT2') then
  call mySubMat2(args) ! call external subroutine
end if

contains ! define internal subroutine

subroutine mySubMat1(args)
...
code for mySubMat1(args)
...
end subroutine mySubMat1

end subroutine UMAT

! define external subroutine
subroutine mySubMat2(args)
...
code for mySubMat2
...
end subroutine mySubMat2
One more thing I prefer use always internal user subroutine, I had one time problems with arguments passed into external subroutine with gfortran.
But the same source code worked well with Intel fortran. Perhaps it's something with gfortran settings I do not know.

Regards,
Bartosz

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources