Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKryslUCSD committed Apr 20, 2024
1 parent 9912f7c commit 3e3da14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FinEtoolsHeatDiff"
uuid = "972d1c22-8bdd-11e9-11cf-cdcb7577b041"
authors = ["Petr Krysl <pkrysl@ucsd.edu>"]
version = "3.0.6"
version = "3.0.7"

[deps]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
Expand Down
22 changes: 14 additions & 8 deletions examples/transient/3-d/steel_block_examples.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Transient heating of a rectangular steel block suddenly subject to surface temperature of 100° C.
Transient heating of a rectangular steel block suddenly subject to surface
temperature of 100° C.
The initial temperature of the block is 20° C. The temperature at the center
climbs from 20° C to approximately 90° C in 1200 seconds.
Expand All @@ -14,7 +15,7 @@ using PlotlyLight

function steel_block_m()
# Thermal conductivity
thermal_conductivity = [i == j ? 44.0 * phun("W/K/m") : zero(FFlt) for i = 1:3, j = 1:3] # conductivity matrix
thermal_conductivity = [i == j ? 44.0 * phun("W/K/m") : zero(Float64) for i = 1:3, j = 1:3] # conductivity matrix
# Specific heat: the specific heat is per unit volume
rho = 8000 * phun("kg/m^3")
specific_heat = 470.0 * phun("J/kg/K") * rho
Expand Down Expand Up @@ -67,12 +68,17 @@ function steel_block_m()

K = conductivity(femm, geom, Temp)
C = capacity(femm, geom, Temp)
L = nzebcloadsconductivity(femm, geom, Temp)

A = cholesky((1 / dt * C + theta * K))
B = (1 / dt * C - (1 - theta) * K)
K_ff = matrix_blocked_ff(K, nfreedofs(Temp))
K_fd = matrix_blocked_fd(K, nfreedofs(Temp))
C_ff = matrix_blocked_ff(C, nfreedofs(Temp))
T_d = gathersysvec(Temp, :d)
L_f = -K_fd * T_d

Tn = gathersysvec(Temp)
A_ff = cholesky((1 / dt * C_ff + theta * K_ff))
B_ff = (1 / dt * C_ff - (1 - theta) * K_ff)

Tn = gathersysvec(Temp, :f)
Tn1 = deepcopy(Tn)

tstart = time()
Expand All @@ -85,8 +91,8 @@ function steel_block_m()
Tn .= Tn1 # current temperature system vector

# Solve for the new temperature vector
rhs = B * Tn + L # complete right-hand side (loads)
Tn1 .= A \ rhs # compute next temperature
rhs = B_ff * Tn + L_f # complete right-hand side (loads)
Tn1 .= A_ff \ rhs # compute next temperature
push!(ts, t)
push!(center_T, Tn1[centerdof, 1][1])
if (t == tend) # Have we reached the end? If so jump out.
Expand Down

2 comments on commit 3e3da14

@PetrKryslUCSD
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/105302

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.7 -m "<description of version>" 3e3da14d571f3cdc35d9c197845a1fdddf692979
git push origin v3.0.7

Also, note the warning: Version 3.0.7 skips over 3.0.6
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

Please # to comment.