Skip to content

Instantly share code, notes, and snippets.

View BinWang0213's full-sized avatar
🙈
Life is beautiful

Bin Wang BinWang0213

🙈
Life is beautiful
View GitHub Profile
@BinWang0213
BinWang0213 / readme.md
Created March 18, 2020 00:45
OpenFoam 6.0 install on REHL 6.5 SuperMike II Cluster
@BinWang0213
BinWang0213 / CalculixRun.sh
Last active March 25, 2020 19:01
Calculix 2.13 install on REHL 6.5 SuperMike II Cluster
#!/bin/bash
#PBS -A hpc_cdss01
#PBS -q workq
#PBS -l nodes=2:ppn=16
#PBS -l walltime=30:00:00
#PBS -V
#PBS -j oe
#PBS -N TransmissionLine
#-----------------Environment setup---------------------
@BinWang0213
BinWang0213 / Openfoam_LDU2CSR
Created March 27, 2020 02:42
Code convert Openfoam internal LDU into CSR format
*
* CSR_convert.H - part of the SpeedIT Classic toolkit
* Copyright 2010 (C) Vratis Ltd
* email: support@vratis.com
*
* SpeedIT Classic toolkit is a free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
```
Solver
======
Type: FGMRES(30)
Unknowns: 4898600
Memory footprint: 2.26 G
Preconditioner
==============
Schur complement (two-stage preconditioner)
@BinWang0213
BinWang0213 / tree_dirtree.py
Created May 21, 2020 06:04
Generate latex dir tree structure
import os
def list_files(startpath):
for root, dirs, files in os.walk(startpath):
if '.git' in dirs: # don't go into any .git directories.
dirs.remove('.git')
level = root.replace(startpath, '').count(os.sep)
indent = ' ' * 4 * (level)
dirname=os.path.basename(root).replace('_','\_')
#print('{}{}{}.'.format(indent, '.%d '%(level+1),os.path.basename(root)))
@BinWang0213
BinWang0213 / GenerateSDF.cpp
Last active August 9, 2020 05:27
Paraview support for GenerateSDF.exe in InteractiveComputerGraphics/Discregrid
//
//https://github.com/InteractiveComputerGraphics/Discregrid
#include <Discregrid/All>
#include <Eigen/Dense>
#include "resource_path.hpp"
#include <string>
@BinWang0213
BinWang0213 / readme.md
Last active July 19, 2021 20:43
Install Fenics in Docker

1. Show available containers 

sudo docker ps

2. Start container with shared root in local machine  $(pwd):/media/home/Fenics/ to container root  /home/fenics/shared 

docker run --shm-size=1g -ti --name notebook -w /home/fenics -v F:/fenics/run_examples:/home/fenics/shared -d -p 127.0.0.1:8888:8888 quay.io/fenicsproject/stable 'jupyter-notebook --ip=0.0.0.0'

docker run --shm-size=1g -ti --name fenics -v F:/fenics/run_examples:/home/fenics/shared quay.io/fenicsproject/stable

notebook usage

docker inspect notebook #find ip address ip:8888

@BinWang0213
BinWang0213 / SubJobs.py
Last active August 22, 2021 11:17
Compile fenics with Intel Compiler and MPI in SuperMikeII HPC Cluster
import shutil
import glob, os
import subprocess
#Find all job files
os.chdir("./")
bash_files=[]
for file in glob.glob("*.sh"):
#print(file)
bash_files+=[file]
@BinWang0213
BinWang0213 / readme.md
Last active November 12, 2020 17:01
Docker OpenFOAM 7 usage

Install OpenFOAM7 in Docker

Install Openfoam and setup linux environment

#Download openfoam7
docker run --shm-size=1g -ti --name of7 -v F:/hybridPorousFoam/:/home/openfoam openfoam/openfoam7-paraview56

#Re-login as root user
exit
docker exec -u 0 -it of7  bash
@BinWang0213
BinWang0213 / readme.md
Last active November 18, 2020 14:27
Docker opengeosys usage

Install opengeosys in Docker

Install opengeosys and setup linux environment

#Download build system
docker run --shm-size=1g -ti --name ogs6 -v F:/ogs/:/home ogs6/gcc


#Download and build ogs
git clone --filter=blob:limit=100k -b 6.3.2 https://gitlab.opengeosys.org/ogs/ogs.git