summaryrefslogtreecommitdiffstats
path: root/Temparray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Temparray.cpp')
-rw-r--r--Temparray.cpp98
1 files changed, 94 insertions, 4 deletions
diff --git a/Temparray.cpp b/Temparray.cpp
index 6385434..83008cc 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -35,7 +35,7 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
}
}
}
- cubehole(2, 2, 2, 1).setColor(vmml::vec4f(0.0, 0.0, 0.0, 1.0),
+/* cubehole(2, 2, 2, 1).setColor(vmml::vec4f(0.0, 0.0, 0.0, 1.0),
vmml::vec4f(0.0, 0.0, 0.0, 1.0),
vmml::vec4f(0.0, 0.0, 0.0, 1.0),
vmml::vec4f(0.0, 0.0, 0.0, 1.0));
@@ -46,7 +46,7 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
cubehole(2, 2, 2, 3).setColor(vmml::vec4f(0.5, 0.5, 0.5, 1.0),
vmml::vec4f(0.5, 0.5, 0.5, 1.0),
vmml::vec4f(0.5, 0.5, 0.5, 1.0),
- vmml::vec4f(0.5, 0.5, 0.5, 1.0));
+ vmml::vec4f(0.5, 0.5, 0.5, 1.0));*/
}
void Temparray::calcTemp(){
@@ -256,6 +256,27 @@ void Temparray::calcTemp(){
temperaturenew(i, j, k, l, 0) + ((temperatureold(i, j, k, l, 3) -
temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau21))));
}
+ if(j == sy-1) {
+ if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
+ / 0.9 * meterperunit;
+ if(m % 2 == 1)area = (((width - innerwidth)/2)*((depth + innerdepth)/2))
+ / 0.9 * meterperunit;
+
+ thermalresistance = 3 + (height/2 / 0.9 * meterperunit /(conductivity * area));
+
+ if(m % 2 == 0)capacity = specificcapacity *((((depth - innerdepth)/2)*
+ ((width + innerwidth)/2)*height)
+ / 0.9 * meterperunit);
+ if(m % 2 == 1)capacity = specificcapacity *((((width - innerwidth)/2)*
+ ((depth + innerdepth)/2)*height)
+ / 0.9 * meterperunit);
+
+ tau12 = capacity * thermalresistance;
+
+ temperaturenew(i, j, k, 0, m) =
+ temperaturenew(i, j, k, 0, m) - ((temperatureold(i, j, k, 0, m) - earthtemp)
+ *(1-exp(-(1/tau12))));
+ }
}
}
if(i > 0) {
@@ -270,7 +291,7 @@ void Temparray::calcTemp(){
thermalresistance = ((width - innerwidth)/2) / 0.9 * meterperunit /
(conductivity * area);
- capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
+ capacity = specificcapacity *((((depth + innerdepth)/2)*((width - innerwidth)/2)*
height)/0.9*meterperunit);
tau12 = capacity * thermalresistance;
@@ -281,6 +302,29 @@ void Temparray::calcTemp(){
temperaturenew(i-1, j, k, 0, 1) + ((temperatureold(i, j, k, 0, 3) -
temperatureold(i-1, j, k, 0, 1))*(1-exp(-(1/tau12))));
}
+ if (i == 0 || i == sx-1) {
+ int h=3;
+ if(i == sx-1) h=1;
+
+ width = cubehole(i, j, k, 0).getWidth();
+ height = cubehole(i, j, k, 0).getHeight();
+ depth = cubehole(i, j, k, 0).getDepth();
+ innerwidth = cubehole(i, j, k, 0).getInnerWidth();
+ innerdepth = cubehole(i, j, k, 0).getInnerDepth();
+
+ area = (((depth + innerdepth)/2)*height) / 0.9 * meterperunit;
+
+ thermalresistance = 3 + ((width - innerwidth)/4) / 0.9 * meterperunit /
+ (conductivity * area);
+
+ capacity = specificcapacity *((((depth + innerdepth)/2)*((width - innerwidth)/2)*
+ height)/0.9*meterperunit);
+ tau12 = capacity * thermalresistance;
+
+ temperaturenew(i, j, k, 0, h) =
+ temperaturenew(i, j, k, 0, h) - ((temperatureold(i, j, k, 0, h) - earthtemp)
+ *(1-exp(-(1/tau12))));
+ }
if(k > 0) {
width = cubehole(i, j, k, 0).getWidth();
height = cubehole(i, j, k, 0).getHeight();
@@ -304,10 +348,34 @@ void Temparray::calcTemp(){
temperaturenew(i, j, k-1, 0, 2) + ((temperatureold(i, j, k, 0, 0) -
temperatureold(i, j, k-1, 0, 2))*(1-exp(-(1/tau12))));
}
+ if(k == 0 || k == sz-1) {
+ int h=0;
+ if(i == sz-1) h=2;
+
+ width = cubehole(i, j, k, 0).getWidth();
+ height = cubehole(i, j, k, 0).getHeight();
+ depth = cubehole(i, j, k, 0).getDepth();
+ innerwidth = cubehole(i, j, k, 0).getInnerWidth();
+ innerdepth = cubehole(i, j, k, 0).getInnerDepth();
+
+ area = (((width + innerwidth)/2)*height) / 0.9 * meterperunit;
+
+ thermalresistance = 3 + ((depth - innerdepth)/4) / 0.9 * meterperunit /
+ (conductivity * area);
+
+ capacity = specificcapacity *((((width + innerwidth)/2)*((depth - innerdepth)/2)*
+ height)/0.9*meterperunit);
+ tau12 = capacity * thermalresistance;
+
+ temperaturenew(i, j, k, 0, h) =
+ temperaturenew(i, j, k, 0, h) - ((temperatureold(i, j, k, 0, h) - earthtemp)
+ *(1-exp(-(1/tau12))));
+ }
}
}
}
mergetemperature();
+ coloring();
// std::cerr << temperaturenew(2, 2, 2, 1, 2) << std::endl;
// std::cerr << temperaturenew(2, 2, 2, 2, 2) << std::endl;
// std::cerr << temperaturenew(2, 2, 2, 3, 2) << "\n" << std::endl;
@@ -329,6 +397,28 @@ std::list<Triangle> Temparray::getTriangles(){
}
}
}
-
return triangles;
}
+
+void Temparray::coloring() {
+ float r[4], g[4], b[4];
+ for(int i=0; i<sx; ++i){
+ for(int j=0; j<sy; ++j){
+ for(int k=0; k<sz; ++k){
+ for(int l=0; l<6; ++l){
+ for(int m=0; m<4; ++m){
+ if(temperatureold(i, j, k, l, m) >= 25 ) b[m]=0;
+ else b[m]=(25-temperatureold(i, j, k, l, m))/25;
+ g[m]=fabs((25-temperatureold(i, j, k, l, m))/25);
+ if(temperatureold(i, j, k, l, m) <= 25 ) r[m]=0;
+ else r[m]=(100-temperatureold(i, j, k, l, m))/25;
+ }
+ cubehole(i, j, k, l).setColor(vmml::vec4f(r[0], g[0], b[0], 1.0),
+ vmml::vec4f(r[1], g[1], b[1], 1.0),
+ vmml::vec4f(r[2], g[2], b[2], 1.0),
+ vmml::vec4f(r[3], g[3], b[3], 1.0));
+ }
+ }
+ }
+ }
+}