setcoeff.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // Copyright 2010 Intel Corporation
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #include <math.h>
  17. #include "applu_share.h"
  18. #include "applu_macros.h"
  19. void setcoeff() {
  20. dxi = 1.0 / ( nx0 - 1 );
  21. deta = 1.0 / ( ny0 - 1 );
  22. dzeta = 1.0 / ( nz0 - 1 );
  23. tx1 = 1.0 / ( dxi * dxi );
  24. tx2 = 1.0 / ( 2.0 * dxi );
  25. tx3 = 1.0 / dxi;
  26. ty1 = 1.0 / ( deta * deta );
  27. ty2 = 1.0 / ( 2.0 * deta );
  28. ty3 = 1.0 / deta;
  29. tz1 = 1.0 / ( dzeta * dzeta );
  30. tz2 = 1.0 / ( 2.0 * dzeta );
  31. tz3 = 1.0 / dzeta;
  32. ii1 = 2;
  33. ii2 = nx0 - 1;
  34. ji1 = 2;
  35. ji2 = ny0 - 2;
  36. ki1 = 3;
  37. ki2 = nz0 - 1;
  38. //c---------------------------------------------------------------------
  39. //c diffusion coefficients
  40. //c---------------------------------------------------------------------
  41. dx1 = 0.75;
  42. dx2 = dx1;
  43. dx3 = dx1;
  44. dx4 = dx1;
  45. dx5 = dx1;
  46. dy1 = 0.75;
  47. dy2 = dy1;
  48. dy3 = dy1;
  49. dy4 = dy1;
  50. dy5 = dy1;
  51. dz1 = 1.00;
  52. dz2 = dz1;
  53. dz3 = dz1;
  54. dz4 = dz1;
  55. dz5 = dz1;
  56. //c---------------------------------------------------------------------
  57. //c fourth difference dissipation
  58. //c---------------------------------------------------------------------
  59. dssp = ( fmax (dx1, fmax (dy1, dz1) ) ) / 4.0;
  60. //c---------------------------------------------------------------------
  61. //c coefficients of the exact solution to the first pde
  62. //c---------------------------------------------------------------------
  63. ce(1,1) = 2.0;
  64. ce(1,2) = 0.0;
  65. ce(1,3) = 0.0;
  66. ce(1,4) = 4.0;
  67. ce(1,5) = 5.0;
  68. ce(1,6) = 3.0;
  69. ce(1,7) = 5.0e-01;
  70. ce(1,8) = 2.0e-02;
  71. ce(1,9) = 1.0e-02;
  72. ce(1,10) = 3.0e-02;
  73. ce(1,11) = 5.0e-01;
  74. ce(1,12) = 4.0e-01;
  75. ce(1,13) = 3.0e-01;
  76. //c---------------------------------------------------------------------
  77. //c coefficients of the exact solution to the second pde
  78. //c---------------------------------------------------------------------
  79. ce(2,1) = 1.0;
  80. ce(2,2) = 0.0;
  81. ce(2,3) = 0.0;
  82. ce(2,4) = 0.0;
  83. ce(2,5) = 1.0;
  84. ce(2,6) = 2.0;
  85. ce(2,7) = 3.0;
  86. ce(2,8) = 1.0e-02;
  87. ce(2,9) = 3.0e-02;
  88. ce(2,10) = 2.0e-02;
  89. ce(2,11) = 4.0e-01;
  90. ce(2,12) = 3.0e-01;
  91. ce(2,13) = 5.0e-01;
  92. //c---------------------------------------------------------------------
  93. //c coefficients of the exact solution to the third pde
  94. //c---------------------------------------------------------------------
  95. ce(3,1) = 2.0;
  96. ce(3,2) = 2.0;
  97. ce(3,3) = 0.0;
  98. ce(3,4) = 0.0;
  99. ce(3,5) = 0.0;
  100. ce(3,6) = 2.0;
  101. ce(3,7) = 3.0;
  102. ce(3,8) = 4.0e-02;
  103. ce(3,9) = 3.0e-02;
  104. ce(3,10) = 5.0e-02;
  105. ce(3,11) = 3.0e-01;
  106. ce(3,12) = 5.0e-01;
  107. ce(3,13) = 4.0e-01;
  108. //c---------------------------------------------------------------------
  109. //c coefficients of the exact solution to the fourth pde
  110. //c---------------------------------------------------------------------
  111. ce(4,1) = 2.0;
  112. ce(4,2) = 2.0;
  113. ce(4,3) = 0.0;
  114. ce(4,4) = 0.0;
  115. ce(4,5) = 0.0;
  116. ce(4,6) = 2.0;
  117. ce(4,7) = 3.0;
  118. ce(4,8) = 3.0e-02;
  119. ce(4,9) = 5.0e-02;
  120. ce(4,10) = 4.0e-02;
  121. ce(4,11) = 2.0e-01;
  122. ce(4,12) = 1.0e-01;
  123. ce(4,13) = 3.0e-01;
  124. //c---------------------------------------------------------------------
  125. //c coefficients of the exact solution to the fifth pde
  126. //c---------------------------------------------------------------------
  127. ce(5,1) = 5.0;
  128. ce(5,2) = 4.0;
  129. ce(5,3) = 3.0;
  130. ce(5,4) = 2.0;
  131. ce(5,5) = 1.0e-01;
  132. ce(5,6) = 4.0e-01;
  133. ce(5,7) = 3.0e-01;
  134. ce(5,8) = 5.0e-02;
  135. ce(5,9) = 4.0e-02;
  136. ce(5,10) = 3.0e-02;
  137. ce(5,11) = 1.0e-01;
  138. ce(5,12) = 3.0e-01;
  139. ce(5,13) = 2.0e-01;
  140. return;
  141. }