Derivative of solution at solution points

Hello, everyone,

I want to obtain the derivative of all the solution points. And I am confused about something.

In the navstokes/elements.py, velocity gradients, pressure gradient and density gradient are presented, but I did’t see where to use it. and Where does grad_cons pass from?

  @staticmethod
    def grad_con_to_pri(cons, grad_cons, cfg):
        rho, *rhouvw = cons[:-1]
        grad_rho, *grad_rhouvw, grad_E = grad_cons
        # Divide momentum components by ρ
        uvw = [rhov / rho for rhov in rhouvw]
        # Velocity gradients:
        grad_uvw = [(grad_rhov - v*grad_rho) / rho for grad_rhov, v in zip(grad_rhouvw, uvw)]        
    # Pressure gradient: 
        gamma = cfg.getfloat('constants', 'gamma')
        grad_p = grad_E - 0.5*(np.einsum('ijk,iljk->ljk', uvw, grad_rhouvw) + np.einsum('ijk,iljk->ljk', rhouvw, grad_uvw))                       
        grad_p *= (gamma - 1)
        return [grad_rho] + grad_uvw + [grad_p]

Second, in the navstokes/inters.py, gradul=self._vect_lhs, _vect_lhs is views matrix, I know that the views used by the interface flux calculation are views onto data at flux points. And I didn’t see any derivative operations in _vect_view matrix. Could someone have some idea about these quesions?

The function grad_con_to_pri is only really used in the plugins where it is preferable to use the gradient of the primitives rather than the gradients of the conserved variables. Depending on where you want to access the gradients, the easiest way is probably to use the grad_soln in the integration class.

The _vect_lhs and _vect_rhs define the interfaces for the flux point vector memory and is defined by calling get_vect_fpts_for_inter in the solver.base.elements base class. That memory doesn’t have to be used exclusively for the gradient, and the view itself is just a tuple that includes pointer and no operations. The kernels acting on the memory are all defined in the various elements.py and the operation graph is built in the relevant system.py.