summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConstantin Riß <constantin.riss@dre.de>2010-01-18 17:51:32 +0100
committerConstantin Riß <constantin.riss@dre.de>2010-01-18 17:51:32 +0100
commit4341087e249ca73bfc1799c9427add3a080186f1 (patch)
tree7bc562ebacbf27d2cc10c06c0101bbaf9c29aae6
parenta9312d80a44872fb627ccb8fdf8a743b04d512b6 (diff)
downloadc3d-4341087e249ca73bfc1799c9427add3a080186f1.tar
c3d-4341087e249ca73bfc1799c9427add3a080186f1.zip
zweiter Waermeaustausch...
-rw-r--r--Temparray.cpp183
-rw-r--r--Temparray.h8
2 files changed, 164 insertions, 27 deletions
diff --git a/Temparray.cpp b/Temparray.cpp
index 7d484d5..dacd048 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -38,7 +38,7 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
}
void Temparray::calcTemp(){
- float specificconductivity = 0.7;
+ float conductivity = 0.7, specificcapacity = 1513;
float areasmall, area, areabig, distance, capacity, capacity2, capacity3, volume, thermalresistance,
thermalresistance2, tau12, tau21, tau13, tau31;
float meterperunit = 3.0;
@@ -74,16 +74,16 @@ void Temparray::calcTemp(){
thermalresistance = ((depth2 / 2 - (depth2 - innerdepth2)/4) -
(depth / 2 - (depth - innerdepth)/4)) / 0.9 * meterperunit /
- (specificconductivity * ((area + areabig) / 2));
+ (conductivity * ((area + areabig) / 2));
if(l!=5)thermalresistance2 = ((depth / 2 - (depth - innerdepth)/4)-
(depth3 / 2 - (depth3 - innerdepth3)/4)) / 0.9 * meterperunit /
- (specificconductivity * ((area + areasmall) / 2));
+ (conductivity * ((area + areasmall) / 2));
- capacity = specificconductivity *((((depth + innerdepth)/2)*((width + innerwidth)/2)*
+ capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
height)/0.9*meterperunit);
- capacity2 = specificconductivity *((((depth2 + innerdepth2)/2)*((width2 + innerwidth2)/2)*
+ capacity2 = specificcapacity *((((depth2 - innerdepth2)/2)*((width2 + innerwidth2)/2)*
height2)/0.9*meterperunit);
- if(l!=5)capacity3 = specificconductivity *((((depth3 + innerdepth3)/2)*((width3 + innerwidth3)/2)*
+ if(l!=5)capacity3 = specificcapacity *((((depth3 - innerdepth3)/2)*((width3 + innerwidth3)/2)*
height3)/0.9*meterperunit);
}
else if(m % 2 == 1) {
@@ -93,17 +93,17 @@ void Temparray::calcTemp(){
thermalresistance = ((width2 / 2 - (width2 - innerwidth2)/4) -
(width / 2 - (width - innerwidth)/4)) / 0.9 * meterperunit /
- (specificconductivity * ((area + areabig) / 2));
+ (conductivity * ((area + areabig) / 2));
if(l!=5)thermalresistance2 = (width3 / 2 - (width3 - innerwidth3)/4) -
(width / 2 - (width - innerwidth)/4) / 0.9 * meterperunit /
- (specificconductivity * ((area + areasmall) / 2));
+ (conductivity * ((area + areasmall) / 2));
- capacity = specificconductivity *((((depth + innerdepth)/2)*((width + innerwidth)/2)*
+ capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
height)/0.9*meterperunit);
- capacity2 = specificconductivity *((((depth2 + innerdepth2)/2)*((width2 + innerwidth2)/2)*
+ capacity2 = specificcapacity *((((depth2 - innerdepth2)/2)*((width2 + innerwidth2)/2)*
height2)/0.9*meterperunit);
if(l!=5)
- capacity3 = specificconductivity *((((depth3 + innerdepth3)/2)*((width3 + innerwidth3)/2)*
+ capacity3 = specificcapacity *((((depth3 - innerdepth3)/2)*((width3 + innerwidth3)/2)*
height3)/0.9*meterperunit);
}
tau12 = capacity * thermalresistance;
@@ -111,30 +111,161 @@ void Temparray::calcTemp(){
if(l!=5)tau31 = capacity * thermalresistance2;
if(l!=5)tau13 = capacity3 * thermalresistance2;
- temperatureold(i, j, k, l, m) =
- temperatureold(i, j, k, l, m) + ((temperatureold(i, j, k, l, m) -
- temperatureold(i, j, k, l-1, m))*-exp(-(1/tau12)));
- temperatureold(i, j, k, l-1, m) =
- temperatureold(i, j, k, l-1, m) - ((temperatureold(i, j, k, l, m) -
- temperatureold(i, j, k, l-1, m))*-exp(-(1/tau21)));
-
- if(l!=5)temperatureold(i, j, k, l, m) =
- temperatureold(i, j, k, l, m) + ((temperatureold(i, j, k, l, m) -
- temperatureold(i, j, k, l+1, m))*-exp(-(1/tau13)));
- if(l!=5)temperatureold(i, j, k, l+1, m) =
- temperatureold(i, j, k, l+1, m) - ((temperatureold(i, j, k, l, m) -
- temperatureold(i, j, k, l+1, m))*-exp(-(1/tau31)));
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l-1, m))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l-1, m) =
+ temperaturenew(i, j, k, l-1, m) + ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l-1, m))*(1-exp(-(1/tau21))));
+
+ if(l!=5)temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l+1, m))*(1-exp(-(1/tau13))));
+ if(l!=5)temperaturenew(i, j, k, l+1, m) =
+ temperaturenew(i, j, k, l+1, m) + ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l+1, m))*(1-exp(-(1/tau31))));
}
}
}
}
}
- /*for(int i = 0; i < sx; ++i) {
+ 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++) {temperatureold(i, j, k, l, m)=temperaturenew(i, j, k, l, m);}}}}}*/
+ for(int m = 0; m < 4; m++) {
+ width = cubehole(i, j, k, l).getWidth();
+ height = cubehole(i, j, k, l).getHeight();
+ depth = cubehole(i, j, k, l).getDepth();
+ innerwidth = cubehole(i, j, k, l).getInnerWidth();
+ innerdepth = cubehole(i, j, k, l).getInnerDepth();
+
+ if(m == 0) {
+ area = (sqrt(pow((depth-innerdepth)/2, 2) + pow((width-innerwidth)/2, 2))* height) /
+ 0.9 * meterperunit;
+
+ thermalresistance = sqrt(pow((width/2 - (width-innerwidth)/4)/2, 2)+
+ pow((depth/2 - (depth-innerdepth)/4)/2, 2))/
+ 0.9 * meterperunit /(conductivity * area);
+
+ capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
+ height)/0.9*meterperunit);
+ capacity2 = specificcapacity *((((width - innerwidth)/2)*((depth + innerdepth)/2)*
+ height)/0.9*meterperunit);
+
+ tau12 = capacity * thermalresistance;
+ tau21 = capacity2 * thermalresistance;
+
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l, 3))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 3) =
+ temperaturenew(i, j, k, l, 3) + ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l, 3))*(1-exp(-(1/tau21))));
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l, 1))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 1) =
+ temperaturenew(i, j, k, l, 1) + ((temperatureold(i, j, k, l, m) -
+ temperatureold(i, j, k, l, 1))*(1-exp(-(1/tau21))));
+ }
+ else if(m == 1) {
+ area = (sqrt(pow((width-innerwidth)/2, 2) + pow((depth-innerdepth)/2, 2))* height) /
+ 0.9 * meterperunit;
+
+ thermalresistance = sqrt(pow((depth/2 - (depth-innerdepth)/4)/2, 2)+
+ pow((width/2 - (width-innerwidth)/4)/2, 2))/
+ 0.9 * meterperunit /(conductivity * area);
+
+ capacity = specificcapacity *((((width - innerwidth)/2)*((depth + innerdepth)/2)*
+ height)/0.9*meterperunit);
+ capacity2 = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
+ height)/0.9*meterperunit);
+
+ tau12 = capacity * thermalresistance;
+ tau21 = capacity2 * thermalresistance;
+
+ temperaturenew(i, j, k, l, 1) =
+ temperaturenew(i, j, k, l, 1) - ((temperatureold(i, j, k, l, 1) -
+ temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 0) =
+ temperaturenew(i, j, k, l, 0) + ((temperatureold(i, j, k, l, 1) -
+ temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau21))));
+ temperaturenew(i, j, k, l, 1) =
+ temperaturenew(i, j, k, l, 1) - ((temperatureold(i, j, k, l, 1) -
+ temperatureold(i, j, k, l, 2))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 2) =
+ temperaturenew(i, j, k, l, 2) + ((temperatureold(i, j, k, l, 1) -
+ temperatureold(i, j, k, l, 2))*(1-exp(-(1/tau21))));
+ }
+ else if(m == 2) {
+ area = (sqrt(pow((depth-innerdepth)/2, 2) + pow((width-innerwidth)/2, 2))* height) /
+ 0.9 * meterperunit;
+
+ thermalresistance = sqrt(pow((width/2 - (width-innerwidth)/4)/2, 2)+
+ pow((depth/2 - (depth-innerdepth)/4)/2, 2))/
+ 0.9 * meterperunit /(conductivity * area);
+
+ capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
+ height)/0.9*meterperunit);
+ capacity2 = specificcapacity *((((width - innerwidth)/2)*((depth + innerdepth)/2)*
+ height)/0.9*meterperunit);
+
+ tau12 = capacity * thermalresistance;
+ tau21 = capacity2 * thermalresistance;
+
+ temperaturenew(i, j, k, l, 2) =
+ temperaturenew(i, j, k, l, 2) - ((temperatureold(i, j, k, l, 2) -
+ temperatureold(i, j, k, l, 1))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 1) =
+ temperaturenew(i, j, k, l, 1) + ((temperatureold(i, j, k, l, 2) -
+ temperatureold(i, j, k, l, 1))*(1-exp(-(1/tau21))));
+ temperaturenew(i, j, k, l, 2) =
+ temperaturenew(i, j, k, l, 2) - ((temperatureold(i, j, k, l, 2) -
+ temperatureold(i, j, k, l, 3))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 3) =
+ temperaturenew(i, j, k, l, 3) + ((temperatureold(i, j, k, l, 2) -
+ temperatureold(i, j, k, l, 3))*(1-exp(-(1/tau21))));
+ }
+ else if(m == 3) {
+ area = (sqrt(pow((width-innerwidth)/2, 2) + pow((depth-innerdepth)/2, 2))* height) /
+ 0.9 * meterperunit;
+
+ thermalresistance = sqrt(pow((depth/2 - (depth-innerdepth)/4)/2, 2)+
+ pow((width/2 - (width-innerwidth)/4)/2, 2))/
+ 0.9 * meterperunit /(conductivity * area);
+
+ capacity = specificcapacity *((((width - innerwidth)/2)*((depth + innerdepth)/2)*
+ height)/0.9*meterperunit);
+ capacity2 = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
+ height)/0.9*meterperunit);
+
+ tau12 = capacity * thermalresistance;
+ tau21 = capacity2 * thermalresistance;
+
+ temperaturenew(i, j, k, l, 3) =
+ temperaturenew(i, j, k, l, 3) - ((temperatureold(i, j, k, l, 3) -
+ temperatureold(i, j, k, l, 2))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 2) =
+ temperaturenew(i, j, k, l, 2) + ((temperatureold(i, j, k, l, 3) -
+ temperatureold(i, j, k, l, 2))*(1-exp(-(1/tau21))));
+ temperaturenew(i, j, k, l, 3) =
+ temperaturenew(i, j, k, l, 3) - ((temperatureold(i, j, k, l, 3) -
+ temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, l, 0) =
+ temperaturenew(i, j, k, l, 0) + ((temperatureold(i, j, k, l, 3) -
+ temperatureold(i, j, k, l, 0))*(1-exp(-(1/tau21))));
+ }
+ }
+ }
+ }
+ }
+ }
+ mergetemperature();
+// 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;
std::cerr << temperatureold(2, 2, 2, 1, 2) << std::endl;
std::cerr << temperatureold(2, 2, 2, 2, 2) << std::endl;
std::cerr << temperatureold(2, 2, 2, 3, 2) << "\n" << std::endl;
diff --git a/Temparray.h b/Temparray.h
index 04250c4..921de69 100644
--- a/Temparray.h
+++ b/Temparray.h
@@ -35,10 +35,15 @@ class Temparray
int sx, sy, sz;
float averagetemp;
-
Cubehole& cubehole(int x, int y, int z, int line) {
return cubearray[x*sy*sz*6 + y*sz*6 + z*6 + line];
}
+ void mergetemperature(){
+ 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++){temperatureold(i, j, k, l, m)=temperaturenew(i, j, k, l, m);}}}}}}
void tempInit(float temp0, int x0, int y0, int z0){
for(int i=0; i<x0; i++){
for(int j=0; j<y0; j++){
@@ -53,6 +58,7 @@ class Temparray
}
}
temperatureold(2, 2, 2, 2, 2) = 90;
+ temperaturenew(2, 2, 2, 2, 2) = 90;
}
/* void calcAverage(){
float tempcache = 0;