summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Temparray.cpp60
1 files changed, 21 insertions, 39 deletions
diff --git a/Temparray.cpp b/Temparray.cpp
index 39edd1b..0d48f44 100644
--- a/Temparray.cpp
+++ b/Temparray.cpp
@@ -258,11 +258,11 @@ void Temparray::calcTemp(){
tau12 = capacity * thermalresistance;
tau21 = capacity2 * thermalresistance;
- temperaturenew(i, j, k, l, m) =
- temperaturenew(i, j, k, l, m) - ((temperatureold(i, j, k, l, m) -
+ temperaturenew(i, j, k, l, 0) =
+ temperaturenew(i, j, k, l, 0) - ((temperatureold(i, j, k, l, 0) -
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) -
+ temperaturenew(i, j, k, l, 1) + ((temperatureold(i, j, k, l, 0) -
temperatureold(i, j, k, l, 1))*(1-exp(-(1/tau21))));
}
else if(m == 1) {
@@ -378,13 +378,13 @@ void Temparray::calcTemp(){
}
}
}
- if(i > 0) {
- 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();
+ 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();
+ if(i > 0) {
area = (((depth + innerdepth)/2)*height) / 0.9 * meterperunit;
thermalresistance = ((width - innerwidth)/2) / 0.9 * meterperunit /
@@ -405,12 +405,6 @@ void Temparray::calcTemp(){
int h=1;
if(i == sx-1) h=3;
- 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 /
@@ -425,38 +419,26 @@ void Temparray::calcTemp(){
*(1-exp(-(1/tau12))));
}
if(k > 0) {
- 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;
- area = (((width + innerwidth)/2)*height) / 0.9 * meterperunit;
+ thermalresistance = ((depth - innerdepth)/2) / 0.9 * meterperunit /
+ (conductivity * area);
- thermalresistance = ((depth - innerdepth)/2) / 0.9 * meterperunit /
- (conductivity * area);
+ capacity = specificcapacity *((((width + innerwidth)/2)*((depth - innerdepth)/2)*
+ height)/0.9*meterperunit);
+ tau12 = capacity * thermalresistance;
- capacity = specificcapacity *((((depth - innerdepth)/2)*((width + innerwidth)/2)*
- height)/0.9*meterperunit);
- tau12 = capacity * thermalresistance;
-
- 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))));
+ temperaturenew(i, j, k, 0, 2) =
+ temperaturenew(i, j, k, 0, 2) - ((temperatureold(i, j, k, 0, 2) -
+ temperatureold(i, 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, 0) -
+ temperatureold(i, j, k-1, 0, 0))*(1-exp(-(1/tau12))));
}
if(k == 0 || k == sz-1) {
int h=2;
if(k == sz-1) h=0;
- 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 /