You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Using the following codes, we can check if we can get the derivatives correctly from the adjoint method by comparing it with the finite difference results.
Copy file name to clipboardExpand all lines: src/darcy.jl
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -136,7 +136,8 @@ uh, ph = xh
136
136
137
137
# Since this is a multi-field example, the `solve` function returns a multi-field solution `xh`, which can be unpacked in order to finally recover each field of the problem. The resulting single-field objects can be visualized as in previous tutorials (see next figure).
Copy file name to clipboardExpand all lines: src/elasticity.jl
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,8 @@ model = DiscreteModelFromFile("../models/solid.json")
49
49
50
50
# In order to inspect it, write the model to vtk
51
51
52
-
writevtk(model,"model")
52
+
mkpath("output_path")
53
+
writevtk(model,"output_path/model")
53
54
54
55
# and open the resulting files with Paraview. The boundaries $\Gamma_{\rm B}$ and $\Gamma_{\rm G}$ are identified with the names `"surface_1"` and `"surface_2"` respectively. For instance, if you visualize the faces of the model and color them by the field `"surface_2"` (see next figure), you will see that only the faces on $\Gamma_{\rm G}$ have a value different from zero.
55
56
#
@@ -118,7 +119,7 @@ uh = solve(op)
118
119
#
119
120
# Finally, we write the results to a file. Note that we also include the strain and stress tensors into the results file.
# It can be clearly observed (see next figure) that the surface $\Gamma_{\rm B}$ is pulled in $x_1$-direction and that the solid deforms accordingly.
124
125
#
@@ -186,7 +187,7 @@ uh = solve(op)
186
187
187
188
# Once the solution is computed, we can store the results in a file for visualization. Note that, we are including the stress tensor in the file (computed with the bi-material law).
# `tags_field` is a field which value at $x$ is the tag of the cell containing $x$. `σ_bimat_cst` is used like a constant in (bi)linear form definition and solution export:
Copy file name to clipboardExpand all lines: src/fsi_tutorial.jl
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,8 @@ using Gridap
76
76
model =DiscreteModelFromFile("../models/elasticFlag.json")
77
77
78
78
# We can inspect the loaded geometry and associated parts by printing to a `vtk` file:
79
-
writevtk(model,"model")
79
+
mkpath("output_path")
80
+
writevtk(model,"output_path/model")
80
81
81
82
# This will produce an output in which we can identify the different parts of the domain, with the associated labels and tags.
82
83
#
@@ -357,12 +358,12 @@ uhs, uhf, ph = solve(op)
357
358
# ```
358
359
# ### Visualization
359
360
# The solution fields $[\mathbf{U}^h_{\rm S},\mathbf{U}^h_{\rm F},\mathbf{P}^h_{\rm F}]^T$ are defined over all the domain, extended with zeros on the inactive part. Calling the function `writevtk` passing the global triangulation, we will output the global fields.
# However, we can also restrict the fields to the active part by calling the function `restrict` with the field along with the respective active triangulation.
0 commit comments