-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
OpenFOAM-4.x-56a4152a9.patch
3685 lines (3459 loc) · 119 KB
/
OpenFOAM-4.x-56a4152a9.patch
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.gitignore | 1 +
Allwmake | 6 +-
applications/Allwmake | 3 +-
.../mesh/generation/snappyHexMesh/Make/options | 1 -
.../mesh/manipulation/renumberMesh/Allwmake | 13 +-
.../mesh/manipulation/renumberMesh/Make/options | 1 -
.../postProcessing/graphics/PV3Readers/Allwmake | 3 +
.../postProcessing/graphics/PVReaders/Allwmake | 7 +-
bin/foamInstallationTest | 21 +++-
bin/foamJob | 6 +
bin/foamMonitor | 11 +-
bin/paraFoam | 5 +
bin/tools/RunFunctions | 22 +++-
etc/bashrc | 83 ++++++++++---
etc/config.sh/mac/CGAL | 69 +++++++++++
etc/config.sh/mac/functions | 133 ++++++++++++++++++++
etc/config.sh/mac/metis | 44 +++++++
etc/config.sh/mac/paraview | 16 +++
etc/config.sh/mac/scotch | 47 +++++++
etc/config.sh/mpi | 6 +-
etc/config.sh/settings | 16 ++-
src/Allwmake | 3 +-
src/OSspecific/POSIX/POSIX.C | 36 ++++++
src/OSspecific/POSIX/clockTime/clockTime.H | 3 +
src/OSspecific/POSIX/printStack.C | 72 +++++++++--
src/OSspecific/POSIX/signals/sigFpe.C | 92 +++++++++++++-
src/OSspecific/POSIX/signals/sigFpe.H | 14 ++-
src/OpenFOAM/Make/files | 6 +
src/OpenFOAM/db/IOobject/IOobject.H | 3 +-
src/OpenFOAM/db/IOobject/IOobjectI.H | 17 ++-
src/OpenFOAM/db/IOobject/IOobjectWriteHeader.C | 1 +
src/OpenFOAM/db/IOstreams/IOstreams.H | 4 +
.../db/dynamicLibrary/dynamicCode/dynamicCode.C | 4 +
.../db/dynamicLibrary/dynamicCode/dynamicCode.H | 4 +
src/OpenFOAM/fields/Fields/Field/FieldMapper.H | 2 +-
src/OpenFOAM/primitives/Scalar/doubleFloat.H | 15 +++
src/OpenFOAM/primitives/ints/int/int.H | 8 ++
src/OpenFOAM/primitives/ints/long/long.C | 50 ++++++++
src/OpenFOAM/primitives/ints/long/long.H | 138 +++++++++++++++++++++
src/OpenFOAM/primitives/ints/long/longIO.C | 104 ++++++++++++++++
src/OpenFOAM/primitives/ints/ulong/ulong.C | 52 ++++++++
src/OpenFOAM/primitives/ints/ulong/ulong.H | 138 +++++++++++++++++++++
src/OpenFOAM/primitives/ints/ulong/ulongIO.C | 101 +++++++++++++++
.../primitives/ranges/labelRange/labelRangeI.H | 5 +-
.../primitives/ranges/labelRange/labelRangesI.H | 2 +-
src/conversion/ensight/part/ensightPartCells.C | 4 +-
src/fvAgglomerationMethods/Allwmake | 9 +-
.../MGridGenGamgAgglomeration/Make/options | 16 ++-
.../edgeFaceCirculator/edgeFaceCirculator.C | 2 +-
src/parallel/decompose/Allwmake | 4 +-
src/parallel/decompose/metisDecomp/Allwmake | 10 +-
src/parallel/decompose/metisDecomp/Make/options | 1 -
src/parallel/decompose/metisDecomp/metisDecomp.C | 6 +-
src/parallel/decompose/ptscotchDecomp/Make/options | 10 +-
src/parallel/decompose/scotchDecomp/Make/options | 8 +-
src/renumber/Allwmake | 12 +-
src/renumber/SloanRenumber/Make/options | 15 ++-
wmake/makefiles/apps | 3 +-
wmake/makefiles/files | 12 +-
wmake/makefiles/general | 43 ++++---
wmake/rules/General/CGAL | 9 +-
wmake/rules/General/X | 2 +
wmake/rules/General/bison | 16 ++-
wmake/rules/General/btyacc | 11 +-
wmake/rules/General/btyacc++ | 4 +-
wmake/rules/General/byacc | 11 +-
wmake/rules/General/flex | 8 +-
wmake/rules/General/flex++ | 8 +-
wmake/rules/General/general | 30 +++--
wmake/rules/General/moc | 8 +-
wmake/rules/General/mplib | 2 +
wmake/rules/General/mplibMPICH | 2 +
wmake/rules/General/mplibMPICH-GM | 2 +
wmake/rules/General/mplibOPENMPI | 1 +
wmake/rules/General/mplibQSMPI | 2 +
wmake/rules/General/mplibSGIMPI | 2 +
wmake/rules/General/mplibSYSTEMMPI | 2 +
wmake/rules/General/mplibSYSTEMOPENMPI | 2 +
wmake/rules/General/standard | 2 +-
wmake/rules/General/transform | 6 +-
wmake/rules/General/version | 12 +-
wmake/rules/General/yacc | 20 ++-
wmake/rules/darwin64Clang/c | 23 ++++
wmake/rules/darwin64Clang/c++ | 35 ++++++
wmake/rules/darwin64Clang/c++Debug | 4 +
wmake/rules/darwin64Clang/c++Opt | 5 +
wmake/rules/darwin64Clang/c++Prof | 4 +
wmake/rules/darwin64Clang/cDebug | 4 +
wmake/rules/darwin64Clang/cOpt | 4 +
wmake/rules/darwin64Clang/cProf | 4 +
wmake/rules/darwin64Clang/general | 12 ++
wmake/rules/linux64Clang/c | 2 +
wmake/rules/linux64Clang/c++ | 2 +
wmake/rules/linux64Clang/c++Debug | 2 +
wmake/rules/linux64Clang/c++Opt | 2 +
wmake/rules/linux64Clang/c++Prof | 2 +
wmake/rules/linux64Clang/cDebug | 2 +
wmake/rules/linux64Clang/cOpt | 2 +
wmake/rules/linux64Clang/cProf | 2 +
wmake/rules/linux64Clang/general | 2 +
wmake/rules/linux64Clang/mplibHPMPI | 2 +
wmake/rules/linux64Clang/mplibINTELMPI | 2 +
wmake/rules/linux64Gcc/c | 2 +
wmake/rules/linux64Gcc/c++ | 2 +
wmake/rules/linux64Gcc/c++Debug | 2 +
wmake/rules/linux64Gcc/c++Opt | 2 +
wmake/rules/linux64Gcc/c++Prof | 2 +
wmake/rules/linux64Gcc/cDebug | 2 +
wmake/rules/linux64Gcc/cOpt | 2 +
wmake/rules/linux64Gcc/cProf | 2 +
wmake/rules/linux64Gcc/general | 2 +
wmake/rules/linux64Gcc/mplibHPMPI | 2 +
wmake/rules/linux64Gcc/mplibINTELMPI | 2 +
wmake/scripts/AllwmakeParseArguments | 3 +
wmake/scripts/wmakeFunctions | 2 +-
wmake/src/Makefile | 14 ++-
wmake/src/wmkdep.l | 14 ++-
wmake/wclean | 6 +-
wmake/wmake | 25 ++--
wmake/wmakeLnInclude | 7 +-
wmake/wmakeLnIncludeAll | 2 +-
wmake/wrmdep | 2 +-
122 files changed, 1747 insertions(+), 172 deletions(-)
diff --git a/.gitignore b/.gitignore
index a897b8121..8f59031f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ linux*Gcc*/
linux*Icc*/
solaris*Gcc*/
SunOS*Gcc*/
+darwin*Clang*/
platforms/
# Reinstate wmake/rules that might look like build directories
diff --git a/Allwmake b/Allwmake
index cf49e407b..7d397aec7 100755
--- a/Allwmake
+++ b/Allwmake
@@ -13,11 +13,12 @@ wmakeCheckPwd "$WM_PROJECT_DIR" || {
exit 1
}
-[ -n "$FOAM_EXT_LIBBIN" ] || {
+[ "$(uname -s)" = "Darwin" ] || { [ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
+}
# Compile wmake support applications
(cd wmake/src && make)
@@ -27,7 +28,8 @@ if [ -d "$WM_THIRD_PARTY_DIR" ]
then
$WM_THIRD_PARTY_DIR/Allwmake
else
- echo "Allwmake: no ThirdParty directory found - skipping"
+ [ "$(uname -s)" = "Darwin" ] \
+ || echo "Allwmake: no ThirdParty directory found - skipping"
fi
# Compile OpenFOAM libraries and applications
diff --git a/applications/Allwmake b/applications/Allwmake
index 23c5ebbae..50709b0c3 100755
--- a/applications/Allwmake
+++ b/applications/Allwmake
@@ -12,11 +12,12 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" || {
exit 1
}
-[ -n "$FOAM_EXT_LIBBIN" ] || {
+[ "$(uname -s)" = "Darwin" ] || { [ -n "$FOAM_EXT_LIBBIN" ] || {
echo "Allwmake error: FOAM_EXT_LIBBIN not set"
echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1
}
+}
set -x
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options
index fb480c522..ce48c514d 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options
+++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options
@@ -1,5 +1,4 @@
EXE_INC = \
- /* -g -DFULLDEBUG -O0 */ \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/mesh/snappyHexMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake b/applications/utilities/mesh/manipulation/renumberMesh/Allwmake
index 34b8b78d2..29e0f5028 100755
--- a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake
+++ b/applications/utilities/mesh/manipulation/renumberMesh/Allwmake
@@ -3,24 +3,29 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for compilation (at least for error catching)
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
+_soExt=so
+[ "$(uname -s)" = "Darwin" ] && _soExt=dylib
+
set -x
export COMPILE_FLAGS=''
export LINK_FLAGS=''
-if [ -f "${FOAM_LIBBIN}/libSloanRenumber.so" ]
+if [ -f "${FOAM_LIBBIN}/libSloanRenumber.$_soExt" ]
then
- echo "Found libSloanRenumber.so -- enabling Sloan renumbering support."
+ echo "Found libSloanRenumber.$_soExt -- enabling Sloan renumbering support."
export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber"
fi
-if [ -f "${ZOLTAN_ARCH_PATH}/lib/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ]
+if [ -f "${ZOLTAN_ARCH_PATH}/lib/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.$_soExt" ]
then
- echo "Found libzoltanRenumber.so -- enabling zoltan renumbering support."
+ echo "Found libzoltanRenumber.$_soExt -- enabling zoltan renumbering support."
export COMPILE_FLAGS="-DFOAM_USE_ZOLTAN"
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
fi
+unset _soExt
+
wmake
#------------------------------------------------------------------------------
diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Make/options b/applications/utilities/mesh/manipulation/renumberMesh/Make/options
index ef0651050..720011d74 100644
--- a/applications/utilities/mesh/manipulation/renumberMesh/Make/options
+++ b/applications/utilities/mesh/manipulation/renumberMesh/Make/options
@@ -1,5 +1,4 @@
EXE_INC = \
- /* -DFULLDEBUG -g -O0 */ \
${COMPILE_FLAGS} \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
index 049c1bfca..4ad9bdc94 100755
--- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake
@@ -6,6 +6,9 @@ targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
#set -x
+# Skip on OS X
+[ "$(uname -s)" = "Darwin" ] && exit 0
+
case "$ParaView_VERSION" in
3*)
if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ]
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
index edaa31a37..96728b219 100755
--- a/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
+++ b/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
@@ -26,7 +26,12 @@ case "$ParaView_VERSION" in
fi
;;
*)
- echo "WARN: PV readers not building: ParaView_VERSION=$ParaView_VERSION"
+ if [ "$(uname -s)" = "Darwin" ]
+ then
+ echo "INFO: Skipping PV readers."
+ else
+ echo "WARN: PV readers not building: ParaView_VERSION=$ParaView_VERSION"
+ fi
;;
esac
diff --git a/bin/foamInstallationTest b/bin/foamInstallationTest
index 17b285a5a..f11e61e4f 100755
--- a/bin/foamInstallationTest
+++ b/bin/foamInstallationTest
@@ -306,13 +306,23 @@ reportExecutable()
VERSION=`$APP_PATH --version | head -1`
;;
tar)
- VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4`
- ;;
+ case "$OSTYPE" in
+ Darwin)
+ VERSION=`$APP_PATH --version | head -1 | cut -d" " -f2`
+ ;;
+ *)
+ VERSION=`$APP_PATH --version | head -1 | cut -d" " -f4`
+ ;;
+ esac
+ ;;
gzip)
case "$OSTYPE" in
SunOS)
VERSION=`$1 --version 2>&1 | grep gzip | cut -d" " -f2`
;;
+ Darwin)
+ VERSION=`$1 --version 2>&1`
+ ;;
*)
VERSION=`$1 --version | head -1 | cut -d" " -f2`
;;
@@ -341,6 +351,7 @@ reportExecutable()
checkOpenFOAMEnvironment()
{
[ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] || {
+ [ "$(uname -s)" = "Darwin" ] && return 0
echo ""
echo "FATAL ERROR: OpenFOAM environment not configured."
echo ""
@@ -388,7 +399,7 @@ checkHostName()
checkOS()
{
case "$OSTYPE" in
- Linux | LinuxAMD64 | SunOS )
+ Linux | LinuxAMD64 | SunOS | Darwin )
echo "`fixlen OS: $WIDTH` $OSTYPE version $(uname -r)"
;;
*)
@@ -429,7 +440,7 @@ echo "$COL1 $COL2 $COL3 $COL5"
hline
reportEnv '$WM_PROJECT_INST_DIR' 'noPath' "yes"
reportEnv '$WM_PROJECT_USER_DIR' 'noPath' "no"
-reportEnv '$WM_THIRD_PARTY_DIR' 'noPath' "yes"
+[ "$(uname -s)" = "Darwin" ] || reportEnv '$WM_THIRD_PARTY_DIR' 'noPath' "yes"
hline
#------------------------------------------------------------------------------
@@ -468,7 +479,7 @@ reportExecutable flex
reportExecutable "$WM_CC"
reportExecutable "$WM_CXX"
reportExecutable gzip
-if [ "$OSTYPE" = Linux ]
+if [ "$OSTYPE" = Linux -o "$OSTYPE" = "Darwin" ]
then
reportExecutable tar
else
diff --git a/bin/foamJob b/bin/foamJob
index 6646e5dd8..e24728fb8 100755
--- a/bin/foamJob
+++ b/bin/foamJob
@@ -277,6 +277,12 @@ then
fi
else
+ # Check if we are on El Capitan
+ if test "$(uname -s)" = "Darwin" && \
+ { test "$(uname -r | cut -d. -f1)" -gt 15; }
+ then
+ APPLICATION="foamExec $APPLICATION"
+ fi
#
# Run (on single processor)
#
diff --git a/bin/foamMonitor b/bin/foamMonitor
index 8ae19858b..b7b8d1ef0 100755
--- a/bin/foamMonitor
+++ b/bin/foamMonitor
@@ -57,7 +57,12 @@ USAGE
plotFileHeader() {
cat<<EOF
-set term x11 1 font "helvetica,17" linewidth 1.5 persist noraise
+if (strstrt(GPVAL_TERMINALS, 'wxt')) {
+ selected_terminal = 'wxt'
+} else {
+ selected_terminal = 'x11'
+}
+set term selected_terminal 1 font "helvetica,17" linewidth 1.5 persist noraise
$LOGSCALE
$YRANGE
set title "Data Monitoring"
@@ -82,6 +87,8 @@ LOGSCALE=""
YRANGE=""
GNUPLOT=$(which gnuplot)
! [ "x$GNUPLOT" = "x" ] || usage "Gnuplot not installed"
+STAT="stat --format=%Y"
+[ "$(uname -s)" = "Darwin" ] && STAT="stat -f %m"
# parse options
while [ "$#" -gt 0 ]
@@ -169,7 +176,7 @@ PID=$!
while true
do
- MODTIME=$(stat --format=%Y $FILE)
+ MODTIME=$($STAT $FILE)
IDLEAGO=$(expr $(date +%s) - $IDLE)
test "$MODTIME" -gt "$IDLEAGO" || break
sleep $REFRESH
diff --git a/bin/paraFoam b/bin/paraFoam
index 84b82ecdb..e965e6970 100755
--- a/bin/paraFoam
+++ b/bin/paraFoam
@@ -72,6 +72,11 @@ extension=OpenFOAM
requirePV=1
+[ "$(uname -s)" = "Darwin" ] && {
+extension=foam
+requirePV=0
+}
+
# Parse options
while [ "$#" -gt 0 ]
do
diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions
index ed101f97d..769ee9462 100644
--- a/bin/tools/RunFunctions
+++ b/bin/tools/RunFunctions
@@ -28,6 +28,18 @@
# Miscellaneous functions for running tutorial cases
#------------------------------------------------------------------------------
+isSIPEnabled()
+{
+ $(which -s csrutil) && {
+ [ $(csrutil status | awk '{print $5}' | tr -d ".") = "enabled" ] \
+ && return 0
+ }
+ return 1
+}
+
+# Workaround for cleared DYLD_LIBRARY_PATH
+[ "$(uname -s)" = "Darwin" ] && [ isSIPEnabled ] && . $WM_PROJECT_DIR/etc/bashrc
+
isTest()
{
for i in "$@"; do
@@ -46,7 +58,9 @@ getNumberOfProcessors()
getApplication()
{
- sed -ne 's/^ *application\s*\([a-zA-Z]*\)\s*;.*$/\1/p' system/controlDict
+ grep application system/controlDict \
+ | awk '{print $2}' \
+ | tr -d ";"
}
runApplication()
@@ -64,7 +78,7 @@ runApplication()
LOG_IGNORE=true
LOG_APPEND=true
;;
- -overwrite|-o)
+ -overwrite|-o|-f)
LOG_IGNORE=true
;;
-suffix|-s)
@@ -111,7 +125,7 @@ runParallel()
LOG_IGNORE=true
LOG_APPEND=true
;;
- -overwrite|-o)
+ -overwrite|-o|-f)
LOG_IGNORE=true
;;
-suffix|-s)
@@ -168,4 +182,4 @@ cloneCase()
fi
}
-#------------------------------------------------------------------------------
+# vim: set ft=sh et sw=4 ts=4 sts=4:
diff --git a/etc/bashrc b/etc/bashrc
index b5e1745aa..0a14b6514 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -116,9 +116,22 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
+# Check if we are building OpenFOAM on OS X
+_foamOnOSX ()
+{
+ # For portability we do not rely on $?
+ if [ "$(uname -s)" = "Darwin" ]
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
# Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
+_foamOnOSX || \
+ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# Location of site-specific templates etc
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -138,6 +151,9 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. $WM_PROJECT_DIR/etc/config.sh/functions
+# Additional function for OS X
+_foamOnOSX && . $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
# Add in preset user or site preferences:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
@@ -151,17 +167,30 @@ _foamEval $@
foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- Clean PATH
-cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
+cleaned=$($foamClean "$PATH" "$foamOldDirs") && PATH="$cleaned"
-#- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` \
- && LD_LIBRARY_PATH="$cleaned"
+if _foamOnOSX
+then
+ #- Clean DYLD_LIBRARY_PATH
+ cleaned=$($foamClean "$DYLD_LIBRARY_PATH" "$foamOldDirs") \
+ && DYLD_LIBRARY_PATH="$cleaned"
+else
+ #- Clean LD_LIBRARY_PATH
+ cleaned=$($foamClean "$LD_LIBRARY_PATH" "$foamOldDirs") \
+ && LD_LIBRARY_PATH="$cleaned"
+fi
#- Clean MANPATH
-cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
+cleaned=$($foamClean "$MANPATH" "$foamOldDirs") && MANPATH="$cleaned"
-export PATH LD_LIBRARY_PATH MANPATH
+export PATH MANPATH
+if _foamOnOSX
+then
+ export DYLD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH
+fi
# Source project setup files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -172,13 +201,24 @@ _foamSource $WM_PROJECT_DIR/etc/config.sh/aliases
# Source user setup files for optional packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mpi`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
+if _foamOnOSX
+then
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mac/paraview`
+else
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
+fi
+
if [ ! -z "$FOAMY_HEX_MESH" ]
then
- _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
+ if _foamOnOSX
+ then
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/mac/CGAL`
+ else
+ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
+ fi
fi
@@ -187,13 +227,26 @@ fi
#- Clean PATH
cleaned=`$foamClean "$PATH"` && PATH="$cleaned"
-#- Clean LD_LIBRARY_PATH
-cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
+if _foamOnOSX
+then
+ #- Clean DYLD_LIBRARY_PATH
+ cleaned=`$foamClean "$DYLD_LIBRARY_PATH"` && DYLD_LIBRARY_PATH="$cleaned"
+else
+ #- Clean LD_LIBRARY_PATH
+ cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
+fi
#- Clean MANPATH (trailing ':' to find system pages)
cleaned=`$foamClean "$MANPATH"`: && MANPATH="$cleaned"
-export PATH LD_LIBRARY_PATH MANPATH
+export PATH MANPATH
+
+if _foamOnOSX
+then
+ export DYLD_LIBRARY_PATH
+else
+ export LD_LIBRARY_PATH
+fi
#- Clean LD_PRELOAD
if [ -n "$LD_PRELOAD" ]
@@ -212,4 +265,6 @@ unset cleaned foamClean foamOldDirs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. $WM_PROJECT_DIR/etc/config.sh/functions
+_foamOnOSX && . $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mac/CGAL b/etc/config.sh/mac/CGAL
new file mode 100644
index 000000000..3e5304369
--- /dev/null
+++ b/etc/config.sh/mac/CGAL
@@ -0,0 +1,69 @@
+# CGAL configuration for OS X
+
+if [ -n "$SOURCE_CGAL_VERSIONS_ONLY" ]
+then
+ . $WM_PROJECT_DIR/etc/config.sh/mac/functions
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ _prefix=$(_foamBrewPrefix)
+ boost_version="boost-$(_foamGetPackageVersion boost)"
+ export BOOST_ARCH_PATH="$_prefix/opt/boost"
+ unset _prefix
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ _prefix=$(_foamPortPrefix)
+ boost_version=$(_foamGetPackageVersion boost)
+ export BOOST_ARCH_PATH="$_prefix"
+ unset _prefix
+ else
+ boost_version=boost-unknown
+ export BOOST_ARCH_PATH=/usr/local
+ fi
+ unset boost_version
+ . $WM_PROJECT_DIR/etc/config.sh/mac/functions
+else
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ _prefix=$(_foamBrewPrefix)
+
+ boost_version="boost-$(_foamGetPackageVersion boost)"
+ cgal_version="CGAL-$(_foamGetPackageVersion cgal)"
+
+ export BOOST_ARCH_PATH="$_prefix/opt/boost"
+ export CGAL_ARCH_PATH="$_prefix/opt/cgal"
+ export GMP_ARCH_PATH="$_prefix/opt/gmp"
+ export MPFR_ARCH_PATH="$_prefix/opt/mpfr"
+
+ unset _prefix
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ _prefix=$(_foamPortPrefix)
+
+ boost_version=$(_foamGetPackageVersion boost)
+ cgal_version=$(_foamGetPackageVersion cgal)
+
+ export BOOST_ARCH_PATH="$_prefix"
+ export CGAL_ARCH_PATH="$_prefix"
+ export GMP_ARCH_PATH="$_prefix"
+ export MPFR_ARCH_PATH="$_prefix"
+
+ unset _prefix
+ else
+ boost_version=boost-unknown
+ cgal_version=CGAL-unknown
+
+ export BOOST_ARCH_PATH=/usr/local
+ export CGAL_ARCH_PATH=/usr/local
+ fi
+
+ if [ "$FOAM_VERBOSE" -a "$PS1" ]
+ then
+ echo "Using CGAL and boost" 1>&2
+ echo " $cgal_version at $CGAL_ARCH_PATH" 1>&2
+ echo " $boost_version at $BOOST_ARCH_PATH" 1>&2
+ fi
+ unset boost_version cgal_version
+fi
+
+
+# vim: set ft=sh:
diff --git a/etc/config.sh/mac/functions b/etc/config.sh/mac/functions
new file mode 100644
index 000000000..ba089e6ec
--- /dev/null
+++ b/etc/config.sh/mac/functions
@@ -0,0 +1,133 @@
+# Additional functions for OS X
+
+if [ -z "$WM_BASH_FUNCTIONS_MAC" ]
+then
+ WM_BASH_FUNCTIONS_MAC=loaded
+
+ # Prefix to DYLD_LIBRARY_PATH
+ _foamAddLib ()
+ {
+ while [ $# -ge 1 ]
+ do
+ export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
+ shift
+ done
+ }
+
+ _foamBrew ()
+ {
+ if $(which -s brew)
+ then
+ echo Y
+ return 0
+ else
+ echo N
+ return 1
+ fi
+ }
+
+ _foamPort ()
+ {
+ if $(which -s port)
+ then
+ echo Y
+ return 0
+ else
+ echo N
+ return 1
+ fi
+ }
+
+ _foamPortPrefix ()
+ {
+ echo "$(dirname $(dirname $(which port)))"
+ }
+
+ _foamBrewPrefix ()
+ {
+ echo $(brew --prefix)
+ }
+
+ _foamGetPackageVersion ()
+ {
+ local version="?"
+ local ret=0
+ local pkg="$1"
+
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ local prefix="$(_foamBrewPrefix)"
+ if [ -d "$prefix/opt/$pkg" -a "$WM_LABEL_SIZE" -ne 64 ]
+ then
+ version="$(basename $(readlink "$prefix/opt/$pkg"))"
+ elif [ -d "$prefix/opt/${pkg}64" -a "$WM_LABEL_SIZE" -eq 64 ]
+ then
+ version="$(basename $(readlink "$prefix/opt/${pkg}64"))"
+ else
+ ret=1
+ fi
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ version="0.0.x"
+ else
+ ret=1
+ fi
+ echo $version
+ return $ret
+ }
+
+ _foamGetPackageArchPath ()
+ {
+ local arch_path="/usr/local"
+ local ret=0
+ local pkg="$1"
+ if [ "x$(_foamBrew)" = "xY" ]
+ then
+ local prefix="$(_foamBrewPrefix)"
+ if [ -d "$prefix/opt/$pkg" -a "$WM_LABEL_SIZE" -ne 64 ]
+ then
+ arch_path="$prefix/opt/$pkg"
+ elif [ -d "$prefix/opt/${pkg}64" -a "$WM_LABEL_SIZE" -eq 64 ]
+ then
+ arch_path="$prefix/opt/${pkg}64"
+ else
+ ret=1
+ fi
+ elif [ "x$(_foamPort)" = "xY" ]
+ then
+ arch_path="$(_foamPortPrefix)"
+ else
+ ret=1
+ fi
+ echo $arch_path
+ return $ret
+ }
+
+ _foamIncreaseMaxOpenFiles ()
+ {
+ # Default value
+ local lim=4096
+
+ # Reset if parameter passed
+ [ -n "$1" ] && lim="$1"
+
+ # Silencing the errors
+ local current_limit=$(ulimit -n)
+ if [ "$current_limit" = "unlimited" ]
+ then
+ return 0
+ elif [ "$current_limit" -lt "$lim" ]
+ then
+ ulimit -n "$lim" > /dev/null 2>&1
+ return 0
+ fi
+ return 0
+ }
+else
+ unset WM_BASH_FUNCTIONS_MAC
+ unset _foamAddLib _foamBrew _foamPort _foamPortPrefix _foamBrewPrefix \
+ _foamGetPackageVersion _foamGetPackageArchPath \
+ _foamIncreaseMaxOpenFiles
+fi
+
+# vim: set ft=sh:
diff --git a/etc/config.sh/mac/metis b/etc/config.sh/mac/metis
new file mode 100644
index 000000000..bb87346f7
--- /dev/null
+++ b/etc/config.sh/mac/metis
@@ -0,0 +1,44 @@
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
+# \\/ M anipulation |
+#------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM.
+#
+# OpenFOAM is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+# etc/config.sh/metis
+#
+# Description
+# Setup file for metis include/libraries.
+# Sourced during wmake process only.
+#
+# Note
+# A csh version is not needed, since the values here are only sourced
+# during the wmake process
+#
+#------------------------------------------------------------------------------
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+export METIS_VERSION=$(_foamGetPackageVersion metis)
+export METIS_ARCH_PATH=$(_foamGetPackageArchPath metis)
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mac/paraview b/etc/config.sh/mac/paraview
new file mode 100644
index 000000000..edfaa6306
--- /dev/null
+++ b/etc/config.sh/mac/paraview
@@ -0,0 +1,16 @@
+if [ -d /Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app ];
+then
+ [ "$FOAM_VERBOSE" -a "$PS1" ] && echo Using /Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app
+
+ paraview () {
+ /Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app/Contents/MacOS/paraview "$@"
+ }
+
+ export -f paraview
+else
+ echo
+ echo "Please download binary Paraview release from"
+ echo "http://paraview.org and install it in /Applications"
+ echo "folder."
+ echo
+fi
diff --git a/etc/config.sh/mac/scotch b/etc/config.sh/mac/scotch
new file mode 100644
index 000000000..e62931c9b
--- /dev/null
+++ b/etc/config.sh/mac/scotch
@@ -0,0 +1,47 @@
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+# \\ / O peration |
+# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+# \\/ M anipulation |
+#------------------------------------------------------------------------------
+# License
+# This file is part of OpenFOAM.
+#
+# OpenFOAM is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
+#
+# File
+# etc/config.sh/scotch
+#
+# Description
+# Setup file for scotch include/libraries.
+# Sourced during wmake process only.
+#
+# Note
+# A csh version is not needed, since the values here are only sourced
+# during the wmake process
+#
+# If Scotch is to be entirely disabled, either rename this file or create
+# an empty one with the same name at a user or site location.
+#
+#------------------------------------------------------------------------------
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+export SCOTCH_VERSION=$(_foamGetPackageVersion scotch)
+export SCOTCH_ARCH_PATH=$(_foamGetPackageArchPath scotch)
+
+. $WM_PROJECT_DIR/etc/config.sh/mac/functions
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index 8c679f656..6f4ce02a6 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -49,7 +49,7 @@ SYSTEMOPENMPI)
# include files and libraries.
export MPI_ARCH_PATH="${libDir%/*}"
- _foamAddLib $libDir
+ _foamOnOSX || _foamAddLib $libDir
unset libDir
;;
@@ -66,8 +66,8 @@ OPENMPI)
_foamAddPath $MPI_ARCH_PATH/bin
# 64-bit on OpenSuSE 12.1 uses lib64 others use lib
- _foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
- _foamAddLib $MPI_ARCH_PATH/lib
+ _foamOnOSX || _foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
+ _foamOnOSX || _foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/share/man
;;
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 438a3253f..760e99056 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -121,6 +121,13 @@ SunOS)
export WM_LDFLAGS='-mabi=64 -G0'
;;
+Darwin)
+ WM_ARCH=darwin64
+ export WM_COMPILER_LIB_ARCH=64
+ export WM_CC='clang'
+ export WM_CXX='clang++'
+ ;;
+
*) # An unsupported operating system
/bin/cat <<USAGE 1>&2
@@ -193,7 +200,12 @@ unset siteDir
_foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
# Make sure to pick up dummy versions of external libraries last
-_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
+if [ -n "$FOAM_EXT_LIBBIN" ]
+then
+ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
+else
+ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy
+fi
# Compiler settings
# ~~~~~~~~~~~~~~~~~