00001 /* _______ __ 00002 / ___/ / ___ __ _ / / ___ 00003 / /__/ _ \/ _ \/ ' \/ _ \/ _ \ 00004 \___/_//_/\___/_/_/_/_.__/\___/ 00005 */ 00006 00007 // Gradient.H 00008 00009 // 00010 // This software is copyright (C) by the Lawrence Berkeley 00011 // National Laboratory. Permission is granted to reproduce 00012 // this software for non-commercial purposes provided that 00013 // this notice is left intact. 00014 // 00015 // It is acknowledged that the U.S. Government has rights to 00016 // this software under Contract DE-AC03-765F00098 between 00017 // the U.S. Department of Energy and the University of 00018 // California. 00019 // 00020 // This software is provided as a professional and academic 00021 // contribution for joint exchange. Thus it is experimental, 00022 // is provided ``as is'', with no warranties of any kind 00023 // whatsoever, no support, no promise of updates, or printed 00024 // documentation. By using this software, you acknowledge 00025 // that the Lawrence Berkeley National Laboratory and 00026 // Regents of the University of California shall have no 00027 // liability with respect to the infringement of other 00028 // copyrights by any part of this software. 00029 // 00030 // Dan Martin, Fri, Jan 14, 2000 00031 00032 #ifndef _Gradient_H_ 00033 #define _Gradient_H_ 00034 00035 #include "LevelData.H" 00036 #include "FArrayBox.H" 00037 #include "FluxBox.H" 00038 #include "QuadCFInterp.H" 00039 00040 00041 /*@ManMemo: computes cell-centered level-operator gradient of 00042 cell-centered phi; if phiCrse != NULL, does coarse-fine boundary 00043 conditions for phi (quadratic interpolation) */ 00044 void levelGradientCC( 00046 LevelData<FArrayBox>& a_grad, 00048 LevelData<FArrayBox>& a_phi, 00050 const LevelData<FArrayBox>* a_phiCrsePtr, 00052 const Real a_dx, 00054 const int a_nRefCrse, 00056 const ProblemDomain& a_dProblem); 00057 00058 /*@ManMemo: computes cell-centered level-operator gradient of 00059 cell-centered phi; if phiCrse != NULL, does coarse-fine boundary 00060 conditions for phi (quadratic interpolation). This (deprecated) 00061 interface uses a Box instead of a ProblemDomain */ 00062 void levelGradientCC( 00064 LevelData<FArrayBox>& a_grad, 00066 LevelData<FArrayBox>& a_phi, 00068 const LevelData<FArrayBox>* a_phiCrsePtr, 00070 const Real a_dx, 00072 const int a_nRefCrse, 00074 const Box& a_dProblem); 00075 00076 00077 /*@ManMemo: computes cell-centered level-operator gradient of 00078 cell-centered phi; if phiCrse != NULL, does coarse-fine boundary 00079 conditions for phi (quadratic C/F interpolation); predefined 00080 QuadCFInterp object is passed in for efficiency */ 00081 void levelGradientCC( 00083 LevelData<FArrayBox>& a_grad, 00085 LevelData<FArrayBox>& a_phi, 00087 const LevelData<FArrayBox>* a_phiCrsePtr, 00089 const Real a_dx, 00091 QuadCFInterp& a_cfInterp); 00092 00093 /*@ManMemo: computes cell-centered, level-operator gradient 00094 of cell-centered phi; in this case, assume that all relevant 00095 BC's (coarse-fine and physical) have already been set, so 00096 phi can be a const variable */ 00097 void levelGradientCC( 00099 LevelData<FArrayBox>& a_grad, 00101 const LevelData<FArrayBox>& a_phi, 00103 const Real a_dx); 00104 00105 00106 /*@ManMemo: computes cell-centered composite gradient of cell centered phi; 00107 uses same coarse-level C/F BC's as LevelGradientCC, if phiFinePtr != 00108 NULL, then also uses one-sided differencing to compute gradient 00109 on coarse side of coarse-fine interface. */ 00110 void compGradientCC( 00112 LevelData<FArrayBox>& a_grad, 00114 LevelData<FArrayBox>& a_phi, 00116 const LevelData<FArrayBox>* a_phiCrsePtr, 00118 const LevelData<FArrayBox>* a_phiFinePtr, 00120 const Real a_dx, 00122 const int a_nRefCrse, 00124 const int a_nRefFine, 00126 const ProblemDomain& a_dProblem); 00127 00128 /*@ManMemo: computes cell-centered composite gradient of cell centered phi; 00129 uses same coarse-level C/F BC's as LevelGradientCC, if phiFinePtr != 00130 NULL, then also uses one-sided differencing to compute gradient 00131 on coarse side of coarse-fine interface. This (deprecated) 00132 interface uses a Box instead of a ProblemDomain */ 00133 void compGradientCC( 00135 LevelData<FArrayBox>& a_grad, 00137 LevelData<FArrayBox>& a_phi, 00139 const LevelData<FArrayBox>* a_phiCrsePtr, 00141 const LevelData<FArrayBox>* a_phiFinePtr, 00143 const Real a_dx, 00145 const int a_nRefCrse, 00147 const int a_nRefFine, 00149 const Box& a_dProblem); 00150 00151 /*@ManMemo: computes cell-centered composite gradient of cell-centered phi; 00152 uses same coarse-level C/F BC's as LevelGradientCC, if phiFinePtr != 00153 NULL, then also uses one-sided differencing to compute gradient 00154 on coarse side of coarse-fine interface. A predefined QuadCFInterp 00155 is also passed in for efficiency. Note that no fine QuadCFInterp 00156 is necessary because we use one-sided differencing for coarse 00157 cells adjacent to finer-level coarse-fine interfaces. Note also 00158 that gradient is only really defined in valid regions of grids. */ 00159 void compGradientCC( 00161 LevelData<FArrayBox>& a_grad, 00163 LevelData<FArrayBox>& a_phi, 00165 const LevelData<FArrayBox>* a_phiCrsePtr, 00167 const LevelData<FArrayBox>* a_phiFinePtr, 00169 const Real a_dx, 00171 const int a_nRefFine, 00173 const ProblemDomain& a_dProblem, 00175 QuadCFInterp& a_cfInterpCrse); 00176 00177 00178 /*@ManMemo: computes cell-centered composite gradient of cell-centered phi; 00179 uses same coarse-level C/F BC's as LevelGradientCC, if phiFinePtr != 00180 NULL, then also uses one-sided differencing to compute gradient 00181 on coarse side of coarse-fine interface. A predefined QuadCFInterp 00182 is also passed in for efficiency. Note that no fine QuadCFInterp 00183 is necessary because we use one-sided differencing for coarse 00184 cells adjacent to finer-level coarse-fine interfaces. Note also 00185 that gradient is only really defined in valid regions of grids. 00186 This (deprecated) interface uses a Box instead of a ProblemDomain */ 00187 void compGradientCC( 00189 LevelData<FArrayBox>& a_grad, 00191 LevelData<FArrayBox>& a_phi, 00193 const LevelData<FArrayBox>* a_phiCrsePtr, 00195 const LevelData<FArrayBox>* a_phiFinePtr, 00197 const Real a_dx, 00199 const int a_nRefFine, 00201 const Box& a_dProblem, 00203 QuadCFInterp& a_cfInterpCrse); 00204 00205 00206 /*@ManMemo: computes cell-centered composite gradient of cell-centered 00207 phi; this one assumes that all ghost-cell values have already been set; 00208 if phiFinePtr != NULL, then also uses one-sided differencing to compute 00209 gradient on coarse side of corarse-fine interface. note that gradient 00210 is only really defined in valid regions of grids. */ 00211 void compGradientCC( 00213 LevelData<FArrayBox>& a_Grad, 00215 const LevelData<FArrayBox>& a_phi, 00217 const LevelData<FArrayBox>* a_phiFinePtr, 00219 const Real a_dx, 00221 const int a_nRefFine, 00223 const ProblemDomain& a_dProblem); 00224 00225 00226 /*@ManMemo: computes cell-centered composite gradient of cell-centered 00227 phi; this one assumes that all ghost-cell values have already been set; 00228 if phiFinePtr != NULL, then also uses one-sided differencing to compute 00229 gradient on coarse side of corarse-fine interface. note that gradient 00230 is only really defined in valid regions of grids. This (deprecated) 00231 interface uses a Box instead of a ProblemDomain */ 00232 void compGradientCC( 00234 LevelData<FArrayBox>& a_Grad, 00236 const LevelData<FArrayBox>& a_phi, 00238 const LevelData<FArrayBox>* a_phiFinePtr, 00240 const Real a_dx, 00242 const int a_nRefFine, 00244 const Box& a_dProblem); 00245 00246 00247 00248 00249 /*@ManMemo: computes edge-centered level-operator gradient of cell- 00250 centered field phi; if phiCrsePtr != NULL, does quadratic interpolation 00251 to compute coarse-fine boundary conditions for phi */ 00252 void levelGradientMAC( 00254 LevelData<FluxBox>& a_edgeGrad, 00256 LevelData<FArrayBox>& a_phi, 00258 const LevelData<FArrayBox>* a_phiCrsePtr, 00260 const Real a_dx, 00262 const int a_nRefCrse, 00264 const ProblemDomain& a_dProblem); 00265 00266 /*@ManMemo: computes edge-centered level-operator gradient of cell- 00267 centered field phi; if phiCrsePtr != NULL, does quadratic interpolation 00268 to compute coarse-fine boundary conditions for phi. This (deprecated) 00269 interface uses a Box instead of a ProblemDomain */ 00270 void levelGradientMAC( 00272 LevelData<FluxBox>& a_edgeGrad, 00274 LevelData<FArrayBox>& a_phi, 00276 const LevelData<FArrayBox>* a_phiCrsePtr, 00278 const Real a_dx, 00280 const int a_nRefCrse, 00282 const Box& a_dProblem); 00283 00284 00285 /*@ManMemo: computes edge-centered level-operator gradient of cell- 00286 centered field phi; if phiCrsePtr != NULL, does quadratic interpolation 00287 to compute coarse-fine boundary conditions for phi. A predefined 00288 QuadCFInterp object is passed in for efficiency */ 00289 void levelGradientMAC( 00291 LevelData<FluxBox>& a_edgeGrad, 00293 LevelData<FArrayBox>& a_phi, 00295 const LevelData<FArrayBox>* a_phiCrsePtr, 00297 const Real a_dx, 00299 QuadCFInterp& a_cfInterpCrse); 00300 00301 00302 /*@ManMemo: computes edge-centered level-operator gradient of cell- 00303 centered field phi; assumes _ALL_ ghost cell values have been 00304 preset (so phi can be const) */ 00305 void levelGradientMAC( 00307 LevelData<FluxBox>& a_edgeGrad, 00309 const LevelData<FArrayBox>& a_phi, 00311 const Real a_dx); 00312 00313 00314 00315 /*@ManMemo: computes edge-centered composite gradient of cell-centered 00316 field phi; if phiCrsePtr != NULL, does quadratic interpolation to compute 00317 coarse-fine boundary conditions for phi; since the edge between this level 00318 and finer levels is not considered to be a part of this level, there is 00319 no fine-level coarse-fine BC. because of this, this function produces 00320 exactly the same results as LevelGradientMAC -- it's just included for 00321 completeness... */ 00322 void compGradientMAC( 00324 LevelData<FluxBox>& a_edgeGrad, 00326 LevelData<FArrayBox>& a_phi, 00328 const LevelData<FArrayBox>* a_phiCrse, 00330 const LevelData<FArrayBox>* a_phiFine, 00332 const Real a_dx, 00334 const int a_nRefCrse, 00336 const int a_nRefFine, 00338 const Box& a_dProblem); 00339 00340 00341 /*@ManMemo: computes edge-centered composite gradient of cell-centered 00342 field phi; if phiCrsePtr != NULL, does quadratic interpolation to compute 00343 coarse-fine boundary conditions for phi; since the edge between this level 00344 and finer levels is not considered to be a part of this level, there is 00345 no fine-level coarse-fine BC. because of this, this function produces 00346 exactly the same results as LevelGradientMAC -- it's just included for 00347 completeness... */ 00348 void compGradientMAC( 00350 LevelData<FluxBox>& a_edgeGrad, 00352 LevelData<FArrayBox>& a_phi, 00354 const LevelData<FArrayBox>* a_phiCrse, 00356 const LevelData<FArrayBox>* a_phiFine, 00358 const Real a_dx, 00360 const int a_nRefCrse, 00362 const int a_nRefFine, 00364 const ProblemDomain& a_dProblem); 00365 00366 00367 00368 00369 /*@ManMemo: computes edge-centered composite gradient of cell-centered 00370 field phi; if phiCrsePtr != NULL, does quadratic interpolation to compute 00371 coarse-fine boundary conditions for phi; since the edge between this level 00372 and finer levels is not considered to be a part of this level, there is 00373 no fine-level coarse-fine BC. because of this, this function produces 00374 exactly the same results as LevelGradientMAC -- it's just included for 00375 completeness... In this one, a predefined QuadCFInterp object is passed 00376 in. This (deprecated) interface uses a Box instead of a ProblemDomain 00377 object */ 00378 void compGradientMAC( 00380 LevelData<FluxBox>& a_edgeGrad, 00382 LevelData<FArrayBox>& a_phi, 00384 const LevelData<FArrayBox>* a_phiCrse, 00386 const LevelData<FArrayBox>* a_phiFine, 00388 const Real a_dx, 00390 const int a_nRefFine, 00392 QuadCFInterp& a_cfInterpCrse); 00393 00394 00395 00396 00397 00398 00399 00400 #endif 00401 00402