Skip to content

Commit

Permalink
Merge pull request ElmerCSC#606 from ElmerCSC/RestictionMeetsResidual
Browse files Browse the repository at this point in the history
Restiction meets residual
  • Loading branch information
raback authored Nov 7, 2024
2 parents 922f4bc + a690da9 commit ae4ed28
Show file tree
Hide file tree
Showing 5 changed files with 304 additions and 214 deletions.
3 changes: 3 additions & 0 deletions fem/src/MeshUtils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2970,7 +2970,10 @@ SUBROUTINE PrepareMesh( Model, Mesh, Parallel, Def_Dofs, mySolver )
CALL NonNodalElements()

IF( Parallel ) THEN
CALL Info(Caller,'Generating parallel communications for the non-nodal mesh',Level=20)
CALL ResetTimer('ParallelNonNodal')
CALL ParallelNonNodalElements()
CALL CheckTimer('ParallelNonNodal',Level=7,Delete=.TRUE.)
END IF

CALL EnlargeCoordinates( Mesh )
Expand Down
12 changes: 12 additions & 0 deletions fem/src/ModelDescription.F90
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,18 @@ RECURSIVE SUBROUTINE LoadInputFile( Model, InFileUnit, FileName, &
ELSE IF ( Section == 'run' ) THEN
IF ( PRESENT(runc) ) runc=.TRUE.
EXIT
ELSE IF ( Section == 'stop' ) THEN
CALL Warn(Caller,'Encountered "STOP" in sif, rest will be ignored!')
EXIT
ELSE IF( Section == '/*' ) THEN
CALL Info(Caller,'Starting comment section!')
DO WHILE( ReadAndTrim( InFileUnit, Section, Echo ) )
IF ( Section == '*/' ) THEN
CALL Info(Caller,'Finished comment section!')
EXIT
END IF
END DO
CYCLE
END IF

FreeNames = ( CheckAbort <= 0 )
Expand Down
25 changes: 10 additions & 15 deletions fem/src/SParIterSolver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2055,6 +2055,10 @@ END SUBROUTINE SolveTrilinos4
!
!------------------------------------------------------------------

CALL Info(Caller,'Copying Matrix values into SplittedMatrix',Level=20)
CALL ResetTimer('SplittedMatrix')


GT => SplittedMatrix % GlueTable
DO i = 1, SourceMatrix % NumberOfRows
GRow = ParallelInfo % GlobalDOFs(i)
Expand Down Expand Up @@ -2154,12 +2158,14 @@ END SUBROUTINE SolveTrilinos4
END DO

CALL GlueFinalize( SourceMatrix, SplittedMatrix, ParallelInfo )
CALL CheckTimer('SplittedMatrix',Level=7,Delete=.TRUE.)


!------------------------------------------------------------------
!
! Call the actual solver routine (based on older design)
!
!------------------------------------------------------------------
CALL Info(Caller,'Going into actual parallel solution',Level=20)

CALL Solve( SourceMatrix, SParMatrixDesc % SplittedMatrix, &
ParallelInfo, RHSVec, XVec, Solver, Errinfo )

Expand Down Expand Up @@ -2436,9 +2442,7 @@ SUBROUTINE Solve( SourceMatrix, SplittedMatrix, ParallelInfo, &
PIGpntr => GlobalData

!----------------------------------------------------------------------
!
! Initialize Right-Hand-Side
!
!----------------------------------------------------------------------
ALLOCATE(TmpRHSVec(SplittedMatrix % InsideMatrix % NumberOfRows))
TmpRHSVec = 0
Expand Down Expand Up @@ -2495,12 +2499,10 @@ SUBROUTINE Solve( SourceMatrix, SplittedMatrix, ParallelInfo, &

GlobalMatrix % Ematrix => SourceMatrix
GlobalMatrix % COMPLEX = SourceMatrix % COMPLEX

!----------------------------------------------------------------------
!
! Set up the preconditioner
!
!----------------------------------------------------------------------

IF (SplittedMatrix % InsideMatrix % NumberOFRows>0) THEN
! IF (SplittedMatrix % InsideMatrix % Diag(1)==0) THEN
DO i = 1, SplittedMatrix % InsideMatrix % NumberOfRows
Expand Down Expand Up @@ -2533,11 +2535,8 @@ SUBROUTINE Solve( SourceMatrix, SplittedMatrix, ParallelInfo, &


!----------------------------------------------------------------------
!
! Call the main iterator routine
!
!----------------------------------------------------------------------

CM => SourceMatrix % ConstraintMatrix
IF (ASSOCIATED(CM)) THEN
ALLOCATE(SPerm(SourceMatrix % NumberOfRows)); SPerm=0
Expand Down Expand Up @@ -2576,9 +2575,7 @@ SUBROUTINE Solve( SourceMatrix, SplittedMatrix, ParallelInfo, &
GlobalMatrix => SaveMatrix

!----------------------------------------------------------------------
!
! Collect the result
!
!----------------------------------------------------------------------
ALLOCATE( VecEPerNB( ParEnv % PEs ) )
VecEPerNB = 0
Expand Down Expand Up @@ -2609,12 +2606,10 @@ SUBROUTINE Solve( SourceMatrix, SplittedMatrix, ParallelInfo, &
END DO

CALL ExchangeResult( SourceMatrix,SplittedMatrix,ParallelInfo,XVec )

!----------------------------------------------------------------------
!
! Clean the work space
!
!----------------------------------------------------------------------

DEALLOCATE( TmpXVec, TmpRHSVec, VecEPerNB )
!----------------------------------------------------------------------
END SUBROUTINE Solve
Expand Down
Loading

0 comments on commit ae4ed28

Please sign in to comment.