Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Developing MOOSE Applications with ICE

Revision as of 15:54, 10 November 2016 by Crawfordst.ornl.gov (Talk | contribs) (With CMake)

Introduction

This article is designed to guide users through a typical workflow for developing MOOSE-based applications in ICE. Since ICE is built on top of the Eclipse platform, a large variety of sophisticated tools and technologies for developing scientific software can be leveraged for developing MOOSE applications.

Version control, code editing, code completion, code building, and code generation are just a few of the technologies available to MOOSE-based application developers using ICE. Additionally, after the user develops a custom MOOSE application, the usual MOOSELauncher and MOOSEModel items—along with the ICE Visualization perspective—are still at their disposal for constructing input files, launching jobs, and visualizing results.

Prerequisites

To use the MOOSE support in ICE, the user will need to have MOOSE installed on their system along with any MOOSE-based application that the user would like to run (the user can simply use "moose_test" if no other application is available).

Please note that installing MOOSE requires the user to add several packages (prerequisites) to their system. For more information on how to install MOOSE, check out the MOOSE Getting Started guide.

To install MOOSE and create a MOOSE-based application from scratch (or clone an existing application) from within ICE itself, check out the Developing MOOSE Applications with ICE article.

Cloning MOOSE

The latest version of ICE makes cloning MOOSE very simple.

In the main ICE window, click Developer > Framework > MOOSE > Clone Moose.

Clone moose dev menu stc.png

This step will automatically connect to the MOOSE GitHub repository, create a local clone on the user's disk, and import the MOOSE into the 'Project Explorer.'

Moose project explorer stc.png


Building MOOSE

To build MOOSE/Libmesh within ICE, open the 'Make Target' view pane by going to Window > Show View > Other.

Open make target view stc.png

This will prompt the 'Show View' dialog box. From there select Build Target and click OK.

Select build target stc.png

The MOOSE project is now visible in the 'Build Target' pane. Right click on MOOSE and select New.

Moose select new build target stc.png

This will prompt the 'Create Build Target' dialog, shown below.

Set the 'Target name' as Build Libmesh.
For Build Target: uncheck 'Same as Target name' and leave the 'Build target' field blank.
For Build Command: uncheck 'Use builder settings' and set the command as sh scripts/update_and_rebuild_libmesh.sh.
Click OK.

Moose create build target stc.png

'Build Libmesh' should now appear as a target, which upon double-clicking will execute the update_and_rebuild_libmesh.sh script with the output streaming in the 'Console' view pane.

Moose build libmesh stc 1.png

Moose build libmesh stc-2.png

With CMake

Once this step completes, the user can create another 'Build Target' in the same manner, this time setting the 'Build target' field as Make All and setting the Build command as cmake -E chdir framework make (feel free to add -j N to this command, where N is the number of make threads).

Cmake build target stc.png

If CMake is not installed on the user's machine, they can find the necessary files and instructions on CMake's website or use the alternative method below. If installing CMake on Mac OS X, the user must set the path.

Without CMake

Alternatively, if CMake is not available or not preferred, the user can still build with a couple of extra steps.

First, right click on the MOOSE project in the 'Project Explorer' and select Properties.

Moose build properties stc.png

In this 'Properties' dialog, select C/C++ Build and append to the 'Build directory' field with framework as shown below.

Moose build properties dialog stc.png

Double clicking this Build target will execute the MOOSE build, and the output should stream in the 'Console' view pane.

Forking the Stork

The MOOSE development team provides a GitHub repository called 'stork' (located at https://github.com/idaholab/stork) that includes the base structure needed to create a new MOOSE application. So, 'Forking the Stork'—as the MOOSE team coined it—implies forking this repository, changing its name to the name of the user's new MOOSE application, and cloning the contents of the repository to the user's local disk.

ICE provides this functionality through a simple interface, allowing an ICE user to 'Fork the Stork' in a few short steps.

First, in the main ICE menu, select Developer > Framework > MOOSE > Fork the Stork.

Fork Path.png

The resulting dialog will prompt the user for the name of their new MOOSE application ("animal" in this case), as well as their GitHub username and password.

Fork dialog.png

Once the user has provided this information and clicked Finish, ICE will fork the https://github.com/idaholab/stork repository, rename it to the provided application name, clone it to ~/ICEFiles on the user's local disk, and import it into ICE as a new C++ project in the C/C++ perspective's 'Project Explorer' view pane.

New app.png

Additionally, the import generates a fully configured 'Build Target' in the 'Build Target' view pane and sets up the C++ Indexer to point to the new ICE/MOOSE project's include files. This is essential for facilitating code completion and MOOSE code search MOOSE application development.

Make target.png

To look at a MOOSE class referenced in one of the new MOOSE application's source files, simply click the class name or the header file and click F3. ICE will take the user directly to the declaration for that MOOSE class so they can peruse and look up its method definitions.

Adding a New Kernel

Once you've cloned and built MOOSE, and Forked the Stork to produce a new MOOSE application ready for development, you can easily create custom Kernels with ICE. To create a new Kernel, right click on your new MOOSE-based application project and select New > MOOSE Object > Kernel.

New kernel.png

This action will display an input prompt asking for the name of your new Kernel subclass. Simply enter the name and push 'Ok'. Then ICE will automatically generate a new include and source file in include/kernel and source/kernel, respectively. The new files are the stubbed out, base implementation of a subclassed Kernel that you can then add to and modify.

Kernel source.png

Building your MOOSE App

Building your MOOSE application is simple because the 'Fork the Stork' action produced a Make Target for you. Simply double-click that make target and you application will build, producing the application executable.

Pushing Changes Back to GitHub

To push changes to the remote GitHub repository at https://github.com/username/animal, switch back to the Git perspective and click your applications git repository in the Git Repositories view. On the bottom right of the screen, you should see another set of tabbed views, one of them being the Git Staging view.

Git commit.png

Click the Git Staging View and drag any Unstaged Changes to the Staged Changes section. Now provide a brief commit message and click 'Commit and Push', enter your GitHub credentials, and watch as your files are committed to the remote repository!

Executing Built MOOSE Application

Now that you've developed a new MOOSE application you need to develop input files for it and execute it to see your desired results. This is simple with ICE: just use the built in MOOSE Model Builder and MOOSE Launcher Items. Detailed instructions can be found at Using MOOSE with ICE.

Back to the top