Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed Nov 22, 2017
1 parent f93c011 commit 3e76d7e
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 67 deletions.
9 changes: 7 additions & 2 deletions include/aspect/free_surface.h
Expand Up @@ -41,8 +41,13 @@ namespace aspect
class ApplyStabilization: public Assemblers::Interface<dim>,
public SimulatorAccess<dim>
{
void execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch,
internal::Assembly::CopyData::CopyDataBase<dim> &data) const;
public:
virtual ~ApplyStabilization () {};

virtual
void
execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch,
internal::Assembly::CopyData::CopyDataBase<dim> &data) const;
};
}

Expand Down
14 changes: 0 additions & 14 deletions include/aspect/melt.h
Expand Up @@ -146,8 +146,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~MeltInterface () {};

/**
* Attach melt outputs. Since most melt assemblers require the
* melt material model properties they are created in this base class
Expand All @@ -166,8 +164,6 @@ namespace aspect
class MeltStokesPreconditioner : public MeltInterface<dim>
{
public:
virtual ~MeltStokesPreconditioner () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -182,8 +178,6 @@ namespace aspect
class MeltStokesSystem : public MeltInterface<dim>
{
public:
virtual ~MeltStokesSystem () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -200,8 +194,6 @@ namespace aspect
class MeltStokesSystemBoundary : public MeltInterface<dim>
{
public:
virtual ~MeltStokesSystemBoundary () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -216,8 +208,6 @@ namespace aspect
class MeltAdvectionSystem : public MeltInterface<dim>
{
public:
virtual ~MeltAdvectionSystem () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -241,8 +231,6 @@ namespace aspect
class MeltPressureRHSCompatibilityModification : public MeltInterface<dim>
{
public:
virtual ~MeltPressureRHSCompatibilityModification () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -256,8 +244,6 @@ namespace aspect
class MeltBoundaryTraction : public MeltInterface<dim>
{
public:
virtual ~MeltBoundaryTraction () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand Down
12 changes: 6 additions & 6 deletions include/aspect/newton.h
Expand Up @@ -140,7 +140,7 @@ namespace aspect
class NewtonStokesPreconditioner : public NewtonInterface<dim>
{
public:
virtual ~NewtonStokesPreconditioner () {};
virtual ~NewtonStokesPreconditioner () {}

void
execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -155,7 +155,7 @@ namespace aspect
class NewtonStokesIncompressibleTerms : public NewtonInterface<dim>
{
public:
virtual ~NewtonStokesIncompressibleTerms () {};
virtual ~NewtonStokesIncompressibleTerms () {}

void
execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -171,7 +171,7 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~NewtonStokesCompressibleStrainRateViscosityTerm () {};
virtual ~NewtonStokesCompressibleStrainRateViscosityTerm () {}

virtual
void
Expand All @@ -190,7 +190,7 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~NewtonStokesReferenceDensityCompressibilityTerm () {};
virtual ~NewtonStokesReferenceDensityCompressibilityTerm () {}

virtual
void
Expand All @@ -211,7 +211,7 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~NewtonStokesImplicitReferenceDensityCompressibilityTerm () {};
virtual ~NewtonStokesImplicitReferenceDensityCompressibilityTerm () {}

virtual
void
Expand All @@ -230,7 +230,7 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~NewtonStokesIsothermalCompressionTerm () {};
virtual ~NewtonStokesIsothermalCompressionTerm () {}

virtual
void
Expand Down
6 changes: 0 additions & 6 deletions include/aspect/simulator/assemblers/advection.h
Expand Up @@ -38,8 +38,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~AdvectionSystem () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -59,8 +57,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~AdvectionSystemBoundaryFace () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -76,8 +72,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~AdvectionSystemInteriorFace () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand Down
22 changes: 8 additions & 14 deletions include/aspect/simulator/assemblers/interface.h
Expand Up @@ -62,13 +62,13 @@ namespace aspect
:
cell(),
face_number(numbers::invalid_unsigned_int)
{};
{}

ScratchBase(const ScratchBase &scratch)
:
cell(scratch.cell),
face_number(scratch.face_number)
{};
{}

virtual ~ScratchBase () {};

Expand Down Expand Up @@ -333,8 +333,6 @@ namespace aspect
template <int dim>
struct CopyDataBase
{
CopyDataBase() {};

virtual ~CopyDataBase () {};
};

Expand Down Expand Up @@ -486,7 +484,7 @@ namespace aspect
class Interface
{
public:
virtual ~Interface () {}
virtual ~Interface ();

/**
* Execute this assembler object. This function performs the primary work
Expand All @@ -504,7 +502,7 @@ namespace aspect
virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
internal::Assembly::CopyData::CopyDataBase<dim> &data) const =0;
internal::Assembly::CopyData::CopyDataBase<dim> &data) const = 0;

/**
* This function gets called if a MaterialModelOutputs is created
Expand Down Expand Up @@ -539,7 +537,7 @@ namespace aspect
* This ensures the additional material model output is available when
* execute() is called.
*/
virtual void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &) const {}
virtual void create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &) const;

/**
* A required function for objects that implement the assembly of terms
Expand All @@ -551,16 +549,12 @@ namespace aspect
* equation). Thus different objects compute different residuals (i.e.
* the residual for a melt advection equation looks different from the
* residual for a passive compositional field).
* For assemblers for the Stokes system, an implementation of this
* function is not necessary.
*/
virtual
std::vector<double>
compute_residual(internal::Assembly::Scratch::ScratchBase<dim> &) const
{
AssertThrow(false, ExcMessage("This function should either be implemented "
"(if this is an assembler that has to compute a residual, or not be called "
"(if this is an assembler that has not to compute a residual)."));
return std::vector<double>();
}
compute_residual(internal::Assembly::Scratch::ScratchBase<dim> &) const;
};

/**
Expand Down
18 changes: 0 additions & 18 deletions include/aspect/simulator/assemblers/stokes.h
Expand Up @@ -37,8 +37,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesPreconditioner () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -54,8 +52,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesCompressiblePreconditioner () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -71,8 +67,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesIncompressibleTerms () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -93,8 +87,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesCompressibleStrainRateViscosityTerm () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -115,8 +107,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesReferenceDensityCompressibilityTerm () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -137,8 +127,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesImplicitReferenceDensityCompressibilityTerm () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -159,8 +147,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesIsothermalCompressionTerm () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -176,8 +162,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesBoundaryTraction () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand All @@ -196,8 +180,6 @@ namespace aspect
public SimulatorAccess<dim>
{
public:
virtual ~StokesPressureRHSCompatibilityModification () {};

virtual
void
execute(internal::Assembly::Scratch::ScratchBase<dim> &scratch,
Expand Down
4 changes: 2 additions & 2 deletions include/aspect/simulator_access.h
Expand Up @@ -640,8 +640,8 @@ namespace aspect
get_newton_handler () const;

/**
* Return a set of boundary indicators that describes which of the
* boundaries have a free surface boundary condition
* Return a reference to the free surface handler. This function will
* throw an exception if no free surface is activated.
*/
const FreeSurfaceHandler<dim> &
get_free_surface_handler () const;
Expand Down
30 changes: 29 additions & 1 deletion source/simulator/assemblers/interface.cc
Expand Up @@ -461,6 +461,33 @@ namespace aspect

namespace Assemblers
{
template <int dim>
Interface<dim>::~Interface()
{}



template <int dim>
void
Interface<dim>::create_additional_material_model_outputs(MaterialModel::MaterialModelOutputs<dim> &) const
{}



template <int dim>
std::vector<double>
Interface<dim>::compute_residual(internal::Assembly::Scratch::ScratchBase<dim> &) const
{
AssertThrow(false,
ExcMessage("If this is an assembler that has to compute a residual"
"then this function should be implemented. "
"If this is an assembler that does not have to compute a residual, it should not be called."));

return std::vector<double>();
}



template <int dim>
Manager<dim>::Properties::Properties ()
:
Expand Down Expand Up @@ -492,7 +519,8 @@ namespace aspect
} \
} \
namespace Assemblers { \
template struct Manager<dim>::Properties; \
template class Interface<dim>; \
template class Manager<dim>; \
}
ASPECT_INSTANTIATE(INSTANTIATE)
}
1 change: 1 addition & 0 deletions source/simulator/assemblers/newton_stokes.cc
Expand Up @@ -584,6 +584,7 @@ namespace aspect
namespace Assemblers
{
#define INSTANTIATE(dim) \
template class NewtonInterface<dim>; \
template class NewtonStokesPreconditioner<dim>; \
template class NewtonStokesIncompressibleTerms<dim>; \
template class NewtonStokesCompressibleStrainRateViscosityTerm<dim>; \
Expand Down
2 changes: 1 addition & 1 deletion source/simulator/assembly.cc
Expand Up @@ -109,7 +109,7 @@ namespace aspect
// lines in set_assemblers(), where this operation appears multiple times.
template <int dim, class AssemblerType>
void
initialize_simulator(Simulator<dim> &simulator,
initialize_simulator(const Simulator<dim> &simulator,
std::vector<std_cxx11::unique_ptr<AssemblerType> > &assemblers)
{
for (unsigned int i=0; i<assemblers.size(); ++i)
Expand Down
6 changes: 3 additions & 3 deletions source/simulator/entropy_viscosity.cc
Expand Up @@ -132,9 +132,9 @@ namespace aspect

for (unsigned int i=1; i<assemblers->advection_system.size(); ++i)
{
std::vector<double> new_residual = assemblers->advection_system[i]->compute_residual(scratch);
for (unsigned int i=0; i<residual.size(); ++i)
residual[i] += new_residual[i];
const std::vector<double> new_residual = assemblers->advection_system[i]->compute_residual(scratch);
for (unsigned int j=0; j<residual.size(); ++j)
residual[j] += new_residual[j];
}


Expand Down

0 comments on commit 3e76d7e

Please sign in to comment.