Problem

class Problem : public godzilla::Object, public godzilla::PrintInterface

Problem.

Subclassed by godzilla::LinearProblem, godzilla::NonlinearProblem

Public Functions

virtual void create() override

Build the problem to solve.

virtual void run() = 0

Run the problem.

DM get_dm() const

Provide DM for this problem.

const Vector &get_solution_vector() const

Return solution vector.

virtual Mesh *get_mesh() const

Get mesh this problem is using.

virtual Int get_dimension() const

Get problem spatial dimension.

virtual Real get_time() const

Get simulation time.

For steady-state simulations, time is always 0

Returns:

Simulation time

virtual Int get_step_num() const

Get time step number.

Returns:

Time step number

const std::vector<Function*> &get_functions() const

Get list of functions.

Returns:

List of functions

void add_function(Function *fn)

Add a function object.

Parameters:

fnFunction object to add

void add_output(Output *output)

Add and output object.

Parameters:

outputOutput object to add

void add_postprocessor(Postprocessor *pp)

Add a postprocessor object.

Parameters:

pp – Postprocessor object to add

Postprocessor *get_postprocessor(const std::string &name) const

Get postprocessor by name.

Parameters:

name – The name of the postprocessor

Returns:

Pointer to the postprocessor with name ‘name’ if it exists, otherwise nullptr

const std::vector<std::string> &get_postprocessor_names() const

Get postprocessor names.

Returns:

List of postprocessor names

void compute_postprocessors()

Compute all postprocessors.

void output(ExecuteOnFlag flag)

Output.

Parameters:

mask – Bit mask for an output event, see Output for valid options.

std::string get_vector_type() const

Gets the type of vector created with create_local_vector and create_global_vector

Returns:

The vector type

void set_vector_type(const std::string &type)

Sets the type of vector to be created with create_local_vector and create_global_vector

Parameters:

type – The vector type, for example VECSTANDARD, VECCUDA, or VECVIENNACL

Vector create_local_vector() const

Creates a local vector from a DM object.

Returns:

New local vector

Vector get_local_vector() const

Get a vector that may be used with the DM local routines.

This vector has spaces for the ghost values.

Returns:

Local vector

Vector create_global_vector() const

Creates a global vector from a DM object.

A global vector is a parallel vector that has no duplicate values shared between MPI ranks, that is it has no ghost locations.

Returns:

New global vector

Vector get_global_vector() const

Get a vector that may be used with the DM global routines.

Returns:

Global vector

std::string get_matrix_type() const

Gets the type of matrix that would be created with create_matrix

Returns:

The matrix type

void set_matrix_type(const std::string &type)

Sets the type of matrix created with create_matrix

Parameters:

type – the matrix type, for example MATMPIAIJ

Matrix create_matrix() const

Get an empty matrix for a DM

Section get_local_section() const

Get the Section encoding the local data layout for the DM.

void set_local_section(const Section &section) const

Set the Section encoding the local data layout for the DM.

Section get_global_section() const

Get the Section encoding the global data layout for the DM.

void set_global_section(const Section &section) const

Set the Section encoding the global data layout for the DM.

void set_default_output_on(ExecuteOn flags)

Set default execute on flags.

FieldDecomposition create_field_decomposition()

Create field decomposition.

const Partitioner &get_partitioner()

Get the partitioner associated with this problem.

Returns:

Partitioner

void set_partitioner_type(const std::string &type)

Set partitioner type.

Parameters:

type – Type of the partitioner

void set_partition_overlap(Int overlap)

Set partitioner overlap.

Parameters:

type – Type of the partitioner

Int get_partition_overlap()

Get partition overlap.

Returns:

Partition overlap

Int get_num_auxiliary_vec() const

Get the number of auxiliary vectors.

Returns:

The number of auxiliary data vectors

Vector get_auxiliary_vec(const Label &label, Int value, Int part = 0) const

Get the auxiliary vector for region specified by the given label, value, and equation part.

Parameters:
  • label – The Label

  • value – The label value indicating the region

  • part – The equation part, or 0 if unused

Returns:

The Vector holding auxiliary field data

void set_auxiliary_vec(const Label &label, Int value, Int part, const Vector &vec)

Set an auxiliary vector for region specified by the given label, value, and equation part.

Parameters:
  • label – The Label

  • value – The label value indicating the region

  • part – The equation part, or 0 if unused

  • vec – The Vector holding auxiliary field data

void clear_auxiliary_vec()

Destroys the auxiliary vector information and creates a new empty one.

IndexSet create_section_subis(const std::vector<Int> &fields) const

Returns an IndexSet containing a Section that encapsulates a subproblem defined by a subset of the fields in a Section in the problem.

Parameters:

fields – The field numbers of the selected fields

Returns:

The global indices for the subproblem

struct FieldDecomposition

Public Members

std::vector<std::string> field_name

Field names.

std::vector<IndexSet> is

Global indices for each field.