-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathBCpost.jl
101 lines (56 loc) · 2.06 KB
/
BCpost.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
println(ARGS)
endTime,deltaT,writeInterval,topT,bottomT,hc = ARGS
include("foamLia/foamLia.jl")
using foamLia
# okay, test implementation
caseFolder = "/users/a/r/areagan/scratch/run/BCTest-$(topT)-$(bottomT)"
case = OpenFoam(caseFolder)
# manipulate parameters
case.controlDict["endTime"] = int(endTime)
case.controlDict["deltaT"] = float(deltaT)
case.controlDict["writeInterval"] = float(writeInterval)
# case.T["..."] = replace(case.T["..."],Text=340,Text=Ttop)
case.T["boundaryField"]["bottominside"]["variables"] = "\"Text=$(bottomT);hc=$(hc);gradT=(Text-T)*hc;\""
case.T["boundaryField"]["bottomoutside"]["variables"] = "\"Text=$(bottomT);hc=$(hc);gradT=(Text-T)*hc;\""
case.T["boundaryField"]["topinside"]["variables"] = "\"Text=$(topT);hc=$(hc);gradT=(Text-T)*hc;\""
case.T["boundaryField"]["topinside"]["variables"] = "\"Text=$(topT);hc=$(hc);gradT=(Text-T)*hc;\""
println(case.T)
baseCase = "/users/a/r/areagan/OpenFOAM/areagan-2.2.1/run/juliabase"
# initCase(case,baseCase)
# run(case,`./Allrun`,"workq")
faces,cells = readMesh(case)
timeSaves = findTimes(case)
println(timeSaves)
Tavg = zeros(Float64,4,length(timeSaves))
Phiavg = zeros(Float64,4,length(timeSaves))
for i in 1:length(timeSaves)
t = timeSaves[i]
println(t)
if t>0
Tl = readVarSpec(case,stringG(t),"T",cells[1])
Tt = readVarSpec(case,stringG(t),"T",cells[2])
Tr = readVarSpec(case,stringG(t),"T",cells[3])
Tb = readVarSpec(case,stringG(t),"T",cells[4])
Tavg[1,i] = mean(Tl)
Tavg[2,i] = mean(Tt)
Tavg[3,i] = mean(Tr)
Tavg[4,i] = mean(Tb)
Phil = readVarSpec(case,stringG(t),"phi",faces[1])
Phit = readVarSpec(case,stringG(t),"phi",faces[2])
Phir = readVarSpec(case,stringG(t),"phi",faces[3])
Phib = readVarSpec(case,stringG(t),"phi",faces[4])
Phiavg[1,i] = mean(Phil)
Phiavg[2,i] = mean(Phit)
Phiavg[3,i] = mean(Phir)
Phiavg[4,i] = mean(Phib)
end
end
# println(Tavg)
# println(Phiavg)
cd("/users/a/r/areagan/scratch/run/BCTest-$(topT)-$(bottomT)")
f = open("Tavg.csv","w")
writecsv(f,Tavg)
close(f)
f = open("Phiavg.csv","w")
writecsv(f,Phiavg)
close(f)