Skip to content

Commit

Permalink
update thermal transient
Browse files Browse the repository at this point in the history
  • Loading branch information
HelgeGehring committed Oct 19, 2023
1 parent 1b65026 commit 412c3d0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
28 changes: 14 additions & 14 deletions docs/julia/heater_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GridapPETSc.with(args = split(options)) do
Dict(get_tag_from_name(labels, u) => v for (u, v) in electrical_conductivity)
ϵ_electrical_conductivity(tag) = electrical_conductivity[tag]

boundary_conditions = Dict(["metal3#e1___None" => 1, "metal3#e2___None" => 0.0])
boundary_conditions = Dict(["metal3#e1___None" => 0.4, "metal3#e2___None" => 0.0])

p0 = compute_potential(
ϵ_electrical_conductivity τ,
Expand Down Expand Up @@ -125,23 +125,23 @@ GridapPETSc.with(args = split(options)) do
uₕₜ = calculate_temperature_transient(
ϵ_conductivities τ,
ϵ_diffisitivities τ,
power_density(p0) * 0,
power_density(p0),
temperatures,
temperature(T0),
temperature(T0) * 0,
.5e-6,
2e-5,
3e-5,
solver = PETScLinearSolver(),
)

createpvd("poisson_transient_solution") do pvd
for (uₕ, t) in uₕₜ
pvd[t] = createvtk(
Ω,
"poisson_transient_solution_$t" * ".vtu",
cellfields = ["u" => uₕ],
)
end
end
#createpvd("poisson_transient_solution") do pvd
# for (uₕ, t) in uₕₜ
# pvd[t] = createvtk(
# Ω,
# "poisson_transient_solution_$t" * ".vtu",
# cellfields = ["u" => uₕ],
# )
# end
#end

Ω_w = Triangulation(model, tags = "core")
dΩ_w = Measure(Ω_w, 1)
Expand All @@ -152,5 +152,5 @@ GridapPETSc.with(args = split(options)) do

t, s = getindex.(sums, 1), getindex.(sums, 2)
lines!(ax, t * 1e3, s)
display(figure)
#display(figure)
end
8 changes: 3 additions & 5 deletions src/Thermal/Thermal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ function calculate_temperature_transient(
m₀(u, v) = (thermal_conductivity / thermal_diffusitivity * u * v)dΩ
a₀(u, v) = (thermal_conductivity * ((u) (v)))dΩ

if typeof(power_density) == Function
op_C = if typeof(power_density) <: Function
println("function!")
b₀(t, v) = (power_density(t) * v)dΩ
op_C = TransientConstantMatrixFEOperator(m₀, a₀, b₀, U, V)
TransientConstantMatrixFEOperator(m₀, a₀, (t, v) -> (power_density(t) * v)dΩ, U, V)
else
b(v) = (power_density * v)dΩ
op_C = TransientConstantFEOperator(m₀, a₀, b, U, V)
TransientConstantFEOperator(m₀, a₀, v -> (power_density * v)dΩ, U, V)
end

θ = 0.5
Expand Down

0 comments on commit 412c3d0

Please sign in to comment.