Needs["pkg`"] is only evaluated for the first time!
Initialize the notebook:
If[Length[Names["`*"]]>0,Remove["`*"]];
If[$InputFileName === "",
SetDirectory[NotebookDirectory[]],
SetDirectory[DirectoryName[$InputFileName]]
];
Plot:
PlotBasicStyle[width_]:=Sequence[PlotTheme->{"Scientific","Monochrome"},
BaseStyle->{FontSize->10,FontFamily->"Times"},
LabelStyle->{FontSize->10,FontFamily->"Times"},
ImageSize->width/2.54*100,
AspectRatio->1/GoldenRatio
];
PlotExport[file_,plot_,width_]:=Module[{dir},
dir=DirectoryName[file];
dir=If[dir==="",NotebookDirectory[],dir];
If[!DirectoryQ[dir],CreateDirectory[dir,CreateIntermediateDirectories->True]];
Export[file,plot,ImageResolution->600,RasterSize->Round[width/2.54*600],Background->None]
];
figNum=1;
figWidth=8;
plot[figNum]=Plot[Sin[x],{x,0,1},Evaluate[PlotBasicStyle[figWidth]]]
PlotExport["plot.png",plot[figNum],figWidth];
Collect coefficients:
Collect[eq,{Cos[_],Sin[_],a[_],b[_]},Simplify]
Vscode setting:
{
"wolfram.systemKernel": "/usr/local/Wolfram/WolframEngine/14.3/Executables/WolframKernel",
"wolfram.systemKernel": "/usr/local/Wolfram/Wolfram/14.3/Executables/WolframKernel",
"[wolfram]": {"editor.formatOnSave": false},
}
Matlab install in linux:
sudo apt install unrar
unrar x MathWorks.part1.rar
xhost +SI:localuser:root
sudo -H ./install
xhost -SI:localuser:root
Add matlab app:
sudo vim /usr/share/applications/matlab.desktop
[Desktop Entry]
Type=Application
Terminal=False
Exec=/usr/local/MATLAB/R2025b/bin/matlab -desktop
Name=MATLAB R2025b
Icon=/usr/local/MATLAB/R2025b/ui/install/installer_login/images/bg_global_logo.jpg
sudo chmod +x /usr/share/applications/matlab.desktop
OpenFOAM install in linux:
#!/bin/bash
cd $HOME/OpenFOAM/
sudo rm -rf OpenFOAM-v2512
sudo tar -xzf OpenFOAM-v2512.tgz
sudo rm -rf ThirdParty-v2512
sudo tar -xzf ThirdParty-v2512.tar.gz
sudo chmod -R 777 OpenFOAM-v2512
sudo chmod -R 777 ThirdParty-v2512
cd OpenFOAM-v2512
source ./etc/bashrc
foamSystemCheck
./Allwmake -with-bear -j 4 -s -q -l
alias of2512='source ~/openfoam/OpenFOAM-v2512/etc/bashrc'
Test dynamicMeshDict:
#!/bin/bash
foamCleanTutorials
blockMesh
moveDynamicMesh -noFunctionObjects
Apply linear motion before rotational motion to make rotational origin attached to the body.
Paraview install in linux:
sudo apt-get install libxcb-cursor-dev
Add paraview app:
sudo vim /usr/share/applications/paraview.desktop
[Desktop Entry]
Version=1.0
Name=ParaView 6.0.1
Exec=$HOME/paraview/ParaView/bin/paraview
Terminal=false
Icon=$HOME/paraview/ParaView-6.0.1/share/icons/hicolor/96x96/apps/paraview.png
Type=Application
sudo chmod +x /usr/share/applications/paraview.desktop
The interfaceHeight position can not overlap the decomposeParDict mesh boundaries!
Git config:
git config --global user.name "Peng Peng"
git config --global user.email "211110103110@stu.just.edu.cn"
Git uppercase to lowercase:
git mv Uppercase lowercase
Compress pdf:
ghostscript -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH \
-sOutputFile=out.pdf file.pdf
Convert mp4 to gif:
ffmpeg -i file.mp4 file.gif
Proxy for WSL2:
export all_proxy="socks5://$(awk '/nameserver/ {print $2}' /etc/resolv.conf):${Port:-7890}"
git config --global proxy.https "${all_proxy:-}"
Vscode proxy setting:
{
"http.proxyStrictSSL": false,
"http.proxy": "http://ipconfig-IPv4 Address:7890",
}
mpirun test:
mpirun -np 4 hostname
For desktop, WSL2 mirror network may affect mpirun!
Unable to mount: wrong fs type
sudo apt install ntfs-3g
sudo ntfsfix -d /dev/sda3
Convert tikz to png:
#!/bin/bash
tikz2png(){
local filename=$1
local page=$2
local outname=$3
convert -density 600 -units pixelsperinch -quality 100 -alpha remove "$filename.pdf[$page]" -trim "$outname.png"
}
# source ../../template/tikz.sh
tikz2png pde-tikz 0 transport-equation
\documentclass[tikz]{standalone}
\tikzstyle{basic}=[font=\fontsize{8}{10}\selectfont]
\begin{document}
% Fig. 1: transport equation
\begin{tikzpicture}[basic]
\end{tikzpicture}
\end{document}
\documentclass{article}
% \usepackage{import}
% \import{../template/}{article}
\usepackage{amsmath} % math formulas
\usepackage{amsthm} % proof
\usepackage{amssymb} % \mathbb{R}
\usepackage{mathtools} % dcases
\usepackage{graphics} % \includegraphics
\usepackage{float} % figure[H]
\usepackage{booktabs} % three-line table
\usepackage{biblatex} % \autocite{}
\usepackage[left=1.57cm,right=1.57cm,top=0.95cm,bottom=2.54cm]{geometry}
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}{Definition}[section]
\theoremstyle{definition}
\newtheorem{example}{Example}[section]
\newtheorem{exercise}{Exercise}[section]
\addbibresource{../Library.bib}
\title{Partial Differential Equations}
\author{Peng Peng}
\date{Created: March 22 2026, Version: \today}
\begin{document}
\maketitle
\tableofcontents
\section{Four Fundamental Linear PDEs}
\printbibliography
\end{document}
Vscode config:
sudo apt install gdb
Display raw fields codes: Alt + F9
OBS setting:
settings -> Video -> General:
Base and Output Resolution: 2560*1440;
Common FPS Values: 10
settings -> Output -> Recording:
Recording Format: MPEG-4 (.mp4);
Recording Quality: High Quality, Medium File Size