[Dune] suggestion for example adaptivefinitevolume.cc
Matteo Semplice
matteo.semplice at uninsubria.it
Sat Nov 26 17:08:00 CET 2011
Hi.
I was examining the source code of adaptivefinitevolume.cc in
dune-grid-howto (version 2.1) and noticed that
1) the initial data is written to disk, the appropriate entry is
inserted in concentration.series, but then the next call to vtkout opens
concentration.series in write mode, erasing the entry about the first
timestep. So I did:
--- adaptivefinitevolume.cc~ 2011-04-29 17:31:53.000000000 +0200
+++ adaptivefinitevolume.cc 2011-11-26 16:55:57.000000000 +0100
@@ -42,7 +42,7 @@
double dt, t=0;
double saveStep = 0.1;
const double saveInterval = 0.1;
- int counter = 0;
+ int counter = 1; //file number 0 is the initial datum
int k = 0;
std::cout << "s=" << grid.size(0) << " k=" << k << " t=" << t <<
std::endl;
2) a minor point is that I think that saveStep should be computed from
initial time and saveInterval, as follows
--- adaptivefinitevolume.cc~ 2011-04-29 17:31:53.000000000 +0200
+++ adaptivefinitevolume.cc 2011-11-26 16:56:32.000000000 +0100
@@ -40,9 +40,9 @@
// variables for time, timestep etc.
double dt, t=0;
- double saveStep = 0.1;
const double saveInterval = 0.1;
- int counter = 0;
+ double saveStep = t+saveInterval;
+ int counter = 1; //file number 0 is the initial datum
int k = 0;
std::cout << "s=" << grid.size(0) << " k=" << k << " t=" << t <<
std::endl;
Matteo
--
Matteo Semplice Dip. di Fisica e Matematica
Phone: 031-2386132 Università dell'Insubria
Fax: 031-2386209 Via Valleggio, 11
22100 Como
More information about the Dune
mailing list