Fortran - Allocate array in subroutine

Click For Summary

Discussion Overview

The discussion revolves around the allocation and deallocation of arrays in Fortran, specifically within the context of integrating Abaqus and CFD software. Participants seek to share experiences and troubleshoot issues related to memory management in their Fortran code.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses difficulty in allocating an array within a subroutine and seeks advice from others who may have similar experiences.
  • Another participant requests clarification on the original question and suggests providing source code for better assistance.
  • A participant describes their project involving the coupling of Abaqus and CFD code, indicating they are trying to control CFD code using Fortran.
  • One participant asks if anyone has experience with array allocation in Abaqus and requests shared experiences.
  • A participant mentions encountering issues with deallocating memory, specifically receiving an error message from Abaqus, and describes the behavior of their code under different conditions regarding memory allocation and deallocation.
  • Another participant inquires about the size of the code and whether the status variables for allocation and deallocation are explicitly declared as integers.

Areas of Agreement / Disagreement

Participants do not appear to reach a consensus on the best approach to memory allocation and deallocation in Fortran, and multiple viewpoints and experiences are presented without resolution.

Contextual Notes

There are limitations regarding the clarity of the original question and the specifics of the code being discussed. The discussion also highlights potential issues with memory management that remain unresolved.

Who May Find This Useful

Individuals working with Fortran, particularly in the context of software integration involving Abaqus and CFD, may find this discussion relevant.

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 6 ·
Replies
6
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
8K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 59 ·
2
Replies
59
Views
12K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K