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

Difference between revisions of "Developing MOOSE Applications with ICE"

(Forking the Stork)
(Building your MOOSE App)
Line 133: Line 133:
  
 
== Building your MOOSE App ==  
 
== Building your MOOSE App ==  
Building the newly-created MOOSE application is simple because the 'Fork the Stork' action also produced a 'Build Target' for the user.
+
Building the newly-created MOOSE application is simple because the 'Fork the Stork' action also produced a 'Build Target' for the user and set 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.
  
 
<!-- Need screenshot here -->
 
<!-- Need screenshot here -->

Revision as of 15:22, 11 November 2016

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 and the prerequisites for doing so, please check out the MOOSE Getting Started guide.

For Mac OS X users, ICE developers also recommend installing the Homebrew package manager to ensure all required packages and their dependencies are available to the user.

To install MOOSE and create a MOOSE-based application from scratch (or clone an existing application) from within ICE itself, users should 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 MOOSE into the 'Project Explorer.'

Moose project explorer stc.png


Building MOOSE

The Cloning MOOSE step above also creates the two required 'Build Targets' used to build Libmesh and MOOSE. Libmesh is required for MOOSE to build, so the user should start there.

Building Libmesh

The 'Build Libmesh' build target will appear in the 'Build Targets' view pane.

Double clicking the 'Build Libmesh' target will execute the sh update_and_rebuild_libmesh.sh script with the output streaming in the 'Console' view pane.

Moose build libmesh stc 1.png

Note that this process will take some time.

Moose build libmesh stc-2.png

Building MOOSE

Once the Libmesh build completes, the user can then execute the 'Build MOOSE' target and the output should stream in the 'Console' view pane.

Cmake build target stc.png

Note that this process will take some time.

Moose build console output stc.png

With MOOSE built, the user can start the process of creating their own MOOSE-based application. The first step, 'Forking the Stork,' is described below.

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 ("animals" 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 'stork' repository (located at https://github.com/idaholab/stork), 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 the newly-created MOOSE application is simple because the 'Fork the Stork' action also produced a 'Build Target' for the user and set 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.


Navigate to the 'Build Target' view pane and double click on the new 'Build Target.'


The newly-created MOOSE application will then build, producing an application executable.


Pushing Changes Back to GitHub

As the user makes modifications to their project, they will want to periodically commit or 'push' these changes to their Github repository.

Git Perspective

The first step is to open the 'Git Perspective' by clicking the Open Perspective button in the upper right hand corner of ICE.

ICE OpenPerspective.png

Next, select 'Git' from the resulting prompt. Once 'Git' is selected, click OK.

Open git perspective stc 2.png

The user should now have the Git perspective button available on the ICE toolbar.

Git perspective button stc.png

Click the Git perspective button to bring up the Git interface pane in the main ICE window. The user should now see the repository for their MOOSE-based application in the 'Git Repositories' view pane (left), "animals" in this case.

Git repos view stc.png

Push Changes

To push these changes/modifications to the remote GitHub repository, switch to the Git perspective, as above, and select the desired repository in the 'Git Repositories' view pane.

The 'Git Repositories' view includes a new set of tabbed views. Select the Git Staging tab to pull up the 'Git Staging' view pane.

Git commit.png

Drag any 'Unstaged Changes' to the 'Staged Changes' section.

Provide a brief commit message regarding your commit.

Finally, click Commit and Push, enter your GitHub credentials if/when prompted, 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