Skip to content

Instantly share code, notes, and snippets.

View ma-sadeghi's full-sized avatar
🏠
Working from home

Amin Sadeghi ma-sadeghi

🏠
Working from home
View GitHub Profile
@ma-sadeghi
ma-sadeghi / rtl-bug
Created April 8, 2023 03:25
How to reproduce RTL bug in Obsidian
```tasks
tag includes test
hide backlink
hide edit button
```
- [ ] Test #test
- [ ] Another test #test
- [ ] Yet another test #test
@ma-sadeghi
ma-sadeghi / rfb.py
Last active September 28, 2021 15:25
RFB model by @WenRui-Lv666
"""
Created on Tue Sep 28 19:55:05 2021
@author: lv
In order to make the programming process easier, the same parameters as in the literature are used:
Sadeghi, M. A., Agnaou, M., Kok, M. et al.
Exploring the Impact of Electrode Microstructure on Redox Flow Battery Performance Using a Multiphysics
Pore Network Model [J]. Journal of The Electrochemical Society, 2019, 166(10): A2121–A2130
The only difference from the literature is that the "front" and "back" are used as the boundary of the
electrolyte inflow and outflow.
"""
@ma-sadeghi
ma-sadeghi / TestPardiso4py.ipynb
Last active December 10, 2020 14:24
Test pardiso4py's performance against scipy/umfpack's spsolve
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ma-sadeghi
ma-sadeghi / TestCupy.ipynb
Last active December 10, 2020 14:21
Test cupy's conjugate gradient performance against scipy's
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ma-sadeghi
ma-sadeghi / test.py
Created October 2, 2020 23:18
How to handle extra boundary pores added by SNOW extraction method from porespy?
def generate_network(shape, radius, ncyl, phimax, thetamax):
ws = op.Workspace()
ws.clear()
proj = ws.new_project(name='proj1')
im = psp.generators.cylinders(shape=shape, radius=radius, ncylinders=ncyl, phi_max=phimax, theta_max=thetamax)
im = psp.filters.fill_blind_pores(im)
im = psp.filters.trim_floating_solid(im)
@ma-sadeghi
ma-sadeghi / gist:591fb77cfa82d42679a8e2edeae4439e
Created July 1, 2020 00:07 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:

Problem

A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.

Investigation

@ma-sadeghi
ma-sadeghi / pnm_petsc.py
Created March 17, 2020 16:34
Diffusion in a 3D PNM on a regular lattice network
import numpy as np
import openpnm as op
from time import time
import openpnm.utils.petsc
rank = openpnm.utils.petsc.PETSc.COMM_WORLD.rank
size = openpnm.utils.petsc.PETSc.COMM_WORLD.size
np.random.seed(10)
[ 10.909] _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
[ 10.909] _XSERVTransMakeAllCOTSServerListeners: server already running
[ 10.909] (--) Log file renamed from "/var/log/Xorg.pid-1623.log" to "/var/log/Xorg.1.log"
[ 10.909]
X.Org X Server 1.20.5
X Protocol Version 11, Revision 0
[ 10.909] Build Operating System: Linux 4.4.0-165-generic x86_64 Ubuntu
[ 10.909] Current Operating System: Linux mcgill 5.3.0-23-generic #25-Ubuntu SMP Tue Nov 12 09:22:33 UTC 2019 x86_64
[ 10.909] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.3.0-23-generic root=UUID=ab778d32-5ce1-4c38-a14e-2024d96eb5d3 ro quiet splash vt.handoff=7
[ 10.909] Build Date: 08 October 2019 09:43:30AM
""" last edited Thur Oct 3 : achieving mercury curve of third model (a 100*80 2D)
##----------------------------------------------------------------------------
import openpnm as op
import scipy as sp
from math import pi
import matplotlib.pyplot as plt
import pore_size_normal
##Network----------------------------------------------------------------------
pn=op.network.Cubic(shape=[100,80,1],spacing=0.00001) #SI unit: meter
##Geometry---------------------------------------------------------------------