Skip to content

Commit

Permalink
[skip ci] Allow for the A-V split together with eigenfunction BCs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalinen committed Nov 14, 2024
1 parent f6c727d commit 99c7550
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions fem/src/modules/VectorHelmholtz.F90
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ SUBROUTINE LocalMatrixBC( BC, Element, n, nd, InitHandles )
REAL(KIND=dp), ALLOCATABLE :: Re_Eigenf(:), Im_Eigenf(:)
REAL(KIND=dp) :: th, DetJ
LOGICAL :: Stat, Found, UpdateStiff, WithNdofs, ThinSheet, ConductorBC, EigenBC, PortSource
LOGICAL :: LineElement, DegenerateElement, Regularize
LOGICAL :: LineElement, DegenerateElement, Regularize, Consistent
LOGICAL :: AllocationsDone = .FALSE.
TYPE(GaussIntegrationPoints_t) :: IP
INTEGER :: t, i, j, m, np, p, q, ndofs, EigenInd
Expand Down Expand Up @@ -880,6 +880,10 @@ SUBROUTINE LocalMatrixBC( BC, Element, n, nd, InitHandles )
MASS = 0.0_dp
FORCE = 0.0_dp

ndofs = MAXVAL(Solver % Def_Dofs(GetElementFamily(Element),:,1))
WithNdofs = ndofs > 0
np = n * ndofs

! Check whether BC should be created in terms of pre-computed eigenfunction:
EigenBC = ListGetElementLogical(EigenvectorSource, Element, Found)

Expand All @@ -894,8 +898,13 @@ SUBROUTINE LocalMatrixBC( BC, Element, n, nd, InitHandles )
Eigensolver, EigenInd, ComplexPart=.FALSE.)

nd_eigen = GetElementNOFDOFs(USolver=Eigensolver)
nd_eigen = nd_eigen - n
IF (nd_eigen /= nd) CALL Fatal(Caller, &

IF (WithNDOFs) THEN
Consistent = (nd_eigen == nd)
ELSE
Consistent = (nd_eigen - n) == nd
END IF
IF (.NOT. Consistent) CALL Fatal(Caller, &
'The DOFs of the port model are not compatible with the DOFs of this solver')
END IF

Expand All @@ -905,15 +914,8 @@ SUBROUTINE LocalMatrixBC( BC, Element, n, nd, InitHandles )
IP = GaussPoints(Element, EdgeBasis=.TRUE., PReferenceElement=PiolaVersion, &
EdgeBasisDegree=EdgeBasisDegree )

ndofs = MAXVAL(Solver % Def_Dofs(GetElementFamily(Element),:,1))
np = n * ndofs
WithNdofs = ndofs > 0

IF (WithNdofs) THEN
Regularize = UseGaussLaw .AND. ListGetElementLogical( ChargeConservation, Element, Found )
IF (EigenBC) THEN
CALL Fatal(Caller, 'Eigenfunction BC needs the plain E-formulation')
END IF
END IF

LineElement = GetElementFamily(Element) == 2
Expand Down

0 comments on commit 99c7550

Please sign in to comment.