Skip to content
Snippets Groups Projects
problemcreator.hh 3.04 KiB
Newer Older
Robert Kloefkorn's avatar
Robert Kloefkorn committed
#ifndef FEMHOWTO_NSEQ_RPOBLEMCREATOR_HH
#define FEMHOWTO_NSEQ_RPOBLEMCREATOR_HH
Robert K's avatar
Robert K committed

#ifdef SPGRID_COUNT_FLOPS
//#define COUNT_FLOPS
#warning "FLOP/s counting enabled!"
#endif

Robert Kloefkorn's avatar
Robert Kloefkorn committed
#include <config.h>

Robert K's avatar
Robert K committed
#ifndef POLORDER
#define POLORDER 1
#endif

Robert Kloefkorn's avatar
Robert Kloefkorn committed
// system includes
#include <string>

#include "passtraits.hh"

// dune includes
#include <dune/common/version.hh>
#include <dune/fem/io/parameter.hh>

// local includes
#include <dune/fem-dg/operator/fluxes/eulerfluxes.hh>
#include <dune/fem-dg/operator/fluxes/diffusionflux.hh>
#include "nswaves.hh"
Robert Kloefkorn's avatar
Robert Kloefkorn committed
#include "ns_model.hh"

#include <dune/fem-dg/stepper/advectiondiffusionstepper.hh>
template< class GridType >
struct ProblemCreator
Robert Kloefkorn's avatar
Robert Kloefkorn committed
{
  static const int polynomialOrder =  POLORDER ;
  typedef NSWaves< GridType > ProblemType;
Robert Kloefkorn's avatar
Robert Kloefkorn committed

  template< class GridPart >
  struct Traits
  {
    typedef ProblemType      InitialDataType;
Robert Kloefkorn's avatar
Robert Kloefkorn committed
    typedef Dune::NSModel< GridPart, InitialDataType > ModelType;
    // choice of diffusion flux (see diffusionflux.hh for methods)
    static const Dune :: DGDiffusionFluxIdentifier PrimalDiffusionFluxId
Robert Kloefkorn's avatar
Robert Kloefkorn committed
           = Dune :: method_general ;

// for header check
#ifndef FLUX
#define FLUX 1
#endif

Robert Kloefkorn's avatar
Robert Kloefkorn committed
// ******************************** NUMERICAL FLUX *****************************
#if (FLUX==1)
#warning "FLUX: LLF"
    typedef LLFFlux< ModelType > FluxType;
#elif (FLUX==2)
#warning "FLUX: HLL (Dennis)"
    typedef HLLNumFlux< ModelType > FluxType;
#elif (FLUX==3)
#warning "FLUX: HLLC (Dennis)"
    typedef HLLCNumFlux< ModelType > FluxType;
#elif (FLUX==4)
#warning "FLUX: HLL2C"
    typedef HLL2CFlux< ModelType > FluxType;
#elif (FLUX==5)
#warning "FLUX: HLL2"
    typedef HLL2Flux< ModelType > FluxType;
#elif (FLUX==6)
#warning "FLUX: HLLEM (Mhd)"
    typedef HLLEMNumFlux< ModelType > FluxType;
#else
#error "Set the flag FLUX! See Makefile.am for details!"
#endif
Robert Kloefkorn's avatar
Robert Kloefkorn committed
// ****************************** END NUMERICAL FLUX ***************************
  };

  static inline std::string advectionFluxName()
  {
#if (FLUX==1)
    return "LLF";
#elif (FLUX==2)
    return "HLL(Dennis)";
#elif (FLUX==3)
    return "HLLC(Dennis)";
#elif (FLUX==4)
    return "HLL2C";
#elif (FLUX==5)
    return "HLL2";
#elif (FLUX==6)
    return "HLLEM(Mhd)";
#endif
  }

  static inline std::string diffusionFluxName()
  {
#ifdef EULER
    return "";
#elif (defined PRIMALDG)
    return Dune::Fem::Parameter::getValue< std::string >("dgdiffusionflux.method");
#else
    return "LDG";
#endif
  }

  static inline std::string moduleName()
  {
    return "";
  static inline Dune::GridPtr<GridType>
  initializeGrid()
Robert Kloefkorn's avatar
Robert Kloefkorn committed
  {
    std::string description( advectionFluxName() + " " + diffusionFluxName() );
    // use default implementation
Robert Kloefkorn's avatar
Robert Kloefkorn committed
    return initialize< GridType > ( description );
  }

Robert Kloefkorn's avatar
Robert Kloefkorn committed
  static ProblemType* problem()
  {
    // choice of explicit or implicit ode solver
    return new ProblemType ();
  }

  // this should be ok but could lead to a henn-egg problem
  typedef AdvectionDiffusionStepper< GridType, ProblemCreator< GridType>, polynomialOrder > StepperType;
#define NEW_STEPPER_SELECTOR_USED
Robert Kloefkorn's avatar
Robert Kloefkorn committed
#endif // FEMHOWTO_NSEQ_RPOBLEMCREATOR_HH