This repository was archived by the owner on Dec 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The general organization has been modified and a file was added.
A bug regarding the stress calculation was fixed.
- Loading branch information
Marco Mazzeo
committed
Jul 27, 2007
1 parent
8b99a0c
commit d59a9e5
Showing
6 changed files
with
446 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// In this file all the declarations and some simple functions are reported. | ||
|
||
#include "mpi.h" | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
#include <math.h> | ||
#include <rpc/types.h> | ||
#include <rpc/xdr.h> | ||
#include "config.h" | ||
|
||
int STABLE = 1; | ||
int UNSTABLE = 0; | ||
|
||
// the constants needed to define the configuration of the lattice | ||
// sites follow | ||
|
||
unsigned int SOLID_TYPE = 0U; | ||
unsigned int FLUID_TYPE = 1U; | ||
unsigned int INLET_TYPE = 2U; | ||
unsigned int OUTLET_TYPE = 3U; | ||
unsigned int NULL_TYPE = 4U; | ||
|
||
unsigned int BOUNDARIES = 4U; | ||
unsigned int INLET_BOUNDARY = 0U; | ||
unsigned int OUTLET_BOUNDARY = 1U; | ||
unsigned int WALL_BOUNDARY = 2U; | ||
unsigned int CHARACTERISTIC_BOUNDARY = 3U; | ||
|
||
unsigned int SITE_TYPE_BITS = 2U; | ||
unsigned int BOUNDARY_CONFIG_BITS = 14U; | ||
unsigned int BOUNDARY_DIR_BITS = 4U; | ||
unsigned int BOUNDARY_ID_BITS = 10U; | ||
|
||
unsigned int BOUNDARY_CONFIG_SHIFT = 2U; // SITE_TYPE_BITS; | ||
unsigned int BOUNDARY_DIR_SHIFT = 16U; // BOUNDARY_CONFIG_SHIFT + BOUNDARY_CONFIG_BITS; | ||
unsigned int BOUNDARY_ID_SHIFT = 20U; // BOUNDARY_DIR_SHIFT + BOUNDARY_DIR_BITS; | ||
|
||
unsigned int SITE_TYPE_MASK = ((1U << 2U) - 1U); // ((1U << SITE_TYPE_BITS) - 1U); | ||
unsigned int BOUNDARY_CONFIG_MASK = ((1U << 14U) - 1U) << 2U; // ((1U << BOUNDARY_CONFIG_BITS) - 1U) << BOUNDARY_CONFIG_SHIFT; | ||
unsigned int BOUNDARY_DIR_MASK = ((1U << 4U) - 1U) << 16U; //((1U << BOUNDARY_DIR_BITS) - 1U) << BOUNDARY_DIR_SHIFT; | ||
unsigned int BOUNDARY_ID_MASK = ((1U << 10U) - 1U) << 20U; // ((1U << BOUNDARY_ID_BITS) - 1U) << BOUNDARY_ID_SHIFT | ||
unsigned int CHARACTERISTIC_MASK = 1U << 31U; | ||
|
||
// square of the speed of sound | ||
|
||
double Cs2 = 3.0 / 8.0; | ||
|
||
|
||
// parameters related to the lattice directions | ||
|
||
int e_x[] = { 0, 1,-1, 0, 0, 0, 0, 1,-1, 1,-1, 1,-1, 1,-1}; | ||
int e_y[] = { 0, 0, 0, 1,-1, 0, 0, 1,-1, 1,-1,-1, 1,-1, 1}; | ||
int e_z[] = { 0, 0, 0, 0, 0, 1,-1, 1,-1,-1, 1, 1,-1,-1, 1}; | ||
int inv_dir[] = {0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13}; | ||
|
||
|
||
double *f_old = NULL, *f_new = NULL; | ||
|
||
int *f_id = NULL; | ||
|
||
Velocity *vel = NULL; | ||
|
||
|
||
short int f_data[4*SHARED_DISTRIBUTIONS_MAX]; | ||
|
||
double f_to_send[SHARED_DISTRIBUTIONS_MAX]; | ||
double f_to_recv[SHARED_DISTRIBUTIONS_MAX]; | ||
|
||
int f_send_id[SHARED_DISTRIBUTIONS_MAX]; | ||
int f_recv_iv[SHARED_DISTRIBUTIONS_MAX]; | ||
|
||
|
||
|
||
// some simple functions | ||
|
||
int min (int a, int b) | ||
{ | ||
if (a < b) | ||
{ | ||
return a; | ||
} | ||
else | ||
{ | ||
return b; | ||
} | ||
} | ||
|
||
|
||
int max (int a, int b) | ||
{ | ||
if (a > b) | ||
{ | ||
return a; | ||
} | ||
else | ||
{ | ||
return b; | ||
} | ||
} | ||
|
||
|
||
double myClock () | ||
{ | ||
return (double)clock () / (double)CLOCKS_PER_SEC; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.