Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frap Theory
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hubatsch
Frap Theory
Commits
93f01f9c
Commit
93f01f9c
authored
5 years ago
by
Lars Hubatsch
Browse files
Options
Downloads
Patches
Plain Diff
New solver method in fenics_mpi_example.py
parent
d63fc08e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fenics_mpi_example.py
+6
-6
6 additions, 6 deletions
fenics_mpi_example.py
with
6 additions
and
6 deletions
fenics_mpi_example.py
+
6
−
6
View file @
93f01f9c
...
...
@@ -6,10 +6,8 @@
# Runs with fenics 2019.01
# The resulting .pvd file can be opened using default settings in ParaView
import
matplotlib.pyplot
as
plt
import
mshr
as
ms
import
numpy
as
np
from
scipy.optimize
import
curve_fit
import
random
from
dolfin
import
*
...
...
@@ -55,7 +53,7 @@ y_mesh = 1
# mesh = UnitSquareMesh.create(x_mesh, y_mesh, CellType.Type.quadrilateral)
# mesh = RectangleMesh(Point(0, 0), Point(1, 0.02), x_mesh, y_mesh)
domain
=
ms
.
Sphere
(
Point
(
0
,
0
,
0
),
1.0
)
mesh
=
ms
.
generate_mesh
(
domain
,
2
0
)
mesh
=
ms
.
generate_mesh
(
domain
,
6
0
)
P1
=
FiniteElement
(
"
Lagrange
"
,
mesh
.
ufl_cell
(),
1
)
ME
=
FunctionSpace
(
mesh
,
P1
*
P1
)
# Define trial and test functions
...
...
@@ -87,7 +85,9 @@ a = derivative(L, u, du)
# Create nonlinear problem and Newton solver
problem
=
CahnHilliardEquation
(
a
,
L
)
solver
=
NewtonSolver
()
solver
.
parameters
[
"
linear_solver
"
]
=
"
lu
"
solver
.
parameters
[
"
linear_solver
"
]
=
"
gmres
"
solver
.
parameters
[
"
preconditioner
"
]
=
"
ilu
"
#solver.parameters["linear_solver"] = "mumps"
solver
.
parameters
[
"
convergence_criterion
"
]
=
"
incremental
"
solver
.
parameters
[
"
relative_tolerance
"
]
=
1e-6
# Output file
...
...
@@ -95,9 +95,9 @@ file = File("output.pvd", "compressed")
# Step in time
t
=
0.0
T
=
10
*
dt
T
=
3
*
dt
while
(
t
<
T
):
file
<<
(
u
.
split
()[
0
],
t
)
t
+=
dt
u0
.
vector
()[:]
=
u
.
vector
()
solver
.
solve
(
problem
,
u
.
vector
())
\ No newline at end of file
solver
.
solve
(
problem
,
u
.
vector
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment