Skip to content
Snippets Groups Projects
Commit 5994ba90 authored by Andreas Dedner's avatar Andreas Dedner
Browse files

use chorin method as exact solution for RP

parent 664eb098
No related branches found
No related tags found
1 merge request!6Latest improvements in dune-fem-dg
Pipeline #24776 failed
from ufl import *
from dune.ufl import Space
from dune.femdg.testing import Parameters
from dune.generator import algorithm
from dune.common import FieldVector
from dune.ufl import Space, GridFunction
from dune.fem.function import gridFunction
import numpy
def CompressibleEuler(dim, gamma):
......@@ -123,15 +123,23 @@ def sod(dim=2,gamma=1.4):
space = Space(dim,dim+2)
x = SpatialCoordinate(space.cell())
Model = CompressibleEulerReflection(dim,gamma)
Model.initial=riemanProblem( Model, x[0], x0, [1,0,0,1], [0.125,0,0,0.1])
Vl, Vr = [1.,0.,0.,1.], [0.125,0,0,0.1]
Model.initial=riemanProblem( Model, x[0], x0, Vl, Vr)
#Model.domain=[[0, 0], [1, 0.25], [256, 64]]
#Model.domain=[[0, 0], [1, 0.25], [128, 32]]
Model.domain=[[0, 0], [1, 0.25], [64, 16]]
Model.endTime=0.15
#def u(t,x):
# val = algorithm.load('sod','sod.hh', t, x0, x )
# return val
#Model.exact = lambda t: u(t,x)
def chorin(gv,t):
gf = gv.function("chorin","chorin.hh", Vl,Vr,gamma,x0,t,name="chorin")
lgf = gf.localFunction() # this seems to fail?
@gridFunction(gv,"sod",3)
def lf(e,x):
lgf.bind(e)
return FieldVector( Model.toCons(lgf(x)) )
# return Model.toCons(gf(e,x))
lf.plot()
return lf
Model.exact = lambda gv,t: chorin(gv,t)
Model.name="sod"
return Model
def radialSod1(dim=2,gamma=1.4):
......
......@@ -4,11 +4,27 @@
#include <dune/common/fvector.hh>
#include <dune/fem-dg/examples/euler/problems/chorjo.hh>
void chorin(const double (&Ulr)[6], double gamma,
double t,double x,
double& q_erg,double& u_erg,double& p_erg)
{
EULERCHORIN::
lsg(x,t,&q_erg,&u_erg,&p_erg,
Ulr[0],Ulr[3],Ulr[1],Ulr[4],Ulr[2],Ulr[5],
gamma);
}
template <class DomainType>
Dune::FieldVector<double, DomainType::dimension+2> sod( const double t, const double x0, const DomainType& x )
Dune::FieldVector<double, DomainType::dimension+2> sod(
const std::vector<double> &UL,
const std::vector<double> &UR,
double gamma,
const double t, const double x0, const DomainType& x )
{
Dune::FieldVector<double, DomainType::dimension+2> res( 0 );
return chorin(t,x[0]-x0,res[0],res[1],res[DomainType::dimension+1]);
double Ulr[6] = { UL[0],UL[1],UL[DomainType::dimension+1],
UR[0],UR[1],UR[DomainType::dimension+1] };
chorin(Ulr,gamma,t,x[0]-x0,res[0],res[1],res[DomainType::dimension+1]);
return res;
}
#endif
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