-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from gridap/petsc_ksp_partitioned_simulations_…
…mpi_mode_support PetscLinearSolver partitioned mpi support
- Loading branch information
Showing
7 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Gridap | ||
using Gridap.Algebra | ||
using Gridap.FESpaces | ||
using GridapDistributed | ||
using GridapPETSc | ||
using PartitionedArrays | ||
using Test | ||
|
||
function main(parts) | ||
options = "-info -pc_type jacobi -ksp_type cg -ksp_monitor -ksp_rtol 1.0e-12" | ||
GridapPETSc.with(args=split(options)) do | ||
domain = (0,4,0,4) | ||
cells = (4,4) | ||
model = CartesianDiscreteModel(parts,domain,cells) | ||
|
||
labels = get_face_labeling(model) | ||
add_tag_from_tags!(labels,"dirichlet",[1,2,3,5,7]) | ||
add_tag_from_tags!(labels,"neumann",[4,6,8]) | ||
|
||
Ω = Triangulation(model) | ||
Γn = Boundary(model,tags="neumann") | ||
n_Γn = get_normal_vector(Γn) | ||
|
||
k = 2 | ||
u((x,y)) = (x+y)^k | ||
f(x) = -Δ(u,x) | ||
g = n_Γn⋅∇(u) | ||
|
||
reffe = ReferenceFE(lagrangian,Float64,k) | ||
V = TestFESpace(model,reffe,dirichlet_tags="dirichlet") | ||
U = TrialFESpace(u,V) | ||
|
||
dΩ = Measure(Ω,2*k) | ||
dΓn = Measure(Γn,2*k) | ||
|
||
a(u,v) = ∫( ∇(v)⋅∇(u) )dΩ | ||
l(v) = ∫( v*f )dΩ + ∫( v*g )dΓn | ||
op = AffineFEOperator(a,l,U,V) | ||
|
||
ls = PETScLinearSolver() | ||
fels = LinearFESolver(ls) | ||
uh = solve(fels,op) | ||
eh = u - uh | ||
@test sqrt(sum( ∫(abs2(eh))dΩ )) < 1.0e-9 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include("../PLaplacianTests.jl") | ||
nparts = (2,2) | ||
prun(main,mpi,nparts) | ||
prun(main,mpi,nparts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include("../PoissonTests.jl") | ||
nparts = (2,2) | ||
prun(main,mpi,nparts) | ||
prun(main,mpi,nparts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module PoissonTestsRun | ||
include("mpiexec.jl") | ||
run_mpi_driver(procs=4,file="PoissonTests.jl") | ||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters