0%

色散方程

射流线性稳定性中色散方程(Dispersion relation)是描述射流受到扰动时,时间扰动增长率和空间扰动增长率的关系。假设粘性射流受到轴向波数为 \(k\) 、周向阶数为 \(n\)、时间增长率为 \(\omega\) 的扰动,粘性相关无量纲数为 \(Oh\),则色散方程的无量纲形式 \(D(Oh;k,n,\omega)=0\) 如下所示 \[ \begin{equation}\label{eq1} \begin{vmatrix} D_{11} & D_{12} & D_{13} \\ 2\mathrm{i}kI_n^\prime(k) & -\frac{l^2}{k^2}I_n^\prime(l)-I_{n+1}(l) & \frac{l^2}{k^2}I_n^\prime(l)+I_{n-1}(l) \\ 2\mathrm{i}n[kI_n^\prime(k)-I_n(k)] & lI_{n+2}(l) & lI_{n-2}(l) \end{vmatrix} = 0, \end{equation} \]

阅读全文 »

Gerris 是一款用于求解流体流动的软件包,能够准确描述两相流界面形变。其源码采用 C 语言编译,因此 Gerris 脚本可以内嵌标准的 C 语言函数。本文介绍如何写一个简单的 Gerris 脚本,原文请见。注意,请确保你已经安装了 Gerris,安装教程可参考我的之前博客。由于 Gerris 在类 Unix 平台下运行,因此你需要熟悉类 Unix 的基本命令。

一个简单的脚本文件

Gerris 输入脚本由模拟域网格划分与初始条件边界条件固体边界输出内容控制参数与数值算法几部分组成。注意,Gerris 中求解的是无量纲化NS 方程,所有物理量都是无量纲的,默认粘度、表面张力等量为 0。

以下以一个初始随机涡量的例子说明 Gerris 脚本。在命令窗口输入以下命令新建vorticity.gfs脚本:

阅读全文 »

在 NS 方程中,常常会涉及标量向量张量。比如压力 \(p\) 为标量,速度 \(\boldsymbol{u}\) 为向量,剪切应力 \(\boldsymbol{\tau}\) 为张量。考虑三维体系,则标量为 \(1\times1\) 的 0 维矩阵,向量为 \(3\times1\) 的 1 维矩阵,二维张量为 \(3\times3\) 的 2 维矩阵。矢量运算涉及梯度运算和散度运算,还有旋度计算,下图展示了一些矢量之间关系。本文列举三种坐标系下 NS 方程中常见的矢量运算表达式,主要参考 Jens Eggers 书籍《Singularities Formation, Structure, and Propagation》中附录 A。

矢量计算
阅读全文 »

This is a series of lecture notes on the advanced fluid dynamics. This original lectures see here. This blog introduces how to find scaling and similarity parameters relevant to a problem at hand. Normalization by these scales leads to dimensionless parameters which represent the relative importance of various parts of the full equations. Depending on the magnitudes of these parameters, suitable approximations can be devised which can lead to answers that capture the essence of the problem. As an illustration we use the incompressible fluid of constant density to explain this philosophy and approach.

阅读全文 »

许多物理问题,比如风刮过山脉、船在海上行驶等,本文主要无量纲化动量方程

单相 NS 方程

标准方程

单相粘性不可压 NS 方程可表示为 \[ \begin{equation}\label{eq1} \rho \left( \frac{\partial \boldsymbol{u}}{\partial t} + (\boldsymbol{u}\cdot\nabla) \boldsymbol{u} \right) = -\nabla p + \mu \nabla^2\boldsymbol{u} + \boldsymbol{F}, \end{equation} \]

阅读全文 »

This is a series of my lecture notes about English writing. The English writing lessons are on Bilibili. This blog is the second lecture note about how to write an email in English.

A email starts with a greeting such as Dear Lina. Then you should explain why you are writing. Usually, a single sentence is OK. Next you need add details to your topic in a short paragraph. Finally, adding a call to action to your email and an appropriate sign-off is necessary.

阅读全文 »

This is a series of my lecture notes about English writing. The English writing lessons are on Bilibili. This blog is the first lecture note about how to improve your English writing.

Before your writing, you need know what you write for or what you want to achieve. Then you need plan your writing. What idea you should include and what idea you need leave out? You need know your goal and what your reader need. Next you need organize your ideas into clear paragraphs. Usually one main idea is in per paragraph. Cutting empty words and sentences, as well as using short simple sentence where possible (about 10 words in a sentence) are a good habit. Finally, it's important to put your subject at the start of the sentence.

阅读全文 »

移动用户目录

  • 在 D 盘新建mv.bat文件,mv.bat文件如下代码所示
  • win键+R 打开运行,输入shutdown -O -r -t 0进入 OOBE
  • 进入疑难解答,命令行窗口
  • 进入 D 盘,运行mv.bat
1
2
3
4
@echo off
robocopy "C:\\Users" "D:\\Users" /E /COPYALL /XJ /XD WindowsApps
rmdir "C:\\Users" /S /Q
mklink /J "C:\\Users" "D:\\Users"

Windows UI 和控制台字体设置

  • 右键为所有用户安装MSYHMONO.ttf字体
  • 运行font.regconsole.regcontextmenu.regconsole.bat

font.reg如下,用于设置某些软件 UI (如 Mendeley,Ansys 等)字体

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Windows Registry Editor Version 5.00

;; 字体设置

[HKEY_CLASSES_ROOT\MIME\Database\Codepage\936]
"FixedWidthFont"="Microsoft YaHei Mono"
"ProportionalFont"="Microsoft YaHei Mono"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Codepage\936]
"FixedWidthFont"="Microsoft YaHei Mono"
"ProportionalFont"="Microsoft YaHei Mono"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]
"GUIFont.Facename"="Microsoft YaHei UI"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]
"GUIFont.Facename"="Microsoft YaHei UI"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FontAssoc\Associated DefaultFonts]
"AssocSystemFont"="msyh.ttc"
"FontPackage"="微软雅黑"
"FontPackageDontCare"="微软雅黑"
"FontPackageRoman"="微软雅黑"
"FontPackageSwiss"="微软雅黑"
"FontPackageModern"="微软雅黑"
"FontPackageScript"="微软雅黑"
"FontPackageDecorative"="微软雅黑"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FontAssoc\Associated DefaultFonts]
"AssocSystemFont"="msyh.ttc"
"FontPackage"="微软雅黑"
"FontPackageDontCare"="微软雅黑"
"FontPackageRoman"="微软雅黑"
"FontPackageSwiss"="微软雅黑"
"FontPackageModern"="微软雅黑"
"FontPackageScript"="微软雅黑"
"FontPackageDecorative"="微软雅黑"

console.reg文件如下,用于设置cmd/powershell窗口字体与大小

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Windows Registry Editor Version 5.00

;; 控制台设置

; 设置 命令提示符/PowerShell 窗口字体与大小
[HKEY_CURRENT_USER\Console]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 120*25, 20十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明

; 设置 PowerShell(x86) 窗口字体与大小
[HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 25*120, 25十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明


; 设置 PowerShell 窗口字体与大小
[HKEY_CURRENT_USER\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe]
"FaceName"="Microsoft YaHei Mono"
"FontSize"=dword:00120000; 18 号字体, 18十六进制为0012
"WindowSize"=dword:00190078; 25*120, 25十六进制为0019, 100十六进制为0078
"WindowAlpha"=dword:000000e6; 90% 透明

contextmenu.reg如下,设置右键cmd 此处打开命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Windows Registry Editor Version 5.00

;; 右键命令行窗口菜单

; 在此处打开命令窗口(&W)
[-HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd]
@="@shell32.dll,-8506"
"Extended"=""
"NoWorkingDirectory"=""
"Icon"="C:\\Windows\\System32\\cmd.exe, 0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="cmd.exe /s /k pushd \"%V\""

; 以管理员身份打开命令窗口(&A)
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
"ShowBasedOnVelocityId"=dword:00639bc8
"Extended"=""
"Icon"="C:\\Windows\\System32\\cmd.exe ,0"
"MUIVerb"="以管理员身份打开命令窗口(&A)"

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

console.bat如下。用于修复右键开始菜单打开命令窗口异常。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@echo off
chcp 65001
echo 删除 PowerShell 快捷方式

del "%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell.lnk"
del "%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell (x86).lnk"

echo 创建 PowerShell 快捷方式

set PWS=powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile

set TARGET='%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe'
set SHORTCUT='%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell.lnk'
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%SHORTCUT%); $S.TargetPath = %TARGET%; $S.Save()"

set TARGET='%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe'
set SHORTCUT='%AppData%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell\Windows Powershell (x86).lnk'
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%SHORTCUT%); $S.TargetPath = %TARGET%; $S.Save()"

pause

Windows 相关优化

在使用 LAMMPS 构建模型时,有时需要在主组分原子中随机替换为其他种类原子。比如 Fe 的 10×20×30 晶格中 15% Ni 被替换,可以通过以下方式进行替换。以下使用的脚本和文件见百度云盘,提取码 ei4i。推荐使用 LAMMPS 内建 shell+Python 命令替换。

set type/fraction 命令

set type/fraction是 LAMMPS 的内建命令,可以指定选中类型的原子一部分为另一种原子,用法如下:

1
set type type-1-ID type/fraction type-2-ID fraction seed

以上表示type-1-ID类型的原子中有fraction比例被替换成type-2-ID类型原子。比如我们实现上述 Fe 晶格中部分被替换成 Ni,LAMMPS 脚本(test.in)如下:

阅读全文 »