Author Topic: BFGS  (Read 18348 times)

JStorm

  • Sr. Member
  • ****
  • Posts: 250
BFGS
« on: July 22, 2020, 07:38:34 AM »
I was able to run FEAP with BFGS in serial mode with the solution scheme
Code: [Select]
    LOOP,jail,50
      TANG
      BFGS,,10,0.8,1.d-10
      FORM CONVerge
      SOLVe
    NEXT,jail
Is it possible check the residual criteria without the calculation of a standard solution?


Is it possible to run BFGS in ParFEAP? When I use more then 1 BFGS iteration, then ParFEAP hangs eigther in the BFGS command. With iteration numbers for the outer loop larger 1, then ParFEAP hangs in the TANG command.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: BFGS
« Reply #1 on: July 22, 2020, 12:13:45 PM »
A quick look seems to say that unfortunately you have to do the solve right now.
I would guess that it is not too difficult of a change to make in the code. 
BFGS is in program/pmacr3.f.  One would have to add the convergence checks
that are done when SOLVe is executed; those can be found in program/pmacr1.f.

Regarding parfeap, I do not believe that we ever ported the BFGS algorithm to
the parallel code (if we did, one of the validation examples in the parallel manual
would show it, but I did not see it when looking quickly).
« Last Edit: July 22, 2020, 02:02:47 PM by Prof. S. Govindjee »

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: BFGS
« Reply #2 on: July 22, 2020, 10:47:01 PM »
Thank you for the hint. I will add the convergence checks to the bfgs routine and post the result.

My hope that BFGS can be used with ParFEAP was caused by this post: http://feap.berkeley.edu/forum/index.php?topic=1749.msg6812#msg6812.
At least the code is hanging instead of crashing. Maybe ther is just a bug. I tried it with FEAP 8.4.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: BFGS
« Reply #3 on: July 23, 2020, 12:00:09 AM »
I'll have to look at it more carefully, I'm not sure that post is accurate.

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: BFGS
« Reply #4 on: July 23, 2020, 06:31:14 AM »
I'll have to look at it more carefully, I'm not sure that post is accurate.
I am very interested to get it working in ParFEAP. The experiences I made so far in serial FEAP with my kind of problems are very promising.

I have add a few lines of code to pmacr3.f in order to check convergence. I guess the code need some generalisation, but was doing its work for my tests:
Code: [Select]
      integer   toteq
      real*8    reln
and to the [BFGS,...] block
Code: [Select]
      !if(ct(1,l).le.0.0d0) ct(1,l) = 0.8d0
      if (rnmax.eq.0.0d0) then
        ee     = 0.0d0
        autcnv = .false.
        rnmax  = abs(aengy)
        reln   = 1.d0
        aold   = rnmax/0.8d0/0.9999d0
      else
        reln   = (aengy-ee)/rnmax
      endif
      if(pfr) then
        write(iow,2043) rnmax,aengy-ee,reln,tol
        if(ior.lt.0) then
          write(*,2043) rnmax,aengy-ee,reln,tol
        endif
      endif
      toteq  = neq
      if(abs(aengy-ee).le.tol*rnmax .or. linear .or.
     &    abs(rnorm)/dble(toteq) .lt.
     &    abs(rnorm1/rnormn)*sqrt(tol)*1.d-3    .or.
     &    abs(aengy-ee).lt.enzer               ) then
        if(lv.gt.1) then
          ct(1,lve(lv)) = ct(1,lvs(lv))
          l             = lve(lv) - 1
          floop(1)      = .false.
        endif
        autcnv = .true.
      endif

Then the inputfile reads
Code: [Select]
    LOOP,jail,ms
      TANG
      BFGS,,mb,0.8,1.d-10
    NEXT,jail
where ms is the maximum number of quasi-newton iterations and mb the maximum number of BFGS iterations.

Although, written to the O-file, the L-file do not contains the initial residual and energy norm.
« Last Edit: July 23, 2020, 06:36:53 AM by JStorm »

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: BFGS
« Reply #5 on: July 23, 2020, 11:46:34 AM »

Thanks for the update.  Please add a post to the Wishlist board regarding these two features for BFGS; that will help remind us to add them to the next release.

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2647
Re: BFGS
« Reply #6 on: July 23, 2020, 12:26:24 PM »
I am not clear on what is being done.  Currently BFGS converges based on energy norm only (see iterat.f).  It does compute the residual norm also but does not check convergence based on this.  Adding a check after returning from iterat.f does not seem to add much.  What exactly is desired?

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: BFGS
« Reply #7 on: July 24, 2020, 12:02:02 AM »
Dear Prof. Taylor, I am working on strongly coupled non-convex problems. Newton and simple Quasi-Newton methods converge hardly or frequently fail. Next to the staggered solutions (operator split) also BFGS turned out to be an efficient and robust solution scheme. Because BFGS with a lot of iterations can also causes divergence, I enhance the BFGS scheme by exact tangents from time to time. (This scheme is mentioned in the manual, too.)
Code: [Select]
    LOOP,jail,ms
      TANG
      BFGS,,mb,0.8,1.d-10
    NEXT,jail
Then the solution process is robust like the staggered one but a lot quicker.
« Last Edit: July 24, 2020, 12:25:38 AM by JStorm »

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: BFGS
« Reply #8 on: July 24, 2020, 12:44:16 AM »
For BROYden's method the manual suggest
Code: [Select]
    LOOP,jail,ms
      TANG,,1
      BROYden,,mb
    NEXT,jail
If the Broyden scheme has converged, then still another solution via TANG,,1 is calculated because convergence of BROYden do not cause to leave the loop.