Skip to content

Instantly share code, notes, and snippets.

using OrdinaryDiffEq, DiffEqOperators,Sundials
n = 600
M = rand(n,n)
K = rand(n,n)
ϵ = 1e-2
p = (ϵ,M,K)
u0 = ones(n)
using DiffEqOperators
using OrdinaryDiffEq
A = -10*speye(3)
M = speye(3)
num_steps = 1
function update_A(A,u,p,t)
julia> using OrdinaryDiffEq
[ Info: Precompiling OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed]
ERROR: LoadError: LoadError: LoadError: UndefVarError: @pack not defined
Stacktrace:
[1] top-level scope
[2] include at ./boot.jl:317 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1038
[4] include at ./sysimg.jl:29 [inlined]
[5] include(::String) at /home/nathanael/.julia/packages/OrdinaryDiffEq/c746g/src/OrdinaryDiffEq.jl:1
[6] top-level scope at none:0
TypeError(func=:<:, context="", expected=Type{T} where T, got=T<:Union{Float16, Float32, Float64})
rec_backtrace at /buildworker/worker/package_linux64/build/src/stackwalk.c:94
record_backtrace at /buildworker/worker/package_linux64/build/src/task.c:246
jl_throw at /buildworker/worker/package_linux64/build/src/task.c:577
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:118
jl_type_error at /buildworker/worker/package_linux64/build/src/rtutils.c:124
jl_f_issubtype at /buildworker/worker/package_linux64/build/src/builtins.c:407
tuplemerge at ./compiler/typelimits.jl:422
function locatePoint(ctx::gridContext{dim}, x::Vec{dim,T}) where {dim,T}
return locatePoint(ctx.loc, ctx.grid, x) #This call causes problems, replacing it by something else fixes things.
end
...
struct regular2DGridLocator{C} <: cellLocator where {M,N,C <: JuAFEM.Cell{2,M,N}}
nx::Int
ny::Int
LL::Tensors.Vec{2,Float64}
UR::Tensors.Vec{2,Float64}
using SharedArrays,BenchmarkTools,StaticArrays
U = SharedArray{Float64}(zeros(100,100,100))
function mytestfun(U)
function getIndices(i,j,k)
#return U[i,j,k]
return U[mod(i,3)+1,j,k]
end
uvals = @SArray [getIndices(i,j,k) for i in 1:4, j in 1:4, k in 1:4]
function build_full_finite_difference_matrix()
result = spzeros(Int64,64,64)
function to1d(i,j,k)
return i + j*4 + k*4*4
end
#Point values
for i in 0:1, j in 0:1, k in 0:1
aindex::Int64 = i + 2*j + 4*k +1
result[aindex,to1d(i+1,j+1,k+1)+1] = 8
using Plots
using PyPlot, FourierFlows
using Random: seed!
using Printf: @printf
import GeophysicalFlows.TwoDTurb
import GeophysicalFlows.TwoDTurb: energy, enstrophy, dissipation, work, drag
nx = 128 # Resolution
@natschil
natschil / TG.py
Created July 2, 2019 14:39
Minimal (non)working example
from __future__ import print_function
import warnings
from numpy import pi, zeros, sum, float64, sin, cos, prod
from spectralDNS import config, get_solver, solve
try:
import matplotlib.pyplot as plt
except ImportError:
warnings.warn("matplotlib not installed")
/** \file
* PTP handlers to extend Magic Lantern to the USB port.
*
* These handlers are registered to allow Magic Lantern to interact with
* a PTP client on the USB port.
*/
#include "dryos.h"
#include "ptp.h"
#include "ptp-extra.h"