Skip to content

Commit

Permalink
addressed feedback from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
quffaro committed Feb 14, 2024
1 parent 485d2a8 commit fcc53d1
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .buildkite/jobscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ echo "Running Tests..."
julia --project -e 'using Pkg; Pkg.status(); Pkg.test()'

echo "Building Documentation..."
julia -t 32 --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.status(); Pkg.instantiate(); include("docs/make.jl")'
julia -t 16 --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.status(); Pkg.instantiate(); include("docs/make.jl")'
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:

- label: ":scroll: Build docs and run tests"
command:
- "srun --cpus-per-task=32 --mem=8G --time=1:00:00 --output=.buildkite/build_%j.log --unbuffered .buildkite/jobscript.sh"
- "srun --cpus-per-task=16 --mem=8G --time=1:00:00 --output=.buildkite/build_%j.log --unbuffered .buildkite/jobscript.sh"
env:
JULIA_PROJECT: "docs/"

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/toolbox/dryrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
# check if we are in a valid git repository
REPO=`git rev-parse --show-toplevel`
if [[ ! $REPO ]]; then
echo "badness"
echo "We are not in a valid git repo $(pwd)"
exit 1
fi

Expand Down
4 changes: 2 additions & 2 deletions .buildkite/toolbox/srun.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
srun --cpus-per-task=32 \
srun --cpus-per-task=16 \
--mem=8G \
--time=1:00:00 \
--output=.buildkite/log_%jl.log \
--output=.buildkite/build_%j.log \
--unbuffered \
.buildkite/jobscript.sh
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Catlab = "0.15, 0.16"
CombinatorialSpaces = "0.5, 0.6"
ComponentArrays = "0.15"
DataStructures = "0.18.13"
DiagrammaticEquations = "0.1.2"
Distributions = "0.25"
FileIO = "1.16"
GeometryBasics = "0.4.2"
Expand Down
46 changes: 24 additions & 22 deletions examples/chemistry/brusselator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ using Decapodes
using MLStyle
using OrdinaryDiffEq
using LinearAlgebra
using CairoMakie
using Logging
using JLD2
using Printf
using CairoMakie
import CairoMakie: wireframe, mesh, Figure, Axis
using ComponentArrays


using GeometryBasics: Point2, Point3
Point2D = Point2{Float64}
Point3D = Point3{Float64}
Expand Down Expand Up @@ -59,7 +61,7 @@ s[:point] = map(x -> scaling_mat*x, s[:point])
s[:edge_orientation] = false
orient!(s)
# Visualize the mesh.
CairoMakie.wireframe(s)
wireframe(s)
sd = EmbeddedDeltaDualComplex2D{Bool,Float64,Point2D}(s)
subdivide_duals!(sd, Circumcenter())

Expand Down Expand Up @@ -93,7 +95,7 @@ end
F₁ = map(sd[:point]) do (x,y)
(x-0.3)^2 + (y-0.6)^2 (0.1)^2 ? 5.0 : 0.0
end
CairoMakie.mesh(s, color=F₁, colormap=:jet)
mesh(s, color=F₁, colormap=:jet)

# TODO: Try making this sparse.
F₂ = zeros(nv(sd))
Expand All @@ -113,14 +115,14 @@ fₘ = sim(sd, generate)

# Create problem and run sim for t ∈ [0,tₑ).
# Map symbols to data.
u₀ = ComponentArrays(U=U, V=V, One=One)
u₀ = ComponentArray(U=U, V=V, One=One)

# Visualize the initial conditions.
# If GLMakie throws errors, then update your graphics drivers,
# or use an alternative Makie backend like CairoMakie.
fig_ic = CairoMakie.Figure()
p1 = CairoMakie.mesh(fig_ic[1,2], s, color=u₀.U, colormap=:jet)
p2 = CairoMakie.mesh(fig_ic[1,3], s, color=u₀.V, colormap=:jet)
# or use an alternative Makie backend like
fig_ic = Figure()
p1 = mesh(fig_ic[1,2], s, color=u₀.U, colormap=:jet)
p2 = mesh(fig_ic[1,3], s, color=u₀.V, colormap=:jet)

tₑ = 11.5

Expand All @@ -136,14 +138,14 @@ soln = solve(prob, Tsit5())
@save "brusselator.jld2" soln

# Visualize the final conditions.
CairoMakie.mesh(s, color=soln(tₑ).U, colormap=:jet)
mesh(s, color=soln(tₑ).U, colormap=:jet)

# BEGIN Gif creation
begin
frames = 100
fig = CairoMakie.Figure(resolution = (1200, 800))
p1 = CairoMakie.mesh(fig[1,2], s, color=soln(0).U, colormap=:jet, colorrange=extrema(soln(0).U))
p2 = CairoMakie.mesh(fig[1,4], s, color=soln(0).V, colormap=:jet, colorrange=extrema(soln(0).V))
fig = Figure(resolution = (1200, 800))
p1 = mesh(fig[1,2], s, color=soln(0).U, colormap=:jet, colorrange=extrema(soln(0).U))
p2 = mesh(fig[1,4], s, color=soln(0).V, colormap=:jet, colorrange=extrema(soln(0).V))
ax1 = Axis(fig[1,2], width = 400, height = 400)
ax2 = Axis(fig[1,4], width = 400, height = 400)
hidedecorations!(ax1)
Expand Down Expand Up @@ -172,7 +174,7 @@ s = loadmesh(Icosphere(5))
s[:edge_orientation] = false
orient!(s)
# Visualize the mesh.
CairoMakie.wireframe(s)
wireframe(s)
sd = EmbeddedDeltaDualComplex2D{Bool,Float64,Point3D}(s)
subdivide_duals!(sd, Circumcenter())

Expand Down Expand Up @@ -201,7 +203,7 @@ end
F₁ = map(sd[:point]) do (_,_,z)
z 0.8 ? 5.0 : 0.0
end
CairoMakie.mesh(s, color=F₁, colormap=:jet)
mesh(s, color=F₁, colormap=:jet)

# TODO: Try making this sparse.
F₂ = zeros(nv(sd))
Expand All @@ -220,14 +222,14 @@ fₘ = sim(sd, generate)

# Create problem and run sim for t ∈ [0,tₑ).
# Map symbols to data.
u₀ = ComponentArrays(U=U, V=V, One=One)
u₀ = ComponentArray(U=U, V=V, One=One)

# Visualize the initial conditions.
# If GLMakie throws errors, then update your graphics drivers,
# or use an alternative Makie backend like CairoMakie.
fig_ic = CairoMakie.Figure()
p1 = CairoMakie.mesh(fig_ic[1,2], s, color=u₀.U, colormap=:jet)
p2 = CairoMakie.mesh(fig_ic[1,3], s, color=u₀.V, colormap=:jet)
fig_ic = Figure()
p1 = mesh(fig_ic[1,2], s, color=u₀.U, colormap=:jet)
p2 = mesh(fig_ic[1,3], s, color=u₀.V, colormap=:jet)
display(fig_ic)

tₑ = 11.5
Expand All @@ -244,14 +246,14 @@ soln = solve(prob, Tsit5())
@save "brusselator_sphere.jld2" soln

# Visualize the final conditions.
CairoMakie.mesh(s, color=soln(tₑ).U, colormap=:jet)
mesh(s, color=soln(tₑ).U, colormap=:jet)

# BEGIN Gif creation
begin
frames = 800
fig = CairoMakie.Figure(resolution = (1200, 1200))
p1 = CairoMakie.mesh(fig[1,1], s, color=soln(0).U, colormap=:jet, colorrange=extrema(soln(0).U))
p2 = CairoMakie.mesh(fig[2,1], s, color=soln(0).V, colormap=:jet, colorrange=extrema(soln(0).V))
fig = Figure(resolution = (1200, 1200))
p1 = mesh(fig[1,1], s, color=soln(0).U, colormap=:jet, colorrange=extrema(soln(0).U))
p2 = mesh(fig[2,1], s, color=soln(0).V, colormap=:jet, colorrange=extrema(soln(0).V))
Colorbar(fig[1,2])
Colorbar(fig[2,2])

Expand Down
47 changes: 24 additions & 23 deletions src/canon/Physics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,30 @@ end)
end
)

# @docapode(:OutgoingLongwaveRadiation
# ,"https://www.google.com"
# ,"desc"
# ,:outgoing_longwave_radiation
# ,begin
# (Tₛ, OLR)::Form0
# (A,B)::Constant

# OLR == A .+ (B .* Tₛ)
# end
# )

# @docapode("Heat Transfer"
# ,"https://www.google.com"
# ,"desc"
# ,"heat_transfer"
# ,begin
# (HT, Tₛ)::Form0
# (D,cosϕᵖ,cosϕᵈ)::Constant

# HT == (D ./ cosϕᵖ) .* ⋆(d(cosϕᵈ .* ⋆(d(Tₛ))))
# end
# )
## TODO
@docapode("Outgoing Longwave Radiation"
,"https://www.google.com"
,""
,:outgoing_longwave_radiation
,begin
(Tₛ, OLR)::Form0
(A,B)::Constant

OLR == A .+ (B .* Tₛ)
end
)

@docapode("Heat Transfer"
,"https://www.google.com"
,""
,:heat_transfer
,begin
(HT, Tₛ)::Form0
(D,cosϕᵖ,cosϕᵈ)::Constant

HT == (D ./ cosϕᵖ) .* (d(cosϕᵈ .* (d(Tₛ))))
end
)

@docapode(Schoedinger
,"https://en.wikipedia.org/wiki/Schrodinger_equation"
Expand Down

0 comments on commit fcc53d1

Please sign in to comment.