Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

# Balaje K Balaje

🎯
Focusing
Last active July 24, 2016 15:04
View ff++.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* Solve the poisson problem on a circle with homogeneous boundary conditions and f = x*y NOTE : The extension .cpp is used only for illustration in github gists as syntax highlighting is not available for FreeFEM++. The actual extension for FreeFEM++ is .edp. If you want to run the file, download it as ff++.edp and run it.
Created March 28, 2021 12:58
Julia code to extract the coefficients of the heat equation.
View poisson.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 using ModelingToolkit @parameters x y z @variables u(..) # Need to choose u but user can pass the argument Dx=Differential(x) Dy=Differential(y) Dz=Differential(z) Dxx=Differential(x)^2
Last active July 2, 2021 06:20
SymbolicUtils Test
View ruletest.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 using ModelingToolkit using SymbolicUtils @syms w x y z # Rule using exp rexp=@rule exp(~~xs) => ~~xs A=rexp(exp(10*sin(w)+exp(z))) # Returns 10*sin(w)+exp(z) # Rule using Differential
Last active July 9, 2021 13:24
Complex Plots with UnicodePlots.jl
View phaseportrait_unicode.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 using UnicodePlots using ComplexPhasePortrait nx = 1000 x = range(-1, stop=1, length=nx) Z = x' .+ reverse(x)*im f = z -> (z - 0.5im)^2 * (z + 0.5+0.5im)/z fz = f.(Z)
Last active August 14, 2021 07:52
Julia program to verify the convergence rate of mixed DG method for biharmonic equation
View dgmethod.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 using Gridap using Plots using Gridap: ∇ using Gridap: Δ using LinearAlgebra using Gridap: mean # Define the manufactured solution u(x) = 1000*(x[1]^4*(1-x[1])^4*x[2]^4*(1-x[2])^4*x[3]^4*(1-x[3])^4)
Created July 29, 2021 10:21
Mixed DG method for Biharmonic equation using FreeFem
View mixed_dg_freefem.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* Program to solve the Biharmonic equation \Delta^2 u = f(x,y) in \Omega with u = \Grad u.n = 0 on boundary */ include "getARGV.idp" load "Element_P3dc" load "Element_P4dc" load "Element_P4" verbosity = 0.;
Last active August 20, 2021 12:58
Interpolation Algorithm in Gridap
View blog-script.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 using Pkg Pkg.add("Gridap") Pkg.add("StaticArrays") Pkg.add("Random") using Gridap using Gridap.Algebra using Gridap.CellData using Gridap.Fields using Gridap.Arrays
Last active October 22, 2021 03:17
Last active January 20, 2023 08:12
Julia script to solve a Hamilton Jacobi Equation using the Rouy and Tourin Scheme.
View PlotSolution.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function PlotSolution(fontsize) fig = Figure(fontsize=fontsize, resolution=(1000,700)) ax1 = GLMakie.Axis(fig[1, 1]); ax2 = GLMakie.Axis3(fig[1, 2]); ax3 = GLMakie.Axis3(fig[2, 1]); ax4 = GLMakie.Axis3(fig[2, 2]); image!(ax1, x, y, collect(imrotate(img,π/2))) GLMakie.surface!(ax2, x[2:end-1], y[2:end-1], -0.8*U[2:end-1,2:end-1], colormap=(:gray,:gray),