@@ -20,13 +20,14 @@ The following minimal example demonstrates how to set up and solve a Poisson pro
2020
2121``` julia
2222using ExtendableFEM
23- using ExtendableGrids
23+ using ExtendableGrids # for grid management
2424
25- # Build a uniform-refined 2D unit square grid with triangles
26- xgrid = uniform_refine (grid_unitsquare (Triangle2D), 4 )
25+ # Build a structured ExtendableGrids.grid with mesh width h
26+ h = 0.1
27+ xgrid = simplexgrid (0 : h: 1 , 0 : h: 1 )
2728
2829# Create a new PDE description
29- PD = ProblemDescription ()
30+ PD = ProblemDescription (" Demo problem " )
3031
3132# Define and assign the unknown
3233u = Unknown (" u" ; name = " potential" )
@@ -42,19 +43,19 @@ function f!(fval, qpinfo)
4243end
4344assign_operator! (PD, LinearOperator (f!, [id (u)]))
4445
45- # Assign Dirichlet boundary data (u = 0)
46- assign_operator! (PD, HomogeneousBoundaryData (u; regions = 1 : 4 ))
46+ # Assign Dirichlet boundary data (u = 0) on all four grid boundary regions
47+ assign_operator! (PD, HomogeneousBoundaryData (u; regions = [ 1 , 2 , 3 , 4 ] ))
4748
4849# Discretize: choose finite element space
49- FEType = H1Pk{ 1 , 2 , 3 } # cubic H1-conforming element with 1 component in 2D
50+ FEType = H1Pk (order = 3 , edim = 2 , ncomponents = 1 )
5051FES = FESpace {FEType} (xgrid)
5152
5253# Solve the problem + unicode plot into terminal
5354sol = solve (PD, [FES]; plot = true , timeroutputs = :hide )
5455
5556# Plot the solution
56- using PyPlot
57- plot (id (u), sol; Plotter = PyPlot )
57+ import PythonPlot
58+ plot ([ id (u), grid (u)], sol; Plotter = PythonPlot )
5859```
5960
6061## Running examples from documentation
@@ -63,7 +64,7 @@ In the [documentation](https://wias-pdelib.github.io/ExtendableFEM.jl/stable/ind
6364Each of the examples is implemented as a module that needs to be included first. Afterwards the main file of the module
6465can be run.
6566Usually the main function has a Plotter argument that can be used to toggle a plot the solution with the (already installed) backend of your
66- choice (e.g. Plotter=PyPlot, GLMakie, Plots or others supported by [ GridVisualize.jl] ( https://github.com/WIAS-PDELib/GridVisualize.jl ) ).
67+ choice (e.g. ` Plotter=PythonPlot ` , ` GLMakie ` , ` Plots ` or others supported by [ GridVisualize.jl] ( https://github.com/WIAS-PDELib/GridVisualize.jl ) ).
6768Some examples need several further dependencies. To ensure an environment we everything is installed, one can use the test
6869environment via the package [ TestEnv] ( https://github.com/JuliaTesting/TestEnv.jl ) . The following script runs Example201:
6970``` julia
@@ -78,8 +79,8 @@ include("examples/Example201_PoissonProblem.jl")
7879Example201_PoissonProblem. main ()
7980
8081# use with Plotting backend (added manually to the environment)
81- using GLMakie
82- Example201_PoissonProblem. main (; Plotter = GLMakie )
82+ using PythonPlot
83+ Example201_PoissonProblem. main (; Plotter = PythonPlot )
8384```
8485
8586
0 commit comments