• Main Page
  • Classes
  • Files
  • File List
  • File Members

prob/shu-osher.c

Go to the documentation of this file.
00001 #include "copyright.h"
00002 /*============================================================================*/
00003 /*! \file shu-osher.c
00004  *  \brief Problem generator for Shu-Osher shocktube test, involving
00005  *   interaction of a Mach 3 shock with a sine wave density distribution.  
00006  *
00007  * PURPOSE: Problem generator for Shu-Osher shocktube test, involving
00008  *   interaction of a Mach 3 shock with a sine wave density distribution.  
00009  *
00010  * REFERENCE: C.W. Shu & S. Osher, "Efficient implementation of essentially
00011  *   non-oscillatory shock-capturing schemes, II", JCP, 83, 32 (1998)         */
00012 /*============================================================================*/
00013 
00014 #include <math.h>
00015 #include <stdio.h>
00016 #include <stdlib.h>
00017 #include "defs.h"
00018 #include "athena.h"
00019 #include "globals.h"
00020 #include "prototypes.h"
00021 
00022 #ifdef ISOTHERMAL
00023 #error : The shu-osher test only works for adiabatic EOS.
00024 #endif /* ISOTHERMAL */
00025 #ifndef HYDRO
00026 #error : The shu-osher test only works for hydro.
00027 #endif /* HYDRO */
00028 
00029 /*----------------------------------------------------------------------------*/
00030 /* problem:  */
00031 
00032 void problem(DomainS *pDomain)
00033 {
00034   GridS *pGrid=(pDomain->Grid);
00035   int i,il,iu,js,ks;
00036   Real dl,pl,ul,vl,wl,x1,x2,x3;
00037 
00038 /* Set up the grid bounds for initializing the grid */
00039   iu = pGrid->ie + nghost;
00040   il = pGrid->is - nghost;
00041   js = pGrid->js;
00042   ks = pGrid->ks;
00043 
00044   if (pGrid->Nx[1] > 1 || pGrid->Nx[2] > 1) {
00045     ath_error("Shu Osher test only works for 1D problem in x1-direction\n");
00046   }
00047 
00048 /* setup dependent variables */
00049   dl = 3.857143;
00050   ul = 2.629369;
00051   pl = 10.33333;
00052   wl = 0.0;
00053   vl = 0.0;
00054 
00055   for (i=il; i<=iu; i++) {
00056 /* Calculate the cell center position of the cell i,j */
00057     cc_pos(pGrid,i,js,ks,&x1,&x2,&x3);
00058 
00059     if (x1 < -0.8) {
00060       pGrid->U[ks][js][i].d = dl;
00061       pGrid->U[ks][js][i].M1 = ul*dl;
00062       pGrid->U[ks][js][i].M2 = vl*dl;
00063       pGrid->U[ks][js][i].M3 = wl*dl;
00064       pGrid->U[ks][js][i].E = pl/Gamma_1 + 0.5*dl*(ul*ul + vl*vl + wl*wl);
00065     }
00066     else {
00067       pGrid->U[ks][js][i].d = 1.0 + 0.2*sin(5.0*PI*x1);
00068       pGrid->U[ks][js][i].M1 = 0.0;
00069       pGrid->U[ks][js][i].M2 = 0.0;
00070       pGrid->U[ks][js][i].M3 = 0.0;
00071       pGrid->U[ks][js][i].E = 1.0/Gamma_1;
00072     }
00073   }
00074 
00075   return;
00076 }
00077 
00078 /*==============================================================================
00079  * PROBLEM USER FUNCTIONS:
00080  * problem_write_restart() - writes problem-specific user data to restart files
00081  * problem_read_restart()  - reads problem-specific user data from restart files
00082  * get_usr_expr()          - sets pointer to expression for special output data
00083  * get_usr_out_fun()       - returns a user defined output function pointer
00084  * get_usr_par_prop()      - returns a user defined particle selection function
00085  * Userwork_in_loop        - problem specific work IN     main loop
00086  * Userwork_after_loop     - problem specific work AFTER  main loop
00087  *----------------------------------------------------------------------------*/
00088 
00089 void problem_write_restart(MeshS *pM, FILE *fp)
00090 {
00091   return;
00092 }
00093 
00094 void problem_read_restart(MeshS *pM, FILE *fp)
00095 {
00096   return;
00097 }
00098 
00099 ConsFun_t get_usr_expr(const char *expr)
00100 {
00101   return NULL;
00102 }
00103 
00104 VOutFun_t get_usr_out_fun(const char *name){
00105   return NULL;
00106 }
00107 
00108 void Userwork_in_loop(MeshS *pM)
00109 {
00110 }
00111 
00112 void Userwork_after_loop(MeshS *pM)
00113 {
00114 }

Generated on Mon Sep 27 2010 23:03:08 for Athena by  doxygen 1.7.1