hi how could one define the flux in DG while the advection speed is defined in CG space for unitInterval case?
Your question is not specific enough to get answers. You can look at demos to see implementations of the numerical flux (e.g., the DG advection-diffusion demo). If you have a particular flux in mind you need to be specific.
sorry for I didn't describe the question clearly. I am reading dg-advection-diffusion-demo now, since I want to try a time dependent problem in 1D domain.as I mentioned by Logg, a simple way to write upwind flux is
flux = dot(jump(Ct), jump(up*C))
my question are: 1) I can't understand why it can be write in such manner, since it use the 'exterior' test function. while for me, the flux is integrate over surface, so there is only 'interior' part of test function.
2) how could one define 1D flux? for simpler I have a only constant advect velocity inside 1D domain. then I do things as :
from dolfin import * u0=Expression('1') mesh=UnitInterval(3) V_cg=FunctionSpace(mesh,'CG',1) V_dg=FunctionSpace(mesh,'DG',1) U=Function(V_cg) n=FacetNormal(mesh) un=U*n up=(un+abs(un))/2.0 U.interpolate(u0) c=TrialFunction(V_dg) v=TestFunction(V_dg) flux=jump(v)*jump(up*c)*dS print assemble(flux).array()
but it gives error message as:
Trying to integrate expression of rank 1 with free indices (). Traceback (most recent call last): File "/media/ZHANGWEI/Fenics/1D_DG_upwind_flux.py", line 17, in flux=jump(v)jump(upc)dS File "/usr/lib/python2.7/dist-packages/ufl/integral.py", line 269, in rmul % (integrand.rank(), integrand.free_indices())) File "/usr/lib/python2.7/dist-packages/ufl/log.py", line 154, in error raise self._exception_type(self._format_raw(message)) UFLException: Trying to integrate expression of rank 1 with free indices ().
thanks in advance!