summaryrefslogtreecommitdiffstats
path: root/Temparray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Temparray.cpp')
-rw-r--r--Temparray.cpp69
1 files changed, 38 insertions, 31 deletions
diff --git a/Temparray.cpp b/Temparray.cpp
index 9c67afd..17889ae 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -41,7 +41,7 @@ Temparray::Temparray(float initialtemp, int x0, int y0, int z0){
void Temparray::calcTemp(){
float conductivity = 0.7, specificcapacity = 1513;
- float areasmall, area, areabig, distance, capacity, capacity2, volume, thermalresistance, tau12, tau21;
+ float areasmall, area, areabig, distance, capacity, capacity2, volume, thermalresistance, thermalresistance2, tau12, tau21;
float meterperunit = 3.0;
float width, height, depth, innerwidth, innerdepth;
float width2, height2, depth2, innerwidth2, innerdepth2;
@@ -69,7 +69,11 @@ void Temparray::calcTemp(){
thermalresistance = ((depth2 / 2 - (depth2 - innerdepth2)/4) -
(depth / 2 - (depth - innerdepth)/4)) / 0.9 * meterperunit /
- (conductivity * ((area + areabig) / 2));
+ (conductivity * areabig);
+ thermalresistance2 = ((depth2 / 2 - (depth2 - innerdepth2)/4) -
+ (depth / 2 - (depth - innerdepth)/4)) / 0.9 * meterperunit /
+ (conductivity * area);
+
capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
height)/0.9*meterperunit);
@@ -82,7 +86,10 @@ void Temparray::calcTemp(){
thermalresistance = ((width2 / 2 - (width2 - innerwidth2)/4) -
(width / 2 - (width - innerwidth)/4)) / 0.9 * meterperunit /
- (conductivity * ((area + areabig) / 2));
+ (conductivity * areabig);
+ thermalresistance2 = ((width2 / 2 - (width2 - innerwidth2)/4) -
+ (width / 2 - (width - innerwidth)/4)) / 0.9 * meterperunit /
+ (conductivity * area);
capacity = specificcapacity *((((depth + innerdepth)/2)*((width - innerwidth)/2)*
height)/0.9*meterperunit);
@@ -90,7 +97,7 @@ void Temparray::calcTemp(){
height2)/0.9*meterperunit);
}
tau12 = capacity * thermalresistance;
- tau21 = capacity2 * thermalresistance;
+ tau21 = capacity2 * thermalresistance2;
temperaturenew(i, j, k, l, m) =
temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
@@ -107,13 +114,13 @@ void Temparray::calcTemp(){
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 l = 0; l < 6; ++l) {
for(int m = 0; m < 4; m++) {
- width = cubehole(i, j, k, 5).getWidth();
- height = cubehole(i, j, k, 5).getHeight();
- depth = cubehole(i, j, k, 5).getDepth();
- innerwidth = cubehole(i, j, k, 5).getInnerWidth();
- innerdepth = cubehole(i, j, k, 5).getInnerDepth();
+ 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 % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
/ 0.9 * meterperunit;
@@ -132,8 +139,8 @@ void Temparray::calcTemp(){
((depth + innerdepth)/2)*height)
/ 0.9 * meterperunit);
- loadableenergy = (probetemp - temperatureold(i, j, k, 5, m))/thermalresistance/10;
- unloadableenergy = (temperatureold(i, j, k, 5, m)-21.5)/thermalresistance/10;
+ loadableenergy = (probetemp - temperatureold(i, j, k, l, m))/thermalresistance/10;
+ unloadableenergy = (temperatureold(i, j, k, l, m)-21.5)/thermalresistance/10;
tau12 = capacity * thermalresistance;
@@ -150,8 +157,8 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/loadableenergy;
- temperaturenew(i, j, k, 5, m) =
- temperaturenew(i, j, k, 5, m) + (probetemp-temperatureold(i, j, k, 5, m))
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) + (probetemp-temperatureold(i, j, k, l, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
@@ -168,13 +175,13 @@ void Temparray::calcTemp(){
}
if(inputpower > 0) {
factor = inputpower/unloadableenergy;
- temperaturenew(i, j, k, 5, m) =
- temperaturenew(i, j, k, 5, m) + (21.5-temperatureold(i, j, k, 5, m))
+ temperaturenew(i, j, k, l, m) =
+ temperaturenew(i, j, k, l, m) + (21.5-temperatureold(i, j, k, l, m))
*thermalresistance*factor*(1-exp(-(1/tau12)));
}
}
}
- //}
+ }
}
}
}
@@ -233,7 +240,7 @@ void Temparray::calcTemp(){
temperatureold(i, j-1, k, l, m))*(1-exp(-(1/tau21))));
}
- if(m == 0) {
+ /*if(m == 0) {
area = (sqrt(pow((depth-innerdepth)/2, 2) + pow((width-innerwidth)/2, 2))* height) /
0.9 * meterperunit;
@@ -324,7 +331,7 @@ void Temparray::calcTemp(){
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))));
- }
+ }*/
if(j == sy-1) {
if(m % 2 == 0)area = (((depth - innerdepth)/2)*((width + innerwidth)/2))
/ 0.9 * meterperunit;
@@ -364,12 +371,12 @@ void Temparray::calcTemp(){
height)/0.9*meterperunit);
tau12 = capacity * thermalresistance;
- temperaturenew(i, j, k, 0, 3) =
- temperaturenew(i, j, k, 0, 3) - ((temperatureold(i, j, k, 0, 3) -
- temperatureold(i-1, j, k, 0, 1))*(1-exp(-(1/tau12))));
- temperaturenew(i-1, j, k, 0, 1) =
- temperaturenew(i-1, j, k, 0, 1) + ((temperatureold(i, j, k, 0, 3) -
- temperatureold(i-1, j, k, 0, 1))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, 0, 1) =
+ temperaturenew(i, j, k, 0, 1) - ((temperatureold(i, j, k, 0, 1) -
+ temperatureold(i-1, j, k, 0, 3))*(1-exp(-(1/tau12))));
+ temperaturenew(i-1, j, k, 0, 3) =
+ temperaturenew(i-1, j, k, 0, 3) + ((temperatureold(i, j, k, 0, 1) -
+ temperatureold(i-1, j, k, 0, 3))*(1-exp(-(1/tau12))));
}
if (i == 0 || i == sx-1) {
int h=3;
@@ -410,12 +417,12 @@ void Temparray::calcTemp(){
height)/0.9*meterperunit);
tau12 = capacity * thermalresistance;
- temperaturenew(i, j, k, 0, 0) =
- temperaturenew(i, j, k, 0, 0) - ((temperatureold(i, j, k, 0, 0) -
- temperatureold(i-1, j, k-1, 0, 2))*(1-exp(-(1/tau12))));
- temperaturenew(i, j, k-1, 0, 2) =
- temperaturenew(i, j, k-1, 0, 2) + ((temperatureold(i, j, k, 0, 0) -
- temperatureold(i, j, k-1, 0, 2))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k, 0, 2) =
+ temperaturenew(i, j, k, 0, 2) - ((temperatureold(i, j, k, 0, 2) -
+ temperatureold(i-1, j, k-1, 0, 0))*(1-exp(-(1/tau12))));
+ temperaturenew(i, j, k-1, 0, 0) =
+ temperaturenew(i, j, k-1, 0, 0) + ((temperatureold(i, j, k, 0, 2) -
+ temperatureold(i, j, k-1, 0, 0))*(1-exp(-(1/tau12))));
}
if(k == 0 || k == sz-1) {
int h=0;