3. Creating Model Objects

Model objects are created with the graphical user interface or with the Python interface, by indicating the location of the Model Database.

3.1. With the Graphical User Interface

  1. In the Model section of the main window, click the right mouse button to pop up the context menu. Select Open Model...:

  2. A dialog is then shown where you can browse through the directory hierarchy of your computer's file system(s) and select with a MemCom database:

    To load the database into a new Model object, click on the "Load from Database" button. The Model object is then selected and can be edited.

3.2. With the Python Interface

Below is an example that creates a new Model object which is referenced by the variable m and opens the MemCom database airfoil.mc:

>>> m = Model('airfoil.mc')

The Model constructor takes several optional arguments. Type

>>> help(Model.__init__)

to obtain the online reference for the Model constructor. In the following, we give a number of examples how these arguments are used:

  • For databases containing multiple meshes and/or coordinate sets, one may not know beforehand what mesh or coordinate set to select. Since browsing the available enumerator values with baspl++ is only possible once the Model object has been created, there is the exact_match argument can be used to select the first nearly-matching mesh and coordinate set.

    m = Model('opt.mc', exact_match=False)

    This will load the first valid mesh present on the database. For the Python interface, the exact_match argument is by default set to False. However, when creating Model objects with the graphical user interface or from command-line arguments, this argument is implicitly set to True.

  • A database containing the results of a genetic optimization process consists of many meshes, which are identified by the (generation,variant,discipline) enumerators. The generation enumerator specifies the generation identifier, the variant specifies which variant of the given generation, and the discipline enumerator specifies what discipline ('CFD', 'CSM').

    To each variant, using the results from the different disciplines, a goal function is applied. The variants with the lowest goal function value is considered the best variant.

    m = Model('opt.mc', generation=41, variant='best', discipline='CSM')
  • For nonlinear analyses with mesh adaption, the mesh connectivity may change at each computational cycle. Hence, for each of these cycles, the mesh connectivity is stored on database, and the mesh must be selected when creating the Model object. This is achieved using the meshcycle argument.

    m = Model('adaptation.mc', meshcycle=4)
  • For some aero-elastic analyses, several coordinate sets for the same connectivities may be stored on the database. The coordinate set is chosen using the coorcycle argument:

    m = Model('ae.mc', coorcycle=2)
  • For structured Finite Volume (SFV) meshes, as are used by block-structured CFD codes, the Model object can be created displaced or not. This is steered with the displace_sfv argument which is True by default.

    In undeformed SFV meshes, field values are defined at cell centres and are considered constant over each cell. In displaced meshes, the nodal coordinates are re-located to coincide with centres of the cells and of the ghost cells; this allows for smooth interpolation of field values and rendering of colours. But on the other hand, displacement fields from aero-elastic simulations can only be displayed on undeformed meshes. So for these meshes, the Model object can be created as follows:

    m = Model('ae.mc', displace_sfv=False)
  • All these arguments may be used in combination. Example:

    m = Model('ae.mc', coorcycle=2, exact_match=False, displace_sfv=False)

3.3. What happens when a Model Object is created

The operations performed when a Model object is created are the following:

  1. Open the MemCom database.

  2. Python interface: From the database, select the mesh and coordinates according to the supplied arguments. Graphical user interface or exact_match argument set to False: Select the first mesh from the database.

  3. Load the coordinates and transform them to the global coordinate system

  4. Load the element parameters.

  5. For unstructured meshes, load the element connectivities.