Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • usadellab/cplantbox_simulations
  • ceplas/cplantbox_simulations
2 results
Show changes
Showing
with 690 additions and 0 deletions
upperDepth, lowerDepth, Campbell_he, Campbell_b, VG_he, VG_alpha, VG_n, VG_alpha_mod, VG_n_mod, thetaR, thetaS, Ksat
0.0, 1.0, -4.2, 3.58, -3.8, 0.15, 1.35, 0.3, 1.33, 0.01, 0.46, 0.001
<?xml version="1.0"?><VTKFile type="PolyData" version="0.1" byte_order="LittleEndian">
<PolyData>
<Piece NumberOfLines="35" NumberOfPoints="37">
<CellData Scalars=" CellData">
</CellData>
<Points>
<DataArray type="Float32" Name="Coordinates" NumberOfComponents="3" format="ascii" >
0 0 -3 -0.0268869 -0.0553848 -3.2423 -0.0577364 -0.0669445 -3.49012 -0.0882992 -0.0784067 -3.73798 -0.141769 -0.0767975 -3.98219 -0.191622 -0.0676985 -4.227 -0.253286 -0.0901169 -4.46824 -0.266554 -0.0762119 -4.7175 -0.264042 -0.0542005 -4.96651 -0.223172 -0.027088 -5.21166 -0.191931 -0.00915339 -5.45905 -0.165665 0.0143691 -5.70655 -0.150774 0.0191217 -5.90334 0 0 -3 0 0 -2.75 0 0 -2.5 0 0 -2.3 0 0 -2.05 0 0 -1.8 0 0 -1.6 0 0 -1.35 0 0 -1.1 0 0 -0.900001 7.33909e-18 -0.119856 -2.0806 1.46782e-17 -0.239713 -1.86121 2.20173e-17 -0.359569 -1.64181 2.4618e-17 -0.402043 -1.56407 -2.20173e-17 0.119856 -1.3806 -4.40345e-17 0.239713 -1.16121 -6.60518e-17 0.359569 -0.941813 -7.27758e-17 0.396173 -0.87481 3.66954e-17 -0.119856 -0.680758 7.31667e-17 -0.238981 -0.462702 1.07728e-16 -0.351867 -0.256065 -5.13736e-17 0.119856 -0.680606 -1.02747e-16 0.239713 -0.46121 -1.33401e-16 0.31123 -0.330299
</DataArray>
</Points>
<Lines>
<DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="ascii" >
0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 16 23 23 24 24 25 25 26 19 27 27 28 28 29 29 30 22 31 31 32 32 33 22 34 34 35 35 36
</DataArray>
<DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="ascii" >
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70
</DataArray>
</Lines>
</Piece>
</PolyData>
</VTKFile>
/**
namespace CPlantBox {
* Benchmarks
namespace CPlantBox {
*
namespace CPlantBox {
* Compare root system lengths with the exact solution (see also the Python script singleroot.py)
namespace CPlantBox {
*
namespace CPlantBox {
* Benchmark 1a
namespace CPlantBox {
* Single root, no laterals: defined as apical zone
namespace CPlantBox {
*
namespace CPlantBox {
* Benchmark 1a
namespace CPlantBox {
* Single root, no laterals: defined as root with laterals (lb, ln, la, nob), but laterals have 0 length
namespace CPlantBox {
*
namespace CPlantBox {
* Benchmark 2
namespace CPlantBox {
* Single root, with laterals
namespace CPlantBox {
*
namespace CPlantBox {
*/
namespace CPlantBox {
using namespace std;
namespace CPlantBox {
namespace CPlantBox {
namespace CPlantBox {
void benchmark(string name, vector<double> times, vector<double> dt_, double dx,
namespace CPlantBox {
vector<double>& l0, vector<double>& l1, vector<double>& lt,
namespace CPlantBox {
string bm_name)
namespace CPlantBox {
{
namespace CPlantBox {
RootSystem rs1;
namespace CPlantBox {
rs1.openFile(name,"modelparameter_bu/");
namespace CPlantBox {
rs1.getRootTypeParameter(1)->dx=dx; // apply axial resolution
namespace CPlantBox {
rs1.getRootTypeParameter(2)->dx=dx; // apply axial resolution
namespace CPlantBox {
rs1.initialize();
namespace CPlantBox {
int i =0;
namespace CPlantBox {
for (auto dt : dt_) {
namespace CPlantBox {
rs1.simulate(dt);
namespace CPlantBox {
SegmentAnalyser analysis0(rs1);
namespace CPlantBox {
lt[i] = analysis0.getSummed(RootSystem::st_length);
namespace CPlantBox {
analysis0.filter(RootSystem::st_type,1);
namespace CPlantBox {
l0[i] = analysis0.getSummed(RootSystem::st_length);
namespace CPlantBox {
SegmentAnalyser analysis1(rs1);
namespace CPlantBox {
analysis1.filter(RootSystem::st_type,2);
namespace CPlantBox {
l1[i] = analysis1.getSummed(RootSystem::st_length);
namespace CPlantBox {
i++;
namespace CPlantBox {
}
namespace CPlantBox {
cout << bm_name <<"\ntimes [\t";
namespace CPlantBox {
for (auto t : times) { cout << t << "\t"; }
namespace CPlantBox {
cout << "]\nzero order length [\t";
namespace CPlantBox {
for (auto l : l0) { cout << l << "\t"; }
namespace CPlantBox {
cout << "]\nfirst order length [\t";
namespace CPlantBox {
for (auto l : l1) { cout << l << "\t"; }
namespace CPlantBox {
cout << "]\ntotal length [\t";
namespace CPlantBox {
for (auto l : lt) { cout << l << "\t"; }
namespace CPlantBox {
cout << "]\n\n";
namespace CPlantBox {
}
namespace CPlantBox {
namespace CPlantBox {
namespace CPlantBox {
namespace CPlantBox {
void benchmarks()
namespace CPlantBox {
{
namespace CPlantBox {
vector<double> times = { 7 ,15, 30, 60 };
namespace CPlantBox {
namespace CPlantBox {
vector<double> dt_(times.size());
namespace CPlantBox {
dt_[0] = times[0];
namespace CPlantBox {
for (size_t i=1; i<times.size(); i++) {
namespace CPlantBox {
dt_[i] = times.at(i)-times.at(i-1);
namespace CPlantBox {
}
namespace CPlantBox {
namespace CPlantBox {
vector<double> l0(times.size()); // zero order lengths
namespace CPlantBox {
vector<double> l1(times.size()); // first order lengths
namespace CPlantBox {
vector<double> lt(times.size()); // total lengths
namespace CPlantBox {
namespace CPlantBox {
double dx = 0.1;
namespace CPlantBox {
namespace CPlantBox {
benchmark("bm_singleroot_nl",times,dt_,dx,l0,l1,lt,"Benchmark 1a"); // single root, no laterals, default tap root system
namespace CPlantBox {
benchmark("bm_singleroot_nl2",times,dt_,dx,l0,l1,lt,"Benchmark 1b"); // single root, 0-lenght laterals, pparam file
namespace CPlantBox {
benchmark("bm_singleroot",times,dt_,dx,l0,l1,lt,"Benchmark 2"); // single root, laterals
namespace CPlantBox {
benchmark("bm_monocot_nl",times,dt_,dx,l0,l1,lt,"Benchmark 3a"); // multiple roots of type benchmark 1a
namespace CPlantBox {
benchmark("bm_monocot_nl2",times,dt_,dx,l0,l1,lt,"Benchmark 3b"); // multiple roots of type benchmark 1b
namespace CPlantBox {
benchmark("bm_monocot",times,dt_,dx,l0,l1,lt,"Benchmark 4"); // multiple roots of type benchmark 2
namespace CPlantBox {
namespace CPlantBox {
}
namespace CPlantBox {
/**
* Example 1
*
* 1) Opens plant and root parameters from a file
* 2) Simulates root growth
* 3) Outputs a VTP (for vizualisation in ParaView)
* In Paraview: use tubePLot.py script for fancy visualisation (Macro/Add new macro...), apply after opening file
*
* Additionally, exports the line segments as .txt file to import into Matlab for postprocessing
*/
using namespace std;
namespace CPlantBox {
void example1()
{
Plant plant;
string name = "PMA2018";
/*
* Open plant and root parameter from a file
*/
plant.openXML(name);
//plant.openFile(name);
// plant.writeAlltoXML(name);
// plant.writeParameters(std::cout);
/*
* Initialize
*/
plant.initialize();
std::cout << "finished initialize\n";
/*
* Simulate
*/
double simtime =3; // 60; // 20, 40, 60 days
double dt = 1; // try other values here
int N = round(simtime/dt);
for (int i=0; i<N; i++) {
plant.simulate(dt);
}
cout << "fin (with " << plant.getNumberOfNodes() << " nodes) \n";
auto o_ = plant.getOrgans(Organ::ot_organ);
cout << o_.size() << " organs \n";
/*
* Export final result (as vtp)
*/
// auto t1 = std::chrono::high_resolution_clock::now();
// plant.write("plant_write_rootsystem.vtp");
// auto t2 = std::chrono::high_resolution_clock::now();
// std::cout << "test function took "
// << std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count()
// << " milliseconds\n";
/*
* Export segments for Matlab analysis
*/
SegmentAnalyser analysis(plant);
// analysis.write("rootsystem.txt");
analysis.write("analysis_write_rootsystem.vtp");
/*
* Export dgf file
*/
// analysis.write("rootsystem.dgf");
/*
Total length and surface
*/
// double l = analysis.getSummed(Plant::st_length);
// std::cout << "Root system length " << l << " cm \n";
cout << "Finished with a total of " << plant.getNumberOfNodes()<< " nodes\n";
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2016 Daniel Leitner and Andrea Schnepf. See //license.txt for details.
///This is an under developed version with a simple stem growth.
#include <istream>
#include "Plant.h"
#include "Organ.h"
#include "analysis.h"
#include <iostream>
#include <fstream>
//#include <unistd.h>
#include "tinyxml2.h"
#include "example1.h"
#include "example2.h"
//#include "example3.h"
//#include "example_scenegraph.h"
/**
* Starts an examples (from the examples folder)
*/
int main(int argc, char* argv[])
{
string name = "PMA2018";
if (argc>1) {
name= argv[1];
}
CPlantBox::example1(); // open parameter file, and output VTP
// example2(); // like example 1, but with put geometry
// example3(); // more than 1 plant
// example_scenegraph();
return(0);
}
/mnt/c/cpb1/modelparameter
\ No newline at end of file
File added
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.