Skip to content

Instantly share code, notes, and snippets.

View liangwang0734's full-sized avatar

Liang Wang liangwang0734

  • Princeton University
View GitHub Profile
@liangwang0734
liangwang0734 / read_1d_profile.ipynb
Created January 15, 2018 03:52
read 1d profile from Chuanfei's water world simulation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@liangwang0734
liangwang0734 / khi2d.lua
Last active June 1, 2018 20:01
2d khi cerri
-- XXX testing only; force to use 1st order Lax solver (positivity-conserving but diffusive)
alwaysUseLaxFlux = true
------------------------------------
-- 2D 10-MOMENT SIMULATION OF KHI --
------------------------------------
----------------------
-- HELPER FUNCTIONS --
----------------------
@liangwang0734
liangwang0734 / gkylFile2.py
Last active October 2, 2018 03:07
gkyl moment maxwell file reader
__all__ = ["gkylFile", "gkylFile_Moment"]
import numpy as np
import adios
import numexpr as ne
import re
import random
import string
@liangwang0734
liangwang0734 / gem5m.lua
Created October 2, 2018 15:02
gkeyll v2 gem 5m
-- Gkyl ------------------------------------------------------------------------
local Moments = require("App.PlasmaOnCartGrid").Moments
local Euler = require "Eq.Euler"
-- physical parameters
gasGamma = 5./3.
elcCharge = -1.0
ionCharge = 1.0
ionMass = 1.0
elcMass = ionMass/25.0
@liangwang0734
liangwang0734 / gem5m_gkeyll1.lua
Created October 3, 2018 14:36
gem 5m old gkeyll
-- GEM-challenge problem
Pi = Lucee.Pi
log = Lucee.logInfo
-- physical parameters
gasGamma = 5./3.
elcCharge = -1.0
ionCharge = 1.0
ionMass = 1.0
@liangwang0734
liangwang0734 / test_FiveMomentSource.lua
Created October 4, 2018 19:53
gkyl test 5m source single point
-- Gkyl ------------------------------------------------------------------------
--
-- Test for five-moment source updater
-- _______ ___
-- + 6 @ |||| # P ||| +
--------------------------------------------------------------------------------
local ffi = require "ffi"
local Unit = require "Unit"
local Grid = require "Grid"
@liangwang0734
liangwang0734 / showvalues.py
Last active October 5, 2018 01:00
test gkeyll
import h5py
import numpy
numpy.set_printoptions(precision=16)
def printValues(fname):
fp = h5py.File(fname)
field = fp["StructGridField"][...]
print(field)
fp.close()
----------------------
-- HELPER FUNCTIONS --
----------------------
function writeData(myQ, frame, tCurr, tag)
myQ:write(string.format("%s_%d.h5", tag, frame), tCurr)
end
----------------
-- PARAMETERS --
----------------
@liangwang0734
liangwang0734 / diff.patch
Last active October 11, 2018 20:57
gkeyll v1 fake vs real 2d
--- fake_2d/gkeyll_2d_fake.lua 2018-10-11 16:37:19.000000000 -0400
+++ real_2d/gkeyll_2d_real.lua 2018-10-11 16:39:50.000000000 -0400
@@ -54,10 +54,9 @@
-- domain and grid parameters
xlo, xup, nx = -8. * di0, 8. * di0, 64
ylo, yup, ny = -16. * di0, 16. * di0, 128
- zlo, zup, nz = -0.5 * di0, 0.5 * di0, 1
- lower = {xlo, ylo, zlo}
- upper = {xup, yup, zup}
- cells = {nx, ny, nz}
@liangwang0734
liangwang0734 / gkyl-5m-src-Eigen-time.patch
Created October 12, 2018 17:22
gkyl-5m-src-Eigen-time.patch
diff -r 0d6e9acd97dd App/PlasmaOnCartGrid.lua
--- a/App/PlasmaOnCartGrid.lua Fri Oct 12 11:29:08 2018 -0400
+++ b/App/PlasmaOnCartGrid.lua Fri Oct 12 13:21:32 2018 -0400
@@ -704,8 +704,10 @@
end
local tmSrc = 0.0
+ local tmSrcSol = 0.0
for _, s in pairs(sources) do
tmSrc = tmSrc + s:totalTime()