Changes to parstokes Solver?

Extension of Elmer in computational glaciology
Post Reply
Clemens
Posts: 8
Joined: 13 Dec 2017, 15:06
Antispam: Yes

Changes to parstokes Solver?

Post by Clemens » 02 Feb 2018, 18:48

Hi y'all

I updated to a newer code version of Elmer a few days ago and wanted to start optimising my Par-Stokes set-up. With the old version the code runs smoothly, but with the newer version it only works if I comment out the line

Code: Select all

Element = "p:1 b:4"  
in all three solvers. However doing this made the solver significantly slower and in some cases it did not even converge. Even Thomas' course example crashes. Does anyone know if there have been any updates to the ParStokes solver? A quick diff between the version did not indicate any important changes.

Cheers, Clemens

raback
Site Admin
Posts: 3277
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Changes to parstokes Solver?

Post by raback » 02 Feb 2018, 18:56

Hi

There have been some changes to library but they should not affect "Element" definitions.

Could you share a test case. The standard ones seem to pass.

-Peter

Clemens
Posts: 8
Joined: 13 Dec 2017, 15:06
Antispam: Yes

Re: Changes to parstokes Solver?

Post by Clemens » 05 Feb 2018, 15:25

Hi Peter,

So here is a test case Thomas presented at the last Elmer/Ice course that used to work without problems, but now crashes with a segfault.

Cheers, Clemens
Attachments
ParStokes.tar.gz
(139.05 KiB) Downloaded 58 times

Juha
Site Admin
Posts: 357
Joined: 21 Aug 2009, 15:11

Re: Changes to parstokes Solver?

Post by Juha » 06 Feb 2018, 11:15

Hi

The patch below fixes the case. There seems to have been a misunderstaning of the role of the variable initialization statement
in Fortran, which is very different from c/c++. Fortran initializes the variable only once (not at each re-entry) and so the initialization
also implies saving of the variable between calls.

I'll apply this to 'devel' shortly.

BR, Juha


diff --git a/fem/src/MeshUtils.F90 b/fem/src/MeshUtils.F90
index f7dfa3f..85d8efa 100644
--- a/fem/src/MeshUtils.F90
+++ b/fem/src/MeshUtils.F90
@@ -2852,13 +2852,13 @@ END SUBROUTINE GetMaxDefs
!------------------------------------------------------------------------------
INTEGER :: i,j,el_id
TYPE(Element_t), POINTER :: Element, Edge, Face
- LOGICAL :: AssignEdges=.FALSE.
+ LOGICAL :: AssignEdges
!------------------------------------------------------------------------------

CALL FindMeshEdges(Mesh)

- IF (PRESENT(NeedEdges)) &
- AssignEdges = NeedEdges
+ AssignEdges = .FALSE.
+ IF (PRESENT(NeedEdges)) AssignEdges = NeedEdges

! Set edge and face polynomial degree and degrees of freedom for
! all elements
@@ -15487,10 +15487,10 @@ CONTAINS

INTEGER i,j,n,edgeNumber, numEdges, bMap(4)
TYPE(Element_t), POINTER :: Edge
- LOGICAL :: EvalPE=.TRUE.
+ LOGICAL :: EvalPE

- IF(PRESENT(NoPE)) &
- EvalPE = .NOT.NoPE
+ EvalPE = .TRUE.
+ IF(PRESENT(NoPE)) EvalPE = .NOT.NoPE

! Get number of points, edges or faces
numEdges = 0

Clemens
Posts: 8
Joined: 13 Dec 2017, 15:06
Antispam: Yes

Re: Changes to parstokes Solver?

Post by Clemens » 12 Feb 2018, 10:25

Hi Juha,

Thanks for the quick response. Could you give this thread a bump once this has been updated in 'devel'?

Cheers, Clemens

raback
Site Admin
Posts: 3277
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Changes to parstokes Solver?

Post by raback » 12 Feb 2018, 11:14

Hi Clemens,

I think it is already at the devel, see
https://github.com/ElmerCSC/elmerfem/co ... 019f73da18

-Peter

Clemens
Posts: 8
Joined: 13 Dec 2017, 15:06
Antispam: Yes

Re: Changes to parstokes Solver?

Post by Clemens » 20 Feb 2018, 09:54

A little late, but thanks for the info and the quick fix. All works well again.

Cheers, Clemens

Post Reply