Skip to content

Commit 6b2dac3

Browse files
committed
initial commit
1 parent a8eb1bb commit 6b2dac3

4 files changed

Lines changed: 11 additions & 10 deletions

File tree

deps/build.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ for (i,(title,filename)) in enumerate(files)
4040
notebook = string(notebook_prefix,splitext(filename)[1])
4141
notebook_title = string("# # Tutorial ", i, ": ", title)
4242
function preprocess_notebook(content)
43+
content = replace(content, "output_path" => notebook_prefix)
4344
return string(notebook_title, "\n\n", content)
4445
end
4546
Literate.notebook(joinpath(repo_src,filename), notebooks_dir; name=notebook, preprocess=preprocess_notebook, documenter=false, execute=false)

src/poisson.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ model = DiscreteModelFromFile("../models/model.json")
5454
#
5555
# You can easily inspect the generated discrete model in [Paraview](https://www.paraview.org/) by writing it in `vtk` format.
5656

57-
writevtk(model,"model")
57+
mkdir("output_path")
58+
writevtk(model,"output_path/model")
5859

5960
# The previous line generates four different files `model_0.vtu`, `model_1.vtu`, `model_2.vtu`, and `model_3.vtu` containing the vertices, edges, faces, and cells present in the discrete model. Moreover, you can easily inspect which boundaries are defined within the model.
6061
#
@@ -137,7 +138,7 @@ uh = solve(solver,op)
137138

138139
# The `solve` function returns the computed numerical solution `uh`. This object is an instance of `FEFunction`, the type used to represent a function in a FE space. We can inspect the result by writing it into a `vtk` file:
139140

140-
writevtk(Ω,"results",cellfields=["uh"=>uh])
141+
writevtk(Ω,"output_path/results",cellfields=["uh"=>uh])
141142

142143
# which will generate a file named `results.vtu` having a nodal field named `"uh"` containing the solution of our problem (see next figure).
143144
#

src/transient_linear.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,12 @@ uh = solve(solver, op, t0, tF, uh0)
108108

109109
# We highlight that `uh` is an iterable function and the result at each time step is only computed lazily when iterating over it. We can post-process the results and generate the corresponding `vtk` files using the `createpvd` and `createvtk` functions. The former will create a `.pvd` file with the collection of `.vtu` files saved at each time step by `createvtk`. The computation of the problem solutions will be triggered in the following loop:
110110

111-
if !isdir("tmp")
112-
mkdir("tmp")
113-
end
111+
mkpath("output_path/results")
114112

115-
createpvd("results") do pvd
116-
pvd[0] = createvtk(Ω, "tmp/results_0" * ".vtu", cellfields=["u" => uh0])
113+
createpvd("output_path/results") do pvd
114+
pvd[0] = createvtk(Ω, "output_path/results/results_0" * ".vtu", cellfields=["u" => uh0])
117115
for (tn, uhn) in uh
118-
pvd[tn] = createvtk(Ω, "tmp/results_$tn" * ".vtu", cellfields=["u" => uhn])
116+
pvd[tn] = createvtk(Ω, "output_path/results/results_$tn" * ".vtu", cellfields=["u" => uhn])
119117
end
120118
end
121119

src/validation.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ model3d = CartesianDiscreteModel(domain3d,partition3d)
6666

6767
# Let us return to the 2D `CartesianDiscreteModel` that we have already constructed. You can inspect it by writing it into vtk format. Note that you can also print a 3D model, but not a 4D one. In the future, it would be cool to generate a movie from a 4D model, but this functionality is not yet implemented.
6868

69-
writevtk(model,"model")
69+
mkdir("output_path")
70+
writevtk(model,"output_path/model")
7071

7172

7273
# If you open the generated files, you will see that the boundary vertices and facets are identified with the name "boundary". This is just what we need to impose the Dirichlet boundary conditions in this example.
@@ -113,7 +114,7 @@ e = u - uh
113114

114115
# Once the error is defined, you can, e.g., visualize it.
115116

116-
writevtk(Ω,"error",cellfields=["e" => e])
117+
writevtk(Ω,"output_path/error",cellfields=["e" => e])
117118

118119
# This generates a file called `error.vtu`. Open it with Paraview to check that the error is of the order of the machine precision.
119120
#

0 commit comments

Comments
 (0)