CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   extract information from sample during simulation for use (https://www.cfd-online.com/Forums/openfoam-programming-development/83757-extract-information-sample-during-simulation-use.html)

duongquaphim January 10, 2011 13:51

extract information from sample during simulation for use
 
Hi all,

I am using interFoam and wanna to extract the position of the interface every timestep for later use (for calculating height function). I found that I can use sample to extract the interface at alpha1 = 0.5. In /OpenFOAM-1.6/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C there is a function to write the positions and index of points (s.points() and s.faces()) on the surface called writeGeometry():

158 void Foam::sampledSurfaces::writeGeometry() const
159 {
............
186 genericFormatter_->write
187 (
188 outputDir,
189 s.name(),
190 s.points(),
191 s.faces()
192 );
193 }


What I did is create a function in sampleSurfaces.H like:

224 const vectorField iso_points()
225 {
226 return iso_points_;
227 };

and try to assign the value of s.points() to the value iso_points() later like:

iso_points_ = s.points();

But then when I compiled, I got the error: sampledSurface/sampledSurfaces/sampledSurfaces.C:198: error: passing 'const Foam::vectorField' as 'this' argument of 'void Foam::Field<Type>::operator=(const Foam::Field<Type>&) [with Type = Foam::Vector<double>]' discards qualifiers

I try different ways to get that information but it did not work. If you have any ideas or ways to extract that information for using in the solver, i would very appreciate to hear.

Regards,

Duong


All times are GMT -4. The time now is 02:16.