Skip to content
Snippets Groups Projects
Commit c8d351ae authored by Robert K's avatar Robert K
Browse files

make navier stokes work with Double.

parent 09a0d2a7
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ DGF
Interval
0 0
2 2
4 4
16 16
#
GridParameter
......
......@@ -18,18 +18,20 @@ SOURCES12 = $(BASEDIR)/main.cc $(BASEDIR)/main_1.cc $(BASEDIR)/main_2.cc
#GRIDTYPE = ALUGRID_SIMPLEX
#GRIDTYPE=PARALLELGRID_ALUGRID_CUBE
#GRIDTYPE=PARALLELGRID_ALUGRID_SIMPLEX
# GRIDTYPE=SPGRID
#GRIDTYPE=SPGRID_COUNT_FLOPS
#GRIDTYPE=SPGRID
#GRIDTYPE=CARTESIANGRID_ALUGRID_CUBE
# GRIDTYPE = ALUGRID_CUBE
#GRIDTYPE=YASPGRID
GRIDTYPE = YASPGRID
GRIDDIM=3
GRIDTYPE=YASPGRID
#GRIDTYPE = YASPGRID
GRIDDIM=2
POLORDER=2
PROBLEM = 2 # check ./problemtype.hh
FLUX = 1 # check ./problemcreator.hh
DIFFFLUX=PRIMALDG
VTK=1
#DIFFFLUX=FLUXDG
# INFO SPACE OPERATOR:
......@@ -42,8 +44,8 @@ DIFFFLUX=PRIMALDG
# 1. define LIMITER to limit the advection part of the solution (not checked)
AM_CPPFLAGS = $(USE_OMP) -I../../problems/nseq $(ALL_PKG_CPPFLAGS) -DGRIDDIM=$(GRIDDIM) \
-DPROBLEM=$(PROBLEM) -D$(GRIDTYPE) $(DUNEMPICPPFLAGS) \
-DFLUX=$(FLUX) -D$(DIFFFLUX) # -DLEGENDREBASIS # -DWBPROBLEM -DWELLBALANCE
AM_LDFLAGS = $(ALL_PKG_LDFLAGS) $(LAPACK_LDFLAGS) $(USE_OMP)
-DFLUX=$(FLUX) -DUSE_VTKWRITER=$(VTK) -D$(DIFFFLUX) -DCOUNT_FLOPS # -DLEGENDREBASIS # -DWBPROBLEM -DWELLBALANCE
AM_LDFLAGS = $(ALL_PKG_LDFLAGS) $(LAPACK_LDFLAGS) $(USE_OMP)
EXTRA_PROGRAMS = nseq nseq12
check_PROGRAMS = nseqonep
......@@ -70,7 +72,7 @@ generatecode:
$(MAKE) generate
generate:
./$(PROG) femhowto.eocSteps:1 femhowto.maximaltimesteps:1 fem.io.outputformat:none fem.ode.order:1 paramFiles/paramNSWaves
./$(PROG) femhowto.eocSteps:1 femhowto.maximaltimesteps:1 fem.io.outputformat:none fem.ode.order:1 parameter
compilecode:
$(MAKE) clean
......
......@@ -31,19 +31,20 @@ class NSModelTraits
enum { dimGradRange = dimRange * dimDomain };
enum { dimGradient = dimDomain + 1 };
typedef Fem :: FunctionSpace< double, double, dimDomain, dimRange > FunctionSpaceType ;
typedef typename ProblemType :: FunctionSpaceType FunctionSpaceType;
typedef typename FunctionSpaceType :: DomainType DomainType ;
typedef typename FunctionSpaceType :: DomainFieldType DomainFieldType ;
typedef typename FunctionSpaceType :: RangeFieldType RangeFieldType ;
typedef FieldVector< DomainFieldType, dimDomain - 1 > FaceDomainType;
typedef typename FunctionSpaceType :: RangeType RangeType ;
typedef FieldVector< double, dimGradRange > GradientType;
typedef FieldVector< DomainFieldType, dimGradRange > GradientType;
typedef typename FunctionSpaceType :: JacobianRangeType JacobianRangeType;
typedef JacobianRangeType FluxRangeType;
typedef FieldVector< double, dimGradRange > GradientRangeType;
typedef FieldMatrix< double, dimGradRange, dimDomain > JacobianFluxRangeType;
typedef FieldVector< DomainFieldType, dimGradRange > GradientRangeType;
typedef FieldMatrix< DomainFieldType, dimGradRange, dimDomain > JacobianFluxRangeType;
typedef typename GridPart :: IntersectionIteratorType IntersectionIterator;
typedef typename IntersectionIterator::Intersection Intersection;
......
......@@ -21,14 +21,16 @@ class NSFlux
public:
typedef typename Traits::ProblemType ProblemType;
typedef typename Traits::DomainType DomainType;
typedef typename Traits::DomainFieldType DomainFieldType;
typedef typename Traits::RangeFieldType RangeFieldType;
typedef typename Traits::RangeType RangeType;
typedef Dune::FieldVector< double, dimGradRange > GradientRangeType;
typedef Dune::FieldVector< RangeFieldType, dimGradRange > GradientRangeType;
typedef typename Traits::JacobianRangeType JacobianRangeType;
typedef Dune::FieldMatrix< double, dimGradRange, dimDomain > JacobianFluxRangeType;
typedef Dune::FieldMatrix< RangeFieldType, dimGradRange, dimDomain > JacobianFluxRangeType;
typedef Dune::Fem::FieldMatrixConverter< GradientRangeType, JacobianRangeType >
ConvertedJacobianRangeType;
typedef Dune::FieldMatrix< double, dimDomain, dimDomain > VelocityGradientType;
typedef Dune::FieldMatrix< RangeFieldType, dimDomain, dimDomain > VelocityGradientType;
NSFlux( const ProblemType& problem )
: eulerFlux_()
......
......@@ -26,14 +26,19 @@ namespace Dune {
template <class GridType>
class NSWaves : public EvolutionProblemInterface<
Dune::Fem::FunctionSpace< double, double, GridType::dimension, GridType::dimension + 2 >,
Dune::Fem::FunctionSpace< typename GridType::ctype,
typename GridType::ctype,
//double,
GridType::dimension, GridType::dimension + 2 >,
true >,
public Thermodynamics< GridType::dimensionworld >
{
NSWaves( const NSWaves& );
public:
typedef Fem::FunctionSpace<typename GridType::ctype,
double, GridType::dimensionworld,
typename GridType::ctype,
// double,
GridType::dimensionworld,
GridType::dimensionworld + 2 > FunctionSpaceType ;
typedef Fem::Parameter ParameterType ;
......@@ -140,14 +145,14 @@ class NSWaves : public EvolutionProblemInterface<
protected:
const std::string myName_;
const double omegaGNS_;
const double kGNS_;
const double gammaGNS_;
const DomainFieldType omegaGNS_;
const DomainFieldType kGNS_;
const DomainFieldType gammaGNS_;
const double endTime_;
const double mu_;
const double k_;
const double A_;
const double B_;
const DomainFieldType mu_;
const DomainFieldType k_;
const DomainFieldType A_;
const DomainFieldType B_;
};
......@@ -229,13 +234,13 @@ inline double NSWaves<GridType>
res *= Amplitude;
*/
double sumX = 0;
DomainFieldType sumX = 0;
for( int i=0; i< dimension; ++i ) sumX += x[i];
const double beta = kGNS_ * sumX - omegaGNS_*t;
const double cosBeta = std::cos( beta );
const double sinBeta = std::sin( beta );
const double sin2BetaGamma = std::sin( 2.*beta ) * gammaGNS_;
const double sinGammaKappa = sin2BetaGamma * kGNS_ * (gamma() - 1.);
const DomainFieldType beta = kGNS_ * sumX - omegaGNS_*t;
const DomainFieldType cosBeta = std::cos( beta );
const DomainFieldType sinBeta = std::sin( beta );
const DomainFieldType sin2BetaGamma = std::sin( 2.*beta ) * gammaGNS_;
const DomainFieldType sinGammaKappa = sin2BetaGamma * kGNS_ * (gamma() - 1.);
res[0] = gammaGNS_*( cosBeta * ( dimension * kGNS_ - omegaGNS_) );
res[1] = gammaGNS_*( cosBeta * A_ + sinGammaKappa );
......@@ -287,11 +292,11 @@ inline void NSWaves<GridType>
res[ energyId ] *= res[ 0 ];
*/
double sumX = 0;
DomainFieldType sumX = 0;
for( int i=0; i< dimension; ++i ) sumX += x[i];
const double beta = kGNS_ * sumX - omegaGNS_*t;
const double sinBeta = std::sin( beta );
const double sinGamma2 = sinBeta * gammaGNS_ + 2.;
const DomainFieldType beta = kGNS_ * sumX - omegaGNS_*t;
const DomainFieldType sinBeta = std::sin( beta );
const DomainFieldType sinGamma2 = sinBeta * gammaGNS_ + 2.;
for(int i=0; i<energyId; ++i)
{
......
......@@ -48,7 +48,8 @@ Re: 1. #(Reynold's number)
Pr: 0.72 # 0.72 #(Prandtl's number)
femhowto.startTime: 0. # s
femhowto.endTime: 0.1
femhowto.eocSteps: 5
femdg.stepper.endtime: 0.1
fem.eoc.steps: 2
gammaGNS: 0.5
omegaGNS: 1.
......
......@@ -38,7 +38,7 @@ namespace Dune {
//typedef Fem::ElementQuadrature< GridPartType, 1 > FaceQuadratureType;
// Allow generalization to systems
typedef Fem::FunctionSpace< ctype, double, dimDomain, dimRange > FunctionSpaceType;
typedef Fem::FunctionSpace< ctype, ctype, dimDomain, dimRange > FunctionSpaceType;
#ifdef LEGENDREBASIS
#warning "Using Legendre basis functions"
typedef Fem::LegendreDiscontinuousGalerkinSpace< FunctionSpaceType,
......@@ -51,7 +51,7 @@ namespace Dune {
Fem::CachingStorage > DiscreteFunctionSpaceType;
#else
#warning "Using standard modal basis functions"
typedef Fem::DiscontinuousGalerkinSpace< Fem::FunctionSpace< ctype, double, dimDomain, 1 >,
typedef Fem::DiscontinuousGalerkinSpace< Fem::FunctionSpace< ctype, ctype, dimDomain, 1 >,
GridPartType, polOrd, Fem::CachingStorage > ContainedSpaceType;
typedef Fem::CombinedSpace< ContainedSpaceType, dimRange, Fem::VariableBased > DiscreteFunctionSpaceType;
#endif
......@@ -59,7 +59,7 @@ namespace Dune {
//typedef Fem::PetscDiscreteFunction< DiscreteFunctionSpaceType > DestinationType;
// Indicator for Limiter
typedef Fem::FunctionSpace< ctype, double, dimDomain, 3> FVFunctionSpaceType;
typedef Fem::FunctionSpace< ctype, ctype, dimDomain, 3> FVFunctionSpaceType;
typedef Fem::FiniteVolumeSpace<FVFunctionSpaceType,GridPartType, 0, Fem::SimpleStorage> IndicatorSpaceType;
typedef Fem::AdaptiveDiscreteFunction<IndicatorSpaceType> IndicatorType;
......
......@@ -100,7 +100,7 @@ struct ProblemCreator
static inline std::string moduleName()
{
return "navierstokes";
return "";
}
static inline Dune::GridPtr<GridType>
......
......@@ -2,7 +2,7 @@
#---------------------
fem.ode.odesolver: EX # ode solvers: EX, IM, IMEX
#fem.ode.order: 2
fem.ode.order: 3
fem.ode.verbose: none # ode output: none, cfl, full
fem.ode.cflincrease: 1.25
fem.ode.miniterations: 95
......
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