This file contains hidden or 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 PyPlot | |
| using ADCMEKit | |
| NT = 2000 | |
| n = 100 | |
| Δt = 1.0/NT | |
| Δx = 1/n | |
| method = "Central" |
This file contains hidden or 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
| std::string survey_fname; | |
| std::string dir(__FILE__); | |
| dir = dir.substr(0, dir.find_last_of("\\/")); |
This file contains hidden or 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
| for n in 50 60 70 80 90 100 | |
| do | |
| julia euro_main.jl $n 2>&1 | tee -a euro$n.log & | |
| done | |
| wait %1 %2 %3 %4 %5 %6 | |
| for n in 50 70 90 110 130 150 | |
| do | |
| julia flap_main.jl $n 2>&1 | tee -a flap$n.log & |
This file contains hidden or 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 LinearAlgebra | |
| using PyPlot | |
| using SparseArrays | |
| # https://uu.diva-portal.org/smash/get/diva2:1148496/FULLTEXT01.pdf page 8 | |
| # https://regulation.pstat.ucsb.edu/sites/sa-wcmf6/5-Peng_ECIR_Model_Qidi.pdf page 13 | |
| # params | |
| r0 = 0.5 | |
| L = 4.0 | |
| a = 1.0 |
This file contains hidden or 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
| # modified version from http://edwardlib.org/tutorials/ | |
| from tensorflow_probability import edward2 as ed | |
| import tensorflow as tf | |
| import tensorflow_probability as tfp | |
| import numpy as np | |
| def logistic_regression(features): | |
| coeffs = ed.Normal(loc=0., scale=1., | |
| sample_shape=features.shape[1], name="coeffs") | |
| outcomes = ed.Bernoulli(logits=tf.tensordot(features, coeffs, [[1], [0]]), |
This file contains hidden or 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 TensorFlow | |
| num_layers = 3 # number of hidden layer | |
| nh = 20 # number of neurons per hidden layer | |
| """ | |
| neural(x, scope="default", reuse=false) | |
| A Multilayer Perceptron with `num_layers` hidden layers. The last layer is a linear layer. | |
| The neural network is enough to perform many useful approximations | |
| """ |
This file contains hidden or 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 1D wave equation with ABC | |
| using PyPlot | |
| using Plots | |
| using LinearAlgebra | |
| N = 100 | |
| x = LinRange(-1.,1.,N+1) | |
| Δx = x[2]-x[1] | |
| NT = 200 |
This file contains hidden or 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
| # This example solves the plane stress problem | |
| # E/(2(1+ν)) ∇^2 u_1 + E/(2(1-ν)) * ∂/∂x ( ∂u_1/∂x + ∂u_2/∂y ) = f1 | |
| # E/(2(1+ν)) ∇^2 u_2 + E/(2(1-ν)) * ∂/∂y ( ∂u_1/∂x + ∂u_2/∂y ) = f2 | |
| # Exact solution = sin(πx)sin(πy) | |
| # f1, f2, σ can be evaluated analytically | |
| using LinearAlgebra | |
| using PyPlot | |
| import Plots |
This file contains hidden or 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
| # This is an example of solving the Poisson problem using the Assembler Programming method | |
| # (-Δ) u(x) = f(x) | |
| # u(x) = 0, x ∈ [0,1]^2 | |
| # The exact solution is u(x,y) = sin(pi*x)sin(pi*y) | |
| # and f(x,y) = 2pi^2 * sin(pi*x)sin(pi*y) | |
| using PyPlot | |
| import Plots | |
| using PyCall | |
| using SparseArrays |
NewerOlder