Fortran Fortran - Allocate array in subroutine

AI Thread Summary
The discussion revolves around a user attempting to allocate an array within a Fortran program that interfaces with Abaqus and a CFD code. The user has successfully allocated a variable in a subroutine but is struggling with array allocation in loops. They share their code snippet for allocating and deallocating an array, which includes error handling for memory issues. However, they encounter a persistent error message regarding deallocation, even though the program runs successfully without the error check. Participants suggest clarifying the question, posting the relevant code, and ensuring that the status variables for allocation and deallocation are explicitly declared as integers. Additionally, they recommend seeking advice on specialized forums for Abaqus or CFD if further assistance is needed.
luonganh89
Messages
12
Reaction score
0
I try to write a small program to allocate a variable in small subroutine and I've passed it, now i allocate array in a loop or many loops but i don't have any ideas about it.
Has anyone done like me , can share some experiences ??
 
Technology news on Phys.org
luonganh89:

Welcome to the forum.

Please make another attempt to ask your question more clearly.

Maybe, if you are having a problem implementing something in fortran, post the source code, tell what you are trying to do, and how you think it should be done, etc.
 
Thank your attention !

I've just passed it . My project is coupling 2 software together: abaqus and CFD code. I've controlled abaqus by using fortran. now I've tried to control CFD code (written by Fortran). I'm writting a sample code , if it runs succefully, i will apply it to my CFD code
 
Hi !
Have you ever coded in Abaqus about Allocating Array ! Can share me some experience ?
 
I don't use Abaqus.

You may want to consider visiting an Abaqus/CFD forum, if you don't get an answer here.
 
It seems to be simple, But i can't explain how it run wrongly

I use statement:
ALLOCATE( CV(100), STAT = AllocateStatus)
IF (AllocateStatus /= 0) STOP "*** Not enough memory ***"
and

DEALLOCATE( CV, STAT = DeAllocateStatus)
IF (DeAllocateStatus /= 0) STOP "*** Trouble deallocating ***"
Abaqus always announces "*** Trouble deallocating ***" but
- when i don't use " IF (DeAllocateStatus /= 0) STOP "*** Trouble deallocating ***" it run successfully.
- when i don't use "DEALLOCATE( CV, STAT = DeAllocateStatus) IF (DeAllocateStatus /= 0) STOP "*** Trouble deallocating ***" it announces "Not enough memory"

can you explain something ?
 
Is your code very large? can you post it? (use code tags if you do).

Are both status variables AllocateStatus and DeAllocateStatus explicitely declared integers?
 

Similar threads

Replies
5
Views
8K
Replies
4
Views
4K
Replies
2
Views
3K
Replies
59
Views
11K
Replies
8
Views
3K
Replies
5
Views
3K
Back
Top