|
58 | 58 | # \nabla \chi_p \cdot \textbf{n} = \frac{1}{\Delta h} (\chi_w - \chi_e) = 0 |
59 | 59 | # ``` |
60 | 60 | # from which follows $\chi_w = \chi_e$. Thus for boundary elements we can replace the value for the missing neighbor by the value of the opposite neighbor. |
61 | | -# In order to find the corresponding neighbor elements, we will make use of Ferrites grid topology funcionalities. |
| 61 | +# In order to find the corresponding neighbor elements, we will make use of Ferrite's grid topology functionalities. |
62 | 62 | # |
63 | 63 | # ## Commented Program |
64 | 64 | # We now solve the problem in Ferrite. What follows is a program spliced with comments. |
@@ -188,7 +188,7 @@ function compute_densities(states, dh) |
188 | 188 | end |
189 | 189 | #md nothing # hide |
190 | 190 |
|
191 | | -# For the Laplacian we need some neighboorhood information which is constant throughout the analysis so we compute it once and cache it. |
| 191 | +# For the Laplacian we need some neighborhood information which is constant throughout the analysis so we compute it once and cache it. |
192 | 192 | # We iterate through each facet of each element, |
193 | 193 | # obtaining the neighboring element by using the `getneighborhood` function. For boundary facets, |
194 | 194 | # the function call will return an empty object. In that case we use the dictionary to instead find the opposite |
@@ -218,7 +218,7 @@ function cache_neighborhood(dh, topology) |
218 | 218 | end |
219 | 219 | #md nothing # hide |
220 | 220 |
|
221 | | -# Now we calculate the Laplacian using the previously cached neighboorhood information. |
| 221 | +# Now we calculate the Laplacian using the previously cached neighborhood information. |
222 | 222 | function approximate_laplacian(nbgs, χn, Δh) |
223 | 223 | ∇²χ = zeros(length(nbgs)) |
224 | 224 | for i in 1:length(nbgs) |
@@ -290,13 +290,13 @@ end |
290 | 290 | # Finally, we put everything together to update the density. The loop ensures the stability of the |
291 | 291 | # updated solution. |
292 | 292 |
|
293 | | -function update_density(dh, states, mp, ρ, neighboorhoods, Δh) |
| 293 | +function update_density(dh, states, mp, ρ, neighborhoods, Δh) |
294 | 294 | n_j = Int(ceil(6 * mp.β / (mp.η * Δh^2))) # iterations needed for stability |
295 | 295 | χn = compute_densities(states, dh) # old density field |
296 | 296 | χn1 = zeros(length(χn)) |
297 | 297 |
|
298 | 298 | for j in 1:n_j |
299 | | - ∇²χ = approximate_laplacian(neighboorhoods, χn, Δh) # Laplacian |
| 299 | + ∇²χ = approximate_laplacian(neighborhoods, χn, Δh) # Laplacian |
300 | 300 | pΨ = compute_driving_forces(states, mp, dh, χn) # driving forces |
301 | 301 | p_Ω = compute_average_driving_force(mp, pΨ, χn) # average driving force |
302 | 302 |
|
@@ -442,7 +442,7 @@ function topopt(ra, ρ, n, filename; output = :false) |
442 | 442 | conv = :false |
443 | 443 |
|
444 | 444 | topology = ExclusiveTopology(grid) |
445 | | - neighboorhoods = cache_neighborhood(dh, topology) |
| 445 | + neighborhoods = cache_neighborhood(dh, topology) |
446 | 446 |
|
447 | 447 | ## Newton-Raphson loop |
448 | 448 | NEWTON_TOL = 1.0e-8 |
@@ -496,7 +496,7 @@ function topopt(ra, ρ, n, filename; output = :false) |
496 | 496 | end |
497 | 497 |
|
498 | 498 | ## update density |
499 | | - χ = update_density(dh, states, mp, ρ, neighboorhoods, Δh) |
| 499 | + χ = update_density(dh, states, mp, ρ, neighborhoods, Δh) |
500 | 500 |
|
501 | 501 | ## update old displacement, density and compliance |
502 | 502 | un .= u |
|
0 commit comments