Executing an input file

546 views
Skip to first unread message

Shouvik Ganguly

unread,
Dec 5, 2016, 3:51:48 PM12/5/16
to moose-users
Hello ,

I have just downloaded MOOSE and am trying to get started. I created an application using fork in my projects folder.  I observe file as make_new_application.py make_new_module.py and directories as src, tests, unit etc.
I want to run an input script say example.i How do I proceed from here. Do I place example.i in the src directory. If I add a class derived from MathFreeEnergy. Do I place the new class in the src directory as well. How do I build the code.Finally how do I run the input script to obtain output.

Thanks a lot for helping me get started.

Regards,
Shouvik

Cody Permann

unread,
Dec 5, 2016, 5:03:39 PM12/5/16
to moose-users
You're going to to want to take it a step at a time.

Before you start building an application, try to get the tests running. The "test" application is a full MOOSE-based application and there are several working input files ready to go in that area. The instructions for how to do that are right on the getting started page. You can also compile and run the examples in a similar manner and learn quite a bit before you start building in your own application.

In every case, if you have the redistributable package you should just be able to go into one of the directories with an application (i.e. moose/test, moose/examples/ex01, etc.), type "make" and get your application compiled. Supplying an input file is done like this:

./application-opt -i input.i

It doesn't matter where the input is located as long as the resources it needs are available (possibly a mesh file if you aren't generating one). Also keep in mind that the output will be dumped in the current directory where you are executing.

Cody

--
You received this message because you are subscribed to the Google Groups "moose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moose-users...@googlegroups.com.
Visit this group at https://groups.google.com/group/moose-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/moose-users/bc44aa5e-17fe-4713-91f9-4a2297750802%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shouvik Ganguly

unread,
Dec 12, 2016, 2:08:29 PM12/12/16
to moose-users
Thank you for the basics to get started. After these steps if I want to open the output results file as yxz_out.e do I need to use Paraview or any other postprocessor.

Thanks,
Shouvik

Daniel Schwen

unread,
Dec 12, 2016, 2:25:08 PM12/12/16
to moose-users
Paraview is the suggested visualization tool.

Anil Kunwar

unread,
Dec 13, 2016, 8:06:53 AM12/13/16
to moose-users
Hi Shouvik,
1. You can create a directory called examples or problems within your  directory of application name (named after birds or animals usually as per the MOOSE tradition) and  put your .
Your_App_Name contents:
1. src
2. include
3. tests
4. lib
5. doc
6. units
7. some files derived from stork
8. CREATE the directories examples/ or problems/ HERE.

2. Then, you can run your input file in terminal by jumping into the directory containing your_app_name-opt executable as:
$ mpiexec -n 4 ./your_app_name-opt -i ~/path/to/sample-example.i




(in parallel)
Provided your moose directory and app directory are within the $HOME/projects/ folder, then the commnad becomes:
$ mpiexec -n 4 ./your_app_name-opt -i ~/projects/your_app_name/examples/sample-example.i





The number 4 may be any number depending upon the nproc.
or

$ ./your_app_name-opt -i ~/path/to/sample-example.i




(serial)

If the executable and input file sample-example.i are in same directory, then you need to be in the directory where the executable is located and type
$ ./your_app_name-opt -i sample-example.i
$ mpiexec -n 4 ./your_app_name-opt -i sample-example.i



2. The application which are based upon MOOSE and the moose modules, have the same folder structure with the MOOSE framework and thus when we create the derived class of some Moose kernels or materials or ICS or BCs or auxkernels or so on; we give a similar structure in our user application.
So, for the material class MathFreeEnergy (https://github.com/idaholab/moose/blob/devel/modules/phase_field/src/materials/MathFreeEnergy.C) of phase field module; if you are going to create a derived class, for example: DerivedMathFreeEnergy, you will put it in ~/projects/your_app_name/src/materials/DerivedMathFreeEnergy.C and the corresponding header file in ~/projects/your_app_name/include/materials/DerivedMathFreeEnergy.h . To make this files recognizable to the MOOSE framework via your_app_name's executable, you need to register these material classes in ~/projects/your_app_name/src/base/Your_app_nameApp.C in this way:
...
// Materials
#include "DerivedMathFreeEnergy.h"

...
template<>
...

// External entry point for dynamic object registration


extern "C" void Your_app_nameApp__registerObjects(Factory & factory) { Your_app_nameApp::registerObjects(factory); }


void
Your_app_nameApp::registerObjects(Factory & factory)
{
...
registerMaterial
(DerivedMathFreeEnergy);
...
}








Yours Sincerely,
Anil Kunwar

anil kunwar

unread,
Dec 20, 2016, 2:09:49 AM12/20/16
to Shouvik Ganguly, Abridged Recipients
Hi Shouvik,
As you have got reply from Daniel regarding the coordinate system integration into the free energy in this post Google Groups; I hope you have got the answer well. There, Daniel has suggested for the use of Auxkernels and Auxvariables for the definition of co-ordinate variables.

Some relevant theoretical backgrounds:
1. Parsed Function:
ParsedFunction objects are defined by strings directly in the input file, e.g.
value = 'x*x+sin(y*t)'



2. Parsed Material:
Parsed materials (unlike ParsedFunctions) can couple to non-linear variables and material properties. In its configuration block all non-linear variables the free energy depends on (args), as well as constants (constant_names and constant_expressions) and other material properties (material_property_names) are declared.


ParsedFunctions have predefined values for coordinates (x,y,z) and time (t) whereas ParsedMaterial needs the coordinates to be defined somewhere before they can be used in its functional expression. Literally, you have mixed functions of ParsedMaterial and values of ParsedFunctions input things together in the function of ParsedMaterial. In order to put the coordinates in the ParsedMaterial (which does not inherit the ParsedFunction), you need to define the coordinates x, y somewhere before you write them in the function of ParsedMaterial. For, this Daniel gave you the  provisional blocks of MOOSE - namely Auxkernels and Auxvariables. Define them and use them.

Yours Sincerely,
Anil Kunwar

On Tuesday, December 20, 2016 5:03 AM, Shouvik Ganguly <shouv...@gmail.com> wrote:


Hi Anil,

thanks for the elaborate information. 
I am trying to study an example file phase_field/examples/rigidbodymotion/grain_motion_GT.i
I see that the free energy parameter is a function of variables 'c eta0 eta1 eta2 eta3'.
If I want to make it a function of x coordinate , how can I modify this.
Can I use something like following

function = 'c^2*(1-c)^2  + cos(x) * 2 + eta0*eta1

I obtain an error as I think x is unrecognised. How can I declare x .

Thanks,
Shouvik
So, for the material class MathFreeEnergy (https://github.com/idaholab/ moose/blob/devel/modules/ phase_field/src/materials/ MathFreeEnergy.C) of phase field module; if you are going to create a derived class, for example: DerivedMathFreeEnergy, you will put it in ~/projects/your_app_name/src/ materials/ DerivedMathFreeEnergy.C and the corresponding header file in ~/projects/your_app_name/ include/materials/ DerivedMathFreeEnergy.h . To make this files recognizable to the MOOSE framework via your_app_name's executable, you need to register these material classes in ~/projects/your_app_name/src/ base/Your_app_nameApp.C in this way:
Reply all
Reply to author
Forward
0 new messages