[dune-pdelab] Instationary Navier-Stokes equations with Finite Volume method : Getting the velocity components at the center of the faces
CERRITO Samuel
Samuel.CERRITO at eurogiciel.fr
Mon Sep 22 17:14:43 CEST 2014
Hi,
I wrote my own Local Operator to achieve a finite volume method on the instasionary Navier-Stokes equations.
I also coded the associated Local Functions (localBasis, localcoefficients and LocalInterpolation) to have a proper finite element map.
The problem is I DON'T want to get my velocity components on the vertices BUT on the center of the faces of my cells.
To do so, I tried to start form the cgstokes case in which the addVertexData is used.
I looked into the VTKWriter.hh file but couldn't find out how to change the position where to get my data (from vertex to center of face)...
In my LocalInterpolation.hh file, I use the following function :
template<typename F, typename C>
void interpolate (const F& f, std::vector<C>& out) const {
typename LB::Traits::DomainType x;
typename LB::Traits::RangeType y;
out.resize(4);
x[0] = 0.5; x[1] = 0.0; f.evaluate(x,y); out[0] = y; // out[] should be 1 or 2
x[0] = 0.0; x[1] = 0.5; f.evaluate(x,y); out[1] = y;
x[0] = 1.0; x[1] = 1.0; f.evaluate(x,y); out[2] = y;
x[0] = 0.5; x[1] = 1.0; f.evaluate(x,y); out[3] = y;
}
In my Main, I have the following lines :
//////////////////////////////////////////////////////////
// Initial guess
Dune::PDELab::FilenameHelper fn(filename); //output file name
{
// Generate functions suitable for VTK output
typedef Dune::PDELab::VectorDiscreteGridFunction<VelocitySubGFS,V> VDGF;
VDGF vdgf(velocitySubGfs,x0);
typedef Dune::PDELab::DiscreteGridFunction<PressureSubGFS,V> PDGF;
PDGF pdgf(pressureSubGfs,x0);
// Output grid function with SubsamplingVTKWriter
Dune::SubsamplingVTKWriter<GV> vtkwriter(gv,2);
vtkwriter.addCellData(new Dune::PDELab::VTKGridFunctionAdapter<PDGF>(pdgf,"p")); // get pressure
vtkwriter.addVertexData(new Dune::PDELab::VTKGridFunctionAdapter<VDGF>(vdgf,"v")); // get velocity
vtkwriter.write(fn.getName(),Dune::VTK::ascii);//appendedraw); // write ouput file
std::cout << "VTK output file was written: " << fn.getName() << ".vtu" << std::endl;
fn.increment(); // increment output file name
}
Thx for your help !
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20140922/d80fce77/attachment.htm>
More information about the dune-pdelab
mailing list