wiki:u/johannjc/scratchpad

Version 18 (modified by Jonathan, 11 years ago) ( diff )

For backward euler we evaluate the RHS at time although we still have to linearize

or equivalently

Now to make the scheme 2nd order in time we can set and we get

Where we can identify the left and right coefficients as

and the center coefficient as

and the RHS left and right contributions

and the RHS center term contribution as

and finally in the code the values for and are negated:

    kx = (0.5*kappa1*dt_diff/(dx**2))
    CALL getTemp(Info,i,j,k,T)
    stencil_fixed(0) = -2.0*REAL(nDim,8)*kx*T(0)**ndiff
    DO l = 1, 2*nDim
       stencil_fixed(l) = kx*T(l)**ndiff
    END DO  
    source = ((ndiff-1.0)/(ndiff+1.0))*dot_product(T(0:2*nDim),stencil_fixed(0:2*nDim)) - T(0)*gamma7*Info%q(i,j,k,1)
    stencil_fixed(0) = stencil_fixed(0) - gamma7*Info%q(i,j,k,1)

also note that the equation is multipled by the mean molecular weight… which is why and

a note about flux boundary conditions

If we have a specified flux at a boundary - then the equation is just

which can be discretized as

which leads to a center coefficient of

and a left right source term contribution

and if the left boundary is a flux boundary, but the right side is normal, then we have to adjust the coefficients

and the center coefficient as

and the RHS left and right contributions

and the RHS center term contribution as

Of course - remembering that in AstroBEAR everything is negated…

This is accomplished by

     source = source + ((ndiff-1.0)/(ndiff+1.0))*(T(0)*kx*T(0)**ndiff)
     source = source - ((ndiff-1.0)/(ndiff+1.0))*(T(p)*kx*T(p)**ndiff)
     stencil_fixed(0)=stencil_fixed(0)+kx*T(0)**ndiff
     stencil_fixed(p)=0.0
     source = source - flb*dt_diff/dx
Note: See TracWiki for help on using the wiki.