Author Topic: SAVE command needs to be used or not  (Read 4046 times)

nima_ikm

  • Jr. Member
  • **
  • Posts: 33
SAVE command needs to be used or not
« on: February 18, 2015, 01:21:53 AM »
Hello,

I have one small question :)

In standard element which is defined in feap such as SOLID2D, I have seen after defining format of variables (i.e. integer, real, character) SAVE statement is used. I want to know what is the reason for using that? Is it safe to use this statement ? (because it save all local variables - most people they are not using as far as I know)?
Is this neseccerey to use this. The reason I am asking is because for this: Because  when I used my user element in LINUX everything is fine without save command. However, when I am using same user element in Windows I will get wrong result unless I used SAVE command (I define history field and as I checked this needs save command in windows).

Thank you for your help :)

nima_ikm

  • Jr. Member
  • **
  • Posts: 33
Re: SAVE command needs to be used or not
« Reply #1 on: February 18, 2015, 06:44:13 AM »
If I just want to give another quick example that it is not work without save is this:

for example if in isw.eq.1 I define one flag either true or false for one statment, the flag cannot be remember in isw.eq.3. Also, by defualt in standard feap in user folder we have :

a. I have not seen SAVE statment is written by default in : elemt01 or umat
b. I have seen SAVE statment is written by default in : umacr

This would be important in compiling where some suggested use QZERO and QSAVE by default for compiling specially for intel compiler. I really confused, because this give me wrong result in windows (becasue this statment would save all local varaible).

Thank you for your help :)
« Last Edit: February 18, 2015, 06:53:00 AM by nima_ikm »

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: SAVE command needs to be used or not
« Reply #2 on: February 18, 2015, 08:19:44 AM »
Generally the SAVE statement forces the values of any variable you define to be retained between different calls to the same routine.  If it is a variable in COMMON then it forces the common variables to be updated when changed.   You may find that your routine works sometimes without the SAVE -- maybe for small problems -- but later you get erratic results since variable may be lost between calls (i.e., the value you set when isw = 1 was different when you returned in isw = 3).  Of course it may be dangerous to count on things you set when isw = 1 since the element routine is called multiple times for the many elements in the mesh.  generally we try to save things in the "D(*)" array so that they may be retrieved for each different material or element as needed.