Skip to content

Instantly share code, notes, and snippets.

View liangwang0734's full-sized avatar

Liang Wang liangwang0734

  • Princeton University
View GitHub Profile

Earth_Lunar_MagnetosphereNightCarrp1m1N

  • O+ flux 极区均匀; H+ flux极区空了两块,非极区也有
  • u dot r > 0 then u=0
  • proton 表面密度是 sw_rho0.1, oxygen 表面密度是 sw_rho1e-9; sw_rho ~ 400 /cc

Earth_Lunar_MagnetosphereNightCarrp1m1N_new

  • O+ H+ fluxes太偏了

Earth_Lunar_MagnetosphereNightCarrp1m1NU

  • O+ H+ fluxes 略偏,但可以接受;但是和radius >0.5的地方箭头方位不完全一致
@liangwang0734
liangwang0734 / turbulence3d-2d-slice-full-data.ipynb
Created March 13, 2020 19:20
turbulence3d-2d-slice-full-data
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@liangwang0734
liangwang0734 / rt-5m-uniform_r70.lua
Created April 2, 2019 01:02
pair plasma, low frequency "Alfven wave", w=k*vA, small k and w;w is well resolved, none of wce and wpe is resolved; k is well resolved, none of rce and de is resolved; small k requires longer wavelength, thus longer box; perpendicular propagation, Ey, vx, Bz nonzero; vy small;
-- Gkyl ------------------------------------------------------------------------
local Moments = require("App.PlasmaOnCartGrid").Moments
local Euler = require "Eq.Euler"
local Constants = require "Lib.Constants"
local Mpi = require "Comm.Mpi"
local rank = Mpi.Comm_rank(Mpi.COMM_WORLD)
local seed = rank^2 + 3
math.randomseed(seed)
@liangwang0734
liangwang0734 / interp_along_curve.py
Created November 6, 2018 16:46
interp_along_curve.py
import numpy as np
import matplotlib as mpl
def line(p0, p1, n):
p0 = np.asarray(p0, dtype=np.float32)
p1 = np.asarray(p1, dtype=np.float32)
n = int(n)
dp = p1 - p0
l = np.linspace(0.0, 1.0, n)
dim = len(p0)
@liangwang0734
liangwang0734 / slice_sphere_gkeyll_v1_paraview_v5.5.0rc2.py
Created October 26, 2018 14:28
slice_sphere_gkeyll_v1_paraview_v5.5.0rc2.py
# trace generated using paraview version 5.5.0
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
folder = "/scratch/gpfs/lw6/mercury/test/"
fname_in = "mercury_v2_q_6.h5"
fname_out = "slice_sphere_0.xmf"
fname_img = "slice_sphere_0.png"
@liangwang0734
liangwang0734 / compare_mercury_messenger_vs_gkeyll_B_field.py
Last active October 31, 2018 17:03
compare_mercury_messenger_vs_gkeyll_B_field.py
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import matplotlib as mpl
show_on_screen = True
if not show_on_screen:
mpl.use("agg") # if not showing on screen, agg is faster
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
@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()
@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}
----------------------
-- HELPER FUNCTIONS --
----------------------
function writeData(myQ, frame, tCurr, tag)
myQ:write(string.format("%s_%d.h5", tag, frame), tCurr)
end
----------------
-- PARAMETERS --
----------------
@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()