-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cxx
More file actions
52 lines (44 loc) · 1.2 KB
/
test.cxx
File metadata and controls
52 lines (44 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <bout/physicsmodel.hxx>
#include "neutrals.hxx"
#include "neutrals_diffusion.hxx"
#include "unit.hxx"
class MonitorExample : public PhysicsModel {
protected:
// Initialisation
int init(bool restarting) {
unit = new BohmUnit(.5, 40, 8e18, 2);
solver->add(f, "f");
neut = NeutralsFactory::create(solver, mesh, "neutrals");
neut->setUnit(*unit);
neut->setPlasmaDensity(f);
neut->setElectronTemperature(f);
neut->setIonTemperature(f);
neut->setElectronVelocity(f);
neut->setIonVelocity(f);
return 0;
}
// Calculate time-derivatives
int rhs(BoutReal t) {
ddt(f) = -f;
neut->update();
return 0;
}
// This called every output timestep
int outputMonitor(BoutReal simtime, int iter, int NOUT) {
output.write("\nOutput monitor, time = %e, step %d of %d\n", simtime, iter, NOUT);
return 0;
}
// This called every timestep
int timestepMonitor(BoutReal simtime, BoutReal dt) {
output.write("\nTimestep monitor, time = %e, dt = %e\n", simtime, dt);
return 0;
}
public:
~MonitorExample() { delete unit; }
private:
Field3D f;
std::unique_ptr<Neutrals> neut;
Unit *unit;
};
// Create a default main()
BOUTMAIN(MonitorExample);