Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amdis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Backofen, Rainer
amdis
Commits
f624d7ca
Commit
f624d7ca
authored
Jun 12, 2012
by
Thomas Witkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added nullspace support.
parent
705566b3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
34 deletions
+44
-34
AMDiS/src/parallel/BddcMlSolver.cc
AMDiS/src/parallel/BddcMlSolver.cc
+1
-1
AMDiS/src/parallel/PetscSolver.cc
AMDiS/src/parallel/PetscSolver.cc
+4
-2
AMDiS/src/parallel/PetscSolver.h
AMDiS/src/parallel/PetscSolver.h
+5
-3
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
+34
-28
No files found.
AMDiS/src/parallel/BddcMlSolver.cc
View file @
f624d7ca
...
...
@@ -323,7 +323,7 @@ namespace AMDiS {
int
use_defaults_int
=
1
;
int
parallel_division_int
=
1
;
int
use_arithmetic_int
=
1
;
int
use_arithmetic_int
=
0
;
int
use_adaptive_int
=
0
;
// MSG("call to \"bddcml_setup_preconditioner\" with the following arguments (each in one line):\n");
// MSG(" %d\n", matrixtype);
...
...
AMDiS/src/parallel/PetscSolver.cc
View file @
f624d7ca
...
...
@@ -27,14 +27,16 @@ namespace AMDiS {
coarseSpaceMap
(
NULL
),
mpiRank
(
-
1
),
kspPrefix
(
""
),
removeRhsNullSpace
(
false
)
removeRhsNullspace
(
false
),
hasConstantNullspace
(
false
)
{
string
kspStr
=
""
;
Parameters
::
get
(
"parallel->solver->petsc->ksp"
,
kspStr
);
if
(
kspStr
!=
""
)
PetscOptionsInsertString
(
kspStr
.
c_str
());
Parameters
::
get
(
"parallel->remove rhs null space"
,
removeRhsNullSpace
);
Parameters
::
get
(
"parallel->remove rhs null space"
,
removeRhsNullspace
);
Parameters
::
get
(
"parallel->has constant null space"
,
hasConstantNullspace
);
}
...
...
AMDiS/src/parallel/PetscSolver.h
View file @
f624d7ca
...
...
@@ -116,9 +116,9 @@ namespace AMDiS {
kspPrefix
=
s
;
}
void
setRemoveRhsNull
S
pace
(
bool
b
)
void
setRemoveRhsNull
s
pace
(
bool
b
)
{
removeRhsNull
S
pace
=
b
;
removeRhsNull
s
pace
=
b
;
}
/// Adds a new vector to the basis of the operator's nullspace.
...
...
@@ -253,7 +253,9 @@ namespace AMDiS {
/// If true, the constant null space is projected out of the RHS vector. It
/// depends on the specific PETSc solver if it considers this value.
bool
removeRhsNullSpace
;
bool
removeRhsNullspace
;
bool
hasConstantNullspace
;
};
...
...
AMDiS/src/parallel/PetscSolverGlobalMatrix.cc
View file @
f624d7ca
...
...
@@ -364,18 +364,6 @@ namespace AMDiS {
// === Remove Dirichlet BC DOFs. ===
// removeDirichletBcDofs(vec);
// === Remove null space, if requested. ===
if
(
removeRhsNullSpace
)
{
TEST_EXIT_DBG
(
coarseSpaceMap
==
NULL
)(
"Not supported!
\n
"
);
MSG
(
"Remove constant null space from the RHS!
\n
"
);
MatNullSpace
sp
;
MatNullSpaceCreate
(
mpiCommGlobal
,
PETSC_TRUE
,
0
,
PETSC_NULL
,
&
sp
);
MatNullSpaceRemove
(
sp
,
rhsInterior
,
PETSC_NULL
);
MatNullSpaceDestroy
(
&
sp
);
}
}
...
...
@@ -397,35 +385,53 @@ namespace AMDiS {
VecAssemblyEnd
(
petscSolVec
);
}
MatNullSpace
matNullSpace
;
MatNullSpace
matNullspace
;
Vec
nullspaceBasis
;
if
(
nullspace
.
size
()
>
0
)
{
TEST_EXIT_DBG
(
nullspace
.
size
()
=
=
1
)(
"Not yet implemented!
\n
"
);
if
(
nullspace
.
size
()
>
0
||
hasConstantNullspace
)
{
TEST_EXIT_DBG
(
nullspace
.
size
()
<
=
1
)(
"Not yet implemented!
\n
"
);
if
(
nullspace
.
size
()
>
0
)
{
VecDuplicate
(
petscSolVec
,
&
nullspaceBasis
);
for
(
int
i
=
0
;
i
<
nComponents
;
i
++
)
setDofVector
(
nullspaceBasis
,
nullspace
[
0
]
->
getDOFVector
(
i
),
i
,
true
);
VecAssemblyBegin
(
nullspaceBasis
);
VecAssemblyEnd
(
nullspaceBasis
);
MatNullSpaceCreate
(
mpiCommGlobal
,
PETSC_FALSE
,
1
,
&
nullspaceBasis
,
&
matNullSpace
);
KSPSetNullSpace
(
kspInterior
,
matNullS
pace
);
MatNullSpaceCreate
(
mpiCommGlobal
,
(
hasConstantNullspace
?
PETSC_TRUE
:
PETSC_FALSE
),
1
,
&
nullspaceBasis
,
&
matNulls
pace
);
MatMult
(
matIntInt
,
nullspaceBasis
,
petscSolVec
);
PetscReal
n
;
VecNorm
(
petscSolVec
,
NORM_2
,
&
n
);
MSG
(
"NORM IS: %e
\n
"
,
n
);
}
else
{
MatNullSpaceCreate
(
mpiCommGlobal
,
PETSC_TRUE
,
0
,
PETSC_NULL
,
&
matNullspace
);
}
KSPSetNullSpace
(
kspInterior
,
matNullspace
);
// === Remove null space, if requested. ===
if
(
removeRhsNullspace
)
{
TEST_EXIT_DBG
(
coarseSpaceMap
==
NULL
)(
"Not supported!
\n
"
);
MatNullSpaceRemove
(
matNullspace
,
rhsInterior
,
PETSC_NULL
);
}
}
else
{
TEST_EXIT
(
removeRhsNullspace
==
false
)
(
"No nullspace provided that should be removed from rhs!
\n
"
);
}
// PETSc.
solve
(
rhsInterior
,
petscSolVec
);
if
(
nullspace
.
size
()
>
0
)
{
MatNullSpaceDestroy
(
&
matNull
S
pace
);
MatNullSpaceDestroy
(
&
matNull
s
pace
);
VecDestroy
(
&
nullspaceBasis
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment