re-run clang format

This commit is contained in:
James McClure 2023-10-23 04:18:20 -04:00
parent 88897e73e2
commit 1ed3428ef6
106 changed files with 15405 additions and 10171 deletions

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/ElectroChemistry.h" #include "analysis/ElectroChemistry.h"
ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(std::shared_ptr<Domain> dm) ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(std::shared_ptr<Domain> dm)
@ -49,7 +65,7 @@ ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(std::shared_ptr<Domain> dm)
IonFluxElectrical_y.fill(0); IonFluxElectrical_y.fill(0);
IonFluxElectrical_z.resize(Nx, Ny, Nz); IonFluxElectrical_z.resize(Nx, Ny, Nz);
IonFluxElectrical_z.fill(0); IonFluxElectrical_z.fill(0);
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
bool WriteHeader = false; bool WriteHeader = false;
TIMELOG = fopen("electrokinetic.csv", "r"); TIMELOG = fopen("electrokinetic.csv", "r");
@ -75,9 +91,11 @@ ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(ScaLBL_IonModel &IonModel)
Nz = Dm->Nz; Nz = Dm->Nz;
Volume = (Nx - 2) * (Ny - 2) * (Nz - 2) * Dm->nprocx() * Dm->nprocy() * Volume = (Nx - 2) * (Ny - 2) * (Nz - 2) * Dm->nprocx() * Dm->nprocy() *
Dm->nprocz() * 1.0; Dm->nprocz() * 1.0;
if (Dm->rank()==0) printf("Analyze system with sub-domain size = %i x %i x %i \n",Nx,Ny,Nz); if (Dm->rank() == 0)
printf("Analyze system with sub-domain size = %i x %i x %i \n", Nx, Ny,
Nz);
USE_MEMBRANE = IonModel.USE_MEMBRANE; USE_MEMBRANE = IonModel.USE_MEMBRANE;
ChemicalPotential.resize(Nx, Ny, Nz); ChemicalPotential.resize(Nx, Ny, Nz);
@ -120,11 +138,11 @@ ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(ScaLBL_IonModel &IonModel)
IonFluxElectrical_y.fill(0); IonFluxElectrical_y.fill(0);
IonFluxElectrical_z.resize(Nx, Ny, Nz); IonFluxElectrical_z.resize(Nx, Ny, Nz);
IonFluxElectrical_z.fill(0); IonFluxElectrical_z.fill(0);
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
printf("Set up analysis routines for %lu ions \n",IonModel.number_ion_species); printf("Set up analysis routines for %lu ions \n",
IonModel.number_ion_species);
bool WriteHeader = false; bool WriteHeader = false;
TIMELOG = fopen("electrokinetic.csv", "r"); TIMELOG = fopen("electrokinetic.csv", "r");
if (TIMELOG != NULL) if (TIMELOG != NULL)
@ -138,15 +156,19 @@ ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(ScaLBL_IonModel &IonModel)
//fprintf(TIMELOG,"--------------------------------------------------------------------------------------\n"); //fprintf(TIMELOG,"--------------------------------------------------------------------------------------\n");
fprintf(TIMELOG, "timestep voltage_out voltage_in "); fprintf(TIMELOG, "timestep voltage_out voltage_in ");
fprintf(TIMELOG, "voltage_out_membrane voltage_in_membrane "); fprintf(TIMELOG, "voltage_out_membrane voltage_in_membrane ");
for (size_t i=0; i<IonModel.number_ion_species; i++){ for (size_t i = 0; i < IonModel.number_ion_species; i++) {
fprintf(TIMELOG, "rho_%lu_out rho_%lu_in ",i, i); fprintf(TIMELOG, "rho_%lu_out rho_%lu_in ", i, i);
fprintf(TIMELOG, "rho_%lu_out_membrane rho_%lu_in_membrane ", i, i); fprintf(TIMELOG, "rho_%lu_out_membrane rho_%lu_in_membrane ", i,
fprintf(TIMELOG, "jx_%lu_out jx_%lu_in ",i, i); i);
fprintf(TIMELOG, "jx_%lu_out_membrane jx_%lu_in_membrane ", i, i); fprintf(TIMELOG, "jx_%lu_out jx_%lu_in ", i, i);
fprintf(TIMELOG, "jy_%lu_out jy_%lu_in ",i, i); fprintf(TIMELOG, "jx_%lu_out_membrane jx_%lu_in_membrane ", i,
fprintf(TIMELOG, "jy_%lu_out_membrane jy_%lu_in_membrane ", i, i); i);
fprintf(TIMELOG, "jz_%lu_out jz_%lu_in ",i, i); fprintf(TIMELOG, "jy_%lu_out jy_%lu_in ", i, i);
fprintf(TIMELOG, "jz_%lu_out_membrane jz_%lu_in_membrane ", i, i); fprintf(TIMELOG, "jy_%lu_out_membrane jy_%lu_in_membrane ", i,
i);
fprintf(TIMELOG, "jz_%lu_out jz_%lu_in ", i, i);
fprintf(TIMELOG, "jz_%lu_out_membrane jz_%lu_in_membrane ", i,
i);
} }
fprintf(TIMELOG, "count_out count_in "); fprintf(TIMELOG, "count_out count_in ");
fprintf(TIMELOG, "count_out_membrane count_in_membrane\n"); fprintf(TIMELOG, "count_out_membrane count_in_membrane\n");
@ -163,18 +185,16 @@ ElectroChemistryAnalyzer::~ElectroChemistryAnalyzer() {
void ElectroChemistryAnalyzer::SetParams() {} void ElectroChemistryAnalyzer::SetParams() {}
void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion, void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
ScaLBL_Poisson &Poisson, ScaLBL_Poisson &Poisson, int timestep) {
int timestep) {
int i, j, k; int i, j, k;
Poisson.getElectricPotential(ElectricalPotential); Poisson.getElectricPotential(ElectricalPotential);
if (Dm->rank() == 0) if (Dm->rank() == 0)
fprintf(TIMELOG, "%i ", timestep); fprintf(TIMELOG, "%i ", timestep);
/* int iq, ip, nq, np, nqm, npm;
/* int iq, ip, nq, np, nqm, npm;
Ion.MembraneDistance(i,j,k); // inside (-) or outside (+) the ion Ion.MembraneDistance(i,j,k); // inside (-) or outside (+) the ion
for (int link; link<Ion.IonMembrane->membraneLinkCount; link++){ for (int link; link<Ion.IonMembrane->membraneLinkCount; link++){
int iq = Ion.IonMembrane->membraneLinks[2*link]; int iq = Ion.IonMembrane->membraneLinks[2*link];
@ -187,7 +207,7 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
*/ */
unsigned long int in_local_count, out_local_count; unsigned long int in_local_count, out_local_count;
unsigned long int in_global_count, out_global_count; unsigned long int in_global_count, out_global_count;
double value_in_local, value_out_local; double value_in_local, value_out_local;
double value_in_global, value_out_global; double value_in_global, value_out_global;
@ -208,54 +228,53 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
double jx_in_global, jx_out_global; double jx_in_global, jx_out_global;
double jy_in_global, jy_out_global; double jy_in_global, jy_out_global;
double jz_in_global, jz_out_global; double jz_in_global, jz_out_global;
unsigned long int membrane_in_local_count, membrane_out_local_count; unsigned long int membrane_in_local_count, membrane_out_local_count;
unsigned long int membrane_in_global_count, membrane_out_global_count; unsigned long int membrane_in_global_count, membrane_out_global_count;
double memdist,value,jx,jy,jz; double memdist, value, jx, jy, jz;
in_local_count = 0; in_local_count = 0;
out_local_count = 0; out_local_count = 0;
membrane_in_local_count = 0; membrane_in_local_count = 0;
membrane_out_local_count = 0; membrane_out_local_count = 0;
value_membrane_in_local = 0.0; value_membrane_in_local = 0.0;
value_membrane_out_local = 0.0; value_membrane_out_local = 0.0;
value_in_local = 0.0; value_in_local = 0.0;
value_out_local = 0.0; value_out_local = 0.0;
for (k = Dm->inlet_layers_z; k < Nz; k++) { for (k = Dm->inlet_layers_z; k < Nz; k++) {
for (j = 1; j < Ny; j++) { for (j = 1; j < Ny; j++) {
for (i = 1; i < Nx; i++) { for (i = 1; i < Nx; i++) {
/* electric potential */ /* electric potential */
memdist = Ion.MembraneDistance(i,j,k); memdist = Ion.MembraneDistance(i, j, k);
value = ElectricalPotential(i,j,k); value = ElectricalPotential(i, j, k);
if (memdist < 0.0){ if (memdist < 0.0) {
// inside the membrane // inside the membrane
if (fabs(memdist) < 1.0){ if (fabs(memdist) < 1.0) {
value_membrane_in_local += value; value_membrane_in_local += value;
membrane_in_local_count++; membrane_in_local_count++;
} }
value_in_local += value; value_in_local += value;
in_local_count++; in_local_count++;
} } else {
else { // outside the membrane
// outside the membrane if (fabs(memdist) < 1.0) {
if (fabs(memdist) < 1.0){ value_membrane_out_local += value;
value_membrane_out_local += value; membrane_out_local_count++;
membrane_out_local_count++; }
} value_out_local += value;
value_out_local += value; out_local_count++;
out_local_count++; }
} }
} }
}
} }
/* these only need to be computed the first time through */ /* these only need to be computed the first time through */
out_global_count = Dm->Comm.sumReduce(out_local_count); out_global_count = Dm->Comm.sumReduce(out_local_count);
in_global_count = Dm->Comm.sumReduce(in_local_count); in_global_count = Dm->Comm.sumReduce(in_local_count);
membrane_out_global_count = Dm->Comm.sumReduce(membrane_out_local_count); membrane_out_global_count = Dm->Comm.sumReduce(membrane_out_local_count);
membrane_in_global_count = Dm->Comm.sumReduce(membrane_in_local_count); membrane_in_global_count = Dm->Comm.sumReduce(membrane_in_local_count);
value_out_global = Dm->Comm.sumReduce(value_out_local); value_out_global = Dm->Comm.sumReduce(value_out_local);
value_in_global = Dm->Comm.sumReduce(value_in_local); value_in_global = Dm->Comm.sumReduce(value_in_local);
value_membrane_out_global = Dm->Comm.sumReduce(value_membrane_out_local); value_membrane_out_global = Dm->Comm.sumReduce(value_membrane_out_local);
@ -265,12 +284,12 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
value_in_global /= in_global_count; value_in_global /= in_global_count;
value_membrane_out_global /= membrane_out_global_count; value_membrane_out_global /= membrane_out_global_count;
value_membrane_in_global /= membrane_in_global_count; value_membrane_in_global /= membrane_in_global_count;
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
fprintf(TIMELOG, "%.8g ", value_out_global); fprintf(TIMELOG, "%.8g ", value_out_global);
fprintf(TIMELOG, "%.8g ", value_in_global); fprintf(TIMELOG, "%.8g ", value_in_global);
fprintf(TIMELOG, "%.8g ", value_membrane_out_global); fprintf(TIMELOG, "%.8g ", value_membrane_out_global);
fprintf(TIMELOG, "%.8g ", value_membrane_in_global); fprintf(TIMELOG, "%.8g ", value_membrane_in_global);
} }
value_membrane_in_local = 0.0; value_membrane_in_local = 0.0;
@ -279,72 +298,81 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
value_out_local = 0.0; value_out_local = 0.0;
for (size_t ion = 0; ion < Ion.number_ion_species; ion++) { for (size_t ion = 0; ion < Ion.number_ion_species; ion++) {
Ion.getIonConcentration(Rho, ion); Ion.getIonConcentration(Rho, ion);
Ion.getIonFluxDiffusive(IonFluxDiffusive_x, IonFluxDiffusive_y, IonFluxDiffusive_z, ion); Ion.getIonFluxDiffusive(IonFluxDiffusive_x, IonFluxDiffusive_y,
Ion.getIonFluxAdvective(IonFluxAdvective_x, IonFluxAdvective_y, IonFluxAdvective_z, ion); IonFluxDiffusive_z, ion);
Ion.getIonFluxElectrical(IonFluxElectrical_x, IonFluxElectrical_y, IonFluxElectrical_z, ion); Ion.getIonFluxAdvective(IonFluxAdvective_x, IonFluxAdvective_y,
IonFluxAdvective_z, ion);
Ion.getIonFluxElectrical(IonFluxElectrical_x, IonFluxElectrical_y,
IonFluxElectrical_z, ion);
value_membrane_in_local = 0.0; value_membrane_in_local = 0.0;
value_membrane_out_local = 0.0; value_membrane_out_local = 0.0;
value_in_local = 0.0; value_in_local = 0.0;
value_out_local = 0.0; value_out_local = 0.0;
jx_membrane_in_local = jy_membrane_in_local = jz_membrane_in_local = 0.0; jx_membrane_in_local = jy_membrane_in_local = jz_membrane_in_local =
jx_membrane_out_local = jy_membrane_out_local = jz_membrane_out_local = 0.0; 0.0;
jx_in_local = jy_in_local = jz_in_local = 0.0; jx_membrane_out_local = jy_membrane_out_local = jz_membrane_out_local =
jx_out_local = jy_out_local = jz_out_local = 0.0; 0.0;
jx_in_local = jy_in_local = jz_in_local = 0.0;
jx_out_local = jy_out_local = jz_out_local = 0.0;
for (k = Dm->inlet_layers_z; k < Nz; k++) { for (k = Dm->inlet_layers_z; k < Nz; k++) {
for (j = 1; j < Ny; j++) { for (j = 1; j < Ny; j++) {
for (i = 1; i < Nx; i++) { for (i = 1; i < Nx; i++) {
/* electric potential */ /* electric potential */
memdist = Ion.MembraneDistance(i,j,k); memdist = Ion.MembraneDistance(i, j, k);
value = Rho(i,j,k); value = Rho(i, j, k);
jx = IonFluxDiffusive_x(i,j,k) + IonFluxAdvective_x(i,j,k) + IonFluxElectrical_x(i,j,k); jx = IonFluxDiffusive_x(i, j, k) +
jy = IonFluxDiffusive_y(i,j,k) + IonFluxAdvective_y(i,j,k) + IonFluxElectrical_y(i,j,k); IonFluxAdvective_x(i, j, k) +
jz = IonFluxDiffusive_z(i,j,k) + IonFluxAdvective_z(i,j,k) + IonFluxElectrical_z(i,j,k); IonFluxElectrical_x(i, j, k);
jy = IonFluxDiffusive_y(i, j, k) +
if (memdist < 0.0){ IonFluxAdvective_y(i, j, k) +
// inside the membrane IonFluxElectrical_y(i, j, k);
if (fabs(memdist) < 1.0){ jz = IonFluxDiffusive_z(i, j, k) +
value_membrane_in_local += value; IonFluxAdvective_z(i, j, k) +
jx_membrane_in_local += jx; IonFluxElectrical_z(i, j, k);
jy_membrane_in_local += jy;
jz_membrane_in_local += jz;
} if (memdist < 0.0) {
value_in_local += value; // inside the membrane
jx_in_local += jx; if (fabs(memdist) < 1.0) {
jy_in_local += jy; value_membrane_in_local += value;
jz_in_local += jz; jx_membrane_in_local += jx;
jy_membrane_in_local += jy;
jz_membrane_in_local += jz;
}
value_in_local += value;
jx_in_local += jx;
jy_in_local += jy;
jz_in_local += jz;
} } else {
else { // outside the membrane
// outside the membrane if (fabs(memdist) < 1.0) {
if (fabs(memdist) < 1.0){ value_membrane_out_local += value;
value_membrane_out_local += value; jx_membrane_out_local += jx;
jx_membrane_out_local += jx; jy_membrane_out_local += jy;
jy_membrane_out_local += jy; jz_membrane_out_local += jz;
jz_membrane_out_local += jz; }
value_out_local += value;
} jx_out_local += jx;
value_out_local += value; jy_out_local += jy;
jx_out_local += jx; jz_out_local += jz;
jy_out_local += jy; }
jz_out_local += jz; }
} }
}
}
} }
value_out_global = Dm->Comm.sumReduce(value_out_local); value_out_global = Dm->Comm.sumReduce(value_out_local);
value_in_global = Dm->Comm.sumReduce(value_in_local); value_in_global = Dm->Comm.sumReduce(value_in_local);
value_membrane_out_global = Dm->Comm.sumReduce(value_membrane_out_local); value_membrane_out_global =
Dm->Comm.sumReduce(value_membrane_out_local);
value_membrane_in_global = Dm->Comm.sumReduce(value_membrane_in_local); value_membrane_in_global = Dm->Comm.sumReduce(value_membrane_in_local);
value_out_global /= out_global_count; value_out_global /= out_global_count;
value_in_global /= in_global_count; value_in_global /= in_global_count;
value_membrane_out_global /= membrane_out_global_count; value_membrane_out_global /= membrane_out_global_count;
value_membrane_in_global /= membrane_in_global_count; value_membrane_in_global /= membrane_in_global_count;
jx_out_global = Dm->Comm.sumReduce(jx_out_local); jx_out_global = Dm->Comm.sumReduce(jx_out_local);
jx_in_global = Dm->Comm.sumReduce(jx_in_local); jx_in_global = Dm->Comm.sumReduce(jx_in_local);
jx_membrane_out_global = Dm->Comm.sumReduce(jx_membrane_out_local); jx_membrane_out_global = Dm->Comm.sumReduce(jx_membrane_out_local);
@ -354,7 +382,7 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
jx_in_global /= in_global_count; jx_in_global /= in_global_count;
jx_membrane_out_global /= membrane_out_global_count; jx_membrane_out_global /= membrane_out_global_count;
jx_membrane_in_global /= membrane_in_global_count; jx_membrane_in_global /= membrane_in_global_count;
jy_out_global = Dm->Comm.sumReduce(jy_out_local); jy_out_global = Dm->Comm.sumReduce(jy_out_local);
jy_in_global = Dm->Comm.sumReduce(jy_in_local); jy_in_global = Dm->Comm.sumReduce(jy_in_local);
jy_membrane_out_global = Dm->Comm.sumReduce(jy_membrane_out_local); jy_membrane_out_global = Dm->Comm.sumReduce(jy_membrane_out_local);
@ -364,7 +392,7 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
jy_in_global /= in_global_count; jy_in_global /= in_global_count;
jy_membrane_out_global /= membrane_out_global_count; jy_membrane_out_global /= membrane_out_global_count;
jy_membrane_in_global /= membrane_in_global_count; jy_membrane_in_global /= membrane_in_global_count;
jz_out_global = Dm->Comm.sumReduce(jz_out_local); jz_out_global = Dm->Comm.sumReduce(jz_out_local);
jz_in_global = Dm->Comm.sumReduce(jz_in_local); jz_in_global = Dm->Comm.sumReduce(jz_in_local);
jz_membrane_out_global = Dm->Comm.sumReduce(jz_membrane_out_local); jz_membrane_out_global = Dm->Comm.sumReduce(jz_membrane_out_local);
@ -376,38 +404,37 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
jz_membrane_in_global /= membrane_in_global_count; jz_membrane_in_global /= membrane_in_global_count;
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
fprintf(TIMELOG, "%.8g ", value_out_global); fprintf(TIMELOG, "%.8g ", value_out_global);
fprintf(TIMELOG, "%.8g ", value_in_global); fprintf(TIMELOG, "%.8g ", value_in_global);
fprintf(TIMELOG, "%.8g ", value_membrane_out_global); fprintf(TIMELOG, "%.8g ", value_membrane_out_global);
fprintf(TIMELOG, "%.8g ", value_membrane_in_global); fprintf(TIMELOG, "%.8g ", value_membrane_in_global);
fprintf(TIMELOG, "%.8g ", jx_out_global); fprintf(TIMELOG, "%.8g ", jx_out_global);
fprintf(TIMELOG, "%.8g ", jx_in_global); fprintf(TIMELOG, "%.8g ", jx_in_global);
fprintf(TIMELOG, "%.8g ", jx_membrane_out_global); fprintf(TIMELOG, "%.8g ", jx_membrane_out_global);
fprintf(TIMELOG, "%.8g ", jx_membrane_in_global); fprintf(TIMELOG, "%.8g ", jx_membrane_in_global);
fprintf(TIMELOG, "%.8g ", jy_out_global); fprintf(TIMELOG, "%.8g ", jy_out_global);
fprintf(TIMELOG, "%.8g ", jy_in_global); fprintf(TIMELOG, "%.8g ", jy_in_global);
fprintf(TIMELOG, "%.8g ", jy_membrane_out_global); fprintf(TIMELOG, "%.8g ", jy_membrane_out_global);
fprintf(TIMELOG, "%.8g ", jy_membrane_in_global); fprintf(TIMELOG, "%.8g ", jy_membrane_in_global);
fprintf(TIMELOG, "%.8g ", jz_out_global); fprintf(TIMELOG, "%.8g ", jz_out_global);
fprintf(TIMELOG, "%.8g ", jz_in_global); fprintf(TIMELOG, "%.8g ", jz_in_global);
fprintf(TIMELOG, "%.8g ", jz_membrane_out_global); fprintf(TIMELOG, "%.8g ", jz_membrane_out_global);
fprintf(TIMELOG, "%.8g ", jz_membrane_in_global); fprintf(TIMELOG, "%.8g ", jz_membrane_in_global);
} }
} }
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
fprintf(TIMELOG, "%lu ", out_global_count); fprintf(TIMELOG, "%lu ", out_global_count);
fprintf(TIMELOG, "%lu ", in_global_count); fprintf(TIMELOG, "%lu ", in_global_count);
fprintf(TIMELOG, "%lu ", membrane_out_global_count); fprintf(TIMELOG, "%lu ", membrane_out_global_count);
fprintf(TIMELOG, "%lu\n", membrane_in_global_count); fprintf(TIMELOG, "%lu\n", membrane_in_global_count);
fflush(TIMELOG); fflush(TIMELOG);
} }
} }
void ElectroChemistryAnalyzer::Basic(ScaLBL_IonModel &Ion, void ElectroChemistryAnalyzer::Basic(ScaLBL_IonModel &Ion,
ScaLBL_Poisson &Poisson, ScaLBL_Poisson &Poisson,
ScaLBL_StokesModel &Stokes, int timestep) { ScaLBL_StokesModel &Stokes, int timestep) {
@ -522,34 +549,35 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
ScaLBL_StokesModel &Stokes, ScaLBL_StokesModel &Stokes,
std::shared_ptr<Database> input_db, std::shared_ptr<Database> input_db,
int timestep) { int timestep) {
auto vis_db = input_db->getDatabase("Visualization"); auto vis_db = input_db->getDatabase("Visualization");
char VisName[40]; char VisName[40];
auto format = vis_db->getWithDefault<string>( "format", "hdf5" ); auto format = vis_db->getWithDefault<string>("format", "hdf5");
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n", format.c_str()); printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n",
if (vis_db->getWithDefault<bool>("save_electric_potential", true)){ format.c_str());
printf(" save electric potential \n"); if (vis_db->getWithDefault<bool>("save_electric_potential", true)) {
} printf(" save electric potential \n");
if (vis_db->getWithDefault<bool>("save_concentration", true)) { }
printf(" save concentration \n"); if (vis_db->getWithDefault<bool>("save_concentration", true)) {
} printf(" save concentration \n");
if (vis_db->getWithDefault<bool>("save_velocity", false)) { }
printf(" save velocity \n"); if (vis_db->getWithDefault<bool>("save_velocity", false)) {
} printf(" save velocity \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_diffusive", false)) { }
printf(" save ion flux (diffusive) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_diffusive", false)) {
} printf(" save ion flux (diffusive) \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_advective", false)) { }
printf(" save ion flux (advective) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_advective", false)) {
} printf(" save ion flux (advective) \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) { }
printf(" save ion flux (electrical) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) {
} printf(" save ion flux (electrical) \n");
if (vis_db->getWithDefault<bool>("save_electric_field", false)) { }
printf(" save electric field \n"); if (vis_db->getWithDefault<bool>("save_electric_field", false)) {
} printf(" save electric field \n");
}
} }
std::vector<IO::MeshDataStruct> visData; std::vector<IO::MeshDataStruct> visData;
@ -557,8 +585,8 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
{Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1}, {Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1},
0, 1); 0, 1);
IO::initialize("",format,"false"); IO::initialize("", format, "false");
// Create the MeshDataStruct // Create the MeshDataStruct
visData.resize(1); visData.resize(1);
visData[0].meshName = "domain"; visData[0].meshName = "domain";
@ -955,8 +983,7 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
} }
void ElectroChemistryAnalyzer::Basic(ScaLBL_IonModel &Ion, void ElectroChemistryAnalyzer::Basic(ScaLBL_IonModel &Ion,
ScaLBL_Poisson &Poisson, ScaLBL_Poisson &Poisson, int timestep) {
int timestep) {
int i, j, k; int i, j, k;
double Vin = 0.0; double Vin = 0.0;
@ -975,10 +1002,10 @@ void ElectroChemistryAnalyzer::Basic(ScaLBL_IonModel &Ion,
double *rho_mu_fluctuation_global; double *rho_mu_fluctuation_global;
double *rho_psi_avg_global; double *rho_psi_avg_global;
double *rho_psi_fluctuation_global; double *rho_psi_fluctuation_global;
/* Get the distance to the membrane */ /* Get the distance to the membrane */
if (Ion.USE_MEMBRANE){ if (Ion.USE_MEMBRANE) {
//Ion.MembraneDistance; //Ion.MembraneDistance;
} }
/* local sub-domain averages */ /* local sub-domain averages */
@ -1075,40 +1102,41 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
auto vis_db = input_db->getDatabase("Visualization"); auto vis_db = input_db->getDatabase("Visualization");
char VisName[40]; char VisName[40];
auto format = vis_db->getWithDefault<string>( "format", "hdf5" ); auto format = vis_db->getWithDefault<string>("format", "hdf5");
std::vector<IO::MeshDataStruct> visData; std::vector<IO::MeshDataStruct> visData;
fillHalo<double> fillData(Dm->Comm, Dm->rank_info, fillHalo<double> fillData(Dm->Comm, Dm->rank_info,
{Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1}, {Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1},
0, 1); 0, 1);
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n", format.c_str()); printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n",
if (vis_db->getWithDefault<bool>("save_electric_potential", true)){ format.c_str());
printf(" save electric potential \n"); if (vis_db->getWithDefault<bool>("save_electric_potential", true)) {
} printf(" save electric potential \n");
if (vis_db->getWithDefault<bool>("save_concentration", true)) { }
printf(" save concentration \n"); if (vis_db->getWithDefault<bool>("save_concentration", true)) {
} printf(" save concentration \n");
if (vis_db->getWithDefault<bool>("save_velocity", false)) { }
printf(" save velocity \n"); if (vis_db->getWithDefault<bool>("save_velocity", false)) {
} printf(" save velocity \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_diffusive", false)) { }
printf(" save ion flux (diffusive) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_diffusive", false)) {
} printf(" save ion flux (diffusive) \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_advective", false)) { }
printf(" save ion flux (advective) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_advective", false)) {
} printf(" save ion flux (advective) \n");
if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) { }
printf(" save ion flux (electrical) \n"); if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) {
} printf(" save ion flux (electrical) \n");
if (vis_db->getWithDefault<bool>("save_electric_field", false)) { }
printf(" save electric field \n"); if (vis_db->getWithDefault<bool>("save_electric_field", false)) {
} printf(" save electric field \n");
}
} }
IO::initialize("",format,"false"); IO::initialize("", format, "false");
// Create the MeshDataStruct // Create the MeshDataStruct
visData.resize(1); visData.resize(1);
visData[0].meshName = "domain"; visData[0].meshName = "domain";
@ -1200,7 +1228,6 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
} }
} }
if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) { if (vis_db->getWithDefault<bool>("save_ion_flux_electrical", false)) {
for (size_t ion = 0; ion < Ion.number_ion_species; ion++) { for (size_t ion = 0; ion < Ion.number_ion_species; ion++) {
// x-component of electro-migrational flux // x-component of electro-migrational flux

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
* averaging tools for electrochemistry * averaging tools for electrochemistry
*/ */
@ -29,7 +45,7 @@ public:
double nu_n, nu_w; double nu_n, nu_w;
double gamma_wn, beta; double gamma_wn, beta;
double Fx, Fy, Fz; double Fx, Fy, Fz;
bool USE_MEMBRANE; bool USE_MEMBRANE;
//........................................................................... //...........................................................................
@ -56,14 +72,16 @@ public:
DoubleArray IonFluxElectrical_z; DoubleArray IonFluxElectrical_z;
ElectroChemistryAnalyzer(std::shared_ptr<Domain> Dm); ElectroChemistryAnalyzer(std::shared_ptr<Domain> Dm);
ElectroChemistryAnalyzer( ScaLBL_IonModel &IonModel); ElectroChemistryAnalyzer(ScaLBL_IonModel &IonModel);
~ElectroChemistryAnalyzer(); ~ElectroChemistryAnalyzer();
void SetParams(); void SetParams();
void Basic(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, ScaLBL_StokesModel &Stokes, int timestep); void Basic(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson,
ScaLBL_StokesModel &Stokes, int timestep);
void Membrane(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, int timestep); void Membrane(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, int timestep);
void WriteVis(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, void WriteVis(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson,
ScaLBL_StokesModel &Stokes,std::shared_ptr<Database> input_db, int timestep); ScaLBL_StokesModel &Stokes,
std::shared_ptr<Database> input_db, int timestep);
void Basic(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, int timestep); void Basic(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, int timestep);
void WriteVis(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson, void WriteVis(ScaLBL_IonModel &Ion, ScaLBL_Poisson &Poisson,
std::shared_ptr<Database> input_db, int timestep); std::shared_ptr<Database> input_db, int timestep);

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* Flow adaptor class for multiphase flow methods */ /* Flow adaptor class for multiphase flow methods */
#include "analysis/FlowAdaptor.h" #include "analysis/FlowAdaptor.h"
@ -17,9 +33,7 @@ FlowAdaptor::FlowAdaptor(ScaLBL_ColorModel &M) {
phi_t.fill(0); // time derivative for the phase indicator field phi_t.fill(0); // time derivative for the phase indicator field
} }
FlowAdaptor::~FlowAdaptor() { FlowAdaptor::~FlowAdaptor() {}
}
double FlowAdaptor::ImageInit(ScaLBL_ColorModel &M, std::string Filename) { double FlowAdaptor::ImageInit(ScaLBL_ColorModel &M, std::string Filename) {
int rank = M.rank; int rank = M.rank;
@ -237,12 +251,12 @@ double FlowAdaptor::UpdateFractionalFlow(ScaLBL_ColorModel &M) {
//ScaLBL_CopyToDevice(Phi,phase.data(),7*Np*sizeof(double)); //ScaLBL_CopyToDevice(Phi,phase.data(),7*Np*sizeof(double));
ScaLBL_CopyToDevice(M.Aq, Aq_tmp, 7 * Np * sizeof(double)); ScaLBL_CopyToDevice(M.Aq, Aq_tmp, 7 * Np * sizeof(double));
ScaLBL_CopyToDevice(M.Bq, Bq_tmp, 7 * Np * sizeof(double)); ScaLBL_CopyToDevice(M.Bq, Bq_tmp, 7 * Np * sizeof(double));
delete Aq_tmp; delete Aq_tmp;
delete Bq_tmp; delete Bq_tmp;
delete Vel_x; delete Vel_x;
delete Vel_y; delete Vel_y;
delete Vel_z; delete Vel_z;
delete Phase; delete Phase;
return (TOTAL_MASS_CHANGE); return (TOTAL_MASS_CHANGE);
@ -594,8 +608,8 @@ double FlowAdaptor::SeedPhaseField(ScaLBL_ColorModel &M,
//ScaLBL_CopyToDevice(Phi,phase.data(),7*Np*sizeof(double)); //ScaLBL_CopyToDevice(Phi,phase.data(),7*Np*sizeof(double));
ScaLBL_CopyToDevice(M.Aq, Aq_tmp, 7 * Np * sizeof(double)); ScaLBL_CopyToDevice(M.Aq, Aq_tmp, 7 * Np * sizeof(double));
ScaLBL_CopyToDevice(M.Bq, Bq_tmp, 7 * Np * sizeof(double)); ScaLBL_CopyToDevice(M.Bq, Bq_tmp, 7 * Np * sizeof(double));
delete Aq_tmp; delete Aq_tmp;
delete Bq_tmp; delete Bq_tmp;
return (mass_loss); return (mass_loss);
} }

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* Flow adaptor class for multiphase flow methods */ /* Flow adaptor class for multiphase flow methods */
#ifndef ScaLBL_FlowAdaptor_INC #ifndef ScaLBL_FlowAdaptor_INC
@ -62,7 +78,7 @@ public:
* \details Update fractional flow condition. Mass will be preferentially added or removed from * \details Update fractional flow condition. Mass will be preferentially added or removed from
* phase regions based on where flow is occurring * phase regions based on where flow is occurring
* @param M ScaLBL_ColorModel * @param M ScaLBL_ColorModel
*/ */
double UpdateFractionalFlow(ScaLBL_ColorModel &M); double UpdateFractionalFlow(ScaLBL_ColorModel &M);
/** /**

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/FreeEnergy.h" #include "analysis/FreeEnergy.h"
FreeEnergyAnalyzer::FreeEnergyAnalyzer(std::shared_ptr<Domain> dm) : Dm(dm) { FreeEnergyAnalyzer::FreeEnergyAnalyzer(std::shared_ptr<Domain> dm) : Dm(dm) {

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
* averaging tools for electrochemistry * averaging tools for electrochemistry
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/GreyPhase.h" #include "analysis/GreyPhase.h"
// Constructor // Constructor

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
* Sub-phase averaging tools * Sub-phase averaging tools
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/Minkowski.h" #include "analysis/Minkowski.h"
#include "analysis/pmmc.h" #include "analysis/pmmc.h"
#include "analysis/analysis.h" #include "analysis/analysis.h"
@ -145,7 +161,7 @@ void Minkowski::MeasureObject() {
* 1 - labels the rest of the * 1 - labels the rest of the
*/ */
//DoubleArray smooth_distance(Nx,Ny,Nz); //DoubleArray smooth_distance(Nx,Ny,Nz);
for (int k = 0; k < Nz; k++) { for (int k = 0; k < Nz; k++) {
for (int j = 0; j < Ny; j++) { for (int j = 0; j < Ny; j++) {
for (int i = 0; i < Nx; i++) { for (int i = 0; i < Nx; i++) {

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Header file for two-phase averaging class // Header file for two-phase averaging class
#ifndef Minkowski_INC #ifndef Minkowski_INC
#define Minkowski_INC #define Minkowski_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PointList_INC #ifndef PointList_INC
#define PointList_INC #define PointList_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/SubPhase.h" #include "analysis/SubPhase.h"
// Constructor // Constructor
@ -411,7 +427,7 @@ void SubPhase::Basic() {
dir_z = 1.0; dir_z = 1.0;
force_mag = 1.0; force_mag = 1.0;
} }
double Porosity = (gwb.V + gnb.V)/Dm->Volume; double Porosity = (gwb.V + gnb.V) / Dm->Volume;
double saturation = gwb.V / (gwb.V + gnb.V); double saturation = gwb.V / (gwb.V + gnb.V);
double water_flow_rate = double water_flow_rate =
gwb.V * (gwb.Px * dir_x + gwb.Py * dir_y + gwb.Pz * dir_z) / gwb.M / gwb.V * (gwb.Px * dir_x + gwb.Py * dir_y + gwb.Pz * dir_z) / gwb.M /
@ -431,10 +447,12 @@ void SubPhase::Basic() {
//double fractional_flow = water_flow_rate / total_flow_rate; //double fractional_flow = water_flow_rate / total_flow_rate;
double h = Dm->voxel_length; double h = Dm->voxel_length;
double krn = h * h * nu_n * Porosity * not_water_flow_rate / force_mag; double krn = h * h * nu_n * Porosity * not_water_flow_rate / force_mag;
double krw = h * h * nu_w * Porosity* water_flow_rate / force_mag; double krw = h * h * nu_w * Porosity * water_flow_rate / force_mag;
/* not counting films */ /* not counting films */
double krnf = krn - h * h * nu_n * Porosity * not_water_film_flow_rate / force_mag; double krnf = krn - h * h * nu_n * Porosity * not_water_film_flow_rate /
double krwf = krw - h * h * nu_w * Porosity * water_film_flow_rate / force_mag; force_mag;
double krwf =
krw - h * h * nu_w * Porosity * water_film_flow_rate / force_mag;
double eff_pressure = 1.0 / (krn + krw); // effective pressure drop double eff_pressure = 1.0 / (krn + krw); // effective pressure drop
fprintf(TIMELOG, fprintf(TIMELOG,

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
* Sub-phase averaging tools * Sub-phase averaging tools
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/TwoPhase.h" #include "analysis/TwoPhase.h"
#include "analysis/pmmc.h" #include "analysis/pmmc.h"
@ -11,7 +27,6 @@
#include "IO/Writer.h" #include "IO/Writer.h"
#include "analysis/filters.h" #include "analysis/filters.h"
#include <memory> #include <memory>
#define BLOB_AVG_COUNT 35 #define BLOB_AVG_COUNT 35
@ -401,7 +416,8 @@ void TwoPhase::UpdateSolid() {
void TwoPhase::UpdateMeshValues() { void TwoPhase::UpdateMeshValues() {
int i, j, k, n; int i, j, k, n;
fillHalo<double> fillData(Dm->Comm, Dm->rank_info, {Nx-2,Ny-2,Nz-2}, {1, 1, 1}, 0, 1); fillHalo<double> fillData(Dm->Comm, Dm->rank_info, {Nx - 2, Ny - 2, Nz - 2},
{1, 1, 1}, 0, 1);
//........................................................................... //...........................................................................
//Dm->CommunicateMeshHalo(SDn); //Dm->CommunicateMeshHalo(SDn);
@ -560,7 +576,7 @@ void TwoPhase::ComputeLocal() {
Kwn += pmmc_CubeSurfaceInterpValue( Kwn += pmmc_CubeSurfaceInterpValue(
CubeValues, GaussCurvature, nw_pts, nw_tris, Values, i, CubeValues, GaussCurvature, nw_pts, nw_tris, Values, i,
j, k, n_nw_pts, n_nw_tris); j, k, n_nw_pts, n_nw_tris);
Jwn += pmmc_CubeSurfaceInterpValue( Jwn += pmmc_CubeSurfaceInterpValue(
CubeValues, MeanCurvature, nw_pts, nw_tris, Values, i, CubeValues, MeanCurvature, nw_pts, nw_tris, Values, i,
j, k, n_nw_pts, n_nw_tris); j, k, n_nw_pts, n_nw_tris);
@ -591,7 +607,7 @@ void TwoPhase::ComputeLocal() {
efawns += pmmc_CubeContactAngle( efawns += pmmc_CubeContactAngle(
CubeValues, Values, SDn_x, SDn_y, SDn_z, SDs_x, SDs_y, CubeValues, Values, SDn_x, SDn_y, SDn_z, SDs_x, SDs_y,
SDs_z, local_nws_pts, i, j, k, n_local_nws_pts); SDs_z, local_nws_pts, i, j, k, n_local_nws_pts);
wwnsdnwn += pmmc_CommonCurveSpeed( wwnsdnwn += pmmc_CommonCurveSpeed(
CubeValues, dPdt, vawns, SDn_x, SDn_y, SDn_z, SDs_x, CubeValues, dPdt, vawns, SDn_x, SDn_y, SDn_z, SDs_x,
SDs_y, SDs_z, local_nws_pts, i, j, k, n_local_nws_pts); SDs_y, SDs_z, local_nws_pts, i, j, k, n_local_nws_pts);
@ -705,18 +721,19 @@ void TwoPhase::ComputeStatic() {
kmin = 1; kmin = 1;
kmax = Nz - 1; kmax = Nz - 1;
imin = jmin = 1; imin = jmin = 1;
/* set fluid isovalue to "grow" NWP for contact angle measurement */ /* set fluid isovalue to "grow" NWP for contact angle measurement */
fluid_isovalue = -1.0; fluid_isovalue = -1.0;
string FILENAME = "ContactAngle"; string FILENAME = "ContactAngle";
char LocalRankString[8]; char LocalRankString[8];
char LocalRankFilename[40]; char LocalRankFilename[40];
sprintf(LocalRankString, "%05d", Dm->rank()); sprintf(LocalRankString, "%05d", Dm->rank());
sprintf(LocalRankFilename, "%s%s%s", "ContactAngle.", LocalRankString,".csv"); sprintf(LocalRankFilename, "%s%s%s", "ContactAngle.", LocalRankString,
".csv");
FILE *ANGLES = fopen(LocalRankFilename, "a+"); FILE *ANGLES = fopen(LocalRankFilename, "a+");
fprintf(ANGLES,"x y z angle\n"); fprintf(ANGLES, "x y z angle\n");
for (k = kmin; k < kmax; k++) { for (k = kmin; k < kmax; k++) {
for (j = jmin; j < Ny - 1; j++) { for (j = jmin; j < Ny - 1; j++) {
@ -761,13 +778,13 @@ void TwoPhase::ComputeStatic() {
Kwn += pmmc_CubeSurfaceInterpValue( Kwn += pmmc_CubeSurfaceInterpValue(
CubeValues, GaussCurvature, nw_pts, nw_tris, Values, i, CubeValues, GaussCurvature, nw_pts, nw_tris, Values, i,
j, k, n_nw_pts, n_nw_tris); j, k, n_nw_pts, n_nw_tris);
Jwn += pmmc_CubeSurfaceInterpValue( Jwn += pmmc_CubeSurfaceInterpValue(
CubeValues, MeanCurvature, nw_pts, nw_tris, Values, i, CubeValues, MeanCurvature, nw_pts, nw_tris, Values, i,
j, k, n_nw_pts, n_nw_tris); j, k, n_nw_pts, n_nw_tris);
Xwn += geomavg_EulerCharacteristic(nw_pts, nw_tris, n_nw_pts, Xwn += geomavg_EulerCharacteristic(
n_nw_tris, i, j, k); nw_pts, nw_tris, n_nw_pts, n_nw_tris, i, j, k);
// Integrate the trimmed mean curvature (hard-coded to use a distance of 4 pixels) // Integrate the trimmed mean curvature (hard-coded to use a distance of 4 pixels)
pmmc_CubeTrimSurfaceInterpValues( pmmc_CubeTrimSurfaceInterpValues(
@ -785,12 +802,13 @@ void TwoPhase::ComputeStatic() {
efawns += pmmc_CubeContactAngle( efawns += pmmc_CubeContactAngle(
CubeValues, Values, SDn_x, SDn_y, SDn_z, SDs_x, SDs_y, CubeValues, Values, SDn_x, SDn_y, SDn_z, SDs_x, SDs_y,
SDs_z, local_nws_pts, i, j, k, n_local_nws_pts); SDs_z, local_nws_pts, i, j, k, n_local_nws_pts);
for (int p = 0; p < n_local_nws_pts; p++) { for (int p = 0; p < n_local_nws_pts; p++) {
// Extract the line segment // Extract the line segment
Point A = local_nws_pts(p); Point A = local_nws_pts(p);
double value = Values(p); double value = Values(p);
fprintf(ANGLES, "%.8g %.8g %.8g %.8g\n", A.x, A.y, A.z, value); fprintf(ANGLES, "%.8g %.8g %.8g %.8g\n", A.x, A.y, A.z,
value);
} }
pmmc_CurveCurvature(SDn, SDs, SDn_x, SDn_y, SDn_z, SDs_x, pmmc_CurveCurvature(SDn, SDs, SDn_x, SDn_y, SDn_z, SDs_x,
@ -800,14 +818,14 @@ void TwoPhase::ComputeStatic() {
lwns += lwns +=
pmmc_CubeCurveLength(local_nws_pts, n_local_nws_pts); pmmc_CubeCurveLength(local_nws_pts, n_local_nws_pts);
/* half contribution for vertices / edges at the common line /* half contribution for vertices / edges at the common line
* each cube with contact line has a net of undercounting vertices * each cube with contact line has a net of undercounting vertices
* each cube is undercounting edges due to internal counts * each cube is undercounting edges due to internal counts
*/ */
Xwn += 0.25*n_local_nws_pts - 0.5; Xwn += 0.25 * n_local_nws_pts - 0.5;
Xws += 0.25*n_local_nws_pts - 0.5; Xws += 0.25 * n_local_nws_pts - 0.5;
Xns += 0.25*n_local_nws_pts - 0.5; Xns += 0.25 * n_local_nws_pts - 0.5;
} }
// Solid interface averagees // Solid interface averagees
@ -820,12 +838,12 @@ void TwoPhase::ComputeStatic() {
n_ns_tris); n_ns_tris);
aws += pmmc_CubeSurfaceOrientation(Gws, ws_pts, ws_tris, aws += pmmc_CubeSurfaceOrientation(Gws, ws_pts, ws_tris,
n_ws_tris); n_ws_tris);
Xws += geomavg_EulerCharacteristic(ws_pts, ws_tris, n_ws_pts, Xws += geomavg_EulerCharacteristic(
n_ws_tris, i, j, k); ws_pts, ws_tris, n_ws_pts, n_ws_tris, i, j, k);
Xns += geomavg_EulerCharacteristic(ns_pts, ns_tris, n_ns_pts, Xns += geomavg_EulerCharacteristic(
n_ns_tris, i, j, k); ns_pts, ns_tris, n_ns_pts, n_ns_tris, i, j, k);
} }
//........................................................................... //...........................................................................
// Compute the integral curvature of the non-wetting phase // Compute the integral curvature of the non-wetting phase
@ -850,11 +868,9 @@ void TwoPhase::ComputeStatic() {
Kn += pmmc_CubeSurfaceInterpValue(CubeValues, GaussCurvature, Kn += pmmc_CubeSurfaceInterpValue(CubeValues, GaussCurvature,
nw_pts, nw_tris, Values, i, j, nw_pts, nw_tris, Values, i, j,
k, n_nw_pts, n_nw_tris); k, n_nw_pts, n_nw_tris);
euler += geomavg_EulerCharacteristic(nw_pts, nw_tris, n_nw_pts, euler += geomavg_EulerCharacteristic(nw_pts, nw_tris, n_nw_pts,
n_nw_tris, i, j, k); n_nw_tris, i, j, k);
} }
} }
} }
@ -1522,7 +1538,6 @@ void TwoPhase::Reduce() {
dEs = dEs * iVol_global; dEs = dEs * iVol_global;
lwns_global = lwns_global * iVol_global; lwns_global = lwns_global * iVol_global;
*/ */
} }
void TwoPhase::NonDimensionalize(double D, double viscosity, double IFT) { void TwoPhase::NonDimensionalize(double D, double viscosity, double IFT) {
@ -1536,27 +1551,28 @@ void TwoPhase::NonDimensionalize(double D, double viscosity, double IFT) {
void TwoPhase::PrintStatic() { void TwoPhase::PrintStatic() {
if (Dm->rank() == 0) { if (Dm->rank() == 0) {
FILE *STATIC; FILE *STATIC;
STATIC = fopen("geometry.csv", "a+"); STATIC = fopen("geometry.csv", "a+");
if (fseek(STATIC, 0, SEEK_SET) == fseek(STATIC, 0, SEEK_CUR)) { if (fseek(STATIC, 0, SEEK_SET) == fseek(STATIC, 0, SEEK_CUR)) {
// If timelog is empty, write a short header to list the averages // If timelog is empty, write a short header to list the averages
fprintf(STATIC, "sw awn ans aws Jwn Kwn lwns cwns KGws " fprintf(STATIC, "sw awn ans aws Jwn Kwn lwns cwns KGws "
"KGwn Xwn Xws Xns "); // Scalar averages "KGwn Xwn Xws Xns "); // Scalar averages
fprintf(STATIC, fprintf(
STATIC,
"Gwnxx Gwnyy Gwnzz Gwnxy Gwnxz Gwnyz "); // Orientation tensors "Gwnxx Gwnyy Gwnzz Gwnxy Gwnxz Gwnyz "); // Orientation tensors
fprintf(STATIC, "Gwsxx Gwsyy Gwszz Gwsxy Gwsxz Gwsyz "); fprintf(STATIC, "Gwsxx Gwsyy Gwszz Gwsxy Gwsxz Gwsyz ");
fprintf(STATIC, "Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz "); fprintf(STATIC, "Gnsxx Gnsyy Gnszz Gnsxy Gnsxz Gnsyz ");
fprintf(STATIC, "trawn trJwn trRwn "); //trimmed curvature, fprintf(STATIC, "trawn trJwn trRwn "); //trimmed curvature,
fprintf(STATIC, "Vw Aw Jw Xw "); //miknowski measures, fprintf(STATIC, "Vw Aw Jw Xw "); //miknowski measures,
fprintf(STATIC, "Vn An Jn Xn\n"); //miknowski measures, fprintf(STATIC, "Vn An Jn Xn\n"); //miknowski measures,
//fprintf(STATIC,"Euler Kn2 Jn2 An2\n"); //miknowski measures, //fprintf(STATIC,"Euler Kn2 Jn2 An2\n"); //miknowski measures,
} }
fprintf(STATIC, "%.5g ", sat_w); // saturation fprintf(STATIC, "%.5g ", sat_w); // saturation
fprintf(STATIC, "%.5g %.5g %.5g ", awn_global, ans_global, fprintf(STATIC, "%.5g %.5g %.5g ", awn_global, ans_global,
aws_global); // interfacial areas aws_global); // interfacial areas
fprintf(STATIC, "%.5g %.5g ", Jwn_global, fprintf(STATIC, "%.5g %.5g ", Jwn_global,
Kwn_global); // curvature of wn interface Kwn_global); // curvature of wn interface
fprintf(STATIC, "%.5g ", lwns_global); // common curve length fprintf(STATIC, "%.5g ", lwns_global); // common curve length
fprintf(STATIC, "%.5g ", efawns_global); // average contact angle fprintf(STATIC, "%.5g ", efawns_global); // average contact angle
fprintf(STATIC, "%.5g %.5g ", KNwns_global, fprintf(STATIC, "%.5g %.5g ", KNwns_global,
@ -1576,7 +1592,7 @@ void TwoPhase::PrintStatic() {
trRwn_global); // Trimmed curvature trRwn_global); // Trimmed curvature
fprintf(STATIC, "%.5g %.5g %.5g %.5g ", wet_morph->V(), wet_morph->A(), fprintf(STATIC, "%.5g %.5g %.5g %.5g ", wet_morph->V(), wet_morph->A(),
wet_morph->H(), wet_morph->X()); wet_morph->H(), wet_morph->X());
fprintf(STATIC, "%.5g %.5g %.5g %.5g\n", nonwet_morph->V(), fprintf(STATIC, "%.5g %.5g %.5g %.5g\n", nonwet_morph->V(),
nonwet_morph->A(), nonwet_morph->H(), nonwet_morph->X()); nonwet_morph->A(), nonwet_morph->H(), nonwet_morph->X());
//fprintf(STATIC,"%.5g %.5g %.5g %.5g\n",euler_global, Kn_global, Jn_global, An_global); // minkowski measures //fprintf(STATIC,"%.5g %.5g %.5g %.5g\n",euler_global, Kn_global, Jn_global, An_global); // minkowski measures
fclose(STATIC); fclose(STATIC);

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Header file for two-phase averaging class // Header file for two-phase averaging class
#ifndef TwoPhase_INC #ifndef TwoPhase_INC
#define TwoPhase_INC #define TwoPhase_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/analysis.h" #include "analysis/analysis.h"
#include "ProfilerApp.h" #include "ProfilerApp.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Analysis_H_INC #ifndef Analysis_H_INC
#define Analysis_H_INC #define Analysis_H_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/dcel.h" #include "analysis/dcel.h"
DCEL::DCEL() {} DCEL::DCEL() {}

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DCEL_INC #ifndef DCEL_INC
#define DCEL_INC #define DCEL_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/distance.h" #include "analysis/distance.h"
/****************************************************************** /******************************************************************

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Distance_H_INC #ifndef Distance_H_INC
#define Distance_H_INC #define Distance_H_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/filters.h" #include "analysis/filters.h"
#include "math.h" #include "math.h"
#include "ProfilerApp.h" #include "ProfilerApp.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Filters_H_INC #ifndef Filters_H_INC
#define Filters_H_INC #define Filters_H_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
* Generate a histogram for volumetric, interfacial and common curve properties * Generate a histogram for volumetric, interfacial and common curve properties
* copyright 2014, James E. McClure * copyright 2014, James E. McClure

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// These functions mimic the behavior of imfilter in MATLAB // These functions mimic the behavior of imfilter in MATLAB
#ifndef included_imfilter #ifndef included_imfilter
#define included_imfilter #define included_imfilter

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/imfilter.h" #include "analysis/imfilter.h"
#include "ProfilerApp.h" #include "ProfilerApp.h"
#include <math.h> #include <math.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <analysis/morphology.h> #include <analysis/morphology.h>
// Implementation of morphological opening routine // Implementation of morphological opening routine
@ -137,7 +153,8 @@ void Morphology::Initialize(std::shared_ptr<Domain> Dm, DoubleArray &Distance) {
morphRadius.resize(recvLoc); morphRadius.resize(recvLoc);
//.............................. //..............................
/* send the morphological radius */ /* send the morphological radius */
Dm->Comm.Irecv(&morphRadius[recvOffset_x], recvCount, Dm->rank_x(), recvtag + 0); Dm->Comm.Irecv(&morphRadius[recvOffset_x], recvCount, Dm->rank_x(),
recvtag + 0);
Dm->Comm.send(&tmpDistance[0], sendCount, Dm->rank_X(), sendtag + 0); Dm->Comm.send(&tmpDistance[0], sendCount, Dm->rank_X(), sendtag + 0);
/* send the shift values */ /* send the shift values */
Dm->Comm.Irecv(&xShift[recvOffset_x], recvCount, Dm->rank_x(), recvtag + 1); Dm->Comm.Irecv(&xShift[recvOffset_x], recvCount, Dm->rank_x(), recvtag + 1);
@ -501,7 +518,7 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
if (rank == 0) if (rank == 0)
printf("Maximum pore size: %f \n", maxdistGlobal); printf("Maximum pore size: %f \n", maxdistGlobal);
final_void_fraction = volume_fraction; //initialize final_void_fraction = volume_fraction; //initialize
int ii, jj, kk; int ii, jj, kk;
int imin, jmin, kmin, imax, jmax, kmax; int imin, jmin, kmin, imax, jmax, kmax;
int Nx = nx; int Nx = nx;
@ -523,28 +540,30 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
int numTry = 0; int numTry = 0;
int maxTry = 100; int maxTry = 100;
while ( !(void_fraction_new < VoidFraction) && numTry < maxTry) { while (!(void_fraction_new < VoidFraction) && numTry < maxTry) {
numTry++; numTry++;
void_fraction_diff_old = void_fraction_diff_new; void_fraction_diff_old = void_fraction_diff_new;
void_fraction_old = void_fraction_new; void_fraction_old = void_fraction_new;
Rcrit_old = Rcrit_new; Rcrit_old = Rcrit_new;
Rcrit_new -= deltaR * Rcrit_old; Rcrit_new -= deltaR * Rcrit_old;
if (rank==0) printf("Try %i with radius %f \n", numTry, Rcrit_new); if (rank == 0)
printf("Try %i with radius %f \n", numTry, Rcrit_new);
if (Rcrit_new < 0.5) { if (Rcrit_new < 0.5) {
numTry = maxTry; numTry = maxTry;
} }
int Window = round(Rcrit_new); int Window = round(Rcrit_new);
if (Window == 0) if (Window == 0)
Window = 1; // If Window = 0 at the begining, after the following process will have sw=1.0 Window =
1; // If Window = 0 at the begining, after the following process will have sw=1.0
// and sw<Sw will be immediately broken // and sw<Sw will be immediately broken
double LocalNumber = 0.f; double LocalNumber = 0.f;
for (int k = 1; k < Nz-1; k++) { for (int k = 1; k < Nz - 1; k++) {
for (int j = 1; j < Ny-1; j++) { for (int j = 1; j < Ny - 1; j++) {
for (int i = 1; i < Nx-1; i++) { for (int i = 1; i < Nx - 1; i++) {
n = k * nx * ny + j * nx + i; n = k * nx * ny + j * nx + i;
if (SignDist(i, j, k) > Rcrit_new) { if (SignDist(i, j, k) > Rcrit_new) {
// loop over the window and update // loop over the window and update
//printf("Distance(%i %i %i) = %f \n",i,j,k, SignDist(i,j,k)); //printf("Distance(%i %i %i) = %f \n",i,j,k, SignDist(i,j,k));
imin = max(1, i - Window); imin = max(1, i - Window);
jmin = max(1, j - Window); jmin = max(1, j - Window);
kmin = max(1, k - Window); kmin = max(1, k - Window);
@ -611,7 +630,8 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
//*************************************************************************************** //***************************************************************************************
double MorphDrain(DoubleArray &SignDist, signed char *id, double MorphDrain(DoubleArray &SignDist, signed char *id,
std::shared_ptr<Domain> Dm, double VoidFraction, double InitialRadius) { std::shared_ptr<Domain> Dm, double VoidFraction,
double InitialRadius) {
// SignDist is the distance to the object that you want to constaing the morphological opening // SignDist is the distance to the object that you want to constaing the morphological opening
// VoidFraction is the the empty space where the object inst // VoidFraction is the the empty space where the object inst
// id is a labeled map // id is a labeled map
@ -688,10 +708,10 @@ double MorphDrain(DoubleArray &SignDist, signed char *id,
double deltaR = 0.05; // amount to change the radius in voxel units double deltaR = 0.05; // amount to change the radius in voxel units
double Rcrit_old = maxdistGlobal; double Rcrit_old = maxdistGlobal;
double Rcrit_new = maxdistGlobal; double Rcrit_new = maxdistGlobal;
if (InitialRadius < maxdistGlobal){ if (InitialRadius < maxdistGlobal) {
Rcrit_old = InitialRadius; Rcrit_old = InitialRadius;
Rcrit_new = InitialRadius; Rcrit_new = InitialRadius;
} }
//if (argc>2){ //if (argc>2){
// Rcrit_new = strtod(argv[2],NULL); // Rcrit_new = strtod(argv[2],NULL);

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Morphological opening routine // Morphological opening routine
#include "common/Array.h" #include "common/Array.h"
#include "common/Domain.h" #include "common/Domain.h"
@ -7,7 +23,8 @@ double MorphOpen(DoubleArray &SignDist, signed char *id,
std::shared_ptr<Domain> Dm, double VoidFraction, std::shared_ptr<Domain> Dm, double VoidFraction,
signed char ErodeLabel, signed char ReplaceLabel); signed char ErodeLabel, signed char ReplaceLabel);
double MorphDrain(DoubleArray &SignDist, signed char *id, double MorphDrain(DoubleArray &SignDist, signed char *id,
std::shared_ptr<Domain> Dm, double VoidFraction, double InitialRadius); std::shared_ptr<Domain> Dm, double VoidFraction,
double InitialRadius);
double MorphGrow(DoubleArray &BoundaryDist, DoubleArray &Dist, Array<char> &id, double MorphGrow(DoubleArray &BoundaryDist, DoubleArray &Dist, Array<char> &id,
std::shared_ptr<Domain> Dm, double TargetVol, std::shared_ptr<Domain> Dm, double TargetVol,
double WallFactor); double WallFactor);

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef pmmc_INC #ifndef pmmc_INC
#define pmmc_INC #define pmmc_INC
@ -4041,7 +4057,7 @@ inline double pmmc_CubeContactAngle(DoubleArray &CubeValues,
(A.z - B.z) * (A.z - B.z)); (A.z - B.z) * (A.z - B.z));
integral += 0.5 * length * (vA + vB); integral += 0.5 * length * (vA + vB);
} }
return integral; return integral;
} }
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
@ -4422,12 +4438,12 @@ inline void pmmc_CurveCurvature(DoubleArray &f, DoubleArray &s,
fx = f_x(i, j, k); fx = f_x(i, j, k);
fy = f_y(i, j, k); fy = f_y(i, j, k);
fz = f_z(i, j, k); fz = f_z(i, j, k);
// Normal to fluid surface // Normal to fluid surface
Nx.Corners(i - ic, j - jc, k - kc) = fx; Nx.Corners(i - ic, j - jc, k - kc) = fx;
Ny.Corners(i - ic, j - jc, k - kc) = fy; Ny.Corners(i - ic, j - jc, k - kc) = fy;
Nz.Corners(i - ic, j - jc, k - kc) = fz; Nz.Corners(i - ic, j - jc, k - kc) = fz;
// Normal to solid surface // Normal to solid surface
Sx.Corners(i - ic, j - jc, k - kc) = sx; Sx.Corners(i - ic, j - jc, k - kc) = sx;
Sy.Corners(i - ic, j - jc, k - kc) = sy; Sy.Corners(i - ic, j - jc, k - kc) = sy;
@ -4534,7 +4550,7 @@ inline void pmmc_CurveCurvature(DoubleArray &f, DoubleArray &s,
nsx /= norm; nsx /= norm;
nsy /= norm; nsy /= norm;
nsz /= norm; nsz /= norm;
// Normal vector to the fluid surface // Normal vector to the fluid surface
nwx = Nx.eval(P); nwx = Nx.eval(P);
nwy = Ny.eval(P); nwy = Ny.eval(P);
@ -4562,7 +4578,7 @@ inline void pmmc_CurveCurvature(DoubleArray &f, DoubleArray &s,
nwsy = -nwsy; nwsy = -nwsy;
nwsz = -nwsz; nwsz = -nwsz;
} }
// common curve normal in the fluid surface tangent plane (rel. geodesic curvature) // common curve normal in the fluid surface tangent plane (rel. geodesic curvature)
nwnx = twnsy * nwz - twnsz * nwy; nwnx = twnsy * nwz - twnsz * nwy;
nwny = twnsz * nwx - twnsx * nwz; nwny = twnsz * nwx - twnsx * nwz;
@ -4580,7 +4596,6 @@ inline void pmmc_CurveCurvature(DoubleArray &f, DoubleArray &s,
nwnz = -nwnz; nwnz = -nwnz;
} }
if (length > 0.0) { if (length > 0.0) {
// normal curvature component in the direction of the solid surface // normal curvature component in the direction of the solid surface
//KNavg += K * (nsx * nwnsx + nsy * nwnsy + nsz * nwnsz) * length; //KNavg += K * (nsx * nwnsx + nsy * nwnsy + nsz * nwnsz) * length;

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Run the analysis, blob identification, and write restart files // Run the analysis, blob identification, and write restart files
#include "analysis/runAnalysis.h" #include "analysis/runAnalysis.h"
#include "analysis/analysis.h" #include "analysis/analysis.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RunAnalysis_H_INC #ifndef RunAnalysis_H_INC
#define RunAnalysis_H_INC #define RunAnalysis_H_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "analysis/uCT.h" #include "analysis/uCT.h"
#include "analysis/analysis.h" #include "analysis/analysis.h"
#include "analysis/distance.h" #include "analysis/distance.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef uCT_H_INC #ifndef uCT_H_INC
#define uCT_H_INC #define uCT_H_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// clang-format off // clang-format off
#include "common/Array.h" #include "common/Array.h"
#include "common/Array.hpp" #include "common/Array.hpp"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_ArrayClass #ifndef included_ArrayClass
#define included_ArrayClass #define included_ArrayClass

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_ArrayClass_hpp #ifndef included_ArrayClass_hpp
#define included_ArrayClass_hpp #define included_ArrayClass_hpp

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_ArraySizeClass #ifndef included_ArraySizeClass
#define included_ArraySizeClass #define included_ArraySizeClass

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/Communication.h" #include "common/Communication.h"
/******************************************************** /********************************************************

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMUNICATION_H_INC #ifndef COMMUNICATION_H_INC
#define COMMUNICATION_H_INC #define COMMUNICATION_H_INC
@ -192,68 +208,72 @@ inline void CommunicateSendRecvCounts(
} }
//*************************************************************************************** //***************************************************************************************
inline void CommunicateRecvLists( const Utilities::MPI& comm, int sendtag, int recvtag, inline void CommunicateRecvLists(
int *sendList_x, int *sendList_y, int *sendList_z, int *sendList_X, int *sendList_Y, int *sendList_Z, const Utilities::MPI &comm, int sendtag, int recvtag, int *sendList_x,
int *sendList_xy, int *sendList_XY, int *sendList_xY, int *sendList_Xy, int *sendList_y, int *sendList_z, int *sendList_X, int *sendList_Y,
int *sendList_xz, int *sendList_XZ, int *sendList_xZ, int *sendList_Xz, int *sendList_Z, int *sendList_xy, int *sendList_XY, int *sendList_xY,
int *sendList_yz, int *sendList_YZ, int *sendList_yZ, int *sendList_Yz, int *sendList_Xy, int *sendList_xz, int *sendList_XZ, int *sendList_xZ,
int sendCount_x, int sendCount_y, int sendCount_z, int sendCount_X, int sendCount_Y, int sendCount_Z, int *sendList_Xz, int *sendList_yz, int *sendList_YZ, int *sendList_yZ,
int sendCount_xy, int sendCount_XY, int sendCount_xY, int sendCount_Xy, int *sendList_Yz, int sendCount_x, int sendCount_y, int sendCount_z,
int sendCount_xz, int sendCount_XZ, int sendCount_xZ, int sendCount_Xz, int sendCount_X, int sendCount_Y, int sendCount_Z, int sendCount_xy,
int sendCount_yz, int sendCount_YZ, int sendCount_yZ, int sendCount_Yz, int sendCount_XY, int sendCount_xY, int sendCount_Xy, int sendCount_xz,
int *recvList_x, int *recvList_y, int *recvList_z, int *recvList_X, int *recvList_Y, int *recvList_Z, int sendCount_XZ, int sendCount_xZ, int sendCount_Xz, int sendCount_yz,
int *recvList_xy, int *recvList_XY, int *recvList_xY, int *recvList_Xy, int sendCount_YZ, int sendCount_yZ, int sendCount_Yz, int *recvList_x,
int *recvList_xz, int *recvList_XZ, int *recvList_xZ, int *recvList_Xz, int *recvList_y, int *recvList_z, int *recvList_X, int *recvList_Y,
int *recvList_yz, int *recvList_YZ, int *recvList_yZ, int *recvList_Yz, int *recvList_Z, int *recvList_xy, int *recvList_XY, int *recvList_xY,
int recvCount_x, int recvCount_y, int recvCount_z, int recvCount_X, int recvCount_Y, int recvCount_Z, int *recvList_Xy, int *recvList_xz, int *recvList_XZ, int *recvList_xZ,
int recvCount_xy, int recvCount_XY, int recvCount_xY, int recvCount_Xy, int *recvList_Xz, int *recvList_yz, int *recvList_YZ, int *recvList_yZ,
int recvCount_xz, int recvCount_XZ, int recvCount_xZ, int recvCount_Xz, int *recvList_Yz, int recvCount_x, int recvCount_y, int recvCount_z,
int recvCount_yz, int recvCount_YZ, int recvCount_yZ, int recvCount_Yz, int recvCount_X, int recvCount_Y, int recvCount_Z, int recvCount_xy,
int rank_x, int rank_y, int rank_z, int rank_X, int rank_Y, int rank_Z, int rank_xy, int rank_XY, int rank_xY, int recvCount_XY, int recvCount_xY, int recvCount_Xy, int recvCount_xz,
int rank_Xy, int rank_xz, int rank_XZ, int rank_xZ, int rank_Xz, int rank_yz, int rank_YZ, int rank_yZ, int rank_Yz) int recvCount_XZ, int recvCount_xZ, int recvCount_Xz, int recvCount_yz,
{ int recvCount_YZ, int recvCount_yZ, int recvCount_Yz, int rank_x,
MPI_Request req1[18], req2[18]; int rank_y, int rank_z, int rank_X, int rank_Y, int rank_Z, int rank_xy,
req1[0] = comm.Isend(sendList_x,sendCount_x,rank_x,sendtag+0); int rank_XY, int rank_xY, int rank_Xy, int rank_xz, int rank_XZ,
req2[0] = comm.Irecv(recvList_X,recvCount_X,rank_X,recvtag+0); int rank_xZ, int rank_Xz, int rank_yz, int rank_YZ, int rank_yZ,
req1[1] = comm.Isend(sendList_X,sendCount_X,rank_X,sendtag+1); int rank_Yz) {
req2[1] = comm.Irecv(recvList_x,recvCount_x,rank_x,recvtag+1); MPI_Request req1[18], req2[18];
req1[2] = comm.Isend(sendList_y,sendCount_y,rank_y,sendtag+2); req1[0] = comm.Isend(sendList_x, sendCount_x, rank_x, sendtag + 0);
req2[2] = comm.Irecv(recvList_Y,recvCount_Y,rank_Y,recvtag+2); req2[0] = comm.Irecv(recvList_X, recvCount_X, rank_X, recvtag + 0);
req1[3] = comm.Isend(sendList_Y,sendCount_Y,rank_Y,sendtag+3); req1[1] = comm.Isend(sendList_X, sendCount_X, rank_X, sendtag + 1);
req2[3] = comm.Irecv(recvList_y,recvCount_y,rank_y,recvtag+3); req2[1] = comm.Irecv(recvList_x, recvCount_x, rank_x, recvtag + 1);
req1[4] = comm.Isend(sendList_z,sendCount_z,rank_z,sendtag+4); req1[2] = comm.Isend(sendList_y, sendCount_y, rank_y, sendtag + 2);
req2[4] = comm.Irecv(recvList_Z,recvCount_Z,rank_Z,recvtag+4); req2[2] = comm.Irecv(recvList_Y, recvCount_Y, rank_Y, recvtag + 2);
req1[5] = comm.Isend(sendList_Z,sendCount_Z,rank_Z,sendtag+5); req1[3] = comm.Isend(sendList_Y, sendCount_Y, rank_Y, sendtag + 3);
req2[5] = comm.Irecv(recvList_z,recvCount_z,rank_z,recvtag+5); req2[3] = comm.Irecv(recvList_y, recvCount_y, rank_y, recvtag + 3);
req1[4] = comm.Isend(sendList_z, sendCount_z, rank_z, sendtag + 4);
req2[4] = comm.Irecv(recvList_Z, recvCount_Z, rank_Z, recvtag + 4);
req1[5] = comm.Isend(sendList_Z, sendCount_Z, rank_Z, sendtag + 5);
req2[5] = comm.Irecv(recvList_z, recvCount_z, rank_z, recvtag + 5);
req1[6] = comm.Isend(sendList_xy,sendCount_xy,rank_xy,sendtag+6); req1[6] = comm.Isend(sendList_xy, sendCount_xy, rank_xy, sendtag + 6);
req2[6] = comm.Irecv(recvList_XY,recvCount_XY,rank_XY,recvtag+6); req2[6] = comm.Irecv(recvList_XY, recvCount_XY, rank_XY, recvtag + 6);
req1[7] = comm.Isend(sendList_XY,sendCount_XY,rank_XY,sendtag+7); req1[7] = comm.Isend(sendList_XY, sendCount_XY, rank_XY, sendtag + 7);
req2[7] = comm.Irecv(recvList_xy,recvCount_xy,rank_xy,recvtag+7); req2[7] = comm.Irecv(recvList_xy, recvCount_xy, rank_xy, recvtag + 7);
req1[8] = comm.Isend(sendList_Xy,sendCount_Xy,rank_Xy,sendtag+8); req1[8] = comm.Isend(sendList_Xy, sendCount_Xy, rank_Xy, sendtag + 8);
req2[8] = comm.Irecv(recvList_xY,recvCount_xY,rank_xY,recvtag+8); req2[8] = comm.Irecv(recvList_xY, recvCount_xY, rank_xY, recvtag + 8);
req1[9] = comm.Isend(sendList_xY,sendCount_xY,rank_xY,sendtag+9); req1[9] = comm.Isend(sendList_xY, sendCount_xY, rank_xY, sendtag + 9);
req2[9] = comm.Irecv(recvList_Xy,recvCount_Xy,rank_Xy,recvtag+9); req2[9] = comm.Irecv(recvList_Xy, recvCount_Xy, rank_Xy, recvtag + 9);
req1[10] = comm.Isend(sendList_xz,sendCount_xz,rank_xz,sendtag+10); req1[10] = comm.Isend(sendList_xz, sendCount_xz, rank_xz, sendtag + 10);
req2[10] = comm.Irecv(recvList_XZ,recvCount_XZ,rank_XZ,recvtag+10); req2[10] = comm.Irecv(recvList_XZ, recvCount_XZ, rank_XZ, recvtag + 10);
req1[11] = comm.Isend(sendList_XZ,sendCount_XZ,rank_XZ,sendtag+11); req1[11] = comm.Isend(sendList_XZ, sendCount_XZ, rank_XZ, sendtag + 11);
req2[11] = comm.Irecv(recvList_xz,recvCount_xz,rank_xz,recvtag+11); req2[11] = comm.Irecv(recvList_xz, recvCount_xz, rank_xz, recvtag + 11);
req1[12] = comm.Isend(sendList_Xz,sendCount_Xz,rank_Xz,sendtag+12); req1[12] = comm.Isend(sendList_Xz, sendCount_Xz, rank_Xz, sendtag + 12);
req2[12] = comm.Irecv(recvList_xZ,recvCount_xZ,rank_xZ,recvtag+12); req2[12] = comm.Irecv(recvList_xZ, recvCount_xZ, rank_xZ, recvtag + 12);
req1[13] = comm.Isend(sendList_xZ,sendCount_xZ,rank_xZ,sendtag+13); req1[13] = comm.Isend(sendList_xZ, sendCount_xZ, rank_xZ, sendtag + 13);
req2[13] = comm.Irecv(recvList_Xz,recvCount_Xz,rank_Xz,recvtag+13); req2[13] = comm.Irecv(recvList_Xz, recvCount_Xz, rank_Xz, recvtag + 13);
req1[14] = comm.Isend(sendList_yz,sendCount_yz,rank_yz,sendtag+14); req1[14] = comm.Isend(sendList_yz, sendCount_yz, rank_yz, sendtag + 14);
req2[14] = comm.Irecv(recvList_YZ,recvCount_YZ,rank_YZ,recvtag+14); req2[14] = comm.Irecv(recvList_YZ, recvCount_YZ, rank_YZ, recvtag + 14);
req1[15] = comm.Isend(sendList_YZ,sendCount_YZ,rank_YZ,sendtag+15); req1[15] = comm.Isend(sendList_YZ, sendCount_YZ, rank_YZ, sendtag + 15);
req2[15] = comm.Irecv(recvList_yz,recvCount_yz,rank_yz,recvtag+15); req2[15] = comm.Irecv(recvList_yz, recvCount_yz, rank_yz, recvtag + 15);
req1[16] = comm.Isend(sendList_Yz,sendCount_Yz,rank_Yz,sendtag+16); req1[16] = comm.Isend(sendList_Yz, sendCount_Yz, rank_Yz, sendtag + 16);
req2[16] = comm.Irecv(recvList_yZ,recvCount_yZ,rank_yZ,recvtag+16); req2[16] = comm.Irecv(recvList_yZ, recvCount_yZ, rank_yZ, recvtag + 16);
req1[17] = comm.Isend(sendList_yZ,sendCount_yZ,rank_yZ,sendtag+17); req1[17] = comm.Isend(sendList_yZ, sendCount_yZ, rank_yZ, sendtag + 17);
req2[17] = comm.Irecv(recvList_Yz,recvCount_Yz,rank_Yz,recvtag+17); req2[17] = comm.Irecv(recvList_Yz, recvCount_Yz, rank_Yz, recvtag + 17);
comm.waitAll( 18, req1 ); comm.waitAll(18, req1);
comm.waitAll( 18, req2 ); comm.waitAll(18, req2);
} }
//*************************************************************************************** //***************************************************************************************

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COMMUNICATION_HPP_INC #ifndef COMMUNICATION_HPP_INC
#define COMMUNICATION_HPP_INC #define COMMUNICATION_HPP_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/Database.h" #include "common/Database.h"
#include "common/Utilities.h" #include "common/Utilities.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_Database #ifndef included_Database
#define included_Database #define included_Database

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_Database_hpp #ifndef included_Database_hpp
#define included_Database_hpp #define included_Database_hpp

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Domain_INC #ifndef Domain_INC
#define Domain_INC #define Domain_INC
@ -187,7 +203,7 @@ public: // Public variables (need to create accessors instead)
* \brief Read domain IDs from file * \brief Read domain IDs from file
*/ */
void ReadIDs(); void ReadIDs();
/** /**
* \brief Read domain IDs from SWC file * \brief Read domain IDs from SWC file
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FunctionTable.hpp" #include "FunctionTable.hpp"
/******************************************************** /********************************************************
@ -92,12 +108,11 @@ template<> long double genRand<long double>()
/******************************************************** /********************************************************
* axpy * * axpy *
********************************************************/ ********************************************************/
template <> template <> void call_axpy<float>(size_t, const float, const float *, float *) {
void call_axpy<float>(size_t, const float, const float*, float*) {
ERROR("Not finished"); ERROR("Not finished");
} }
template <> template <>
void call_axpy<double>(size_t, const double, const double*, double*) { void call_axpy<double>(size_t, const double, const double *, double *) {
ERROR("Not finished"); ERROR("Not finished");
} }
@ -105,22 +120,22 @@ void call_axpy<double>(size_t, const double, const double*, double*) {
* Multiply two arrays * * Multiply two arrays *
********************************************************/ ********************************************************/
template <> template <>
void call_gemv<double>(size_t, size_t, double, double, void call_gemv<double>(size_t, size_t, double, double, const double *,
const double*, const double*, double*) { const double *, double *) {
ERROR("Not finished"); ERROR("Not finished");
} }
template <> template <>
void call_gemv<float>(size_t, size_t, float, float, void call_gemv<float>(size_t, size_t, float, float, const float *,
const float*, const float*, float*) { const float *, float *) {
ERROR("Not finished"); ERROR("Not finished");
} }
template <> template <>
void call_gemm<double>(size_t, size_t, size_t, double, double, void call_gemm<double>(size_t, size_t, size_t, double, double, const double *,
const double*, const double*, double*) { const double *, double *) {
ERROR("Not finished"); ERROR("Not finished");
} }
template <> template <>
void call_gemm<float>(size_t, size_t, size_t, float, float, void call_gemm<float>(size_t, size_t, size_t, float, float, const float *,
const float*, const float*, float*) { const float *, float *) {
ERROR("Not finished"); ERROR("Not finished");
} }

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_FunctionTable #ifndef included_FunctionTable
#define included_FunctionTable #define included_FunctionTable

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_FunctionTable_hpp #ifndef included_FunctionTable_hpp
#define included_FunctionTable_hpp #define included_FunctionTable_hpp
@ -265,10 +281,9 @@ TYPE FunctionTable::sum(const Array<TYPE, FUN, ALLOC> &A) {
} }
template <class TYPE> template <class TYPE>
inline void FunctionTable::gemmWrapper(char, char, int, int, inline void FunctionTable::gemmWrapper(char, char, int, int, int, TYPE,
int, TYPE, const TYPE*, const TYPE *, int, const TYPE *, int,
int, const TYPE*, int, TYPE, TYPE *, int) {
TYPE, TYPE*, int) {
ERROR("Not finished"); ERROR("Not finished");
} }

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// This file impliments a wrapper class for MPI functions // This file impliments a wrapper class for MPI functions
#include "common/MPI.h" #include "common/MPI.h"
@ -3691,28 +3707,29 @@ MPI MPI::loadBalance(double local, std::vector<double> work) {
return split(0, key[getRank()]); return split(0, key[getRank()]);
} }
/**************************************************************************** /****************************************************************************
* Function Persistent Communication * * Function Persistent Communication *
****************************************************************************/ ****************************************************************************/
template <> template <>
std::shared_ptr<MPI_Request> MPI::Isend_init<double>(const double *buf, int N, int proc, int tag) const std::shared_ptr<MPI_Request> MPI::Isend_init<double>(const double *buf, int N,
{ int proc, int tag) const {
std::shared_ptr<MPI_Request> obj( new MPI_Request, []( MPI_Request *req ) { MPI_Request_free( req ); delete req; } ); std::shared_ptr<MPI_Request> obj(new MPI_Request, [](MPI_Request *req) {
MPI_Send_init( buf, N, MPI_DOUBLE, proc, tag, communicator, obj.get() ); MPI_Request_free(req);
delete req;
});
MPI_Send_init(buf, N, MPI_DOUBLE, proc, tag, communicator, obj.get());
return obj; return obj;
} }
template<> template <>
std::shared_ptr<MPI_Request> MPI::Irecv_init<double>(double *buf, int N, int proc, int tag) const std::shared_ptr<MPI_Request> MPI::Irecv_init<double>(double *buf, int N,
{ int proc, int tag) const {
std::shared_ptr<MPI_Request> obj( new MPI_Request, []( MPI_Request *req ) { MPI_Request_free( req ); delete req; } ); std::shared_ptr<MPI_Request> obj(new MPI_Request, [](MPI_Request *req) {
MPI_Recv_init( buf, N, MPI_DOUBLE, proc, tag, communicator, obj.get() ); MPI_Request_free(req);
delete req;
});
MPI_Recv_init(buf, N, MPI_DOUBLE, proc, tag, communicator, obj.get());
return obj; return obj;
} }
void MPI::Start( MPI_Request &request ) void MPI::Start(MPI_Request &request) { MPI_Start(&request); }
{
MPI_Start( &request );
}
} // namespace Utilities } // namespace Utilities

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// This file includes a wrapper class for MPI functions // This file includes a wrapper class for MPI functions
// Note this is a modified version of the MPI class for the Advanced Multi-Physics Package // Note this is a modified version of the MPI class for the Advanced Multi-Physics Package
// Used with permission // Used with permission
@ -728,8 +744,8 @@ public: // Member functions
* need to manually free the request * need to manually free the request
*/ */
template <class type> template <class type>
std::shared_ptr<MPI_Request> Isend_init(const type *buf, int length, int recv_proc, std::shared_ptr<MPI_Request> Isend_init(const type *buf, int length,
int tag) const; int recv_proc, int tag) const;
/*! /*!
* @brief This function sets up an Irecv call (see MPI_Recv_init) * @brief This function sets up an Irecv call (see MPI_Recv_init)
@ -742,13 +758,14 @@ public: // Member functions
* need to manually free the request * need to manually free the request
*/ */
template <class type> template <class type>
std::shared_ptr<MPI_Request> Irecv_init(type *buf, int length, int send_proc, int tag) const; std::shared_ptr<MPI_Request> Irecv_init(type *buf, int length,
int send_proc, int tag) const;
/*! /*!
* @brief Start the MPI communication * @brief Start the MPI communication
* @param request Request to start * @param request Request to start
*/ */
void Start( MPI_Request &request ); void Start(MPI_Request &request);
/*! /*!
* Each processor sends every other processor a single value. * Each processor sends every other processor a single value.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* Flow adaptor class for multiphase flow methods */ /* Flow adaptor class for multiphase flow methods */
#ifndef ScaLBL_Membrane_INC #ifndef ScaLBL_Membrane_INC
@ -21,9 +37,9 @@
* @param dist - memory buffer to hold the distributions * @param dist - memory buffer to hold the distributions
* @param N - size of the distributions (derived from Domain structure) * @param N - size of the distributions (derived from Domain structure)
*/ */
extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q, extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q, int *d3q7_recvlist,
int *d3q7_recvlist, double *recvbuf, int count, double *recvbuf, int count,
double *dist, int N, double *coef); double *dist, int N, double *coef);
/** /**
* \brief Set custom link rules for D3Q19 distribution based on membrane location * \brief Set custom link rules for D3Q19 distribution based on membrane location
@ -38,8 +54,10 @@ extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q,
* @param dist - memory buffer to hold the distributions * @param dist - memory buffer to hold the distributions
* @param N - size of the distributions (derived from Domain structure) * @param N - size of the distributions (derived from Domain structure)
*/ */
extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links, double *coef, int start, int offset, extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links,
int linkCount, double *recvbuf, double *dist, int N); double *coef, int start, int offset,
int linkCount, double *recvbuf,
double *dist, int N);
/** /**
* \class Membrane * \class Membrane
@ -51,34 +69,35 @@ extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links, double *c
class Membrane { class Membrane {
public: public:
int Np; int Np;
int Nx,Ny,Nz,N; int Nx, Ny, Nz, N;
int membraneLinkCount; int membraneLinkCount;
int BoundaryCondition; int BoundaryCondition;
int *initialNeighborList; // original neighborlist int *initialNeighborList; // original neighborlist
int *NeighborList; // modified neighborlist int *NeighborList; // modified neighborlist
/* host data structures */ /* host data structures */
int *membraneLinks; // D3Q7 links that cross membrane int *membraneLinks; // D3Q7 links that cross membrane
int *membraneTag; // label each link in the membrane int *membraneTag; // label each link in the membrane
double *membraneDist; // distance to membrane for each linked site double *membraneDist; // distance to membrane for each linked site
double *membraneOrientation; // distance to membrane for each linked site double *membraneOrientation; // distance to membrane for each linked site
/* /*
* Device data structures * Device data structures
*/ */
int *MembraneLinks; int *MembraneLinks;
double *MembraneCoef; // mass transport coefficient for the membrane double *MembraneCoef; // mass transport coefficient for the membrane
double *MembraneDistance; double *MembraneDistance;
double *MembraneOrientation; double *MembraneOrientation;
/** /**
* \brief Create a flow adaptor to operate on the LB model * \brief Create a flow adaptor to operate on the LB model
* @param ScaLBL - originating data structures * @param ScaLBL - originating data structures
* @param neighborList - list of neighbors for each site * @param neighborList - list of neighbors for each site
*/ */
//Membrane(std::shared_ptr <Domain> Dm, int *initialNeighborList, int Nsites); //Membrane(std::shared_ptr <Domain> Dm, int *initialNeighborList, int Nsites);
Membrane(std::shared_ptr <ScaLBL_Communicator> sComm, int *dvcNeighborList, int Nsites); Membrane(std::shared_ptr<ScaLBL_Communicator> sComm, int *dvcNeighborList,
int Nsites);
/** /**
* \brief Destructor * \brief Destructor
@ -93,40 +112,44 @@ public:
* @param Map - mapping between regular layout and compact layout * @param Map - mapping between regular layout and compact layout
*/ */
int Create(DoubleArray &Distance, IntArray &Map); int Create(DoubleArray &Distance, IntArray &Map);
/** /**
* \brief Write membrane data to output file * \brief Write membrane data to output file
* @param filename - name of file to save * @param filename - name of file to save
*/ */
void Write(string filename); void Write(string filename);
/** /**
* \brief Read membrane data from input file * \brief Read membrane data from input file
* @param filename - name of file to save * @param filename - name of file to save
*/ */
void Read(string filename); void Read(string filename);
void SendD3Q7AA(double *dist); void SendD3Q7AA(double *dist);
void RecvD3Q7AA(double *dist, bool BounceBack); void RecvD3Q7AA(double *dist, bool BounceBack);
void AssignCoefficients(int *Map, double *Psi, double Threshold, void AssignCoefficients(int *Map, double *Psi, double Threshold,
double MassFractionIn, double MassFractionOut, double ThresholdMassFractionIn, double MassFractionIn, double MassFractionOut,
double ThresholdMassFractionOut); double ThresholdMassFractionIn,
void IonTransport(double *dist, double *den); double ThresholdMassFractionOut);
//...................................................................................... void IonTransport(double *dist, double *den);
// Buffers to store data sent and recieved by this MPI process //......................................................................................
double *sendbuf_x, *sendbuf_y, *sendbuf_z, *sendbuf_X, *sendbuf_Y, *sendbuf_Z; // Buffers to store data sent and recieved by this MPI process
double *recvbuf_x, *recvbuf_y, *recvbuf_z, *recvbuf_X, *recvbuf_Y, *recvbuf_Z; double *sendbuf_x, *sendbuf_y, *sendbuf_z, *sendbuf_X, *sendbuf_Y,
//...................................................................................... *sendbuf_Z;
double *recvbuf_x, *recvbuf_y, *recvbuf_z, *recvbuf_X, *recvbuf_Y,
*recvbuf_Z;
//......................................................................................
private: private:
bool Lock; // use Lock to make sure only one call at a time to protect data in transit bool
int sendtag, recvtag; Lock; // use Lock to make sure only one call at a time to protect data in transit
int iproc,jproc,kproc; int sendtag, recvtag;
int nprocx,nprocy,nprocz; int iproc, jproc, kproc;
// Give the object it's own MPI communicator int nprocx, nprocy, nprocz;
RankInfoStruct rank_info; // Give the object it's own MPI communicator
Utilities::MPI MPI_COMM_SCALBL; // MPI Communicator for this domain RankInfoStruct rank_info;
MPI_Request req1[18],req2[18]; Utilities::MPI MPI_COMM_SCALBL; // MPI Communicator for this domain
MPI_Request req1[18], req2[18];
/** /**
* \brief Set up membrane communication * \brief Set up membrane communication
* \details associate p2p communication links to membrane where necessary * \details associate p2p communication links to membrane where necessary
@ -143,49 +166,59 @@ private:
* @param dvcMap - data structure used to define mapping between dense and sparse representation * @param dvcMap - data structure used to define mapping between dense and sparse representation
* @param Np - number of sites in dense representation * @param Np - number of sites in dense representation
* */ * */
int D3Q7_MapRecv(int Cqx, int Cqy, int Cqz, int *d3q19_recvlist, int D3Q7_MapRecv(int Cqx, int Cqy, int Cqz, int *d3q19_recvlist, int count,
int count, int *membraneRecvLabels, DoubleArray &Distance, int *dvcMap); int *membraneRecvLabels, DoubleArray &Distance,
//...................................................................................... int *dvcMap);
// MPI ranks for all 18 neighbors //......................................................................................
//...................................................................................... // MPI ranks for all 18 neighbors
// These variables are all private to prevent external things from modifying them!! //......................................................................................
//...................................................................................... // These variables are all private to prevent external things from modifying them!!
int rank; //......................................................................................
int rank_x,rank_y,rank_z,rank_X,rank_Y,rank_Z; int rank;
int rank_xy,rank_XY,rank_xY,rank_Xy; int rank_x, rank_y, rank_z, rank_X, rank_Y, rank_Z;
int rank_xz,rank_XZ,rank_xZ,rank_Xz; int rank_xy, rank_XY, rank_xY, rank_Xy;
int rank_yz,rank_YZ,rank_yZ,rank_Yz; int rank_xz, rank_XZ, rank_xZ, rank_Xz;
//...................................................................................... int rank_yz, rank_YZ, rank_yZ, rank_Yz;
int SendCount, RecvCount, CommunicationCount; //......................................................................................
//...................................................................................... int SendCount, RecvCount, CommunicationCount;
int sendCount_x, sendCount_y, sendCount_z, sendCount_X, sendCount_Y, sendCount_Z; //......................................................................................
//...................................................................................... int sendCount_x, sendCount_y, sendCount_z, sendCount_X, sendCount_Y,
int recvCount_x, recvCount_y, recvCount_z, recvCount_X, recvCount_Y, recvCount_Z; sendCount_Z;
//...................................................................................... //......................................................................................
int linkCount_x[5], linkCount_y[5], linkCount_z[5], linkCount_X[5], linkCount_Y[5], linkCount_Z[5]; int recvCount_x, recvCount_y, recvCount_z, recvCount_X, recvCount_Y,
int linkCount_xy, linkCount_yz, linkCount_xz, linkCount_Xy, linkCount_Yz, linkCount_xZ; recvCount_Z;
int linkCount_xY, linkCount_yZ, linkCount_Xz, linkCount_XY, linkCount_YZ, linkCount_XZ; //......................................................................................
//...................................................................................... int linkCount_x[5], linkCount_y[5], linkCount_z[5], linkCount_X[5],
// Send buffers that reside on the compute device linkCount_Y[5], linkCount_Z[5];
int *dvcSendList_x, *dvcSendList_y, *dvcSendList_z, *dvcSendList_X, *dvcSendList_Y, *dvcSendList_Z; int linkCount_xy, linkCount_yz, linkCount_xz, linkCount_Xy, linkCount_Yz,
//int *dvcSendList_xy, *dvcSendList_yz, *dvcSendList_xz, *dvcSendList_Xy, *dvcSendList_Yz, *dvcSendList_xZ; linkCount_xZ;
//int *dvcSendList_xY, *dvcSendList_yZ, *dvcSendList_Xz, *dvcSendList_XY, *dvcSendList_YZ, *dvcSendList_XZ; int linkCount_xY, linkCount_yZ, linkCount_Xz, linkCount_XY, linkCount_YZ,
// Recieve buffers that reside on the compute device linkCount_XZ;
int *dvcRecvList_x, *dvcRecvList_y, *dvcRecvList_z, *dvcRecvList_X, *dvcRecvList_Y, *dvcRecvList_Z; //......................................................................................
//int *dvcRecvList_xy, *dvcRecvList_yz, *dvcRecvList_xz, *dvcRecvList_Xy, *dvcRecvList_Yz, *dvcRecvList_xZ; // Send buffers that reside on the compute device
//int *dvcRecvList_xY, *dvcRecvList_yZ, *dvcRecvList_Xz, *dvcRecvList_XY, *dvcRecvList_YZ, *dvcRecvList_XZ; int *dvcSendList_x, *dvcSendList_y, *dvcSendList_z, *dvcSendList_X,
// Link lists that reside on the compute device *dvcSendList_Y, *dvcSendList_Z;
int *dvcRecvLinks_x, *dvcRecvLinks_y, *dvcRecvLinks_z, *dvcRecvLinks_X, *dvcRecvLinks_Y, *dvcRecvLinks_Z; //int *dvcSendList_xy, *dvcSendList_yz, *dvcSendList_xz, *dvcSendList_Xy, *dvcSendList_Yz, *dvcSendList_xZ;
//int *dvcRecvLinks_xy, *dvcRecvLinks_yz, *dvcRecvLinks_xz, *dvcRecvLinks_Xy, *dvcRecvLinks_Yz, *dvcRecvLinks_xZ; //int *dvcSendList_xY, *dvcSendList_yZ, *dvcSendList_Xz, *dvcSendList_XY, *dvcSendList_YZ, *dvcSendList_XZ;
//int *dvcRecvLinks_xY, *dvcRecvLinks_yZ, *dvcRecvLinks_Xz, *dvcRecvLinks_XY, *dvcRecvLinks_YZ, *dvcRecvLinks_XZ; // Recieve buffers that reside on the compute device
// Recieve buffers for the distributions int *dvcRecvList_x, *dvcRecvList_y, *dvcRecvList_z, *dvcRecvList_X,
int *dvcRecvDist_x, *dvcRecvDist_y, *dvcRecvDist_z, *dvcRecvDist_X, *dvcRecvDist_Y, *dvcRecvDist_Z; *dvcRecvList_Y, *dvcRecvList_Z;
//int *dvcRecvDist_xy, *dvcRecvDist_yz, *dvcRecvDist_xz, *dvcRecvDist_Xy, *dvcRecvDist_Yz, *dvcRecvDist_xZ; //int *dvcRecvList_xy, *dvcRecvList_yz, *dvcRecvList_xz, *dvcRecvList_Xy, *dvcRecvList_Yz, *dvcRecvList_xZ;
//int *dvcRecvDist_xY, *dvcRecvDist_yZ, *dvcRecvDist_Xz, *dvcRecvDist_XY, *dvcRecvDist_YZ, *dvcRecvDist_XZ; //int *dvcRecvList_xY, *dvcRecvList_yZ, *dvcRecvList_Xz, *dvcRecvList_XY, *dvcRecvList_YZ, *dvcRecvList_XZ;
//...................................................................................... // Link lists that reside on the compute device
// mass transfer coefficient arrays int *dvcRecvLinks_x, *dvcRecvLinks_y, *dvcRecvLinks_z, *dvcRecvLinks_X,
double *coefficient_x, *coefficient_X, *coefficient_y, *coefficient_Y, *coefficient_z, *coefficient_Z; *dvcRecvLinks_Y, *dvcRecvLinks_Z;
//...................................................................................... //int *dvcRecvLinks_xy, *dvcRecvLinks_yz, *dvcRecvLinks_xz, *dvcRecvLinks_Xy, *dvcRecvLinks_Yz, *dvcRecvLinks_xZ;
//int *dvcRecvLinks_xY, *dvcRecvLinks_yZ, *dvcRecvLinks_Xz, *dvcRecvLinks_XY, *dvcRecvLinks_YZ, *dvcRecvLinks_XZ;
// Recieve buffers for the distributions
int *dvcRecvDist_x, *dvcRecvDist_y, *dvcRecvDist_z, *dvcRecvDist_X,
*dvcRecvDist_Y, *dvcRecvDist_Z;
//int *dvcRecvDist_xy, *dvcRecvDist_yz, *dvcRecvDist_xz, *dvcRecvDist_Xy, *dvcRecvDist_Yz, *dvcRecvDist_xZ;
//int *dvcRecvDist_xY, *dvcRecvDist_yZ, *dvcRecvDist_Xz, *dvcRecvDist_XY, *dvcRecvDist_YZ, *dvcRecvDist_XZ;
//......................................................................................
// mass transfer coefficient arrays
double *coefficient_x, *coefficient_X, *coefficient_y, *coefficient_Y,
*coefficient_z, *coefficient_Z;
//......................................................................................
}; };
#endif #endif

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/ReadMicroCT.h" #include "common/ReadMicroCT.h"
#include "common/Utilities.h" #include "common/Utilities.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef READMICROCT_H #ifndef READMICROCT_H
#define READMICROCT_H #define READMICROCT_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SpherePack_INC #ifndef SpherePack_INC
#define SpherePack_INC #define SpherePack_INC

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/UnitTest.h" #include "common/UnitTest.h"
#include "common/Utilities.h" #include "common/Utilities.h"
#include <cstring> #include <cstring>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_UnitTest #ifndef included_UnitTest
#define included_UnitTest #define included_UnitTest

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/Units.h" #include "common/Units.h"
#include "common/Utilities.h" #include "common/Utilities.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_Units #ifndef included_Units
#define included_Units #define included_Units

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/Utilities.h" #include "common/Utilities.h"
#include "StackTrace/StackTrace.h" #include "StackTrace/StackTrace.h"
#include "StackTrace/ErrorHandlers.h" #include "StackTrace/ErrorHandlers.h"

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_Utilities #ifndef included_Utilities
#define included_Utilities #define included_Utilities

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef included_Utilities_hpp #ifndef included_Utilities_hpp
#define included_Utilities_hpp #define included_Utilities_hpp
@ -47,7 +63,7 @@ template <class T> void quicksort(std::vector<T> &x) {
} else { } else {
k = (l + ir) / k = (l + ir) /
2; // Choose median of left, center and right elements as partitioning 2; // Choose median of left, center and right elements as partitioning
// element a. Also rearrange so that a(l) < a(l+1) < a(ir). // element a. Also rearrange so that a(l) < a(l+1) < a(ir).
tmp_a = arr[k]; tmp_a = arr[k];
arr[k] = arr[l + 1]; arr[k] = arr[l + 1];
arr[l + 1] = tmp_a; arr[l + 1] = tmp_a;
@ -140,7 +156,7 @@ void quicksort(std::vector<T1> &x, std::vector<T2> &y) {
} else { } else {
k = (l + ir) / k = (l + ir) /
2; // Choose median of left, center and right elements as partitioning 2; // Choose median of left, center and right elements as partitioning
// element a. Also rearrange so that a(l) ? a(l+1) ? a(ir). // element a. Also rearrange so that a(l) ? a(l+1) ? a(ir).
tmp_a = arr[k]; tmp_a = arr[k];
arr[k] = arr[l + 1]; arr[k] = arr[l + 1];
arr[l + 1] = tmp_a; arr[l + 1] = tmp_a;

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// This file contains useful macros including ERROR, WARNING, INSIST, ASSERT, etc. // This file contains useful macros including ERROR, WARNING, INSIST, ASSERT, etc.
#ifndef included_UtilityMacros #ifndef included_UtilityMacros
#define included_UtilityMacros #define included_UtilityMacros

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
This class implements support for halo widths larger than 1 This class implements support for halo widths larger than 1
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* /*
This class implements support for halo widths larger than 1 This class implements support for halo widths larger than 1
*/ */

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C" void ScaLBL_D3Q19_AAeven_BGK(double *dist, int start, int finish, extern "C" void ScaLBL_D3Q19_AAeven_BGK(double *dist, int start, int finish,
int Np, double rlx, double Fx, int Np, double rlx, double Fx,
double Fy, double Fz) { double Fy, double Fz) {

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#define STOKES #define STOKES

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
extern "C" void ScaLBL_D3Q19_Pack(int q, int *list, int start, int count, extern "C" void ScaLBL_D3Q19_Pack(int q, int *list, int start, int count,
@ -32,7 +48,6 @@ extern "C" void ScaLBL_D3Q19_Unpack(int q, int *list, int start, int count,
} }
} }
extern "C" void ScaLBL_D3Q19_AA_Init(double *f_even, double *f_odd, int Np) { extern "C" void ScaLBL_D3Q19_AA_Init(double *f_even, double *f_odd, int Np) {
int n; int n;
for (n = 0; n < Np; n++) { for (n = 0; n < Np; n++) {
@ -1926,8 +1941,8 @@ extern "C" void ScaLBL_D3Q19_AAeven_Compact(double *dist, int Np) {
} }
} }
extern "C" void ScaLBL_D3Q19_AAodd_Compact(int *neighborList, extern "C" void ScaLBL_D3Q19_AAodd_Compact(int *neighborList, double *dist,
double *dist, int Np) { int Np) {
int nread; int nread;
for (int n = 0; n < Np; n++) { for (int n = 0; n < Np; n++) {

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// CPU Functions for D3Q7 Lattice Boltzmann Methods // CPU Functions for D3Q7 Lattice Boltzmann Methods
extern "C" void ScaLBL_Scalar_Pack(int *list, int count, double *sendbuf, extern "C" void ScaLBL_Scalar_Pack(int *list, int count, double *sendbuf,

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// CPU Functions for D3Q7 Lattice Boltzmann Methods // CPU Functions for D3Q7 Lattice Boltzmann Methods
// Boundary Conditions // Boundary Conditions
@ -35,31 +51,39 @@ extern "C" void ScaLBL_Solid_Neumann_D3Q7(double *dist, double *BoundaryValue,
} }
} }
extern "C" void ScaLBL_Solid_DirichletAndNeumann_D3Q7(double *dist,double *BoundaryValue,int* BoundaryLabel,int *BounceBackDist_list,int *BounceBackSolid_list,int N){ extern "C" void ScaLBL_Solid_DirichletAndNeumann_D3Q7(
double *dist, double *BoundaryValue, int *BoundaryLabel,
int *BounceBackDist_list, int *BounceBackSolid_list, int N) {
int idx; int idx;
int iq,ib; int iq, ib;
double value_b,value_b_label,value_q; double value_b, value_b_label, value_q;
for (idx=0; idx<N; idx++){ for (idx = 0; idx < N; idx++) {
iq = BounceBackDist_list[idx]; iq = BounceBackDist_list[idx];
ib = BounceBackSolid_list[idx]; ib = BounceBackSolid_list[idx];
value_b = BoundaryValue[ib];//get boundary value from a solid site value_b = BoundaryValue[ib]; //get boundary value from a solid site
value_b_label = BoundaryLabel[ib];//get boundary label (i.e. type of BC) from a solid site value_b_label = BoundaryLabel
[ib]; //get boundary label (i.e. type of BC) from a solid site
value_q = dist[iq]; value_q = dist[iq];
if (value_b_label==1){//Dirichlet BC if (value_b_label == 1) { //Dirichlet BC
dist[iq] = -1.0*value_q + value_b*0.25;//NOTE 0.25 is the speed of sound for D3Q7 lattice dist[iq] =
-1.0 * value_q +
value_b *
0.25; //NOTE 0.25 is the speed of sound for D3Q7 lattice
} }
if (value_b_label==2){//Neumann BC if (value_b_label == 2) { //Neumann BC
dist[iq] = value_q + value_b; dist[iq] = value_q + value_b;
} }
} }
} }
extern "C" void ScaLBL_Solid_SlippingVelocityBC_D3Q19(double *dist, double *zeta_potential, double *ElectricField, double *SolidGrad, extern "C" void ScaLBL_Solid_SlippingVelocityBC_D3Q19(
double epsilon_LB, double tau, double rho0,double den_scale, double h, double time_conv, double *dist, double *zeta_potential, double *ElectricField,
int *BounceBackDist_list, int *BounceBackSolid_list, int *FluidBoundary_list, double *SolidGrad, double epsilon_LB, double tau, double rho0,
double *lattice_weight, float *lattice_cx, float *lattice_cy, float *lattice_cz, double den_scale, double h, double time_conv, int *BounceBackDist_list,
int count, int Np){ int *BounceBackSolid_list, int *FluidBoundary_list, double *lattice_weight,
float *lattice_cx, float *lattice_cy, float *lattice_cz, int count,
int Np) {
int idx; int idx;
int iq, ib, ifluidBC; int iq, ib, ifluidBC;
@ -181,7 +205,6 @@ extern "C" void ScaLBL_D3Q7_AAodd_Poisson_Potential_BC_z(int *d_neighborList,
} }
} }
extern "C" void ScaLBL_D3Q7_AAodd_Poisson_Potential_BC_Z(int *d_neighborList, extern "C" void ScaLBL_D3Q7_AAodd_Poisson_Potential_BC_Z(int *d_neighborList,
int *list, int *list,
double *dist, double *dist,
@ -214,8 +237,6 @@ extern "C" void ScaLBL_D3Q7_AAodd_Poisson_Potential_BC_Z(int *d_neighborList,
} }
} }
extern "C" void ScaLBL_Poisson_D3Q7_BC_z(int *list, int *Map, double *Psi, extern "C" void ScaLBL_Poisson_D3Q7_BC_z(int *list, int *Map, double *Psi,
double Vin, int count) { double Vin, int count) {
int idx, n, nm; int idx, n, nm;

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Basic cuda functions callable from C/C++ code // Basic cuda functions callable from C/C++ code
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
extern "C" void extern "C" void

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
extern "C" void ScaLBL_D3Q19_AAodd_GreyscaleColor( extern "C" void ScaLBL_D3Q19_AAodd_GreyscaleColor(

View File

@ -1,13 +1,31 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
/***** pH equilibrium ******/ /***** pH equilibrium ******/
extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist, extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
double *Den, double *ElectricField, double *Velocity, double *Den,
double Di, double Vt, double *ElectricField,
int pH_ion, int start, int finish, int Np) { double *Velocity, double Di,
double Vt, int pH_ion,
int start, int finish, int Np) {
int n; int n;
double Ex, Ey, Ez; //electrical field double Ex, Ey, Ez; //electrical field
double ux, uy, uz; double ux, uy, uz;
double uEPx, uEPy, uEPz; //electrochemical induced velocity double uEPx, uEPy, uEPz; //electrochemical induced velocity
double Ca, Cb; double Ca, Cb;
@ -16,8 +34,8 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
double f0, f1, f2, f3, f4, f5, f6; double f0, f1, f2, f3, f4, f5, f6;
int nr1, nr2, nr3, nr4, nr5, nr6; int nr1, nr2, nr3, nr4, nr5, nr6;
double rhoe, tmp; double rhoe, tmp;
// double factor = Di / (Vt *Vt* ionizationEnergy); // double factor = Di / (Vt *Vt* ionizationEnergy);
for (n = start; n < finish; n++) { for (n = start; n < finish; n++) {
//Load data //Load data
@ -25,11 +43,11 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
Ex = ElectricField[n + 0 * Np]; Ex = ElectricField[n + 0 * Np];
Ey = ElectricField[n + 1 * Np]; Ey = ElectricField[n + 1 * Np];
Ez = ElectricField[n + 2 * Np]; Ez = ElectricField[n + 2 * Np];
ux = Velocity[n + 0 * Np]; ux = Velocity[n + 0 * Np];
uy = Velocity[n + 1 * Np]; uy = Velocity[n + 1 * Np];
uz = Velocity[n + 2 * Np]; uz = Velocity[n + 2 * Np];
uEPx = Di / Vt * Ex; uEPx = Di / Vt * Ex;
uEPy = Di / Vt * Ey; uEPy = Di / Vt * Ey;
uEPz = Di / Vt * Ez; uEPz = Di / Vt * Ez;
@ -47,15 +65,17 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
nr5 = neighborList[n + 4 * Np]; nr5 = neighborList[n + 4 * Np];
// q=6 // q=6
nr6 = neighborList[n + 5 * Np]; nr6 = neighborList[n + 5 * Np];
A0 = dist[pH_ion*7*Np + n]; A0 = dist[pH_ion * 7 * Np + n];
A1 = dist[pH_ion*7*Np + nr1]; // reading the A1 data into register Aq A1 =
A2 = dist[pH_ion*7*Np + nr2]; // reading the A2 data into register Aq dist[pH_ion * 7 * Np + nr1]; // reading the A1 data into register Aq
A3 = dist[pH_ion*7*Np + nr3]; A2 =
A4 = dist[pH_ion*7*Np + nr4]; dist[pH_ion * 7 * Np + nr2]; // reading the A2 data into register Aq
A5 = dist[pH_ion*7*Np + nr5]; A3 = dist[pH_ion * 7 * Np + nr3];
A6 = dist[pH_ion*7*Np + nr6]; A4 = dist[pH_ion * 7 * Np + nr4];
A5 = dist[pH_ion * 7 * Np + nr5];
A6 = dist[pH_ion * 7 * Np + nr6];
/* /*
B0 = dist[hydroxide*7*Np + n]; B0 = dist[hydroxide*7*Np + n];
B1 = dist[hydroxide*7*Np + nr1]; // reading the B1 data into register Bq B1 = dist[hydroxide*7*Np + nr1]; // reading the B1 data into register Bq
@ -65,16 +85,16 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
B5 = dist[hydroxide*7*Np + nr5]; B5 = dist[hydroxide*7*Np + nr5];
B6 = dist[hydroxide*7*Np + nr6]; B6 = dist[hydroxide*7*Np + nr6];
*/ */
// charge density // charge density
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6; rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
//rhoe = Ca - Cb; //rhoe = Ca - Cb;
// new equilibrium // new equilibrium
tmp = sqrt(rhoe*rhoe + 4.04e-14); tmp = sqrt(rhoe * rhoe + 4.04e-14);
Ca = rhoe + tmp; Ca = rhoe + tmp;
Cb = Ca - rhoe; Cb = Ca - rhoe;
Den[pH_ion*Np + n] = Ca - Cb; Den[pH_ion * Np + n] = Ca - Cb;
// proton production // proton production
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx)); A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
@ -82,10 +102,10 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
A3 = 0.125 * Ca * (1.0 + 4.0 * (uy) + uEPy); A3 = 0.125 * Ca * (1.0 + 4.0 * (uy) + uEPy);
A4 = 0.125 * Ca * (1.0 - 4.0 * (uy) + uEPy); A4 = 0.125 * Ca * (1.0 - 4.0 * (uy) + uEPy);
A5 = 0.125 * Ca * (1.0 + 4.0 * (uz) + uEPz); A5 = 0.125 * Ca * (1.0 + 4.0 * (uz) + uEPz);
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz); A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
A0 = Ca - (A1+A2+A3+A4+A5+A6); A0 = Ca - (A1 + A2 + A3 + A4 + A5 + A6);
// hydroxide ions created by water ionization (no net charge increase) // hydroxide ions created by water ionization (no net charge increase)
//Cb += (f1 + f2 + f3 + f4 + f5 + f6); //Cb += (f1 + f2 + f3 + f4 + f5 + f6);
// use relative mass of hydroxide + momentum conservation // use relative mass of hydroxide + momentum conservation
@ -95,26 +115,26 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
B4 = 0.125 * Cb * (1.0 - 4.0 * (uy - uEPy)); B4 = 0.125 * Cb * (1.0 - 4.0 * (uy - uEPy));
B5 = 0.125 * Cb * (1.0 + 4.0 * (uz - uEPz)); B5 = 0.125 * Cb * (1.0 + 4.0 * (uz - uEPz));
B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz)); B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz));
B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6); B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6);
B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6); B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6);
f0 = A0 - B0; f0 = A0 - B0;
f1 = A1 - B1; f1 = A1 - B1;
f2 = A2 - B2; f2 = A2 - B2;
f3 = A3 - B3; f3 = A3 - B3;
f4 = A4 - B4; f4 = A4 - B4;
f5 = A5 - B5; f5 = A5 - B5;
f6 = A6 - B6; f6 = A6 - B6;
dist[pH_ion*7*Np + n] = f0; dist[pH_ion * 7 * Np + n] = f0;
dist[pH_ion*7*Np + nr2] = f1; dist[pH_ion * 7 * Np + nr2] = f1;
dist[pH_ion*7*Np + nr1] = f2; dist[pH_ion * 7 * Np + nr1] = f2;
dist[pH_ion*7*Np + nr4] = f3; dist[pH_ion * 7 * Np + nr4] = f3;
dist[pH_ion*7*Np + nr3] = f4; dist[pH_ion * 7 * Np + nr3] = f4;
dist[pH_ion*7*Np + nr6] = f5; dist[pH_ion * 7 * Np + nr6] = f5;
dist[pH_ion*7*Np + nr5] = f6; dist[pH_ion * 7 * Np + nr5] = f6;
/* /*
dist[pH_ion*7*Np + n] = f0; dist[pH_ion*7*Np + n] = f0;
dist[pH_ion*7*Np + nr1] = f1; dist[pH_ion*7*Np + nr1] = f1;
@ -124,18 +144,15 @@ extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
dist[pH_ion*7*Np + nr5] = f5; dist[pH_ion*7*Np + nr5] = f5;
dist[pH_ion*7*Np + nr6] = f6; dist[pH_ion*7*Np + nr6] = f6;
*/ */
} }
} }
extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist, extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization(
double *Den, double *ElectricField, double * Velocity, double *dist, double *Den, double *ElectricField, double *Velocity,
double Di, double Vt, double Di, double Vt, int pH_ion, int start, int finish, int Np) {
int pH_ion, int start, int finish, int Np) {
int n; int n;
double Ex, Ey, Ez; //electrical field double Ex, Ey, Ez; //electrical field
double ux, uy, uz; double ux, uy, uz;
double uEPx, uEPy, uEPz; //electrochemical induced velocity double uEPx, uEPy, uEPz; //electrochemical induced velocity
double Ca, Cb; double Ca, Cb;
@ -143,42 +160,46 @@ extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
double B0, B1, B2, B3, B4, B5, B6; double B0, B1, B2, B3, B4, B5, B6;
double f0, f1, f2, f3, f4, f5, f6; double f0, f1, f2, f3, f4, f5, f6;
double rhoe, tmp; double rhoe, tmp;
// double factor = Di / (Vt *Vt* ionizationEnergy); // double factor = Di / (Vt *Vt* ionizationEnergy);
for (n = start; n < finish; n++) { for (n = start; n < finish; n++) {
//Load data //Load data
//Ci = Den[n]; //Ci = Den[n];
Ex = ElectricField[n + 0 * Np]; Ex = ElectricField[n + 0 * Np];
Ey = ElectricField[n + 1 * Np]; Ey = ElectricField[n + 1 * Np];
Ez = ElectricField[n + 2 * Np]; Ez = ElectricField[n + 2 * Np];
ux = Velocity[n + 0 * Np]; ux = Velocity[n + 0 * Np];
uy = Velocity[n + 1 * Np]; uy = Velocity[n + 1 * Np];
uz = Velocity[n + 2 * Np]; uz = Velocity[n + 2 * Np];
uEPx = Di / Vt * Ex; uEPx = Di / Vt * Ex;
uEPy = Di / Vt * Ey; uEPy = Di / Vt * Ey;
uEPz = Di / Vt * Ez; uEPz = Di / Vt * Ez;
A0 = dist[pH_ion*7*Np + n]; A0 = dist[pH_ion * 7 * Np + n];
A1 = dist[pH_ion*7*Np +2 * Np + n]; A1 = dist[pH_ion * 7 * Np + 2 * Np + n];
A2 = dist[pH_ion*7*Np +1 * Np + n]; A2 = dist[pH_ion * 7 * Np + 1 * Np + n];
A3 = dist[pH_ion*7*Np +4 * Np + n]; A3 = dist[pH_ion * 7 * Np + 4 * Np + n];
A4 = dist[pH_ion*7*Np +3 * Np + n]; A4 = dist[pH_ion * 7 * Np + 3 * Np + n];
A5 = dist[pH_ion*7*Np +6 * Np + n]; A5 = dist[pH_ion * 7 * Np + 6 * Np + n];
A6 = dist[pH_ion*7*Np +5 * Np + n]; A6 = dist[pH_ion * 7 * Np + 5 * Np + n];
// charge density // charge density
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6; rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
//rhoe = Ca - Cb; //rhoe = Ca - Cb;
// new equilibrium // new equilibrium
tmp = sqrt(rhoe*rhoe + 4.04e-14); tmp = sqrt(rhoe * rhoe + 4.04e-14);
Ca = rhoe + tmp; Ca = rhoe + tmp;
Cb = Ca - rhoe; Cb = Ca - rhoe;
if (Ca < 0.0) printf("Error in hydronium concentration, %f (charge density = %f) \n", Ca, rhoe); if (Ca < 0.0)
if (Cb < 0.0) printf("Error in hydroxide concentration, %f \n", Cb); printf(
"Error in hydronium concentration, %f (charge density = %f) \n",
Den[pH_ion*Np + n] = Ca - Cb; Ca, rhoe);
if (Cb < 0.0)
printf("Error in hydroxide concentration, %f \n", Cb);
Den[pH_ion * Np + n] = Ca - Cb;
// proton production // proton production
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx)); A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
@ -186,10 +207,10 @@ extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
A3 = 0.125 * Ca * (1.0 + 4.0 * (uy) + uEPy); A3 = 0.125 * Ca * (1.0 + 4.0 * (uy) + uEPy);
A4 = 0.125 * Ca * (1.0 - 4.0 * (uy) + uEPy); A4 = 0.125 * Ca * (1.0 - 4.0 * (uy) + uEPy);
A5 = 0.125 * Ca * (1.0 + 4.0 * (uz) + uEPz); A5 = 0.125 * Ca * (1.0 + 4.0 * (uz) + uEPz);
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz); A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
A0 = Ca - (A1+A2+A3+A4+A5+A6); A0 = Ca - (A1 + A2 + A3 + A4 + A5 + A6);
// hydroxide ions created by water ionization (no net charge increase) // hydroxide ions created by water ionization (no net charge increase)
//Cb += (f1 + f2 + f3 + f4 + f5 + f6); //Cb += (f1 + f2 + f3 + f4 + f5 + f6);
// use relative mass of hydroxide + momentum conservation // use relative mass of hydroxide + momentum conservation
@ -199,30 +220,30 @@ extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
B4 = 0.125 * Cb * (1.0 - 4.0 * (uy - uEPy)); B4 = 0.125 * Cb * (1.0 - 4.0 * (uy - uEPy));
B5 = 0.125 * Cb * (1.0 + 4.0 * (uz - uEPz)); B5 = 0.125 * Cb * (1.0 + 4.0 * (uz - uEPz));
B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz)); B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz));
B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6); B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6);
f0 = A0 - B0; f0 = A0 - B0;
f1 = A1 - B1; f1 = A1 - B1;
f2 = A2 - B2; f2 = A2 - B2;
f3 = A3 - B3; f3 = A3 - B3;
f4 = A4 - B4; f4 = A4 - B4;
f5 = A5 - B5; f5 = A5 - B5;
f6 = A6 - B6; f6 = A6 - B6;
if (Ez > 0.0 && n == start){ if (Ez > 0.0 && n == start) {
printf("Ca = %.5g, Cb = %.5g \n", Ca, Cb); printf("Ca = %.5g, Cb = %.5g \n", Ca, Cb);
printf(" charge density = %.5g \n", rhoe); printf(" charge density = %.5g \n", rhoe);
printf(" Ez = %.5g, A5 = %.5g, A6 = %.5g \n", Ez, f5, f6); printf(" Ez = %.5g, A5 = %.5g, A6 = %.5g \n", Ez, f5, f6);
} }
dist[pH_ion*7*Np + n] = f0; dist[pH_ion * 7 * Np + n] = f0;
dist[pH_ion*7*Np +1 * Np + n] = f1; dist[pH_ion * 7 * Np + 1 * Np + n] = f1;
dist[pH_ion*7*Np +2 * Np + n] = f2; dist[pH_ion * 7 * Np + 2 * Np + n] = f2;
dist[pH_ion*7*Np +3 * Np + n] = f3; dist[pH_ion * 7 * Np + 3 * Np + n] = f3;
dist[pH_ion*7*Np +4 * Np + n] = f4; dist[pH_ion * 7 * Np + 4 * Np + n] = f4;
dist[pH_ion*7*Np +5 * Np + n] = f5; dist[pH_ion * 7 * Np + 5 * Np + n] = f5;
dist[pH_ion*7*Np +6 * Np + n] = f6; dist[pH_ion * 7 * Np + 6 * Np + n] = f6;
/* /*
dist[pH_ion*7*Np +2 * Np + n] = f1; dist[pH_ion*7*Np +2 * Np + n] = f1;
dist[pH_ion*7*Np +1 * Np + n] = f2; dist[pH_ion*7*Np +1 * Np + n] = f2;
@ -231,108 +252,115 @@ extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
dist[pH_ion*7*Np +6 * Np + n] = f5; dist[pH_ion*7*Np +6 * Np + n] = f5;
dist[pH_ion*7*Np +5 * Np + n] = f6; dist[pH_ion*7*Np +5 * Np + n] = f6;
*/ */
} }
} }
/**** end of pH equlibrium model ********/ /**** end of pH equlibrium model ********/
extern "C" void ScaLBL_D3Q7_Membrane_AssignLinkCoef(
int *membrane, int *Map, double *Distance, double *Psi, double *coef,
double Threshold, double MassFractionIn, double MassFractionOut,
double ThresholdMassFractionIn, double ThresholdMassFractionOut,
int memLinks, int Nx, int Ny, int Nz, int Np) {
extern "C" void ScaLBL_D3Q7_Membrane_AssignLinkCoef(int *membrane, int *Map, double *Distance, double *Psi, double *coef, int link, iq, ip, nq, np, nqm, npm;
double Threshold, double MassFractionIn, double MassFractionOut, double ThresholdMassFractionIn, double ThresholdMassFractionOut, double aq, ap, membranePotential;
int memLinks, int Nx, int Ny, int Nz, int Np){ //double dq, dp, dist, orientation;
/* Interior Links */
int link,iq,ip,nq,np,nqm,npm; for (link = 0; link < memLinks; link++) {
double aq, ap, membranePotential;
//double dq, dp, dist, orientation; // inside //outside
/* Interior Links */ aq = MassFractionIn;
for (link=0; link<memLinks; link++){ ap = MassFractionOut;
iq = membrane[2 * link];
// inside //outside ip = membrane[2 * link + 1];
aq = MassFractionIn; ap = MassFractionOut; nq = iq % Np;
iq = membrane[2*link]; ip = membrane[2*link+1]; np = ip % Np;
nq = iq%Np; np = ip%Np; nqm = Map[nq];
nqm = Map[nq]; npm = Map[np]; // strided layout npm = Map[np]; // strided layout
//dq = Distance[nqm]; dp = Distance[npm]; //dq = Distance[nqm]; dp = Distance[npm];
/* orientation for link to distance gradient*/ /* orientation for link to distance gradient*/
//orientation = 1.0/fabs(dq - dp); //orientation = 1.0/fabs(dq - dp);
/* membrane potential for this link */ /* membrane potential for this link */
membranePotential = Psi[nqm] - Psi[npm]; membranePotential = Psi[nqm] - Psi[npm];
if (membranePotential > Threshold){ if (membranePotential > Threshold) {
aq = ThresholdMassFractionIn; ap = ThresholdMassFractionOut; aq = ThresholdMassFractionIn;
} ap = ThresholdMassFractionOut;
}
/* Save the mass transfer coefficients */
//coef[2*link] = aq*orientation; coef[2*link+1] = ap*orientation; /* Save the mass transfer coefficients */
coef[2*link] = aq; coef[2*link+1] = ap; //coef[2*link] = aq*orientation; coef[2*link+1] = ap*orientation;
} coef[2 * link] = aq;
coef[2 * link + 1] = ap;
}
} }
extern "C" void ScaLBL_D3Q7_Membrane_AssignLinkCoef_halo( extern "C" void ScaLBL_D3Q7_Membrane_AssignLinkCoef_halo(
const int Cqx, const int Cqy, int const Cqz, const int Cqx, const int Cqy, int const Cqz, int *Map, double *Distance,
int *Map, double *Distance, double *Psi, double Threshold, double *Psi, double Threshold, double MassFractionIn,
double MassFractionIn, double MassFractionOut, double ThresholdMassFractionIn, double ThresholdMassFractionOut, double MassFractionOut, double ThresholdMassFractionIn,
int *d3q7_recvlist, int *d3q7_linkList, double *coef, int start, int nlinks, int count, double ThresholdMassFractionOut, int *d3q7_recvlist, int *d3q7_linkList,
const int N, const int Nx, const int Ny, const int Nz) { double *coef, int start, int nlinks, int count, const int N, const int Nx,
//.................................................................................... const int Ny, const int Nz) {
// Unack distribution from the recv buffer //....................................................................................
// Distribution q matche Cqx, Cqy, Cqz // Unack distribution from the recv buffer
// swap rule means that the distributions in recvbuf are OPPOSITE of q // Distribution q matche Cqx, Cqy, Cqz
// dist may be even or odd distributions stored by stream layout // swap rule means that the distributions in recvbuf are OPPOSITE of q
//.................................................................................... // dist may be even or odd distributions stored by stream layout
int n, idx, label, nqm, npm, i, j, k; //....................................................................................
double distanceLocal;//, distanceNonlocal; int n, idx, label, nqm, npm, i, j, k;
double psiLocal, psiNonlocal, membranePotential; double distanceLocal; //, distanceNonlocal;
double ap,aq; // coefficient double psiLocal, psiNonlocal, membranePotential;
double ap, aq; // coefficient
for (idx = 0; idx < count; idx++) {
for (idx = 0; idx < count; idx++) { n = d3q7_recvlist[idx];
n = d3q7_recvlist[idx]; label = d3q7_linkList[idx];
label = d3q7_linkList[idx]; ap = 1.0; // regular streaming rule
ap = 1.0; // regular streaming rule aq = 1.0;
aq = 1.0; if (label > 0 && !(n < 0)) {
if (label > 0 && !(n < 0)){ nqm = Map[n];
nqm = Map[n]; distanceLocal = Distance[nqm];
distanceLocal = Distance[nqm]; psiLocal = Psi[nqm];
psiLocal = Psi[nqm];
// Get the 3-D indices from the send process // Get the 3-D indices from the send process
k = nqm/(Nx*Ny); j = (nqm-Nx*Ny*k)/Nx; i = nqm-Nx*Ny*k-Nx*j; k = nqm / (Nx * Ny);
// Streaming link the non-local distribution j = (nqm - Nx * Ny * k) / Nx;
i -= Cqx; j -= Cqy; k -= Cqz; i = nqm - Nx * Ny * k - Nx * j;
npm = k*Nx*Ny + j*Nx + i; // Streaming link the non-local distribution
//distanceNonlocal = Distance[npm]; i -= Cqx;
psiNonlocal = Psi[npm]; j -= Cqy;
k -= Cqz;
npm = k * Nx * Ny + j * Nx + i;
//distanceNonlocal = Distance[npm];
psiNonlocal = Psi[npm];
membranePotential = psiLocal - psiNonlocal; membranePotential = psiLocal - psiNonlocal;
aq = MassFractionIn; aq = MassFractionIn;
ap = MassFractionOut; ap = MassFractionOut;
/* link is inside membrane */ /* link is inside membrane */
if (distanceLocal > 0.0){ if (distanceLocal > 0.0) {
if (membranePotential < Threshold*(-1.0)){ if (membranePotential < Threshold * (-1.0)) {
ap = MassFractionIn; ap = MassFractionIn;
aq = MassFractionOut; aq = MassFractionOut;
} } else {
else { ap = ThresholdMassFractionIn;
ap = ThresholdMassFractionIn; aq = ThresholdMassFractionOut;
aq = ThresholdMassFractionOut; }
} } else if (membranePotential > Threshold) {
} aq = ThresholdMassFractionIn;
else if (membranePotential > Threshold){ ap = ThresholdMassFractionOut;
aq = ThresholdMassFractionIn; }
ap = ThresholdMassFractionOut; }
} coef[2 * idx] = aq;
} coef[2 * idx + 1] = ap;
coef[2*idx]=aq; }
coef[2*idx+1]=ap;
}
} }
extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q, int *d3q7_recvlist,
extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q, double *recvbuf, int count,
int *d3q7_recvlist, double *recvbuf, int count, double *dist, int N, double *coef) {
double *dist, int N, double *coef) {
//.................................................................................... //....................................................................................
// Unack distribution from the recv buffer // Unack distribution from the recv buffer
// Distribution q matche Cqx, Cqy, Cqz // Distribution q matche Cqx, Cqy, Cqz
@ -340,40 +368,50 @@ extern "C" void ScaLBL_D3Q7_Membrane_Unpack(int q,
// dist may be even or odd distributions stored by stream layout // dist may be even or odd distributions stored by stream layout
//.................................................................................... //....................................................................................
int n, idx; int n, idx;
double fq,fp,fqq,ap,aq; // coefficient double fq, fp, fqq, ap, aq; // coefficient
/* First unpack the regular links */ /* First unpack the regular links */
for (idx = 0; idx < count; idx++) { for (idx = 0; idx < count; idx++) {
n = d3q7_recvlist[idx]; n = d3q7_recvlist[idx];
// update link based on mass transfer coefficients // update link based on mass transfer coefficients
if (!(n < 0)){ if (!(n < 0)) {
aq = coef[2*idx]; aq = coef[2 * idx];
ap = coef[2*idx+1]; ap = coef[2 * idx + 1];
fq = dist[q * N + n]; fq = dist[q * N + n];
fp = recvbuf[idx]; fp = recvbuf[idx];
fqq = (1-aq)*fq+ap*fp; fqq = (1 - aq) * fq + ap * fp;
dist[q * N + n] = fqq; dist[q * N + n] = fqq;
} }
//printf(" LINK: site=%i, index=%i \n", n, idx); //printf(" LINK: site=%i, index=%i \n", n, idx);
} }
} }
extern "C" void ScaLBL_D3Q7_Membrane_IonTransport(int *membrane, double *coef, extern "C" void ScaLBL_D3Q7_Membrane_IonTransport(int *membrane, double *coef,
double *dist, double *Den, int memLinks, int Np){ double *dist, double *Den,
int memLinks, int Np) {
int link,iq,ip,nq,np;
double aq, ap, fq, fp, fqq, fpp, Cq, Cp; int link, iq, ip, nq, np;
for (link=0; link<memLinks; link++){ double aq, ap, fq, fp, fqq, fpp, Cq, Cp;
// inside //outside for (link = 0; link < memLinks; link++) {
aq = coef[2*link]; ap = coef[2*link+1]; // inside //outside
iq = membrane[2*link]; ip = membrane[2*link+1]; aq = coef[2 * link];
nq = iq%Np; np = ip%Np; ap = coef[2 * link + 1];
fq = dist[iq]; fp = dist[ip]; iq = membrane[2 * link];
fqq = (1-aq)*fq+ap*fp; fpp = (1-ap)*fp+aq*fq; ip = membrane[2 * link + 1];
Cq = Den[nq]; Cp = Den[np]; nq = iq % Np;
Cq += fqq - fq; Cp += fpp - fp; np = ip % Np;
Den[nq] = Cq; Den[np] = Cp; fq = dist[iq];
dist[iq] = fqq; dist[ip] = fpp; fp = dist[ip];
} fqq = (1 - aq) * fq + ap * fp;
fpp = (1 - ap) * fp + aq * fq;
Cq = Den[nq];
Cp = Den[np];
Cq += fqq - fq;
Cp += fpp - fp;
Den[nq] = Cq;
Den[np] = Cp;
dist[iq] = fqq;
dist[ip] = fpp;
}
} }
extern "C" void ScaLBL_D3Q7_AAodd_IonConcentration(int *neighborList, extern "C" void ScaLBL_D3Q7_AAodd_IonConcentration(int *neighborList,
@ -461,13 +499,12 @@ extern "C" void ScaLBL_D3Q7_AAeven_IonConcentration(double *dist, double *Den,
} }
} }
extern "C" void ScaLBL_D3Q7_AAodd_Ion_v0(int *neighborList, double *dist, extern "C" void
double *Den, double *FluxDiffusive, ScaLBL_D3Q7_AAodd_Ion_v0(int *neighborList, double *dist, double *Den,
double *FluxAdvective, double *FluxDiffusive, double *FluxAdvective,
double *FluxElectrical, double *Velocity, double *FluxElectrical, double *Velocity,
double *ElectricField, double Di, int zi, double *ElectricField, double Di, int zi, double rlx,
double rlx, double Vt, int start, double Vt, int start, int finish, int Np) {
int finish, int Np) {
int n; int n;
double Ci; double Ci;
double ux, uy, uz; double ux, uy, uz;
@ -527,7 +564,7 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion_v0(int *neighborList, double *dist,
FluxElectrical[n + 0 * Np] = uEPx * Ci; FluxElectrical[n + 0 * Np] = uEPx * Ci;
FluxElectrical[n + 1 * Np] = uEPy * Ci; FluxElectrical[n + 1 * Np] = uEPy * Ci;
FluxElectrical[n + 2 * Np] = uEPz * Ci; FluxElectrical[n + 2 * Np] = uEPz * Ci;
//Den[n] = Ci; //Den[n] = Ci;
/* use logistic function to prevent negative distributions*/ /* use logistic function to prevent negative distributions*/
@ -543,35 +580,33 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion_v0(int *neighborList, double *dist,
// q = 1 // q = 1
dist[nr2] = dist[nr2] =
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx)); f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx));
// f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x); // f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x);
// q=2 // q=2
dist[nr1] = dist[nr1] =
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx)); f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx));
// f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x); // f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x);
// q = 3 // q = 3
dist[nr4] = dist[nr4] =
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy)); f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy));
// f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y ); // f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y );
// q = 4 // q = 4
dist[nr3] = dist[nr3] =
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy)); f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy));
// f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y); // f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y);
// q = 5 // q = 5
dist[nr6] = dist[nr6] =
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz)); f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz));
// f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z); // f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z);
// q = 6 // q = 6
dist[nr5] = dist[nr5] =
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz)); f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz));
// f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z); // f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z);
} }
} }
@ -623,9 +658,9 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion_v0(
FluxElectrical[n + 0 * Np] = uEPx * Ci; FluxElectrical[n + 0 * Np] = uEPx * Ci;
FluxElectrical[n + 1 * Np] = uEPy * Ci; FluxElectrical[n + 1 * Np] = uEPy * Ci;
FluxElectrical[n + 2 * Np] = uEPz * Ci; FluxElectrical[n + 2 * Np] = uEPz * Ci;
//Den[n] = Ci; //Den[n] = Ci;
/* use logistic function to prevent negative distributions*/ /* use logistic function to prevent negative distributions*/
//X = 4.0 * (ux + uEPx); //X = 4.0 * (ux + uEPx);
//Y = 4.0 * (uy + uEPy); //Y = 4.0 * (uy + uEPy);
@ -639,32 +674,32 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion_v0(
// q = 1 // q = 1
dist[1 * Np + n] = dist[1 * Np + n] =
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx)); f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx));
// f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x); // f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x);
// q=2 // q=2
dist[2 * Np + n] = dist[2 * Np + n] =
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx)); f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx));
// f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x); // f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x);
// q = 3 // q = 3
dist[3 * Np + n] = dist[3 * Np + n] =
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy)); f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy));
// f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y); // f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y);
// q = 4 // q = 4
dist[4 * Np + n] = dist[4 * Np + n] =
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy)); f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy));
// f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y); // f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y);
// q = 5 // q = 5
dist[5 * Np + n] = dist[5 * Np + n] =
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz)); f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz));
// f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z); // f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z);
// q = 6 // q = 6
dist[6 * Np + n] = dist[6 * Np + n] =
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz)); f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz));
// f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z); // f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z);
} }
} }
@ -735,7 +770,7 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist,
FluxElectrical[n + 0 * Np] = uEPx * Ci; FluxElectrical[n + 0 * Np] = uEPx * Ci;
FluxElectrical[n + 1 * Np] = uEPy * Ci; FluxElectrical[n + 1 * Np] = uEPy * Ci;
FluxElectrical[n + 2 * Np] = uEPz * Ci; FluxElectrical[n + 2 * Np] = uEPz * Ci;
Den[n] = Ci; Den[n] = Ci;
// q=0 // q=0
@ -743,28 +778,27 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist,
// q = 1 // q = 1
dist[nr2] = dist[nr2] =
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx)); f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx));
// q=2 // q=2
dist[nr1] = dist[nr1] =
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx)); f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx));
// q = 3 // q = 3
dist[nr4] = dist[nr4] =
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy)); f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy));
// q = 4 // q = 4
dist[nr3] = dist[nr3] =
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy)); f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy));
// q = 5 // q = 5
dist[nr6] = dist[nr6] =
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz)); f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz));
// q = 6 // q = 6
dist[nr5] = dist[nr5] =
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz)); f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz));
} }
} }
@ -816,7 +850,7 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion(
FluxElectrical[n + 0 * Np] = uEPx * Ci; FluxElectrical[n + 0 * Np] = uEPx * Ci;
FluxElectrical[n + 1 * Np] = uEPy * Ci; FluxElectrical[n + 1 * Np] = uEPy * Ci;
FluxElectrical[n + 2 * Np] = uEPz * Ci; FluxElectrical[n + 2 * Np] = uEPz * Ci;
Den[n] = Ci; Den[n] = Ci;
// q=0 // q=0
@ -824,27 +858,27 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion(
// q = 1 // q = 1
dist[1 * Np + n] = dist[1 * Np + n] =
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx)); f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (ux + uEPx));
// q=2 // q=2
dist[2 * Np + n] = dist[2 * Np + n] =
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx)); f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (ux + uEPx));
// q = 3 // q = 3
dist[3 * Np + n] = dist[3 * Np + n] =
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy)); f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uy + uEPy));
// q = 4 // q = 4
dist[4 * Np + n] = dist[4 * Np + n] =
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy)); f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uy + uEPy));
// q = 5 // q = 5
dist[5 * Np + n] = dist[5 * Np + n] =
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz)); f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + 4.0 * (uz + uEPz));
// q = 6 // q = 6
dist[6 * Np + n] = dist[6 * Np + n] =
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz)); f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz));
} }
} }
@ -881,8 +915,9 @@ extern "C" void ScaLBL_D3Q7_Ion_Init_FromFile(double *dist, double *Den,
extern "C" void ScaLBL_D3Q7_Ion_ChargeDensity(double *Den, extern "C" void ScaLBL_D3Q7_Ion_ChargeDensity(double *Den,
double *ChargeDensity, double *ChargeDensity,
double IonValence, int ion_component, double IonValence,
int start, int finish, int Np) { int ion_component, int start,
int finish, int Np) {
int n; int n;
double Ci; //ion concentration of species i double Ci; //ion concentration of species i

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C" void INITIALIZE(char *ID, double *f_even, double *f_odd, int Nx, extern "C" void INITIALIZE(char *ID, double *f_even, double *f_odd, int Nx,
int Ny, int Nz) { int Ny, int Nz) {
int n, N; int n, N;

View File

@ -1,6 +1,23 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
extern "C" void Membrane_D3Q19_Unpack(int q, int *list, int *links, int start, int linkCount, This file is part of the Open Porous Media project (OPM).
double *recvbuf, double *dist, int N) { OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C" void Membrane_D3Q19_Unpack(int q, int *list, int *links, int start,
int linkCount, double *recvbuf,
double *dist, int N) {
//.................................................................................... //....................................................................................
// Unack distribution from the recv buffer // Unack distribution from the recv buffer
// Distribution q matche Cqx, Cqy, Cqz // Distribution q matche Cqx, Cqy, Cqz
@ -8,9 +25,9 @@ extern "C" void Membrane_D3Q19_Unpack(int q, int *list, int *links, int start, i
// dist may be even or odd distributions stored by stream layout // dist may be even or odd distributions stored by stream layout
//.................................................................................... //....................................................................................
int n, idx, link; int n, idx, link;
for (link=0; link<linkCount; link++){ for (link = 0; link < linkCount; link++) {
idx = links[start+link]; idx = links[start + link];
// Get the value from the list -- note that n is the index is from the send (non-local) process // Get the value from the list -- note that n is the index is from the send (non-local) process
n = list[start + idx]; n = list[start + idx];
// unpack the distribution to the proper location // unpack the distribution to the proper location
@ -19,8 +36,10 @@ extern "C" void Membrane_D3Q19_Unpack(int q, int *list, int *links, int start, i
} }
} }
extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links, double *coef, int start, int offset, extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links,
int linkCount, double *recvbuf, double *dist, int N){ double *coef, int start, int offset,
int linkCount, double *recvbuf,
double *dist, int N) {
//.................................................................................... //....................................................................................
// Unack distribution from the recv buffer // Unack distribution from the recv buffer
// Distribution q matche Cqx, Cqy, Cqz // Distribution q matche Cqx, Cqy, Cqz
@ -29,14 +48,14 @@ extern "C" void Membrane_D3Q19_Transport(int q, int *list, int *links, double *c
//.................................................................................... //....................................................................................
int n, idx, link; int n, idx, link;
double alpha; double alpha;
for (link=offset; link<linkCount; link++){ for (link = offset; link < linkCount; link++) {
idx = list[start+link]; idx = list[start + link];
// Get the value from the list -- note that n is the index is from the send (non-local) process // Get the value from the list -- note that n is the index is from the send (non-local) process
n = list[start + idx]; n = list[start + idx];
alpha = coef[start + idx]; alpha = coef[start + idx];
// unpack the distribution to the proper location // unpack the distribution to the proper location
if (!(n < 0)) if (!(n < 0))
dist[q * N + n] = alpha*recvbuf[start + idx]; dist[q * N + n] = alpha * recvbuf[start + idx];
} }
} }

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* Implement Mixed Gradient (Lee et al. JCP 2016)*/ /* Implement Mixed Gradient (Lee et al. JCP 2016)*/
extern "C" void ScaLBL_D3Q19_MixedGradient(int *Map, double *Phi, extern "C" void ScaLBL_D3Q19_MixedGradient(int *Map, double *Phi,

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
extern "C" void ScaLBL_D3Q19_AAeven_StokesMRT( extern "C" void ScaLBL_D3Q19_AAeven_StokesMRT(
@ -38,12 +54,20 @@ extern "C" void ScaLBL_D3Q19_AAeven_StokesMRT(
Ey = ElectricField[n + 1 * Np]; Ey = ElectricField[n + 1 * Np];
Ez = ElectricField[n + 2 * Np]; Ez = ElectricField[n + 2 * Np];
//compute total body force, including input body force (Gx,Gy,Gz) //compute total body force, including input body force (Gx,Gy,Gz)
Fx = (UseSlippingVelBC==1) ? Gx : Gx + rhoE * Ex * (time_conv * time_conv) / (h * h * 1.0e-12) / Fx =
den_scale; //the extra factors at the end necessarily convert unit from phys to LB (UseSlippingVelBC == 1)
Fy = (UseSlippingVelBC==1) ? Gy : Gy + rhoE * Ey * (time_conv * time_conv) / (h * h * 1.0e-12) / ? Gx
den_scale; : Gx +
Fz = (UseSlippingVelBC==1) ? Gz : Gz + rhoE * Ez * (time_conv * time_conv) / (h * h * 1.0e-12) / rhoE * Ex * (time_conv * time_conv) / (h * h * 1.0e-12) /
den_scale; den_scale; //the extra factors at the end necessarily convert unit from phys to LB
Fy = (UseSlippingVelBC == 1)
? Gy
: Gy + rhoE * Ey * (time_conv * time_conv) /
(h * h * 1.0e-12) / den_scale;
Fz = (UseSlippingVelBC == 1)
? Gz
: Gz + rhoE * Ez * (time_conv * time_conv) /
(h * h * 1.0e-12) / den_scale;
// q=0 // q=0
fq = dist[n]; fq = dist[n];
@ -520,13 +544,21 @@ extern "C" void ScaLBL_D3Q19_AAodd_StokesMRT(
//Fz = Gz + rhoE * Ez * (time_conv * time_conv) / (h * h * 1.0e-12) / //Fz = Gz + rhoE * Ez * (time_conv * time_conv) / (h * h * 1.0e-12) /
// den_scale; // den_scale;
//When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral //When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral
//and body force induced by external efectric field is reduced to slipping velocity BC. //and body force induced by external efectric field is reduced to slipping velocity BC.
Fx = (UseSlippingVelBC==1) ? Gx : Gx + rhoE * Ex * (time_conv * time_conv) / (h * h * 1.0e-12) / Fx =
den_scale; //the extra factors at the end necessarily convert unit from phys to LB (UseSlippingVelBC == 1)
Fy = (UseSlippingVelBC==1) ? Gy : Gy + rhoE * Ey * (time_conv * time_conv) / (h * h * 1.0e-12) / ? Gx
den_scale; : Gx +
Fz = (UseSlippingVelBC==1) ? Gz : Gz + rhoE * Ez * (time_conv * time_conv) / (h * h * 1.0e-12) / rhoE * Ex * (time_conv * time_conv) / (h * h * 1.0e-12) /
den_scale; den_scale; //the extra factors at the end necessarily convert unit from phys to LB
Fy = (UseSlippingVelBC == 1)
? Gy
: Gy + rhoE * Ey * (time_conv * time_conv) /
(h * h * 1.0e-12) / den_scale;
Fz = (UseSlippingVelBC == 1)
? Gz
: Gz + rhoE * Ez * (time_conv * time_conv) /
(h * h * 1.0e-12) / den_scale;
// q=0 // q=0
fq = dist[n]; fq = dist[n];

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,2 +1,18 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// cpu implementation for thermal lattice boltzmann methods // cpu implementation for thermal lattice boltzmann methods
// copyright James McClure, 2014 // copyright James McClure, 2014

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#define NBLOCKS 1024 #define NBLOCKS 1024

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <cuda_profiler_api.h> #include <cuda_profiler_api.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Basic cuda functions callable from C/C++ code // Basic cuda functions callable from C/C++ code
#include <cuda.h> #include <cuda.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <cooperative_groups.h> #include <cooperative_groups.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// GPU Functions for D3Q7 Lattice Boltzmann Methods // GPU Functions for D3Q7 Lattice Boltzmann Methods
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <cuda_profiler_api.h> #include <cuda_profiler_api.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
// Basic cuda functions callable from C/C++ code // Basic cuda functions callable from C/C++ code
#include <cuda.h> #include <cuda.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#include <cuda_profiler_api.h> #include <cuda_profiler_api.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#define NBLOCKS 1024 #define NBLOCKS 1024

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
//#include <cuda_profiler_api.h> //#include <cuda_profiler_api.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
//************************************************************************* //*************************************************************************
// CUDA kernels for single-phase ScaLBL_D3Q19_MRT code // CUDA kernels for single-phase ScaLBL_D3Q19_MRT code
// James McClure // James McClure

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
/* Implement Mixed Gradient (Lee et al. JCP 2016)*/ /* Implement Mixed Gradient (Lee et al. JCP 2016)*/
#include <cuda.h> #include <cuda.h>
#include <stdio.h> #include <stdio.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
//#include <cuda_profiler_api.h> //#include <cuda_profiler_api.h>

View File

@ -1,3 +1,19 @@
/*
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
Copyright Equnior ASA
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
//#include <cuda_profiler_api.h> //#include <cuda_profiler_api.h>

Some files were not shown because too many files have changed in this diff Show More