@@ -156,12 +156,10 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
156156 END IF
157157
158158 sealevel = ListGetCReal( Model % Constants, ' Sea Level' , Found )
159- If (.NOT. Found) Then
160- WRITE (Message,' (A)' ) ' Constant >Sea Level< not found. &
161- &Setting to 0.0'
162- CALL INFO(SolverName, Message, level= 20 )
163- sealevel= 0.0_dp
164- End if
159+ IF (.NOT. Found) THEN
160+ WRITE (Message,' (A)' ) ' Constant >Sea Level< not found. Setting to zero.'
161+ CALL INFO(SolverName, Message, level= 20 )
162+ END IF
165163
166164 !- -------------------------------------------------------------
167165 ! Allocate some permanent storage, this is done first time only:
@@ -171,10 +169,9 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
171169 ! Get some constants
172170 rhow = ListGetConstReal( Model % Constants, ' Water Density' , Found)
173171 If (.NOT. Found) Then
174- WRITE (Message,' (A)' ) ' Constant Water Density not found. &
175- &Setting to 1.03225e-18'
176- CALL INFO(SolverName, Message, level= 20 )
177172 rhow = 1.03225e-18_dp
173+ WRITE (Message,* ) ' Constant Water Density not found. Setting to: ' ,rhow
174+ CALL INFO(SolverName, Message, level= 20 )
178175 End if
179176
180177 ! Allocate
@@ -183,9 +180,8 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
183180 M = Model % Mesh % NumberOfNodes
184181 IF (AllocationsDone) DEALLOCATE (FORCE, LOAD, STIFF, NodalGravity, &
185182 NodalViscosity, NodalDensity, &
186- NodalZb, NodalZs, NodalU, NodalV, &
187- ElementNodes % x, &
188- ElementNodes % y, ElementNodes % z ,Basis)
183+ NodalZb, NodalZs, NodalU, NodalV, &
184+ ElementNodes % x, ElementNodes % y, ElementNodes % z ,Basis)
189185
190186 ALLOCATE ( FORCE(STDOFs* N), LOAD(N), STIFF(STDOFs* N,STDOFs* N), &
191187 NodalGravity(N), NodalDensity(N), NodalViscosity(N), &
@@ -214,7 +210,6 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
214210
215211 NonlinearIter = GetInteger( Solver % Values, &
216212 ' Nonlinear System Max Iterations' ,GotIt )
217-
218213 IF ( .NOT. GotIt ) NonlinearIter = 1
219214
220215 NewtonTol = ListGetConstReal( Solver % Values, &
@@ -356,7 +351,6 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
356351 IF (.NOT. ASSOCIATED ( BC ) ) CYCLE
357352
358353 ! Find the nodes for which 'Calving Front' = True
359- CalvingFront= .False.
360354 CalvingFront = ListGetLogical( BC, ' Calving Front' , GotIt )
361355 IF (CalvingFront) THEN
362356
@@ -396,7 +390,7 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
396390 UnFoundFatal= UnFoundFatal)
397391
398392 MinH = ListGetConstReal( Material, ' SSA Critical Thickness' ,Found)
399- If (.NOT. Found) MinH= EPSILON (MinH)
393+ If (.NOT. Found) MinH = EPSILON (MinH)
400394
401395 NodalGravity = 0.0_dp
402396 IF ( ASSOCIATED ( BodyForce ) ) THEN
@@ -470,12 +464,12 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
470464
471465 strbasemag = > VariableGet( Solver % Mesh % Variables," strbasemag" )
472466 IF (ASSOCIATED (strbasemag)) THEN
473- ! sanity check
474- IF (strbasemag % TYPE /= Variable_on_elements) &
475- CALL FATAL(SolverName," strbasemag type should be on_elements" )
476- IF (.NOT. ASSOCIATED (strbasemag % Perm)) &
477- CALL FATAL(SolverName," strbasemag perm not associated" )
478- strbasemag % Values= 0._dp
467+ ! sanity check
468+ IF (strbasemag % TYPE /= Variable_on_elements) &
469+ CALL FATAL(SolverName," strbasemag type should be on_elements" )
470+ IF (.NOT. ASSOCIATED (strbasemag % Perm)) &
471+ CALL FATAL(SolverName," strbasemag perm not associated" )
472+ strbasemag % Values = 0._dp
479473 END IF
480474
481475 Ceff = > VariableGet( Solver % Mesh % Variables," Ceff" )
@@ -503,7 +497,6 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
503497 ' It is not possible to compute SSA problems with DOFs=' ,&
504498 STDOFs, ' . Aborting'
505499 CALL Fatal( SolverName, Message)
506- STOP
507500 END IF
508501
509502 Material = > GetMaterial(Element)
@@ -524,49 +517,49 @@ SUBROUTINE SSABasalSolver( Model,Solver,dt,TransientSimulation )
524517
525518 IF (ASSOCIATED (strbasemag)) THEN
526519 IF (strbasemag % Perm(Element % ElementIndex) > 0 ) &
527- strbasemag% Values(strbasemag % Perm(Element % ElementIndex))= &
528- ComputeMeanFriction(Element,n,ElementNodes,STDOFs,NodalU,NodalV,NodalZs,NodalZb,MinH,NodalDensity,SEP,GLnIP,sealevel,rhow)
520+ strbasemag% Values(strbasemag % Perm(Element % ElementIndex))= &
521+ ComputeMeanFriction(Element,n,ElementNodes,STDOFs,NodalU,NodalV,&
522+ NodalZs,NodalZb,MinH,NodalDensity,SEP,GLnIP,sealevel,rhow)
529523 END IF
530524
531525 IF (ASSOCIATED (Ceff)) THEN
532526 Do i= 1 ,n
533527 stat = ElementInfo( Element, ElementNodes, Element % Type % NodeU(i) , Element % Type % NodeV(i),&
534- Element % Type % NodeW(i), detJ, Basis )
535- un= 0._dp
528+ Element % Type % NodeW(i), detJ, Basis )
529+ un = 0._dp
536530 Do j= 1 ,STDOFs
537- un = un + VeloSol % Values(STDOFs* (VeloSol % Perm(NodeIndexes(i))- 1 )+ j) &
538- * VeloSol % Values(STDOFs* (VeloSol % Perm(NodeIndexes(i))- 1 )+ j)
531+ un = un + VeloSol % Values(STDOFs* (VeloSol % Perm(NodeIndexes(i))- 1 )+ j)** 2
539532 End do
540- un= sqrt (un)
533+ un = SQRT (un)
541534
542- h= MAX (SUM (Basis(1 :n)* (NodalZs(1 :n)- NodalZb(1 :n))),MinH)
535+ h = MAX (SUM (Basis(1 :n)* (NodalZs(1 :n)- NodalZb(1 :n))),MinH)
543536 Ceff% Values(Ceff% Perm(NodeIndexes(i)))= &
544- SSAEffectiveFriction(Element,n,Basis,un,SEP,.TRUE. ,h,SUM (NodalDensity(1 :n)* Basis(1 :n)),rhow,sealevel)
537+ SSAEffectiveFriction(Element,n,Basis,un,SEP,.TRUE. ,h,SUM (NodalDensity(1 :n)* Basis(1 :n)),rhow,sealevel)
545538 End do
546539 End IF
547540
548- END DO
541+ END DO
549542 END IF
550543
551544
552545 ! scale the results if a given limit is given... use with care?
553546 UnLimit = ListGetConstReal(SolverParams,' velocity norm limit' ,GotIt)
554547 IF (GotIt) THEN
555- Do i= 1 ,Solver% Mesh% NumberOfNodes
556- un= 0._dp
557- Do j= 1 ,STDOFs
558- un= un+ VariableValues(STDOFs* (i-1 )+ j)* VariableValues(STDOFs * (i -1 ) + j)
559- End do
560- un= sqrt (un)
561- IF (un > 0._dp ) THEN
562- un_max= UnLimit/ un
563- IF (un_max < 1.0_dp ) THEN
564- Do j= 1 ,STDOFs
565- VariableValues(STDOFs* (i-1 )+ j)= VariableValues(STDOFs* (i-1 )+ j)* un_max
566- End do
567- END IF
568- END IF
569- End do
548+ DO i= 1 ,Solver% Mesh% NumberOfNodes
549+ un= 0._dp
550+ DO j= 1 ,STDOFs
551+ un= un+ VariableValues(STDOFs* (i-1 )+ j)** 2
552+ END DO
553+ un= SQRT (un)
554+ IF (un > 0._dp ) THEN
555+ un_max= UnLimit/ un
556+ IF (un_max < 1.0_dp ) THEN
557+ DO j= 1 ,STDOFs
558+ VariableValues(STDOFs* (i-1 )+ j)= VariableValues(STDOFs* (i-1 )+ j)* un_max
559+ END DO
560+ END IF
561+ END IF
562+ END DO
570563 END IF
571564
572565 CALL DefaultFinish()
@@ -622,7 +615,7 @@ SUBROUTINE LocalMatrixUVSSA( STIFF, FORCE, Element, n, Nodes, gravity, &
622615 ELSE
623616 GMSol = > VariableGet( CurrentModel % Variables, ' GroundedMask' ,UnFoundFatal= .TRUE. )
624617 CALL GetLocalSolution( NodalGM,UElement= Element,UVariable= GMSol)
625- PartlyGroundedElement= (ANY (NodalGM(1 :n) > 0._dp ) .AND. ANY (NodalGM(1 :n) < 0._dp ))
618+ PartlyGroundedElement= (ANY (NodalGM(1 :n) >= 0._dp ) .AND. ANY (NodalGM(1 :n) < 0._dp ))
626619 IF (PartlyGroundedElement) THEN
627620 IP = GaussPoints( Element , np= GLnIP )
628621 ELSE
0 commit comments