Skip to content

Commit

Permalink
Static condensation for the bubbles of a basis in H(curl)
Browse files Browse the repository at this point in the history
This reduces the size of the linear system but postprocessing may not be perfect,
since the solution on the element interior is not constructed consistently
afterwards
  • Loading branch information
mmalinen committed Dec 4, 2024
1 parent 02eb0b8 commit c3cc572
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 12 additions & 8 deletions fem/src/modules/VectorHelmholtz.F90
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ SUBROUTINE VectorHelmholtzSolver_Init0(Model,Solver,dt,Transient)
END IF
END IF

CALL ListAddNewLogical(SolverParams, 'Bubbles in Global System', .TRUE.)

!CALL ListAddNewLogical( SolverParams,'Hcurl Basis',.TRUE.)
IF (WithNDOFs) THEN
CALL ListAddNewLogical(SolverParams,'Variable Output',.TRUE.)
Expand Down Expand Up @@ -367,7 +369,7 @@ FUNCTION DoSolve() RESULT(Converged)
TYPE(ValueList_t), POINTER :: BC
REAL(KIND=dp), POINTER CONTIG:: SavedValues(:) => NULL()
REAL(KIND=dp) :: Norm
INTEGER :: Active,k,n,nd,t
INTEGER :: Active,k,n,nd,nb,t
LOGICAL :: InitHandles
!---------------------------------------------------------------------------------------------
! System assembly:
Expand All @@ -382,10 +384,11 @@ FUNCTION DoSolve() RESULT(Converged)
Element => GetActiveElement(t)
n = GetElementNOFNodes()
nd = GetElementNOFDOFs()
nb = GetElementNOFBDOFs()

! Glue local element matrix and rhs vector:
!----------------------------------------
CALL LocalMatrix( Element, n, nd, InitHandles )
CALL LocalMatrix( Element, n, nd+nb, nb, InitHandles )
END DO
CALL DefaultFinishBulkAssembly()

Expand Down Expand Up @@ -556,10 +559,10 @@ END SUBROUTINE SingleDipoleLoad


!-----------------------------------------------------------------------------
SUBROUTINE LocalMatrix( Element, n, nd, InitHandles )
SUBROUTINE LocalMatrix( Element, n, nd, nb, InitHandles )
!------------------------------------------------------------------------------
TYPE(Element_t), POINTER :: Element
INTEGER :: n, nd
INTEGER :: n, nd, nb
LOGICAL :: InitHandles
!------------------------------------------------------------------------------
COMPLEX(KIND=dp) :: eps, muinv, Cond, L(3)
Expand Down Expand Up @@ -811,15 +814,16 @@ SUBROUTINE LocalMatrix( Element, n, nd, InitHandles )
END IF

IF( PrecMatrix ) THEN
IF (CurlCurlPrec) THEN
CALL DefaultUpdatePrec(PREC(1:nd,1:nd))
ELSE
CALL DefaultUpdatePrec(STIFF(1:nd,1:nd) + PREC(1:nd,1:nd))
IF (.NOT. CurlCurlPrec) THEN
PREC(1:nd,1:nd) = STIFF(1:nd,1:nd) + PREC(1:nd,1:nd)
END IF
IF (nb > 0) CALL CondensateP(nd-nb, nb, PREC)
CALL DefaultUpdatePrec(PREC(1:nd,1:nd))
END IF

! Update global matrix and rhs vector from local matrix & vector:
!---------------------------------------------------------------
IF (nb > 0) CALL CondensateP(nd-nb, nb, STIFF, FORCE)
CALL DefaultUpdateEquations( STIFF, FORCE, Element )

!------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion fem/tests/VectorHelmholtzWaveguide2/waveguide.sif
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ End

Solver 1
Equation = "VectorHelmholtz"
Use Piola Transform = Logical False
! Use Piola Transform = True
! Bubbles in Global System = False
Procedure = "VectorHelmholtz" "VectorHelmholtzSolver"

Linear System Row Equilibration = True
Expand Down

0 comments on commit c3cc572

Please sign in to comment.