Faq

在曙光超算中使用

基本使用方法

  • 在曙光超算中,已发布版本位于/work/share/ac21ujhbvo/local/mesospire/,用户可查看目录获取最新版本。
  • 激活方式为source /work/share/ac21ujhbvo/local/mesospire/20xxxxxx/env.sh
  • 运行mesospire_info可以确认程序中包含最新版本更新信息。

1. 参数输入及输入文件创建

mesospire_shell 提供两种不同输入格式,一种是yaml格式,一种是json格式,用户可以根据自己的喜好选择其中一种格式。下面的例子中,我们将展示两种格式的输入文件。
config.yaml
omp_threads: 64
# 指定采用zjdev中的合金凝固模块
type: AlloySolidification
# 输出结果路径
path: results/NiAlTa-solidification-varD-1
# 是否覆盖已有输出结果
clear: true

# 定义所含元素,最后一个为溶剂
elements: [AL, TA, NI]

mesh:
  nx: 150
  ny: 150
  nz: 1
  dx: 5.0e-07
  dt: 1.0e-06
  current_time: 0
  simulation_time: 100

parameter:
  T: 1649.85
  P: [1.64e-07, 6.69e-08]
  Vm: 1.0e-05
  mu: 6.02e-10
  sigma: 0.3
  eta: 2.5e-06

phase:
  # 液相的能量及扩散系数输入
  liquid:
    type: MultiComponentCustomPhase
    name: liquid
    element: [AL, TA]
    gibbs_energy:
      type: NiAlTaLIQUIDGibbsEnergy
    diffusion_potential:
      type: NiAlTaLIQUIDDiffusionPotential
    diffusivity:
      type: NiAlTaLIQUIDDiffusivity

  # 固相的能量及扩散系数输入
  solid:
    type: MultiComponentCustomPhase
    name: solid
    element: [AL, TA]
    gibbs_energy:
      type: NiAlTaFCCGibbsEnergy
    diffusion_potential:
      type: NiAlTaFCCDiffusionPotential
    diffusivity:
      type: NiAlTaFCCDiffusivity

boundary_condition:
  BC0X:
    type: PERIODIC
  BCNX:
    type: PERIODIC
  BC0Y:
    type: PERIODIC
  BCNY:
    type: PERIODIC
    
nucleation:
- type: SetWhole
  variable:
  - varname: phi
    value: [1, 0]
  - varname: c_liquid
    value: [0.131, 0.051]
  - varname: c_solid
    value: [0.131, 0.051]

- type: SetSphere
  point: [75, 75, 0]
  radius: 1
  smooth: true
  smooth_variable: phi
  width: 6
  variable:
  - varname: phi
    value: [0, 1]
  - varname: c_liquid
    value: [0.131, 0.051]
  - varname: c_solid
    value: [0.131, 0.051]

# 各向异性参数
anisotropy:
  type: CubicAnisotropyYang
  parameters: [0.3]
  mobility: [0.3]

output:
  initial_time: 0
  final_time: 10
  # 输出模拟结果的初始时间
  initial_interval: 0.001
  every_number: 10
  factor: 2
  variable: []

information:
- 1.0e-10
- 30000
- 0.02
config.json
{
    "omp_threads": 64,
    "type": "AlloySolidification",
    "path": "results/NiAlTa-solidification-varD-1",
    "clear": true,
    "mesh": {
        "nx": 150,
        "ny": 150,
        "nz": 1,
        "dx": 5e-07,
        "dt": 1e-06,
        "current_time": 0,
        "simulation_time": 100.0
    },
    "parameter": {
        "T": 1649.85,
        "P": [1.64e-7, 6.69e-8],
        "Vm": 1e-05,
        "mu": 6.02e-10,
        "sigma": 0.3,
        "eta": 25.0e-7
    },
    "phase": {
        "liquid": {
            "type": "MultiComponentCustomPhase",
            "name": "liquid",
            "element": ["AL", "TA"],
            "gibbs_energy": {"type": "NiAlTaLIQUIDGibbsEnergy"},
            "diffusion_potential": {"type": "NiAlTaLIQUIDDiffusionPotential"},
            "diffusivity": {"type": "NiAlTaLIQUIDDiffusivity"}
        },
        "solid": {
            "type": "MultiComponentCustomPhase",
            "name": "solid",
            "element": ["AL", "TA"],
            "gibbs_energy": {"type": "NiAlTaFCCGibbsEnergy"},
            "diffusion_potential": {"type": "NiAlTaFCCDiffusionPotential"},
            "diffusivity": {"type": "NiAlTaFCCDiffusivity"}
        }
    },
    "boundary_condition": {
        "BC0X": {"type": "PERIODIC"},
        "BCNX": {"type": "PERIODIC"},
        "BC0Y": {"type": "PERIODIC"},
        "BCNY": {"type": "PERIODIC"}
    },
    "nucleation": [
        {
            "type": "SetWhole",
            "variable": [
                {
                    "varname": "phi",
                    "value": [1.0, 0.0]
                },
                {
                    "varname": "c_liquid",
                    "value": [0.131, 0.051]
                },
                {
                    "varname": "c_solid",
                    "value": [0.131, 0.051]
                }
            ]
        },
        {
            "type": "SetSphere",
            "point": [75, 75, 0],
            "radius": 1,
            "smooth": true,
            "smooth_variable": "phi",
            "width": 6,
            "variable": [
                {
                    "varname": "phi",
                    "value": [0.0, 1.0]
                },
                {
                    "varname": "c_liquid",
                    "value": [0.131, 0.051]
                },
                {
                    "varname": "c_solid",
                    "value": [0.131, 0.051]
                }
            ]
        }
    ],
    "anisotropy": {
        "type": "CubicAnisotropyYang",
        "parameters": [0.3],
        "mobility": [0.3]
    },
    "output": {
        "initial_time": 0,
        "final_time": 10.0,
        "initial_interval": 1e-03,
        "every_number": 10,
        "factor": 2,
        "variable": []
    },
    "elements": [
        "AL",
        "TA",
        "NI"
    ],
    "information": [
        1.0e-10,
        3.0e4,
        0.02
    ]
}

2. 运行脚本及命令

2.1 直接提交

任务提交命令为:

sbatch sumbit_sugon.sh
submit_sugon_direct.sh
#!/bin/sh
#SBATCH --job-name=phasefield
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=64
#SBATCH --partition=wzhcnormal
#SBATCH --time=6:00:00
#SBATCH --output=phasefield.out

source /work/share/ac21ujhbvo/local/mesospire/20230804/env.sh

mesospire_shell -i config.yaml

2.2 便捷提交

任务提交命令为:

bash sumbit_sugon.sh config
submit_sugon.sh
#!/bin/bash
# if not argument, print usage
if [ $# -eq 0 ]; then
    # echo "Usage: ./submit_sugon.sh [input_file_name]"
    echo -e "\033[34mUsage: ./submit_sugon.sh [input_file_name]\033[0m"
    exit 1
fi

# if input file not exist, print error
if [ ! -f "$1.yaml" ]; then
    echo -e "\033[31mError: $1.yaml not exist\033[0m"
    exit 1
fi

# thread_num variable, default 64. if the second argument is not empty, use it as thread_num
thread_num=64
if [ ! -z "$2" ]; then
    thread_num=$2
fi

echo -e "\033[32mCurrent thread number: $thread_num\033[0m"
echo -e "\033[32mCurrent task name: $1, it will be submitted to sugon.\033[0m"

sbatch <<EOT
#!/bin/sh
#SBATCH --job-name=$1
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=$thread_num
#SBATCH --partition=wzhcnormal
#SBATCH --time=6:00:00
#SBATCH --output=$1.out

module load compiler/intel/2021.3.0
module load compiler/gcc/9.3.0

export CXX=/public/software/compiler/intel-compiler/2021.3.0/bin/intel64/icpc
export CC=/public/software/compiler/intel-compiler/2021.3.0/bin/intel64/icc

app_path=../../build/bin/mesospire_shell

\${app_path} -i $1.yaml
EOT

squeue -i 5