How to output the vector field in the cavity2d example

Hello, we can only output the velocity magnitude in the example file “cavity2d”, and I want to output the vector field.
could you please give me some suggestions?

template<class BlockLatticeT>
void writeVTK(BlockLatticeT& lattice,
              IncomprFlowParam<T> const& parameters, plint iter)
    T dx = parameters.getDeltaX();
    T dt = parameters.getDeltaT();
    VtkImageOutput2D<T> vtkOut(createFileName("vtk", iter, 6), dx);
    vtkOut.writeData<float>(*computeVelocityNorm(lattice), "velocityNorm", dx/dt);
    vtkOut.writeData<2,float>(*computeVelocity(lattice), "velocity", dx/dt);

The vector field is an output in this example. I don’t understand you question.


I am guessing maybe you are referring to velocityNormDiff?
If so, you can take a look of codesByTopic/externalMacroscopicVariables/cavity2d.cpp