Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Evolve-Filter-Relax-ROM (EFR-ROM) in NekROM #237

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/MOR
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ c parameters and common blocks for MOR
integer rbf
common /morfilter/ rdft,dfops(lub*lub)
common /morifilt/ rbf
common /morrelax/ relax

! Tensor Decomposition

Expand Down
31 changes: 16 additions & 15 deletions code/MORDICT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ c Note: Keys have to be in capital letters
c
integer MORDICT_NKEYS

parameter (MORDICT_NKEYS = 61)
parameter (MORDICT_NKEYS = 62)

character*132 mordictkey(MORDICT_NKEYS)
data
Expand Down Expand Up @@ -55,17 +55,18 @@ c
& mordictkey(45) / 'FILTER:TYPE' /
& mordictkey(46) / 'FILTER:MODES' /
& mordictkey(47) / 'FILTER:RADIUS' /
& mordictkey(48) / 'BUOYANCY' /
& mordictkey(49) / 'BUOYANCY:MAGNITUDE' /
& mordictkey(50) / 'BUOYANCY:ANGLE' /
& mordictkey(51) / 'BUOYANCY:GX' /
& mordictkey(52) / 'BUOYANCY:GY' /
& mordictkey(53) / 'BUOYANCY:GZ' /
& mordictkey(54) / 'EI' /
& mordictkey(55) / 'EI:MODE' /
& mordictkey(56) / 'EI:EQN' /
& mordictkey(57) / 'TENDEC' /
& mordictkey(58) / 'TENDEC:MODE' /
& mordictkey(59) / 'TENDEC:RANK' /
& mordictkey(60) / 'TENDEC:CORE' /
& mordictkey(61) / 'TENDEC:SKEW' /
& mordictkey(48) / 'FILTER:RELAXATION' /
& mordictkey(49) / 'BUOYANCY' /
& mordictkey(50) / 'BUOYANCY:MAGNITUDE' /
& mordictkey(51) / 'BUOYANCY:ANGLE' /
& mordictkey(52) / 'BUOYANCY:GX' /
& mordictkey(53) / 'BUOYANCY:GY' /
& mordictkey(54) / 'BUOYANCY:GZ' /
& mordictkey(55) / 'EI' /
& mordictkey(56) / 'EI:MODE' /
& mordictkey(57) / 'EI:EQN' /
& mordictkey(58) / 'TENDEC' /
& mordictkey(59) / 'TENDEC:MODE' /
& mordictkey(60) / 'TENDEC:RANK' /
& mordictkey(61) / 'TENDEC:CORE' /
& mordictkey(62) / 'TENDEC:SKEW' /
22 changes: 22 additions & 0 deletions code/filter.f
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,25 @@ subroutine evalnut(nut,u1,u2,u3)
return
end
c-----------------------------------------------------------------------
subroutine efr_relaxation(filtered_coef,coef,relax,nb)

! perform the relaxation step in the evolve-filter-relaxation method

! INPUT:
! filtered_coef := filtered ROM coefficient
! coef := ROM coefficient
! relax := relaxation parameter ([0, 1])
! nb := size of filtered_coef and coef arrays

! OUTPUT:
! filtered_coef := (1-relax)*coef + relax*filtered_coef

real filtered_coef(1:nb), coef(1:nb)
real relax
integer nb

call cmult(filtered_coef,relax,nb)
call add2s2(filtered_coef,coef,(1.-relax),nb)

return
end
4 changes: 4 additions & 0 deletions code/mpar.f
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,9 @@ subroutine mpar_read(ierr)
endif
endif

call finiparser_getdbl(d_out,'filter:relaxation',ifnd)
if (ifnd.eq.1) relax=d_out

! EI

call finiparser_getbool(i_out,'ei:mode',ifnd)
Expand Down Expand Up @@ -547,6 +550,7 @@ subroutine bcastmpar
call bcast(tbarr0,wdsize)
call bcast(rbf,wdsize)
call bcast(rdft,wdsize)
call bcast(relax,wdsize)
call bcast(gx,wdsize)
call bcast(gy,wdsize)
call bcast(gz,wdsize)
Expand Down
21 changes: 14 additions & 7 deletions code/time.f
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,13 @@ subroutine bdfext_step
endif

if (cfloc.eq.'POST') then
if (cftype.eq.'TFUN') then
call pod_proj(rhs(1,1),rbf,nb,'step ')
else if (cftype.eq.'DIFF') then
call pod_df(rhs(1,1))
endif
! copy unfiltered coefficients
call copy(utmp1(1),rhs(1,1),nb)
if (cftype.eq.'TFUN') then
call pod_proj(rhs(1,1),rbf,nb,'step ')
else if (cftype.eq.'DIFF') then
call pod_df(rhs(1,1))
endif
endif

solve_time=solve_time+dnekclock()-ttime
Expand Down Expand Up @@ -238,8 +240,13 @@ subroutine bdfext_step
call copy(rhs(1,2),rhs(1,1),nb)
endif

if (cfloc.eq.'POST'.and.cftype.eq.'POLY')
$ call apply_les_imp(rhs(0,1),rhs(0,2),rdft,fles1,fles2,rtmp1)
if (cfloc.eq.'POST') then
if (cftype.eq.'POLY') then
call apply_les_imp(rhs(0,1),rhs(0,2),rdft,fles1,fles2,rtmp1)
elseif ((cftype.eq.'TFUN').or.(cftype.eq.'DIFF')) then
call efr_relaxation(rhs(1,1),utmp1(1),relax,nb)
endif
endif

if (ifrom(2)) call shift(ut,rhs(0,2),nb+1,5)
if (ifrom(1)) call shift(u,rhs,nb+1,5)
Expand Down
Loading