Author Topic: Save values only in an interval of time  (Read 3641 times)

bbb

  • New Member
  • *
  • Posts: 7
Save values only in an interval of time
« on: July 28, 2022, 02:03:21 AM »
Hello:

I am simulating a sine wave propagating in an elastic medium. I would like to save the values of the generated stress but only for one period of time, not all the time. How should I modify the following statement to include only one period T? I mean from time t1 to time t2, being t2= t1 + T

BATCH
  DT,,dt
  TRANs,newm
  MASS
  LOOP,,nt
  TIME
    LOOP,iter,1
      UTAN,,1
      NEXT,iter
      stre,node,1,1268 ! Here, I am saving all the stress for all time. I want to modify this.
  NEXT
END

Thank you so much,

Beatriz

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2647
Re: Save values only in an interval of time
« Reply #1 on: July 28, 2022, 05:01:55 AM »
You can use an if-else-endi command and parameters for t, dt, t1 and t2

param t=t+dt
if t1-t ! No spaces in expression

else t2-t
   stre node ....
endif

Thus if t < t1 no prints and if t > t2 no prints

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Save values only in an interval of time
« Reply #2 on: July 28, 2022, 09:42:56 AM »
Your other option is to use more loops and only put the output lines in the loop where you want the values, so something like:
Code: [Select]
BATCH
  DT,,dt
  TRANs,newm
  MASS
  LOOP,,n1 ! Loop n1, where dt*n1 = t1
   TIME
    LOOP,iter,1
      UTAN,,1
    NEXT,iter
  NEXT
  LOOP,,n2  ! Loop n2, where dt*n2 = T
   TIME
    LOOP,iter,1
      UTAN,,1
    NEXT,iter
    stre,node,1,1268
  NEXT
  LOOP,,n3  ! Loop n3 to finish
   TIME
    LOOP,iter,1
      UTAN,,1
    NEXT,iter
  NEXT
END
The if-else-endif method is cleaner; this is just another option.

bbb

  • New Member
  • *
  • Posts: 7
Re: Save values only in an interval of time
« Reply #3 on: July 29, 2022, 06:46:19 AM »
Dear Prof. S. Govindjee and Prof. R. Taylor,

Thank you so much for your replies. It works!

Beatriz