OOF2: The Manual

B.6. Changes That May Break OOF2 Scripts

Some of the changes in version 2.1.0 will require changes to OOF2 scripts that were saved by or written for version 2.0.5. Please contact us if you need help updating scripts.

B.6.1. Automatically Generated PixelGroup Names

The group names created by the Group button on the Image page, using %c as the name_template, are now shorter and more manageable. OOF2 used to use its own representation for colors, such as

RGBColor(red=0.24313725490196078,green=0.24313725490196078,blue=0.24313725490196078)

Now it uses the standard hex representation, #rrggbb, where rr, gg, and bb are the RGB values as two digit hexadecimal numbers. The new name of the above group would be #3e3e3e.

Scripts that create pixel groups automatically and then refer to the groups explicitly by name will have to be updated with the new group names.

B.6.2. ContinuumProfiles

OOF2 2.0.x used the ContinuumProfile class to specify arbitrary profile functions for boundary conditions. Now it's necessary to distinguish between constant profiles, time-dependent profiles, and time-dependent profiles that know their time derivatives. Different types of boundary conditions require different kinds of profile arguments.

  • Dirichlet boundary conditions require a ContinuumProfileXTd object, which is a time-dependent function and its first two time derivatives. Its arguments are function, timeDerivative, and timeDerivative2, which are all strings representing functions of x, y, nx, ny, i, s, alpha, and/or t. t is time. The rest of the variables have the same meaning as in previous versions. Here's an example:

      OOF.Mesh.Boundary_Conditions.New(
          name='bc',
          mesh='microstructure:skeleton:mesh',
          condition=DirichletBC(
              field=Temperature, field_component='',
              equation=Heat_Eqn, eqn_component='',
              profile=ContinuumProfileXTd(function='2*t',
                                          timeDerivative='2.0',
                                          timeDerivative2='0.0'),
              boundary='top'))
    

  • Generalized Force boundary conditions require a ContinuumProfileXT object which is a time-dependent function, but the time derivatives do not have to be provided. It has a function argument, which is a string representing a function of x, y, nx, ny, i, s, alpha, and/or t. Example:

      OOF.Mesh.Boundary_Conditions.Edit(
          name='bc',
          mesh='microstructure:skeleton:mesh',
          condition=ForceBC(
              equation=Heat_Eqn, eqn_component='',
              profile=ContinuumProfileXT(function='2*s+t'),
              boundary='topleft'))
      

  • Floating boundary conditions must have profile functions that are not functions of time and are ContinuumProfile objects. ContinuumProfile objects also take an argument named function, but it can't be a function of t. These are unchanged from version 2.0.

B.6.3. Periodic Boundary Conditions

Periodic boundary conditions now apply automatically to all components of a Field, so they no longer have a field_component argument:

  OOF.Mesh.Boundary_Conditions.New(
      name='bc',
       mesh='microstructure:skeleton:mesh',
       condition=PeriodicBC(
           field=Displacement,
           equation=Force_Balance,
           boundary='right left'))
    

B.6.4. Field Initialization

The command OOF.Mesh.Initialize has been replaced by OOF.Mesh.Set_Field_Initializer, which has the same mesh, field, and initializer arguments as the old command. It assigns an initializer, but doesn't actually apply it. That is, it doesn't set Field values at the nodes of the Mesh. To actually set the values for all Fields, use either OOF.Mesh.Apply_Field_Initializers or OOF.Mesh.Apply_Field_Initializers_at_Time after calling OOF.Mesh.Set_Field_Initializer, like this:

  OOF.Mesh.Set_Field_Initializer(
      mesh='microstructure:skeleton:mesh',
      field=Temperature, initializer=ConstScalarFieldInit(value=1.0))
  OOF.Mesh.Apply_Field_Initializers(mesh='microstructure:skeleton:mesh')
  OOF.Mesh.Apply_Field_Initializers_at_Time(mesh='microstructure:skeleton:mesh', time=0.0)
 

B.6.5. The Solve Command

The command OOF.Solver.Solve has been replaced by the combination OOF.Subproblem.Set_Solver and OOF.Mesh.Solve. It's simplest to give an example. A typical Solve command from 2.0.5 uses a linear solver to solve the default subproblem with the CG solver:

  OOF.Solver.Solve(
      subproblem='microstructure:skeleton:mesh:default',
      solver=LinearDriver(
          method=CGSolver(
              max_iterations=1000,
              tolerance=1e-13,
              preconditioner=ILUPreconditioner())))
  

In 2.1, this could be replaced by

  OOF.Subproblem.Set_Solver(
      subproblem='microstructure:skeleton:mesh:default',
      solver_mode=BasicSolverMode(
          time_stepper=BasicStaticDriver(),
          matrix_method=BasicIterative(
              tolerance=1e-13,
              max_iterations=1000)))
  OOF.Mesh.Solve(
      mesh='microstructure:skeleton:mesh',
      endtime=0.0)
  

This combination reproduces the 2.0.5 functionality and should work for any problem that 2.0.5 could solve, including nonlinear problems. It will use the CG solver to solve symmetric matrices and GMRES to solve asymmetric ones.

B.6.6. Output Formatting

The commands in the OOF.Mesh.Analyze menu used to take comment_character and separator arguments. Those arguments have been replaced by global settings in the Settings/Output Formatting menu in the menubar in the main OOF2 window. The arguments should be removed from scripts.

B.6.7. Saving Images

The mode argument to the OOF.File.Save.Image command has been changed to overwrite, and its value is either True or False. Mode was either write or append, but appending to an image file doesn't make much sense.