femmct documentation

This is the beginning of a documentation of the FEM-MCT python code, designed to solve incompressible Stokes equations using fenics, combined with the mode-coupling theory of the glass transition as an integral constitutive equation.

class femmct.stokessolver.StokesSolver(mesh, **kwargs)

Incompressible Stokes equation solver with deformation field history.

This class provides a solver for the incompressible Stokes equation that interfaces with integral constitutive equations that are based on the deformation field history (given through the Finger tensors, evaluated on a logarithmic age grid).

apply_bc(boundary_conditions, subdomain_data=None)

Add boundary condition to the solver.

Parameters:
  • boundary_conditions (dict) – This should be a dict whose keys are the integer values used in subdomain_data to mark the relevant regions of the mesh, and whose entries are functions that return either a dolfin.Constant (interpreted as a pressure value to be set) or a suitable dolfin.DirichletBC object. See femmct.dirichlet_u or femmct.p_inlet or femmct.p_outlet for examples.

  • subdomain_data (dolfin.MeshFunction, optional) – A size_t function containing zeros for non-boundary nodes, and integer values corresponding to the boundary-condition labels used in boundary_conditions on the boundary nodes.

create_files(path='.', polystress=False, N1=False)

Create output files for the solutions.

By default, no output files will be created. Calling this function, by default the velocity, pressure, total stress, and strainrate will be stored. The non-Newtonian stress and the first normal-stress difference can be separately stored.

Parameters:
  • path (str, default: '.') – Base path where to write the files. Must be a directory, and in there, the various pvd files and their vtk/vtu companions will be created (one for each field and time step).

  • polystress (bool, default: False) – If True, also create files for the non-Newtonian stress separately.

  • N1 (bool, default: False) – If True, also create files for the first normal-stress difference separately.

Note

Creating a file does not yet imply that the corresponding quantity will be calculated, and vice versa. The calculation is controlled by the flags given to solve().

initialize(model=None, T=50.0, Nt=500, Na=16, Nb=6, parameters={'muS': 1.0, 'rho': 1.0})

Initialize the Stokes solver.

Parameters:
  • model (femmct.ICEModel, default: None) – Class object that implements the integral constitutive equation. Defaults to None, which just solves the Newtonian background fluid. The model should be used to specify the additional non-Newtonian stresses.

  • T (float, optional) – Maximum time for which to solve.

  • Nt (int, default: 500) – Number of time steps (determines the time step together with T).

  • Na (int, default: 16) – Number of time steps in each block of age information.

  • Nb (int, default: 6) – Number of blocks of age information, where each block contains Na points and each additional block stores age information on twice the time step as the previous one.

  • parameters (dict, optional) – Setting for numerical parameters in the Stokes equation. Should contain keys ‘rho’ and ‘muS’ for the density and the Newtonian background viscosity.

Notes

The parameters Nt, Na, and Nb might be adjusted depending on the specific model in case the implementation requires certain relations between them. Also, the number of history blocks Nb will be cut to those that are actually needed for the specified maximum time interval; any older history would not enter the equations anyway.

loop(stress=True, strainrate=True, polystress=False, N1=False, normalize_pressure=True, **kwargs)

Time-step loop to solver Stokes equation with ICE.

Parameters:
  • stress (bool, default: True) – If True, calculate the stress field and write to file.

  • strainrate (bool, default: True) – If True, calculate the strain rate field and write to file.

  • polystress (bool, default: False) – If True, calculate the non-Newtonian “polymeric” stress and write separately to a file.

  • N1 (bool, default: False) – If True, calculate the first normal-stress difference separately.

  • normalize_pressure (bool, default: True) – If True, the pressure written to the output file will be normalized to 1/volume, since the overall stress magnitude does not play a role in the incompressible Stokes equation. This setting only affects the output, not the calculation.

  • **kwargs (dict, optional) – Optional parameters passed to dolfin.solve().

Note

The stress is given by the addition of the Newtonian stress, the pressure gradient, and the non-Newtonian stress. To get the stress contribution from the non-Newtonian constitutive law, set polystress to True. The first normal-stress difference is calculated separately when setting N1 to True; since this performs the projection on the finite-element function space properly, this is better than evaluating the difference a posteriori from the polystress file.

Indices and tables