Skip to content
Snippets Groups Projects
Commit d82bdbfe authored by Beatrix Becker's avatar Beatrix Becker
Browse files

[exercise-fluidsystem][2pproblem] gnuplot to plot density of component

parent cb6e4abd
No related branches found
No related tags found
1 merge request!21Feature/exercise fluidsystem gnuplot
......@@ -59,6 +59,9 @@
// The two-phase immiscible fluid system
#include <dumux/material/fluidsystems/2pimmiscible.hh>
// The interface to create plots during simulation
#include <dumux/io/gnuplotinterface.hh>
namespace Dumux{
// Forward declaration of the problem class
template <class TypeTag> class ExerciseFluidsystemProblemTwoP;
......@@ -156,6 +159,8 @@ public:
// set the depth of the bottom of the reservoir
depthBOR_ = this->fvGridGeometry().bBoxMax()[dimWorld-1];
if(getParam<bool>("Output.PlotDensity"))
plotDensity_();
}
/*!
......@@ -282,8 +287,27 @@ public:
}
private:
void plotDensity_()
{
std::vector<double> x(100);
std::vector<double> y(100);
for (int i=0; i<100; ++i)
x[i] = 1e4 + i*100910;
for (int i=0; i<100; ++i)
y[i] = MyCompressibleComponent<Scalar>::liquidDensity(300, x[i]);
gnuplot_.resetPlot();
gnuplot_.setXRange(1e4, 1e7);
gnuplot_.setOption("set logscale x 10");
gnuplot_.setYRange(1440, 1480);
gnuplot_.setXlabel("pressure [Pa]");
gnuplot_.setYlabel("density [kg/m^3]");
gnuplot_.addDataSetToPlot(x, y, "YourComponent_density.dat", "w l t 'Liquid density of your component'");
gnuplot_.plot("YourComponent_density");
}
Scalar eps_; //! small epsilon value
Scalar depthBOR_; //! depth at the bottom of the reservoir
Dumux::GnuplotInterface<double> gnuplot_; //! collects data for plotting
};
}
......
......@@ -8,3 +8,6 @@ Name = exercise-fluidsystem_a # name will be given to e.g. to the vtk result fil
[Grid]
UpperRight = 60 60 # x-/y-coordinates of the upper-right corner of the grid [m]
Cells = 60 60 # x-/y-resolution of the grid
[Output]
PlotDensity = false # plot density over pressure for your component
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment