setbv.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 "applu_share.h"
  17. #include "applu_macros.h"
  18. void setbv() {
  19. int i, j, k;
  20. int iglob, jglob;
  21. int one = 1;
  22. //c---------------------------------------------------------------------
  23. //c set the dependent variable values along the top and bottom faces
  24. //c---------------------------------------------------------------------
  25. for ( j = 1; j<= ny; j++) {
  26. jglob = jpt + j;
  27. for ( i = 1; i<= nx; i++) {
  28. iglob = ipt + i;
  29. exact(iglob,jglob,one,&u(1,i,j,1));
  30. exact(iglob,jglob,nz,&u(1,i,j,nz));
  31. }
  32. }
  33. //c---------------------------------------------------------------------
  34. //c set the dependent variable values along north and south faces
  35. //c---------------------------------------------------------------------
  36. if (west == -1) {
  37. for ( k = 1; k<= nz; k++) {
  38. for ( i = 1; i<= nx; i++) {
  39. iglob = ipt + i;
  40. exact(iglob,one,k,&u(1,i,1,k));
  41. }
  42. }
  43. }
  44. if (east == -1) {
  45. for ( k = 1; k<= nz; k++) {
  46. for ( i = 1; i<= nx; i++) {
  47. iglob = ipt + i;
  48. exact(iglob,ny0,k,&u(1,i,ny,k));
  49. }
  50. }
  51. }
  52. //c---------------------------------------------------------------------
  53. //c set the dependent variable values along east and west faces
  54. //c---------------------------------------------------------------------
  55. if (north == -1) {
  56. for ( k = 1; k<= nz; k++) {
  57. for ( j = 1; j<= ny; j++) {
  58. jglob = jpt + j;
  59. exact(one,jglob,k,&u(1,1,j,k));
  60. }
  61. }
  62. }
  63. if (south == -1) {
  64. for ( k = 1; k<= nz; k++) {
  65. for ( j = 1; j<= ny; j++) {
  66. jglob = jpt + j;
  67. exact(nx0,jglob,k,&u(1,nx,j,k));
  68. }
  69. }
  70. }
  71. return;
  72. }