A simple noise generator, i.e. periodic pressure changes in soundemitter == 1 areas
{
double local_pressure_left, local_pressure_right;
int one_boundary;
int left, right;
int counter_mean_pressure;
int i, j, k;
double tmp;
double perfect_sinus_emitter;
perfect_sinus_emitter = 1.0 / sqrt(2);
counter_mean_pressure = 0;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, one_boundary, \
left, right) \
shared(x, y, z, pre, dom, \
pressure_integrated, mean_pressure, counter_mean_pressure)
{
#endif
for (i = 0; i <
x; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
for (k = 0; k <
z; k++) {
#ifdef _OPENMP
#pragma omp critical
#endif
#ifdef _OPENMP
#pragma omp end critical
#endif
#ifdef _OPENMP
#pragma omp critical
#endif
counter_mean_pressure++;
#ifdef _OPENMP
#pragma omp end critical
#endif
}
}
}
}
#ifdef _OPENMP
}
#endif
}
}
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k) \
shared(x, y, z, pre_old, pre, \
soundemitter, dom, pressure, \
pressure_on_solid, with_one_pulse, counter)
{
#endif
for (i = 1; i < x - 1; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 1; j < y - 1; j++) {
for (k = 1; k <
z - 1; k++) {
}
}
}
}
}
}
#ifdef _OPENMP
}
#endif
local_pressure_right = 0.0;
local_pressure_left = 0.0;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, one_boundary, \
left, right) \
shared(x, y, z, pre_old, pre, \
soundemitter, dom, pressure, \
pressure_on_solid, obstalce_absorption_coefficient, \
pressure_integrated, mean_pressure, counter, \
sound_reflexion)
{
#endif
for (i = 1; i < x - 1; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 1; j < y - 1; j++) {
for (k = 1; k < z - 1; k++) {
left = -1;
if (
dom[i - 1][j][k] != 1) {
left = i - 1;
}
if ((
dom[i + 1][j][k] != 1) && (left > 0)) {
right = i + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
}
for (i = 1; i < x - 1; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 1; j < y - 1; j++) {
for (k = 1; k < z - 1; k++) {
left = -1;
if (
dom[i][j - 1][k] != 1) {
left = j - 1;
}
if ((
dom[i][j + 1][k] != 1) && (left > 0)) {
right = j + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
}
for (i = 1; i < x - 1; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 1; j < y - 1; j++) {
for (k = 1; k < z - 1; k++) {
left = -1;
if (
dom[i][j][k - 1] != 1) {
left = k - 1;
}
if ((
dom[i][j][k + 1] != 1) && (left > 0)) {
right = k + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
}
#ifdef _OPENMP
}
#endif
}
k = 0;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k) \
shared(x, y, z, pre_old, pre, \
soundemitter, dom, pressure, \
pressure_on_solid, mean_pressure, \
with_one_pulse, counter)
{
#endif
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (i = 1; i < x - 1; i++) {
for (j = 1; j < y - 1; j++) {
}
}
}
if (
dom[i - 1][j + 1][k] != 1)
pressure_on_solid[i - 1][j + 1][k] =
pre[i - 1][j + 1][k] - pre_old[i - 1][j + 1][k];
if (
dom[i + 1][j - 1][k] != 1)
pressure_on_solid[i + 1][j - 1][k] =
pre[i + 1][j - 1][k] - pre_old[i + 1][j - 1][k];
if (
dom[i + 1][j + 1][k] != 1)
pressure_on_solid[i + 1][j + 1][k] =
pre[i + 1][j + 1][k] - pre_old[i + 1][j + 1][k];
}
}
}
#ifdef _OPENMP
}
#endif
local_pressure_right = 0.0;
local_pressure_left = 0.0;
k = 0;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, \
left, right) \
shared(x, y, z, pre_old, pre, \
soundemitter, dom, pressure_on_solid, \
obstalce_absorption_coefficient, \
sound_reflexion)
{
#endif
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (i = 1; i < x - 1; i++) {
for (j = 1; j < y - 1; j++) {
left = -1;
if (
dom[i - 1][j][k] != 1) {
left = i - 1;
}
if ((
dom[i + 1][j][k] != 1) && (left > 0)) {
right = i + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
#ifdef _OPENMP
}
#endif
local_pressure_right = 0.0;
local_pressure_left = 0.0;
k = 0;
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, \
left, right) \
shared(x, y, z, pre_old, pre, \
soundemitter, dom, pressure_on_solid, \
obstalce_absorption_coefficient, \
sound_reflexion)
{
#endif
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (i = 1; i < x - 1; i++) {
for (j = 1; j < y - 1; j++) {
left = -1;
if (
dom[i][j - 1][k] != 1) {
left = j - 1;
}
if ((
dom[i][j + 1][k] != 1) && (left > 0)) {
right = j + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
#ifdef _OPENMP
}
#endif
}
local_pressure_right = 0.0;
local_pressure_left = 0.0;
k = 0;
j = 0;
for (i = 1; i < x - 1; i++) {
}
}
}
}
for (i = 1; i < x - 1; i++) {
left = -1;
if (
dom[i - 1][j][k] != 1) {
left = i - 1;
}
if ((
dom[i + 1][j][k] != 1) && (left > 0)) {
right = i + 1;
if (fabs(local_pressure_left) > fabs(local_pressure_right)) {
}
if (fabs(local_pressure_left) < fabs(local_pressure_right)) {
}
}
}
}
}
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, one_boundary, \
left, right) \
shared(x, y, z, pre, dom, \
pressure_integrated, mean_pressure, dt)
{
#endif
for (i = 0; i <
x; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
for (k = 0; k <
z; k++) {
}
}
}
}
#ifdef _OPENMP
}
#endif
}
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, local_pressure_left, \
local_pressure_right, one_boundary, \
left, right, tmp) \
shared(x, y, z, pre, pre_old, dom, \
pressure_integrated, mean_pressure, dt, \
perfect_sinus_emitter)
{
#endif
for (i = 0; i <
x; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
for (k = 0; k <
z; k++) {
tmp = fabs(pre_old[i][j][k] -
pre[i][j][k]) * perfect_sinus_emitter;
if (tmp < 2.0e-5) tmp = 0.0;
}
}
}
}
#ifdef _OPENMP
}
#endif
}
return 0;
}