Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

e_block.h

Go to the documentation of this file.
00001 
00010 #ifndef E_BLOCK_HEADER_ALREADY_INCLUDED
00011 
00012 #include <stdio.h>
00013 #include "../../util/source/useful.h"
00014 #include "../../geometry/source/geom.h"
00015 #include "../../gas_models/source/gas.h"
00016 #include "../../flux_calc/source/flux_calc.h"
00017 #include "../../mb_cns/source/cns_cell.h"
00018 
00023 #define NGHOST 2
00024 
00026 #define BLOCK_3D_DIM 200
00027 
00031 #define MAX_FLOW_CONDITION 20
00032 
00033 /*----------------------------------------------------------------*/
00034 
00040 struct block_data_3D
00041 {
00042     int id;                     /* block identifier           */
00043     /* id will usually be the same as the block number.       */
00044     char label[132];            /* symbolic name              */
00045     char root_file_name[132];              /* root of file names for block data  */
00046     FILE *hfp;                             /* history file handle                */
00047     int  create_mesh_from_edges;           /* 0: read from file; 1: generate new */
00048 
00049     double dt_global;           /* global time step, s        */
00050     double dt_allow;            /* Allowable time step        */
00051     double cfl_target;          /* desired CFL number         */
00052     double sim_time;            /* simulation time in seconds */
00053     double cfl_min, cfl_max;    /* estimates of CFL number    */
00054     double cfl_tiny, time_tiny; /* the smallest so far...     */
00055     double residual;            /* residual monitor for       */
00056                                 /* steady state               */
00057     int hncell;                 /* number of sample cells     */
00058     int hicell[NDIM], hjcell[NDIM], hkcell[NDIM]; /* location of sample cell */
00059 
00060     /* Total number of cells in each direction for this block.
00061      * these will be used in the array allocation routines.
00062      */
00063     int nidim, njdim, nkdim;
00064     /* Number of active cells in the i,j,k-directions */
00065     int nni, nnj, nnk;
00066     /* The following  index limits are set to allow convenient access 
00067      * to the arrays without having to worry how many buffer 
00068      * cells are present.
00069      * imin <= i <= imax,  jmin <= j <= jmax
00070      * Typically imin = jmin = kmin = 2.
00071      */
00072     int imin, imax, jmin, jmax, kmin, kmax;
00073 
00074     /* Most of the data is stored in the following arrays.
00075      * ctr[i][j][k]: primary-cell centers
00076      * ifi[i][j][k], ifj[i][j][k], ifk[i][j][k] cell-interfaces
00077      * vtx[i][j][k]: primary-cell vertices
00078      *
00079      * cell-interfaces are used to interface to the Riemann solver
00080      * and to store the interface fluxes.
00081      *
00082      * vtx is used for the viscous terms.
00083      * Primary-cell vertices are secondary-cell centres.
00084      * sifi, sifj and sifk are secondary-cell interfaces
00085      */
00086     struct cell_center    ***ctr;
00087     struct cell_interface ***ifi;
00088     struct cell_interface ***ifj;
00089     struct cell_interface ***ifk;
00090     struct cell_vertex    ***vtx;
00091     struct cell_interface ***sifi;
00092     struct cell_interface ***sifj;
00093     struct cell_interface ***sifk;
00094 
00095     /* Boundary condition flags for the block-domain boundaries. */
00096     int bc[6];
00097     /* Fill and inflow gas properties are recorded here. */
00098     struct flow_state flow_condition[MAX_FLOW_CONDITION]; 
00099     int n_flow_condition;
00100     /* Index to the relevant gas_state. */
00101     int initial_fill_condition;
00102     int inflow_condition[6]; 
00103     /* Wall temperatures for use with the FIXED_T boundary condition. */
00104     double Twall[6];
00105     /* Flags to indicate whether the sponge layer is active for
00106      * Andrew Denman's subsonic boundary condition. */
00107     int sponge[6];
00108     /* Fixed-pressure outflow. */
00109     double Pout[6];
00110 
00111     /* 
00112      * Neighbour information.
00113      * It should be enough to know which blocks are adjacent to any
00114      * particular face and then to know which of the neighbour's 
00115      * corner vertices correspond to the current-block's vertices.
00116      */
00117     /* Identities of the neighbouring blocks (-1 == None) at each face. */
00118     int neighbour_block[6];
00119     int neighbour_faceId[6];
00120     int neighbour_orientation[6];
00121     /* Corresponding vertex on the neighbour's adjacent face. 
00122      * The following storage is a bit of over-kill but it allows us
00123      * to separate the sorting out of connections from the reading
00124      * of the parameter file. */
00125     int neighbour_vertex[6][8];
00126 
00127     /* Transfinite interpolation can be used to make the grid from
00128      * the 12 edges of the block. Save polyline pointers and chuster_tuple. */
00129     struct GPathPolyLine *edge[12];
00130     int end0[12], end1[12];
00131     double beta[12];
00132     /* Block vertex locations can be used to create a simple grid. */
00133     struct Vector3D corner_vertex[8];
00134 
00135     /* Flag to indicate if cgns grid has been written for a block */
00136     int cgns_grid_written;
00137 
00138     /* Flag to indicate if filtering coefficients have been calculated */
00139     int dev_filter_coefficients;
00140 
00141     /* Buffers for boundary-data exchange. */
00142     double *send_buffer[6];
00143     double *receive_buffer[6];
00144 
00145 };  /* end of block_data_3D structure definition */
00146 
00147 
00149 int set_neighbour_blockId_for_face(struct block_data_3D * this_blk,
00150                                    int face_index,
00151                                    int other_blockId);
00152 int get_neighbour_blockId_for_face(struct block_data_3D * this_blk,
00153                                    int face_index);
00154 int set_neighbour_vertex(struct block_data_3D * this_blk,
00155                          int face_index,
00156                          int vertex_index,
00157                          int other_vertex);
00158 int get_neighbour_vertex(struct block_data_3D * this_blk,
00159                          int face_index,
00160                          int vertex_index);
00161 int set_corner_vertex_location(struct block_data_3D * this_blk,
00162                                int vertex_index, 
00163                                double x, double y, double z);
00164 int set_edge_polyline(struct block_data_3D * this_blk,
00165                       int edge_index, 
00166                       struct GPathPolyLine *plp,
00167                       int end0, int end1, double beta);
00168 
00169 int set_bc_index_for_boundary(struct block_data_3D * this_blk,
00170                               int ibndy, int value);
00171 int get_bc_index_for_boundary(struct block_data_3D * this_blk,
00172                               int ibndy);
00173 int set_inflow_index_for_boundary(struct block_data_3D * this_blk,
00174                                   int ibndy, int value);
00175 int set_sponge_flag_for_boundary(struct block_data_3D * this_blk,
00176                                  int ibndy, int value);
00177 double set_Twall_for_boundary(struct block_data_3D * this_blk,
00178                               int ibndy, double value);
00179 
00180 struct cell_center * get_cell_center_ptr(struct block_data_3D * this_blk,
00181                                          int i, int j, int k);
00182 struct cell_interface * get_ifi_ptr(struct block_data_3D * this_blk,
00183                                     int i, int j, int k);
00184 struct cell_interface * get_ifj_ptr(struct block_data_3D * this_blk,
00185                                     int i, int j, int k);
00186 struct cell_interface * get_ifk_ptr(struct block_data_3D * this_blk,
00187                                     int i, int j, int k);
00188 
00189 int array_alloc_3D(struct block_data_3D *A);
00190 int allocate_send_and_receive_buffers_3D( struct block_data_3D *bp );
00191 
00192 int fill_block_flow_data_3D(struct block_data_3D *bp);
00193 int compute_block_geometry_data_3D(struct block_data_3D *bp);
00194 int add_history_cell_to_block(struct block_data_3D *bp, int i, int j, int k);
00195 
00206 /* Vertices -- VTK convention for a hexahedral cell. */
00207 #define IVTX0 (i)
00208 #define JVTX0 (j)
00209 #define KVTX0 (k)
00210 
00211 #define IVTX1 (i+1)
00212 #define JVTX1 (j)
00213 #define KVTX1 (k)
00214 
00215 #define IVTX2 (i+1)
00216 #define JVTX2 (j+1)
00217 #define KVTX2 (k)
00218 
00219 #define IVTX3 (i)
00220 #define JVTX3 (j+1)
00221 #define KVTX3 (k)
00222 
00223 #define IVTX4 (i)
00224 #define JVTX4 (j)
00225 #define KVTX4 (k+1)
00226 
00227 #define IVTX5 (i+1)
00228 #define JVTX5 (j)
00229 #define KVTX5 (k+1)
00230 
00231 #define IVTX6 (i+1)
00232 #define JVTX6 (j+1)
00233 #define KVTX6 (k+1)
00234 
00235 #define IVTX7 (i)
00236 #define JVTX7 (j+1)
00237 #define KVTX7 (k+1)
00238 
00239 /* Vertices -- Ian Johnstons labels -- try to use VTK labelling. */
00240 #define IA (i)
00241 #define JA (j)
00242 #define KA (k+1)
00243 
00244 #define IB (i+1)
00245 #define JB (j)
00246 #define KB (k+1)
00247 
00248 #define IC (i+1)
00249 #define JC (j)
00250 #define KC (k)
00251 
00252 #define ID (i)
00253 #define JD (j)
00254 #define KD (k)
00255 
00256 #define IE (i)
00257 #define JE (j+1)
00258 #define KE (k+1)
00259 
00260 #define IF (i+1)
00261 #define JF (j+1)
00262 #define KF (k+1)
00263 
00264 #define IG (i+1)
00265 #define JG (j+1)
00266 #define KG (k)
00267 
00268 #define IH (i)
00269 #define JH (j+1)
00270 #define KH (k)
00271 
00273 #define IFACE_NORTH  (ifj[i][j+1][k])
00274 #define IFACE_SOUTH  (ifj[i][j][k])
00275 #define IFACE_EAST   (ifi[i+1][j][k])
00276 #define IFACE_WEST   (ifi[i][j][k])
00277 #define IFACE_TOP    (ifk[i][j][k+1])
00278 #define IFACE_BOTTOM (ifk[i][j][k])
00279 
00280 
00286 #define NORTH   4
00287 #define EAST    3
00288 #define SOUTH   0
00289 #define WEST    2
00290 #define TOP     5
00291 #define BOTTOM  1
00292 
00293 
00294 
00295 /*-------------------------------------------------------------------*/
00296 
00297 #define E_BLOCK_HEADER_ALREADY_INCLUDED
00298 #endif
00299 

Generated on Tue Oct 25 10:23:44 2005 for CFCFD by  doxygen 1.4.4