Skip to content
Snippets Groups Projects
Commit b83a172e authored by Robert Kloefkorn's avatar Robert Kloefkorn
Browse files

model determins whether advection or diffusion is enabled.

parent 13d04932
No related branches found
No related tags found
No related merge requests found
......@@ -22,9 +22,6 @@ GRIDDIM = 2
DIMRANGE = 1
FLUX = 1 # LLF 1, HLL 2
ADVECTION=0
DIFFUSION=1
#USE_OMP=-fopenmp
# INFO SPACE OPERATOR:
......@@ -40,7 +37,6 @@ check_PROGRAMS = advdiff advdiffonep advdiff12 # quasiadvdiff quasiadvdiff12 pla
AM_CPPFLAGS = $(USE_OMP) -I../../problems/advdiff $(ALL_PKG_CPPFLAGS) -DGRIDDIM=$(GRIDDIM) \
-D$(GRIDTYPE) $(DUNEMPICPPFLAGS) \
-DADVECTION=$(ADVECTION) -DDIFFUSION=$(DIFFUSION) \
-DDIMRANGE=$(DIMRANGE) -DFLUX=$(FLUX) -DPRIMALDG -DUSE_ASSERT_THROW
AM_LDFLAGS = $(ALL_PKG_LDFLAGS) $(LAPACK_LDFLAGS) $(USE_OMP)
......
......@@ -88,6 +88,10 @@ template <class GridPartType,class ProblemImp>
class HeatEqnModel : public DefaultModel < HeatEqnModelTraits< GridPartType > >
{
public:
// for heat equations advection is disabled
static const bool hasAdvection = false ;
static const bool hasDiffusion = true ;
typedef ProblemImp ProblemType ;
static const int ConstantVelocity = ProblemType :: ConstantVelocity;
......
......@@ -25,7 +25,7 @@ struct ProblemGenerator
Dune::Fem::FunctionSpace< double, double, GridType::dimension,
DIMRANGE>,
false > ProblemType;
//typedef HeatProblemType ProblemType;
// define problem type here if interface should be avoided
template< class GridPart >
struct Traits
......@@ -33,6 +33,7 @@ struct ProblemGenerator
typedef ProblemType InitialDataType;
typedef HeatEqnModel< GridPart, InitialDataType > ModelType;
typedef LLFFlux< ModelType > FluxType;
//typedef UpwindFlux< ModelType > FluxType;
// choice of diffusion flux (see diffusionflux.hh for methods)
static const Dune :: DGDiffusionFluxIdentifier PrimalDiffusionFluxId
......
......@@ -63,27 +63,43 @@ private:
typedef Dune :: DGDiffusionOperator< ModelType, FluxType,
DiffusionFluxId, polynomialOrder > DgDiffusionType;
// default is that both are enabled
template < bool advection, bool diffusion >
struct OperatorChooser
{
typedef DgType FullOperatorType;
typedef DgDiffusionType ImplicitOperatorType;
typedef DgAdvectionType ExplicitOperatorType;
};
// advection operator only, i.e. linear advection equation
template < bool advection >
struct OperatorChooser< advection, false >
{
typedef DgAdvectionType FullOperatorType;
typedef FullOperatorType ImplicitOperatorType;
typedef FullOperatorType ExplicitOperatorType;
};
// diffusion operator only, i.e. for the heat equation
template < bool diffusion >
struct OperatorChooser< false, diffusion >
{
typedef DgDiffusionType FullOperatorType;
typedef FullOperatorType ImplicitOperatorType;
typedef FullOperatorType ExplicitOperatorType;
};
public:
static const bool advection = ModelType :: hasAdvection ;
static const bool diffusion = ModelType :: hasDiffusion ;
#if ADVECTION && DIFFUSION
#warning "Using Advection-Diffusion Operator"
typedef DgType FullOperatorType;
typedef DgDiffusionType ImplicitOperatorType;
typedef DgAdvectionType ExplicitOperatorType;
#elif ADVECTION
#warning "Using Advection Operator"
typedef DgAdvectionType FullOperatorType;
typedef FullOperatorType ImplicitOperatorType;
typedef FullOperatorType ExplicitOperatorType;
#elif DIFFUSION
#warning "Using Diffusion Operator"
typedef DgDiffusionType FullOperatorType;
typedef FullOperatorType ImplicitOperatorType;
typedef FullOperatorType ExplicitOperatorType;
#else
#error "Either ADVECTION or DIFFUSSION has to be set"
#endif
typedef OperatorChooser< advection, diffusion > OperatorChooserType ;
typedef typename OperatorChooserType :: FullOperatorType FullOperatorType;
typedef typename OperatorChooserType :: ImplicitOperatorType ImplicitOperatorType;
typedef typename OperatorChooserType :: ExplicitOperatorType ExplicitOperatorType;
// The discrete function for the unknown solution is defined in the DgOperator
typedef typename DgType :: DestinationType DiscreteFunctionType;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment