idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.68k stars 1.03k forks source link

Add algebraic substitution to input file #876

Closed permcody closed 8 years ago

permcody commented 10 years ago
 Hi everyone,

 I've implemented length scaling in MAMBA-BDM, which scales all material
 properties to help things solve easier. Basically I have things that are
 10^-18 and 10^10 in SI units, and scaling helps equalize them so small
 residuals aren't lost in the noise.

 However, I still have a change a few input file parameters to fit. When I
 change the "scaling_factor," I have to manually change things like
 DirichletBC values, GeneratedMesh sizes, and initial conditions for
 kernels that aren't handled (scaled) inside my material file, kernels,
 etc.

 So, is there a way to symbolically define input parameters in the input
 file? An example would be:
 _________________________________
 [    type = GeneratedMesh
 xmax = 1e-5 * scaling_factor
 ymax = 5e-5 * scaling_factor
 .....
 [SomeDirichletBC](Mesh]

) value = 600 / scaling_factor ..... [ scaling_factor = 0.001


 Alternatively, would I have to define my own Mesh objects, ICs, etc. to
 read in my scaling_factor? This seems like a more roundabout way to do
 it, so I'm hoping for option 1.

 Thanks,
 -Mike Short

To use aprepro, you would put algebraic expressions that you want to be evaluated in curly braces in your input file, and then run aprepro on the file to generate another file that is used as input for MOOSE. Your example would look like this:

{scaling_factor = 0.001}

Mesh type = GeneratedMesh xmax = {1e-5 * scaling_factor} ymax = {5e-5 * scaling_factor} ..... [= {600 / scaling_factor} ..... SomeMaterial

You'd then run algebra orig_file.i new_file.i and then use new_file.i as the input for MOOSE.

permcody commented 8 years ago

We now have support for GetPots Dollar Bracket Expressions (DBE). There are a ton of things you can do with this. Closing this ticket.