-
Notifications
You must be signed in to change notification settings - Fork 10
/
enableReconstructionTimeTrackingInIsoAdvector
executable file
·144 lines (119 loc) · 5.09 KB
/
enableReconstructionTimeTrackingInIsoAdvector
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# Run from geometricVofExt top-level directory only
cd "${0%/*}" || exit
wmake -check-dir "$WM_PROJECT_USER_DIR/modules/geometricVofExt" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_USER_DIR/modules/geometricVofExt"
echo " Check your OpenFOAM environment and installation"
exit 1
}
#------------------------------------------------------------------------------
echo
echo "**** Enable Reconstruction Time Tracking in IsoAdvector (optional) *****"
echo
echo " >> Modifiy transportModels/geometricVoF/isoAdvection/isoAdvection.H"
[ -f ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.H ] || cp ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.H
awk '
BEGIN {
in_section1 = 0
in_section2 = 0
}
/surfaceScalarField alphaPhi_;/ {
print " surfaceScalarField alphaPhi_;"
print ""
print " //- Time spent performing interface reconstruction"
print " scalar reconstructionTime_;"
print ""
in_section1 = 1
next
}
/\/\/- Time spent performing interface advection/ && in_section1 {
print
in_section1 = 0
next
}
/return alphaPhi_;/ {
print " return alphaPhi_;"
print " }"
print ""
print " //- time spend in the reconstruction step"
print " scalar reconstructionTime() const noexcept"
print " {"
print " return reconstructionTime_;"
print " }"
print ""
in_section2 = 1
next
}
/\/\/- time spend in the advection step/ && in_section2 {
print
in_section2 = 0
next
}
!in_section1 && !in_section2 {
print
}
' ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.H > ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.H
echo " >> Modifiy transportModels/geometricVoF/isoAdvection/isoAdvection.C"
[ -f ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.C ] || cp ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.C
awk '
BEGIN {
in_section = 0
}
/advectionTime_\(0\),/ {
print " reconstructionTime_(0),"
print " advectionTime_(0),"
in_section = 1
next
}
/timeIndex_\(-1\),/ && in_section {
print
in_section = 0
next
}
!in_section {
print
}
' ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection_old.C > ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvection.C
echo " >> Modifiy transportModels/geometricVoF/isoAdvection/isoAdvectionTemplates.C"
[ -f ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates_old.C ] || cp ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates_old.C
awk '
BEGIN {
in_section = 0
}
/scalar advectionStartTime = mesh_.time\(\).elapsedCpuTime\(\);/ {
print " // " $0
print ""
print " const scalar rDeltaT = 1.0/mesh_.time().deltaTValue();"
print ""
print " // reconstruct the interface"
print " scalar reconstructionStartTime = mesh_.time().elapsedCpuTime();"
print " surf_->reconstruct();"
print " reconstructionTime_ += (mesh_.time().elapsedCpuTime() - reconstructionStartTime);"
print ""
print " if (timeIndex_ < mesh_.time().timeIndex())"
print " {"
print " timeIndex_= mesh_.time().timeIndex();"
print " surf_->normal().oldTime() = surf_->normal();"
print " surf_->centre().oldTime() = surf_->centre();"
print " }"
print ""
print " scalar advectionStartTime = mesh_.time().elapsedCpuTime();"
print ""
in_section = 1
next
}
/\/\/ Initialising dVf with upwind values/ && in_section {
print
in_section = 0
next
}
!in_section {
print
}
' ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates_old.C > ${WM_PROJECT_DIR}/src/transportModels/geometricVoF/advectionSchemes/isoAdvection/isoAdvectionTemplates.C
echo
echo -n " >> " && wmake libso ${WM_PROJECT_DIR}/src/transportModels/geometricVoF
echo
echo "********************************* Done *********************************"
echo
#------------------------------------------------------------------------------