基于 MOOSE 的应用程序开发所需的依赖项的大量库首选方法是通过 Conda获取。按照以下说明使用 Conda 在计算机上创建环境。

1. 安装Miniforge。

根据您的平台,请按照以下步骤安装 Miniforge。如果您在这些步骤中遇到问题,请访问Conda 故障排除指南。

  • Linux Users:
    Linux用户:
点击查看代码
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.shbash Miniforge3-Linux-x86_64.sh -b -p ~/miniforge
  • Macintosh Users with Intel processors:
    使用 Intel 处理器的 Macintosh 用户:
点击查看代码
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-x86_64.shbash Miniforge3-MacOSX-x86_64.sh -b -p ~/miniforge
  • Macintosh Users with Apple Silicon processors:
    使用 Apple Silicon 处理器的 Macintosh 用户:
点击查看代码
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.shbash Miniforge3-MacOSX-arm64.sh -b -p ~/miniforge

将 Miniforge 安装在主目录中后,导出 PATH 以便可以使用:

点击查看代码
export PATH=$HOME/miniforge/bin:$PATH

Now that we can execute conda, initialize it and then exit the terminal:

现在我们可以执行 conda ,初始化它,然后退出终端:

点击查看代码
conda init --allexitCopy

Upon restarting your terminal, you should see your prompt prefixed with (base). This indicates you are in the base environment, and Conda is ready for operation:

重新启动终端后,您应该会看到以 (base) 为前缀的提示。这表示您处于基础环境中,并且 Conda 已准备好运行:

点击查看代码
$ (base) ~>

The next thing you should do after a fresh install, is perform an update to the base Conda environment:

全新安装后,您应该做的下一件事是对基本 Conda 环境执行更新:

点击查看代码
conda update --all --yes

Add INL’s public channel to gain access to INL’s Conda package library:

添加 INL 的公共通道以访问 INL 的 Conda 包库:

点击查看代码
conda config --add channels https://conda.software.inl.gov/public

警告:不要使用 sudo
如果您发现自己在使用 Conda 命令时使用了 sudo 命令…有些不对劲。需要 sudo 的最常见原因是由于 Conda 安装不当。Conda 应该安装到您的主目录中,而不使用 sudo 。

注:Miniforge vs Miniconda vs Anaconda
他们的核心都是包含conda这一工具,来实现 python 环境(environment) 和 包(package) 管理的,(其实不仅仅可以用来管理python,很多语言R, Java, C都支持)。
Anaconda 和 Miniconda 是一个公司的产品,商用是付费的,个人暂时免费;而Miniforge是由社区主导,用GitHub托管,完全免费。Miniconda 和 Miniforge 是差不多的产物,代表着轻量化,而Anaconda是完整版,就略显臃肿。
Miniforge 使用conda-forge 作为默认 channel,而 Miniconda 使用anaconda.org 作为默认channel。

注:conda channels (源)
conda channels (源)是 packages 存储的位置,也即是你是从哪个来源下载这个包,对应到conda内部处理则是下载文件的链接。因为不同源会有相同名字的包,因此必须指定来源,同时安装conda的时候也会有一个默认的channel。目前主流的就是 conda-forge,齐全且更新快。如果有多个channel,他们会按顺序确定优先级,优先的源上找不到,就会到下一个优先级的源上去找。还可以设置channel的优先级是否strict,如果是strict的话,则只会在这一个源上查找。

2.创建 MOOSE 环境

Create a unique conda environment for MOOSE, named moose, and install the MOOSE dependency packages:
为 MOOSE 创建名为 moose 的唯一 conda 环境,并安装 MOOSE 依赖项包:

点击查看代码
conda create -n moose moose-dev=2023.12.20

After the installation completes, activate the new environment:
安装完成后,激活新环境:

点击查看代码
conda activate moose

If you are running into errors, please see our troubleshooting guide for Conda.

如果您遇到错误,请参阅Conda 故障排除指南

对于打开的每个终端窗口,以及每次要执行 MOOSE 相关工作时,都需要 conda activate moose 。如果您希望将其自动执行,可以将该命令添加到 shell 配置文件的末尾。

3. 克隆 MOOSE

MOOSE is hosted on GitHub and should be cloned directly from there using git. We recommend creating a directory ~/projects to contain all of your MOOSE related work.

MOOSE 托管在 GitHub 上,应使用 git 直接从那里克隆。我们建议创建一个目录 ~/projects 来包含所有与 MOOSE 相关的工作。

To clone MOOSE, run the following commands in a terminal:
要克隆 MOOSE,请在终端中运行以下命令:

点击查看代码
mkdir -p ~/projectscd ~/projectsgit clone https://github.com/idaholab/moose.gitcd moosegit checkout master

> MOOSE 的 master 分支是稳定分支,只有在所有测试通过后才会更新。这可以保护您免受 MOOSE 存储库中的日常更改的影响。

gitee镜像 https://gitee.com/mirrors/moose.git

4.构建和测试 MOOSE

To build MOOSE run the following commands:
要构建 MOOSE,请运行以下命令:

点击查看代码
cd ~/projects/moose/testmake -j 6

To test MOOSE, run the following commands:

若要测试 MOOSE,请运行以下命令:

点击查看代码
cd ~/projects/moose/test./run_tests -j 6

Some tests are SKIPPED. This is normal as some tests are specific to available resources, or some other constraint your machine does not satisfy. If you see failures, or you see MAX FAILURES, thats a problem! And it needs to be addressed before continuing:

某些测试被跳过。这是正常的,因为某些测试特定于可用资源,或者计算机不满足的其他一些约束。如果您看到失败,或者您看到 MAX FAILURES ,那就是一个问题!在继续之前,需要解决它:

  • Supply a report of the actual failure (scroll up a ways). For example the following snippet does not give the full picture (created with ./run_tests -i always_bad):

提供实际故障的报告(向上滚动)。例如,以下代码片段没有给出全貌(使用 ./run_tests -i always_bad 创建):

点击查看代码
Final Test Results:--------------------------------------------------------------------------------tests/test_harness.always_ok .................... FAILED (Application not found)tests/test_harness.always_bad .................................. FAILED (CODE 1)--------------------------------------------------------------------------------Ran 2 tests in 0.2 seconds. Average test time 0.0 seconds, maximum test time 0.0 seconds.0 passed, 0 skipped, 0 pending, 2 FAILED

– Instead, you need to scroll up and report the actual error:

相反,您需要向上滚动并报告实际错误:

点击查看代码
materials/derivative_material_interface.required_property/allow_override .................................. OKmaterials/derivative_material_interface.required_property/derivative_parsed_material ...................... OKpartitioners/petsc_partitioner.ptscotch_weight_elment ........................................ [min_cpus=4] OKpartitioners/petsc_partitioner.ptscotch_weight_side .......................................... [min_cpus=4] OKpartitioners/petsc_partitioner.ptscotch_weight_both .......................................... [min_cpus=4] OKpartitioners/petsc_partitioner.parmetis ...................................................... [min_cpus=4] OKpartitioners/petsc_partitioner.parmetis_weight_element ....................................... [min_cpus=4] OKpartitioners/petsc_partitioner.parmetis_weight_side .......................................... [min_cpus=4] OKpartitioners/petsc_partitioner.parmetis_weight_both .......................................... [min_cpus=4] OKpartitioners/petsc_partitioner.parmetis_presplit_mesh ........................................ [min_cpus=2] OKmeshgenerators/distributed_rectilinear/partition.1D_4 ........................................ [min_cpus=4] OKmeshgenerators/distributed_rectilinear/partition.3D_3 ........................................ [min_cpus=3] OKmeshgenerators/distributed_rectilinear/partition.3D_4 ........................................ [min_cpus=4] OKmeshgenerators/distributed_rectilinear/partition.3D_8 ................... [min_cpus=8,insufficient slots] SKIP------------------------------------------------------------------------------------------Ran 4100 tests in 393.7 seconds. Average test time 0.3 seconds, maximum test time 22.9 seconds.4100 passed, 106 skipped, 0 pending, 0 failed

5.卸载

If you wish to remove the moose environment at any time, you may do so using the following commands:
如果您希望随时删除驼鹿环境,可以使用以下命令进行操作:

点击查看代码
conda activate baseconda env remove -n moose

Now that you have a working MOOSE, proceed to ‘New Users’ to begin your tour of MOOSE!
现在您已经有了一个可以工作的 MOOSE,请前往“新用户”开始您的 MOOSE 之旅!