Prescribing internal velocity constraints with ASCII files#

This section was contributed by Bob Myhill

Building on Prescribed internal velocity constraints, the cookbooks/prescribed_velocity_ascii_data directory contains a plugin which uses an ASCII data file to specify where to prescribe internal velocities. Velocities are prescribed wherever the field value indicated by the ASCII data file is greater than 0.5. As before, the plugin is loaded in parameter files as an additional shared library:

# Load the signal library.
set Additional shared libraries = ./libprescribed_velocity_ascii_data.so

An example parameter file using this plugin can be found at cookbooks/prescribed_velocity_ascii_data/prescribed_velocity_ascii_data.prm. In this file, the velocities are constrained to be zero within the letters “ASPECT” (Fig. 61). The part of this file which provides the location of the ASCII file and the prescribed velocity field function is:

# Turn prescribed velocities on
set Prescribe internal velocities = true

# Use the Ascii data plugin to read in the prescribed velocity ASCII file
# In this cookbook, we use the initial composition file.
subsection Prescribed velocities
  subsection Ascii data model
    set Data directory       = $ASPECT_SOURCE_DIR/cookbooks/prescribed_velocity_ascii_data/
    set Data file name       = aspect_name_initial_composition.txt
  end

  subsection Velocity function
    set Variable names = x,y,t
    # Return u_x; u_y; u_z (u_z only used if in 3d)
    set Function expression = 0;0
  end
end

A temperature gradient is applied within the letters, while the temperature field outside the letters is set to be constant. This initial temperature field is specified by another ASCII data file:

subsection Initial temperature model
  set Model name = ascii data
  subsection Ascii data model
    set Data directory       = $ASPECT_SOURCE_DIR/cookbooks/prescribed_velocity_ascii_data/
    set Data file name       = aspect_name_initial_temperature.txt
  end
end

These two ASCII data files are generated from aspect_name.png by the python file make_ascii_files_from_png.py, both of which can be found in the same directory as the parameter file.

../../../../../_images/prescribed_velocities_ascii_data_initial_conditions.png

Fig. 61 Initial composition and temperature conditions for the prescribed velocity ascii data cookbook, as described in Prescribing internal velocity constraints with ASCII files.#

During the simulation, excess heat diffuses out from the tops of the letters, and into the bases of the letters. The temperature gradients in the unconstrained part of the domain then generate convective flow. Fig. 62 illustrates the resulting flow field.

../../../../../_images/prescribed_velocity_ascii_data.png

Fig. 62 Convective flow around the letters ASPECT, within which velocities are prescribed to be zero, as described in Prescribing internal velocity constraints with ASCII files.#