Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Material output averaging #757

Merged
merged 3 commits into from Feb 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions include/aspect/assembly.h
Expand Up @@ -264,9 +264,7 @@ namespace aspect
{
/**
* A base class for objects that implement assembly
* operations. This base class does not provide a whole lot
* of functionality other than the fact that its destructor
* is virtual.
* operations.
*
* The point of this class is primarily so that we can store
* pointers to such objects in a list. The objects are created
Expand All @@ -279,6 +277,16 @@ namespace aspect
{
public:
virtual ~AssemblerBase () {}

/**
* This function gets called if a MaterialModelOutputs is created
* and allows the assembler to attach AdditionalOutputs. The
* function might be called more than once for a
* MaterialModelOutput, so it is recommended to check if
* get_additional_output() returns an instance before adding a new
* one to the additional_outputs vector.
*/
virtual void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &) {}
};
}

Expand Down
50 changes: 35 additions & 15 deletions include/aspect/material_model/interface.h
Expand Up @@ -246,20 +246,9 @@ namespace aspect
};


/**
* A base class for additional output fields to be added to the
* MaterialModel::MaterialModelOutputs structure and filled in the
* MaterialModel::Interface::evaluate() function. The format of the
* additional quantities defined in derived classes should be the
* same as for MaterialModel::MaterialModelOutputs.
*/
template<int dim>
class AdditionalMaterialOutputs
{
public:
virtual ~AdditionalMaterialOutputs()
{}
};
template <int dim> class AdditionalMaterialOutputs;


/**
* A data structure with the output field of the
* MaterialModel::Interface::evaluate() function. The vectors are the
Expand Down Expand Up @@ -492,10 +481,41 @@ namespace aspect
const typename DoFHandler<dim>::active_cell_iterator &cell,
const Quadrature<dim> &quadrature_formula,
const Mapping<dim> &mapping,
MaterialModelOutputs<dim> &values_out);
MaterialModelOutputs<dim> &values_out);

/**
* Do the requested averaging operation for one array. The
* projection matrix argument is only used if the operation
* chosen is project_to_Q1
*/
void average_property (const AveragingOperation operation,
const FullMatrix<double> &projection_matrix,
const FullMatrix<double> &expansion_matrix,
std::vector<double> &values_out);
}


/**
* A base class for additional output fields to be added to the
* MaterialModel::MaterialModelOutputs structure and filled in the
* MaterialModel::Interface::evaluate() function. The format of the
* additional quantities defined in derived classes should be the
* same as for MaterialModel::MaterialModelOutputs.
*/
template<int dim>
class AdditionalMaterialOutputs
{
public:
virtual ~AdditionalMaterialOutputs()
{}

virtual void average (const MaterialAveraging::AveragingOperation operation,
const FullMatrix<double> &projection_matrix,
const FullMatrix<double> &expansion_matrix)
{}
};



/**
* A base class for parameterizations of material models. Classes derived
Expand Down
6 changes: 6 additions & 0 deletions include/aspect/simulator.h
Expand Up @@ -581,6 +581,12 @@ namespace aspect
*/
std::vector<std_cxx11::shared_ptr<internal::Assembly::Assemblers::AssemblerBase<dim> > > assembler_objects;

/**
* Will call create_additional_material_model_outputs() functions from
* each object in assembler_objects.
*/
void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &);

/**
* Determine, based on the run-time parameters of the current simulation,
* which functions need to be called in order to assemble linear systems,
Expand Down
27 changes: 27 additions & 0 deletions include/aspect/simulator_signals.h
Expand Up @@ -33,6 +33,23 @@

namespace aspect
{
namespace internal
{
namespace Assembly
{
namespace Assemblers
{
template <int dim>
class AssemblerBase;

}
template <int dim>
struct AssemblerLists;

}

}

/**
* A class that collects the definition of signals that can be triggered
* at different points in a computation. A signal is in essence an event
Expand Down Expand Up @@ -150,6 +167,16 @@ namespace aspect
boost::signals2::signal<void (const SimulatorAccess<dim> &,
const bool,
const std::vector<double> &)> post_stokes_solver;


/**
* A signal that is fired at the end of the set_assemblers() function that allows
* modification of the assembly objects active in this simulation.
*/
boost::signals2::signal<void (const SimulatorAccess<dim> &,
aspect::internal::Assembly::AssemblerLists<dim> &,
std::vector<std_cxx11::shared_ptr<internal::Assembly::Assemblers::AssemblerBase<dim> > > &)>
set_assemblers;
};


Expand Down