Skip to content

Commit

Permalink
only update bound when ifdecpl is true and read umin and umax to upma…
Browse files Browse the repository at this point in the history
…x and upmin
  • Loading branch information
Ping-Hsuan committed Sep 13, 2024
1 parent 738b529 commit 2b72971
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions code/aux.f
Original file line number Diff line number Diff line change
Expand Up @@ -495,36 +495,36 @@ subroutine hyperpar(uuk,ttk)
n = lx1*ly1*lz1*nelt
if (ifpod(1)) then
if (rmode.eq.'ON '.or.rmode.eq.'ONB'.or.rmode.eq.'CP ') then
call read_serial(umin,nb,'ops/umin ',wk,nid)
call read_serial(umax,nb,'ops/umax ',wk,nid)
call read_serial(upmin,nb,'ops/umin ',wk,nid)
call read_serial(upmax,nb,'ops/umax ',wk,nid)
else
call cfill(umin,1.e9,nb)
call cfill(umax,-1.e9,nb)
call cfill(upmin,1.e9,nb)
call cfill(upmax,-1.e9,nb)
do j=1,ns
do i=1,nb
if (uuk(i,j).lt.umin(i)) umin(i)=uuk(i,j)
if (uuk(i,j).gt.umax(i)) umax(i)=uuk(i,j)
if (uuk(i,j).lt.upmin(i)) upmin(i)=uuk(i,j)
if (uuk(i,j).gt.upmax(i)) upmax(i)=uuk(i,j)
enddo
enddo
do j=1,nb ! compute hyper-parameter
d= umax(j)-umin(j)
umin(j) = umin(j) - ep * d
umax(j) = umax(j) + ep * d
if (nio.eq.0) write (6,*) j,umin(j),umax(j),'uminmax'
d= upmax(j)-upmin(j)
upmin(j) = upmin(j) - ep * d
upmax(j) = upmax(j) + ep * d
if (nio.eq.0) write (6,*) j,upmin(j),upmax(j),'uminmax'
enddo
endif

! compute distance between umax and umin
call sub3(udis,umax,umin,nb)
call sub3(updis,upmax,upmin,nb)

if (nio.eq.0) then
do i=1,nb
write (6,*) i,udis(i),'udis'
write (6,*) i,updis(i),'udis'
enddo
endif
if (rmode.eq.'ALL'.or.rmode.eq.'OFF'.or.rmode.eq.'AEQ') then
call dump_serial(umin,nb,'ops/umin ',nid)
call dump_serial(umax,nb,'ops/umax ',nid)
call dump_serial(upmin,nb,'ops/umin ',nid)
call dump_serial(upmax,nb,'ops/umax ',nid)
endif
endif

Expand Down
4 changes: 2 additions & 2 deletions code/time.f
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ subroutine bdfext_step
if (ifdecpl) then
call copy(hinv(1,2),hlm(1,2),(nb-nplay)**2)
call diag(hinv(1,2),wt(1,2),rhs(1,2),nb)
call update_k(uk,ukp,tk,tkp)
else
call invmat(hinv(1,2),hlu(1,2),hlm(1,2),
$ ihlu(1,2),ihlu2(1,2),nb-nplay)
Expand All @@ -77,7 +78,6 @@ subroutine bdfext_step
endif
endif
lu_time=lu_time+dnekclock()-ttime
call update_k(uk,ukp,tk,tkp)
endif

call rom_userfop
Expand Down Expand Up @@ -148,6 +148,7 @@ subroutine bdfext_step
if (ifdecpl) then
call copy(hinv,hlm,(nb-nplay)**2)
call diag(hinv,wt,rhs(1,1),nb)
call update_k(uk,ukp,tk,tkp)
else
call invmat(hinv,hlu,hlm,ihlu,ihlu2,nb-nplay)
if (nio.eq.0) write (6,*) 'check nplay',nplay,'cp3'
Expand All @@ -158,7 +159,6 @@ subroutine bdfext_step
endif
endif
lu_time=lu_time+dnekclock()-ttime
call update_k(uk,ukp,tk,tkp)
endif

call rom_userfop
Expand Down

0 comments on commit 2b72971

Please sign in to comment.