Merge branch 'master' of github.com:JamesEMcClure/LBPM-WIA
This commit is contained in:
commit
88897e73e2
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 IO_HELPERS_INC
|
||||
#define IO_HELPERS_INC
|
||||
|
||||
|
|
30
IO/Mesh.cpp
30
IO/Mesh.cpp
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "Mesh.h"
|
||||
#include "IO/IOHelpers.h"
|
||||
#include "common/Utilities.h"
|
||||
|
|
15
IO/Mesh.h
15
IO/Mesh.h
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 MESH_INC
|
||||
#define MESH_INC
|
||||
|
||||
|
|
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "IO/MeshDatabase.h"
|
||||
#include "IO/IOHelpers.h"
|
||||
#include "IO/Mesh.h"
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 MeshDatabase_INC
|
||||
#define MeshDatabase_INC
|
||||
|
||||
|
|
15
IO/PIO.cpp
15
IO/PIO.cpp
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "IO/PIO.h"
|
||||
#include "common/MPI.h"
|
||||
#include "common/Utilities.h"
|
||||
|
|
15
IO/PIO.h
15
IO/PIO.h
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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_PIO
|
||||
#define included_PIO
|
||||
|
||||
|
|
30
IO/PIO.hpp
30
IO/PIO.hpp
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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_PIO_hpp
|
||||
#define included_PIO_hpp
|
||||
|
||||
|
|
|
@ -1,24 +1,8 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "IO/Reader.h"
|
||||
#include "IO/HDF5_IO.h"
|
||||
#include "IO/IOHelpers.h"
|
||||
#include "IO/Mesh.h"
|
||||
#include "IO/MeshDatabase.h"
|
||||
#include "IO/silo.h"
|
||||
#include "common/Utilities.h"
|
||||
|
||||
#include <ProfilerApp.h>
|
||||
|
|
15
IO/Reader.h
15
IO/Reader.h
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 READER_INC
|
||||
#define READER_INC
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "IO/Writer.h"
|
||||
#include "IO/HDF5_IO.h"
|
||||
#include "IO/IOHelpers.h"
|
||||
|
|
15
IO/Writer.h
15
IO/Writer.h
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 WRITER_INC
|
||||
#define WRITER_INC
|
||||
|
||||
|
|
15
IO/silo.cpp
15
IO/silo.cpp
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "IO/silo.h"
|
||||
#include "common/MPI.h"
|
||||
#include "common/Utilities.h"
|
||||
|
|
15
IO/silo.h
15
IO/silo.h
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 SILO_INTERFACE
|
||||
#define SILO_INTERFACE
|
||||
|
||||
|
|
30
IO/silo.hpp
30
IO/silo.hpp
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 SILO_INTERFACE_HPP
|
||||
#define SILO_INTERFACE_HPP
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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_StackTrace
|
||||
#define included_StackTrace
|
||||
|
||||
|
|
|
@ -141,6 +141,12 @@ ElectroChemistryAnalyzer::ElectroChemistryAnalyzer(ScaLBL_IonModel &IonModel)
|
|||
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_membrane rho_%lu_in_membrane ", i, i);
|
||||
fprintf(TIMELOG, "jx_%lu_out jx_%lu_in ",i, i);
|
||||
fprintf(TIMELOG, "jx_%lu_out_membrane jx_%lu_in_membrane ", i, i);
|
||||
fprintf(TIMELOG, "jy_%lu_out jy_%lu_in ",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_membrane count_in_membrane\n");
|
||||
|
@ -188,10 +194,25 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
|
|||
double value_membrane_in_local, value_membrane_out_local;
|
||||
double value_membrane_in_global, value_membrane_out_global;
|
||||
|
||||
/* flux terms */
|
||||
double jx_membrane_in_local, jx_membrane_out_local;
|
||||
double jy_membrane_in_local, jy_membrane_out_local;
|
||||
double jz_membrane_in_local, jz_membrane_out_local;
|
||||
double jx_in_local, jx_out_local;
|
||||
double jy_in_local, jy_out_local;
|
||||
double jz_in_local, jz_out_local;
|
||||
|
||||
double jx_membrane_in_global, jx_membrane_out_global;
|
||||
double jy_membrane_in_global, jy_membrane_out_global;
|
||||
double jz_membrane_in_global, jz_membrane_out_global;
|
||||
double jx_in_global, jx_out_global;
|
||||
double jy_in_global, jy_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_global_count, membrane_out_global_count;
|
||||
|
||||
double memdist,value;
|
||||
double memdist,value,jx,jy,jz;
|
||||
in_local_count = 0;
|
||||
out_local_count = 0;
|
||||
membrane_in_local_count = 0;
|
||||
|
@ -201,7 +222,7 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
|
|||
value_membrane_out_local = 0.0;
|
||||
value_in_local = 0.0;
|
||||
value_out_local = 0.0;
|
||||
for (k = 1; k < Nz; k++) {
|
||||
for (k = Dm->inlet_layers_z; k < Nz; k++) {
|
||||
for (j = 1; j < Ny; j++) {
|
||||
for (i = 1; i < Nx; i++) {
|
||||
/* electric potential */
|
||||
|
@ -258,29 +279,58 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
|
|||
value_out_local = 0.0;
|
||||
for (size_t ion = 0; ion < Ion.number_ion_species; ion++) {
|
||||
Ion.getIonConcentration(Rho, ion);
|
||||
Ion.getIonFluxDiffusive(IonFluxDiffusive_x, IonFluxDiffusive_y, IonFluxDiffusive_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_out_local = 0.0;
|
||||
value_in_local = 0.0;
|
||||
value_out_local = 0.0;
|
||||
for (k = 1; k < Nz; k++) {
|
||||
|
||||
jx_membrane_in_local = jy_membrane_in_local = jz_membrane_in_local = 0.0;
|
||||
jx_membrane_out_local = jy_membrane_out_local = jz_membrane_out_local = 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 (j = 1; j < Ny; j++) {
|
||||
for (i = 1; i < Nx; i++) {
|
||||
/* electric potential */
|
||||
memdist = Ion.MembraneDistance(i,j,k);
|
||||
value = Rho(i,j,k);
|
||||
jx = IonFluxDiffusive_x(i,j,k) + IonFluxAdvective_x(i,j,k) + IonFluxElectrical_x(i,j,k);
|
||||
jy = IonFluxDiffusive_y(i,j,k) + IonFluxAdvective_y(i,j,k) + IonFluxElectrical_y(i,j,k);
|
||||
jz = IonFluxDiffusive_z(i,j,k) + IonFluxAdvective_z(i,j,k) + IonFluxElectrical_z(i,j,k);
|
||||
|
||||
if (memdist < 0.0){
|
||||
// inside the membrane
|
||||
if (fabs(memdist) < 1.0){
|
||||
value_membrane_in_local += value;
|
||||
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 {
|
||||
// outside the membrane
|
||||
if (fabs(memdist) < 1.0){
|
||||
value_membrane_out_local += value;
|
||||
jx_membrane_out_local += jx;
|
||||
jy_membrane_out_local += jy;
|
||||
jz_membrane_out_local += jz;
|
||||
|
||||
}
|
||||
value_out_local += value;
|
||||
jx_out_local += jx;
|
||||
jy_out_local += jy;
|
||||
jz_out_local += jz;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,11 +345,56 @@ void ElectroChemistryAnalyzer::Membrane(ScaLBL_IonModel &Ion,
|
|||
value_membrane_out_global /= membrane_out_global_count;
|
||||
value_membrane_in_global /= membrane_in_global_count;
|
||||
|
||||
jx_out_global = Dm->Comm.sumReduce(jx_out_local);
|
||||
jx_in_global = Dm->Comm.sumReduce(jx_in_local);
|
||||
jx_membrane_out_global = Dm->Comm.sumReduce(jx_membrane_out_local);
|
||||
jx_membrane_in_global = Dm->Comm.sumReduce(jx_membrane_in_local);
|
||||
|
||||
jx_out_global /= out_global_count;
|
||||
jx_in_global /= in_global_count;
|
||||
jx_membrane_out_global /= membrane_out_global_count;
|
||||
jx_membrane_in_global /= membrane_in_global_count;
|
||||
|
||||
jy_out_global = Dm->Comm.sumReduce(jy_out_local);
|
||||
jy_in_global = Dm->Comm.sumReduce(jy_in_local);
|
||||
jy_membrane_out_global = Dm->Comm.sumReduce(jy_membrane_out_local);
|
||||
jy_membrane_in_global = Dm->Comm.sumReduce(jy_membrane_in_local);
|
||||
|
||||
jy_out_global /= out_global_count;
|
||||
jy_in_global /= in_global_count;
|
||||
jy_membrane_out_global /= membrane_out_global_count;
|
||||
jy_membrane_in_global /= membrane_in_global_count;
|
||||
|
||||
jz_out_global = Dm->Comm.sumReduce(jz_out_local);
|
||||
jz_in_global = Dm->Comm.sumReduce(jz_in_local);
|
||||
jz_membrane_out_global = Dm->Comm.sumReduce(jz_membrane_out_local);
|
||||
jz_membrane_in_global = Dm->Comm.sumReduce(jz_membrane_in_local);
|
||||
|
||||
jz_out_global /= out_global_count;
|
||||
jz_in_global /= in_global_count;
|
||||
jz_membrane_out_global /= membrane_out_global_count;
|
||||
jz_membrane_in_global /= membrane_in_global_count;
|
||||
|
||||
if (Dm->rank() == 0) {
|
||||
fprintf(TIMELOG, "%.8g ", value_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", value_in_global);
|
||||
fprintf(TIMELOG, "%.8g ", value_membrane_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", value_membrane_in_global);
|
||||
|
||||
fprintf(TIMELOG, "%.8g ", jx_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jx_in_global);
|
||||
fprintf(TIMELOG, "%.8g ", jx_membrane_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jx_membrane_in_global);
|
||||
|
||||
fprintf(TIMELOG, "%.8g ", jy_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jy_in_global);
|
||||
fprintf(TIMELOG, "%.8g ", jy_membrane_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jy_membrane_in_global);
|
||||
|
||||
fprintf(TIMELOG, "%.8g ", jz_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jz_in_global);
|
||||
fprintf(TIMELOG, "%.8g ", jz_membrane_out_global);
|
||||
fprintf(TIMELOG, "%.8g ", jz_membrane_in_global);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,6 +527,31 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
|
|||
char VisName[40];
|
||||
auto format = vis_db->getWithDefault<string>( "format", "hdf5" );
|
||||
|
||||
if (Dm->rank() == 0) {
|
||||
printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n", format.c_str());
|
||||
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_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_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_electric_field", false)) {
|
||||
printf(" save electric field \n");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<IO::MeshDataStruct> visData;
|
||||
fillHalo<double> fillData(Dm->Comm, Dm->rank_info,
|
||||
{Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1},
|
||||
|
@ -962,6 +1082,31 @@ void ElectroChemistryAnalyzer::WriteVis(ScaLBL_IonModel &Ion,
|
|||
{Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1},
|
||||
0, 1);
|
||||
|
||||
if (Dm->rank() == 0) {
|
||||
printf("ElectroChemistryAnalyzer::WriteVis (format = %s)\n", format.c_str());
|
||||
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_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_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_electric_field", false)) {
|
||||
printf(" save electric field \n");
|
||||
}
|
||||
}
|
||||
|
||||
IO::initialize("",format,"false");
|
||||
// Create the MeshDataStruct
|
||||
visData.resize(1);
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/pmmc.h"
|
||||
#include "analysis/analysis.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#ifndef Minkowski_INC
|
||||
#define Minkowski_INC
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define PointList_INC
|
||||
|
||||
|
|
|
@ -430,11 +430,11 @@ void SubPhase::Basic() {
|
|||
//double total_flow_rate = water_flow_rate + not_water_flow_rate;
|
||||
//double fractional_flow = water_flow_rate / total_flow_rate;
|
||||
double h = Dm->voxel_length;
|
||||
double krn = h * h * nu_n * Porosity* Porosity * not_water_flow_rate / force_mag;
|
||||
double krw = h * h * nu_w * Porosity* Porosity* 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;
|
||||
/* not counting films */
|
||||
double krnf = krn - h * h * nu_n * Porosity* Porosity * not_water_film_flow_rate / force_mag;
|
||||
double krwf = krw - h * h * nu_w * Porosity* Porosity * water_film_flow_rate / force_mag;
|
||||
double krnf = krn - h * h * nu_n * Porosity * not_water_film_flow_rate / 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
|
||||
|
||||
fprintf(TIMELOG,
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/pmmc.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#ifndef TwoPhase_INC
|
||||
#define TwoPhase_INC
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
/*
|
||||
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 "ProfilerApp.h"
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define Analysis_H_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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"
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define Distance_H_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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 "math.h"
|
||||
#include "ProfilerApp.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define Filters_H_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
* copyright 2014, James E. McClure
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#ifndef included_imfilter
|
||||
#define included_imfilter
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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 "ProfilerApp.h"
|
||||
#include <math.h>
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define pmmc_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#include "analysis/runAnalysis.h"
|
||||
#include "analysis/analysis.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define RunAnalysis_H_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/analysis.h"
|
||||
#include "analysis/distance.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define uCT_H_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_ArrayClass
|
||||
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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
|
||||
#define included_ArrayClass_hpp
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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"
|
||||
|
||||
/********************************************************
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define COMMUNICATION_H_INC
|
||||
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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
|
||||
#define COMMUNICATION_HPP_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/Utilities.h"
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_Database
|
||||
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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
|
||||
#define included_Database_hpp
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
// Created by James McClure
|
||||
// Copyright 2008-2020
|
||||
#include <stdio.h>
|
||||
|
@ -355,20 +339,7 @@ void Domain::initialize(std::shared_ptr<Database> db) {
|
|||
// Initialize ranks
|
||||
int myrank = Comm.getRank();
|
||||
rank_info = RankInfoStruct(myrank, nproc[0], nproc[1], nproc[2]);
|
||||
// inlet layers only apply to lower part of domain
|
||||
if (rank_info.ix > 0)
|
||||
inlet_layers_x = 0;
|
||||
if (rank_info.jy > 0)
|
||||
inlet_layers_y = 0;
|
||||
if (rank_info.kz > 0)
|
||||
inlet_layers_z = 0;
|
||||
// outlet layers only apply to top part of domain
|
||||
if (rank_info.ix < nproc[0] - 1)
|
||||
outlet_layers_x = 0;
|
||||
if (rank_info.jy < nproc[1] - 1)
|
||||
outlet_layers_y = 0;
|
||||
if (rank_info.kz < nproc[2] - 1)
|
||||
outlet_layers_z = 0;
|
||||
|
||||
// Fill remaining variables
|
||||
N = Nx * Ny * Nz;
|
||||
Volume = nx * ny * nz * nproc[0] * nproc[1] * nproc[2] * 1.0;
|
||||
|
@ -907,6 +878,22 @@ void Domain::Decomp(const std::string &Filename) {
|
|||
}
|
||||
delete[] SegData;
|
||||
}
|
||||
/************************/
|
||||
// inlet layers only apply to lower part of domain
|
||||
if (rank_info.ix > 0)
|
||||
inlet_layers_x = 0;
|
||||
if (rank_info.jy > 0)
|
||||
inlet_layers_y = 0;
|
||||
if (rank_info.kz > 0)
|
||||
inlet_layers_z = 0;
|
||||
// outlet layers only apply to top part of domain
|
||||
if (rank_info.ix < nproc[0] - 1)
|
||||
outlet_layers_x = 0;
|
||||
if (rank_info.jy < nproc[1] - 1)
|
||||
outlet_layers_y = 0;
|
||||
if (rank_info.kz < nproc[2] - 1)
|
||||
outlet_layers_z = 0;
|
||||
/************************/
|
||||
Comm.barrier();
|
||||
ComputePorosity();
|
||||
}
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define Domain_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_FunctionTable
|
||||
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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
|
||||
#define included_FunctionTable_hpp
|
||||
|
||||
|
|
17
common/MPI.h
17
common/MPI.h
|
@ -2,23 +2,6 @@
|
|||
// Note this is a modified version of the MPI class for the Advanced Multi-Physics Package
|
||||
// Used with permission
|
||||
|
||||
/*
|
||||
|
||||
Copyright (c) 2012 UT-Battelle, LLC
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
provided that the following conditions are met: Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following disclaimer. Redistributions in binary
|
||||
form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the distribution. Collection of
|
||||
administrative costs for redistribution of the source code or binary form is allowed. However,
|
||||
collection of a royalty or other fee in excess of good faith amount for cost recovery for such
|
||||
redistribution is prohibited.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef included_LBPM_MPI
|
||||
#define included_LBPM_MPI
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ Membrane::Membrane(std::shared_ptr <ScaLBL_Communicator> sComm, int *dvcNeighbor
|
|||
//......................................................................................
|
||||
// Create a separate copy of the communicator for the device
|
||||
MPI_COMM_SCALBL = sComm->MPI_COMM_SCALBL.dup();
|
||||
int myrank = sComm->MPI_COMM_SCALBL.getRank();
|
||||
rank_info = RankInfoStruct(myrank, rank_info.nx, rank_info.ny, rank_info.nz);
|
||||
|
||||
ScaLBL_CopyToHost(initialNeighborList, dvcNeighborList, 18*Np*sizeof(int));
|
||||
sComm->MPI_COMM_SCALBL.barrier();
|
||||
|
@ -38,6 +40,8 @@ Membrane::Membrane(std::shared_ptr <ScaLBL_Communicator> sComm, int *dvcNeighbor
|
|||
rank_Y=sComm->rank_Y;
|
||||
rank_Z=sComm->rank_Z;
|
||||
|
||||
BoundaryCondition = sComm->BoundaryCondition;
|
||||
|
||||
if (rank == 0){
|
||||
printf("**** Creating membrane data structure ****** \n");
|
||||
printf(" Number of active lattice sites (rank = %i): %i \n",rank, Np);
|
||||
|
@ -828,7 +832,7 @@ void Membrane::SendD3Q7AA(double *dist){
|
|||
|
||||
}
|
||||
|
||||
void Membrane::RecvD3Q7AA(double *dist){
|
||||
void Membrane::RecvD3Q7AA(double *dist, bool BounceBack){
|
||||
|
||||
//...................................................................................
|
||||
// Wait for completion of D3Q19 communication
|
||||
|
@ -851,12 +855,21 @@ void Membrane::RecvD3Q7AA(double *dist){
|
|||
//...Packing for Y face(q=3).................................
|
||||
ScaLBL_D3Q7_Membrane_Unpack(3,dvcRecvDist_Y, recvbuf_Y,recvCount_Y,dist,Np,coefficient_Y);
|
||||
//...................................................................................
|
||||
//if (BoundaryCondition > 0 && rank_info.kz == 0)
|
||||
if (BounceBack && rank_info.kz == 0)
|
||||
{/* leave the bounce-back distributions in place */}
|
||||
else {
|
||||
//...Packing for z face(q=6)................................
|
||||
ScaLBL_D3Q7_Membrane_Unpack(6,dvcRecvDist_z, recvbuf_z, recvCount_z,dist,Np,coefficient_z);
|
||||
}
|
||||
//if (BoundaryCondition > 0 && rank_info.kz == rank_info.nz-1)
|
||||
if (BounceBack && rank_info.kz == rank_info.nz-1)
|
||||
{/* leave the bounce-back distributions in place */}
|
||||
else {
|
||||
//...Packing for Z face(q=5)................................
|
||||
ScaLBL_D3Q7_Membrane_Unpack(5,dvcRecvDist_Z, recvbuf_Z,recvCount_Z,dist,Np,coefficient_Z);
|
||||
//..................................................................................
|
||||
|
||||
}
|
||||
MPI_COMM_SCALBL.barrier();
|
||||
//...................................................................................
|
||||
Lock=false; // unlock the communicator after communications complete
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
int Np;
|
||||
int Nx,Ny,Nz,N;
|
||||
int membraneLinkCount;
|
||||
int BoundaryCondition;
|
||||
|
||||
int *initialNeighborList; // original neighborlist
|
||||
int *NeighborList; // modified neighborlist
|
||||
|
@ -106,7 +107,7 @@ public:
|
|||
void Read(string filename);
|
||||
|
||||
void SendD3Q7AA(double *dist);
|
||||
void RecvD3Q7AA(double *dist);
|
||||
void RecvD3Q7AA(double *dist, bool BounceBack);
|
||||
void AssignCoefficients(int *Map, double *Psi, double Threshold,
|
||||
double MassFractionIn, double MassFractionOut, double ThresholdMassFractionIn,
|
||||
double ThresholdMassFractionOut);
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2022 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/ScaLBL.h"
|
||||
#include <chrono>
|
||||
|
||||
|
@ -23,6 +7,9 @@ ScaLBL_Communicator::ScaLBL_Communicator(std::shared_ptr <Domain> Dm){
|
|||
//......................................................................................
|
||||
// Create a separate copy of the communicator for the device
|
||||
MPI_COMM_SCALBL = Dm->Comm.dup();
|
||||
int myrank = MPI_COMM_SCALBL.getRank();
|
||||
rank_info = RankInfoStruct(myrank, rank_info.nx, rank_info.ny, rank_info.nz);
|
||||
|
||||
//......................................................................................
|
||||
// Copy the domain size and communication information directly from Dm
|
||||
Nx = Dm->Nx;
|
||||
|
@ -1735,18 +1722,7 @@ void ScaLBL_Communicator::RecvD3Q19AA(double *dist){
|
|||
ScaLBL_D3Q19_Unpack(15,dvcRecvDist_Y,3*recvCount_Y,recvCount_Y,recvbuf_Y,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(17,dvcRecvDist_Y,4*recvCount_Y,recvCount_Y,recvbuf_Y,dist,N);
|
||||
//...................................................................................
|
||||
//...Packing for z face(6,12,13,16,17)................................
|
||||
ScaLBL_D3Q19_Unpack(6,dvcRecvDist_z,0,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(12,dvcRecvDist_z,recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(13,dvcRecvDist_z,2*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(16,dvcRecvDist_z,3*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(17,dvcRecvDist_z,4*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
//...Packing for Z face(5,11,14,15,18)................................
|
||||
ScaLBL_D3Q19_Unpack(5,dvcRecvDist_Z,0,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(11,dvcRecvDist_Z,recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(14,dvcRecvDist_Z,2*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(15,dvcRecvDist_Z,3*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(18,dvcRecvDist_Z,4*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
|
||||
//..................................................................................
|
||||
//...Pack the xy edge (8)................................
|
||||
ScaLBL_D3Q19_Unpack(8,dvcRecvDist_xy,0,recvCount_xy,recvbuf_xy,dist,N);
|
||||
|
@ -1756,22 +1732,42 @@ void ScaLBL_Communicator::RecvD3Q19AA(double *dist){
|
|||
ScaLBL_D3Q19_Unpack(10,dvcRecvDist_xY,0,recvCount_xY,recvbuf_xY,dist,N);
|
||||
//...Pack the XY edge (7)................................
|
||||
ScaLBL_D3Q19_Unpack(7,dvcRecvDist_XY,0,recvCount_XY,recvbuf_XY,dist,N);
|
||||
|
||||
//if (BoundaryCondition == 0 || kproc != 0 ){
|
||||
ScaLBL_D3Q19_Unpack(6,dvcRecvDist_z,0,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(12,dvcRecvDist_z,recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(13,dvcRecvDist_z,2*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(16,dvcRecvDist_z,3*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(17,dvcRecvDist_z,4*recvCount_z,recvCount_z,recvbuf_z,dist,N);
|
||||
|
||||
//...Pack the xz edge (12)................................
|
||||
ScaLBL_D3Q19_Unpack(12,dvcRecvDist_xz,0,recvCount_xz,recvbuf_xz,dist,N);
|
||||
//...Pack the xZ edge (14)................................
|
||||
ScaLBL_D3Q19_Unpack(14,dvcRecvDist_xZ,0,recvCount_xZ,recvbuf_xZ,dist,N);
|
||||
//...Pack the Xz edge (13)................................
|
||||
ScaLBL_D3Q19_Unpack(13,dvcRecvDist_Xz,0,recvCount_Xz,recvbuf_Xz,dist,N);
|
||||
//...Pack the XZ edge (11)................................
|
||||
ScaLBL_D3Q19_Unpack(11,dvcRecvDist_XZ,0,recvCount_XZ,recvbuf_XZ,dist,N);
|
||||
//...Pack the yz edge (16)................................
|
||||
ScaLBL_D3Q19_Unpack(16,dvcRecvDist_yz,0,recvCount_yz,recvbuf_yz,dist,N);
|
||||
//...Pack the yZ edge (18)................................
|
||||
ScaLBL_D3Q19_Unpack(18,dvcRecvDist_yZ,0,recvCount_yZ,recvbuf_yZ,dist,N);
|
||||
//...Pack the Yz edge (17)................................
|
||||
ScaLBL_D3Q19_Unpack(17,dvcRecvDist_Yz,0,recvCount_Yz,recvbuf_Yz,dist,N);
|
||||
|
||||
//}
|
||||
//if (BoundaryCondition == 0 || kproc != nprocz-1){
|
||||
//...Packing for Z face(5,11,14,15,18)................................
|
||||
ScaLBL_D3Q19_Unpack(5,dvcRecvDist_Z,0,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(11,dvcRecvDist_Z,recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(14,dvcRecvDist_Z,2*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(15,dvcRecvDist_Z,3*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
ScaLBL_D3Q19_Unpack(18,dvcRecvDist_Z,4*recvCount_Z,recvCount_Z,recvbuf_Z,dist,N);
|
||||
|
||||
//...Pack the xZ edge (14)................................
|
||||
ScaLBL_D3Q19_Unpack(14,dvcRecvDist_xZ,0,recvCount_xZ,recvbuf_xZ,dist,N);
|
||||
//...Pack the XZ edge (11)................................
|
||||
ScaLBL_D3Q19_Unpack(11,dvcRecvDist_XZ,0,recvCount_XZ,recvbuf_XZ,dist,N);
|
||||
//...Pack the yZ edge (18)................................
|
||||
ScaLBL_D3Q19_Unpack(18,dvcRecvDist_yZ,0,recvCount_yZ,recvbuf_yZ,dist,N);
|
||||
//...Pack the YZ edge (15)................................
|
||||
ScaLBL_D3Q19_Unpack(15,dvcRecvDist_YZ,0,recvCount_YZ,recvbuf_YZ,dist,N);
|
||||
//}
|
||||
|
||||
//...................................................................................
|
||||
Lock=false; // unlock the communicator after communications complete
|
||||
//...................................................................................
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/** @file ScaLBL.h */
|
||||
/* \details Header file for Scalable Lattice Boltzmann Library
|
||||
* Separate implementations for GPU and CPU must both follow the conventions defined in this header
|
||||
|
@ -217,6 +201,39 @@ extern "C" void ScaLBL_D3Q19_AAeven_BGK(double *dist, int start, int finish, int
|
|||
*/
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_BGK(int *neighborList, double *dist, int start, int finish, int Np, double rlx, double Fx, double Fy, double Fz);
|
||||
|
||||
/**
|
||||
* \brief BGK collision based on AA even access pattern for D3Q19
|
||||
* @param dist - D3Q19 distributions
|
||||
* @param start - lattice node to start loop
|
||||
* @param finish - lattice node to finish loop
|
||||
* @param Np - size of local sub-domain (derived from Domain structure)
|
||||
* @param rlx - relaxation parameter
|
||||
* @param Fx - force in x direction
|
||||
* @param Fy - force in y direction
|
||||
* @param Fz - force in z direction
|
||||
*/
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Kubo(double *dist, double *Integral, int start, int finish, int Np);
|
||||
/**
|
||||
* \brief Kubo integral function
|
||||
* @param neighborList - neighbors based on D3Q19 lattice structure
|
||||
* @param dist - D3Q19 distributions
|
||||
* @param integral - time integral
|
||||
* @param start - lattice node to start loop
|
||||
* @param finish - lattice node to finish loop
|
||||
* @param Np - size of local sub-domain (derived from Domain structure)
|
||||
*/
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_Kubo(int *neighborList, double *dist, double *Integral, int start, int finish, int Np);
|
||||
/**
|
||||
* \brief Kubo integral function
|
||||
* @param neighborList - neighbors based on D3Q19 lattice structure
|
||||
* @param dist - D3Q19 distributions
|
||||
* @param integral - time integral
|
||||
* @param start - lattice node to start loop
|
||||
* @param finish - lattice node to finish loop
|
||||
* @param Np - size of local sub-domain (derived from Domain structure)
|
||||
*/
|
||||
|
||||
// MEMBRANE MODEL
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_Membrane_IonTransport(int *membrane, double *coef, double *dist, double *Den, int memLinks, int Np);
|
||||
|
@ -308,6 +325,15 @@ extern "C" void ScaLBL_D3Q7_Ion_Init_FromFile(double *dist, double *Den, int Np)
|
|||
|
||||
extern "C" void ScaLBL_D3Q7_Ion_ChargeDensity(double *Den, double *ChargeDensity, double IonValence, int ion_component, int start, int finish, int Np);
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
|
||||
double *Den, double *ElectricField, double * Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np);
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
|
||||
double *Den, double *ElectricField, double *Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np);
|
||||
|
||||
// LBM Poisson solver
|
||||
|
||||
|
@ -385,12 +411,13 @@ extern "C" void ScaLBL_D3Q19_Poisson_Init(int *Map, double *dist, double *Psi, i
|
|||
extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
||||
double *dist, double *Den_charge,
|
||||
double *Psi, double *ElectricField,
|
||||
double tau, double epsilon_LB, bool UseSlippingVelBC,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np);
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
||||
double *Den_charge, double *Psi,
|
||||
double *ElectricField, double *Error, double tau,
|
||||
double *Den_charge, double *Psi, double *ElectricField, double *Error,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np);
|
||||
|
||||
|
@ -735,6 +762,8 @@ public:
|
|||
//......................................................................................
|
||||
unsigned long int CommunicationCount,SendCount,RecvCount;
|
||||
int Nx,Ny,Nz,N;
|
||||
int iproc,jproc,kproc;
|
||||
int nprocx,nprocy,nprocz;
|
||||
int n_bb_d3q7, n_bb_d3q19;
|
||||
int BoundaryCondition;
|
||||
//......................................................................................
|
||||
|
@ -838,8 +867,6 @@ private:
|
|||
// only one set of Send requests can be active at any time (per instance)
|
||||
int i,j,k,n;
|
||||
|
||||
int iproc,jproc,kproc;
|
||||
int nprocx,nprocy,nprocz;
|
||||
int sendtag,recvtag;
|
||||
// Give the object it's own MPI communicator
|
||||
RankInfoStruct rank_info;
|
||||
|
|
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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 <stdlib.h>
|
||||
#include <iostream>
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define SpherePack_INC
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/Utilities.h"
|
||||
#include <cstring>
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_UnitTest
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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/Utilities.h"
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_Units
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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 "StackTrace/StackTrace.h"
|
||||
#include "StackTrace/ErrorHandlers.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
#define included_Utilities
|
||||
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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.
|
||||
#ifndef included_UtilityMacros
|
||||
#define included_UtilityMacros
|
||||
|
|
16
cpu/BGK.cpp
16
cpu/BGK.cpp
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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,
|
||||
int Np, double rlx, double Fx,
|
||||
double Fy, double Fz) {
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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>
|
||||
|
||||
#define STOKES
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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>
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_Pack(int q, int *list, int start, int count,
|
||||
|
|
16
cpu/D3Q7.cpp
16
cpu/D3Q7.cpp
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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
|
||||
|
||||
extern "C" void ScaLBL_Scalar_Pack(int *list, int count, double *sendbuf,
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2020 Equinor 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>
|
||||
|
||||
extern "C" void
|
||||
|
|
267
cpu/Ion.cpp
267
cpu/Ion.cpp
|
@ -1,6 +1,242 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
/***** pH equilibrium ******/
|
||||
extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
|
||||
double *Den, double *ElectricField, double *Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
int n;
|
||||
double Ex, Ey, Ez; //electrical field
|
||||
double ux, uy, uz;
|
||||
double uEPx, uEPy, uEPz; //electrochemical induced velocity
|
||||
double Ca, Cb;
|
||||
double A0, A1, A2, A3, A4, A5, A6;
|
||||
double B0, B1, B2, B3, B4, B5, B6;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
int nr1, nr2, nr3, nr4, nr5, nr6;
|
||||
double rhoe, tmp;
|
||||
// double factor = Di / (Vt *Vt* ionizationEnergy);
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
//Load data
|
||||
//Ci = Den[n];
|
||||
Ex = ElectricField[n + 0 * Np];
|
||||
Ey = ElectricField[n + 1 * Np];
|
||||
Ez = ElectricField[n + 2 * Np];
|
||||
|
||||
ux = Velocity[n + 0 * Np];
|
||||
uy = Velocity[n + 1 * Np];
|
||||
uz = Velocity[n + 2 * Np];
|
||||
|
||||
uEPx = Di / Vt * Ex;
|
||||
uEPy = Di / Vt * Ey;
|
||||
uEPz = Di / Vt * Ez;
|
||||
|
||||
// q=0
|
||||
// q=1
|
||||
nr1 = neighborList[n]; // neighbor 2 ( > 10Np => odd part of dist)
|
||||
// q=2
|
||||
nr2 = neighborList[n + Np]; // neighbor 1 ( < 10Np => even part of dist)
|
||||
// q=3
|
||||
nr3 = neighborList[n + 2 * Np]; // neighbor 4
|
||||
// q=4
|
||||
nr4 = neighborList[n + 3 * Np]; // neighbor 3
|
||||
// q=5
|
||||
nr5 = neighborList[n + 4 * Np];
|
||||
// q=6
|
||||
nr6 = neighborList[n + 5 * Np];
|
||||
|
||||
A0 = dist[pH_ion*7*Np + n];
|
||||
A1 = dist[pH_ion*7*Np + nr1]; // reading the A1 data into register Aq
|
||||
A2 = dist[pH_ion*7*Np + nr2]; // reading the A2 data into register Aq
|
||||
A3 = dist[pH_ion*7*Np + nr3];
|
||||
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];
|
||||
B1 = dist[hydroxide*7*Np + nr1]; // reading the B1 data into register Bq
|
||||
B2 = dist[hydroxide*7*Np + nr2]; // reading the B2 data into register Bq
|
||||
B3 = dist[hydroxide*7*Np + nr3];
|
||||
B4 = dist[hydroxide*7*Np + nr4];
|
||||
B5 = dist[hydroxide*7*Np + nr5];
|
||||
B6 = dist[hydroxide*7*Np + nr6];
|
||||
*/
|
||||
|
||||
// charge density
|
||||
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
|
||||
//rhoe = Ca - Cb;
|
||||
// new equilibrium
|
||||
tmp = sqrt(rhoe*rhoe + 4.04e-14);
|
||||
Ca = rhoe + tmp;
|
||||
Cb = Ca - rhoe;
|
||||
|
||||
Den[pH_ion*Np + n] = Ca - Cb;
|
||||
|
||||
// proton production
|
||||
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
|
||||
A2 = 0.125 * Ca * (1.0 - 4.0 * (ux + uEPx));
|
||||
A3 = 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);
|
||||
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
|
||||
|
||||
A0 = Ca - (A1+A2+A3+A4+A5+A6);
|
||||
|
||||
// hydroxide ions created by water ionization (no net charge increase)
|
||||
//Cb += (f1 + f2 + f3 + f4 + f5 + f6);
|
||||
// use relative mass of hydroxide + momentum conservation
|
||||
B1 = 0.125 * Cb * (1.0 + 4.0 * (ux - uEPx));
|
||||
B2 = 0.125 * Cb * (1.0 - 4.0 * (ux - uEPx));
|
||||
B3 = 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));
|
||||
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;
|
||||
f1 = A1 - B1;
|
||||
f2 = A2 - B2;
|
||||
f3 = A3 - B3;
|
||||
f4 = A4 - B4;
|
||||
f5 = A5 - B5;
|
||||
f6 = A6 - B6;
|
||||
|
||||
dist[pH_ion*7*Np + n] = f0;
|
||||
dist[pH_ion*7*Np + nr2] = f1;
|
||||
dist[pH_ion*7*Np + nr1] = f2;
|
||||
dist[pH_ion*7*Np + nr4] = f3;
|
||||
dist[pH_ion*7*Np + nr3] = f4;
|
||||
dist[pH_ion*7*Np + nr6] = f5;
|
||||
dist[pH_ion*7*Np + nr5] = f6;
|
||||
/*
|
||||
dist[pH_ion*7*Np + n] = f0;
|
||||
dist[pH_ion*7*Np + nr1] = f1;
|
||||
dist[pH_ion*7*Np + nr2] = f2;
|
||||
dist[pH_ion*7*Np + nr3] = f3;
|
||||
dist[pH_ion*7*Np + nr4] = f4;
|
||||
dist[pH_ion*7*Np + nr5] = f5;
|
||||
dist[pH_ion*7*Np + nr6] = f6;
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
|
||||
double *Den, double *ElectricField, double * Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
|
||||
int n;
|
||||
double Ex, Ey, Ez; //electrical field
|
||||
double ux, uy, uz;
|
||||
double uEPx, uEPy, uEPz; //electrochemical induced velocity
|
||||
double Ca, Cb;
|
||||
double A0, A1, A2, A3, A4, A5, A6;
|
||||
double B0, B1, B2, B3, B4, B5, B6;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
double rhoe, tmp;
|
||||
// double factor = Di / (Vt *Vt* ionizationEnergy);
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
//Load data
|
||||
//Ci = Den[n];
|
||||
Ex = ElectricField[n + 0 * Np];
|
||||
Ey = ElectricField[n + 1 * Np];
|
||||
Ez = ElectricField[n + 2 * Np];
|
||||
|
||||
ux = Velocity[n + 0 * Np];
|
||||
uy = Velocity[n + 1 * Np];
|
||||
uz = Velocity[n + 2 * Np];
|
||||
|
||||
uEPx = Di / Vt * Ex;
|
||||
uEPy = Di / Vt * Ey;
|
||||
uEPz = Di / Vt * Ez;
|
||||
|
||||
A0 = dist[pH_ion*7*Np + n];
|
||||
A1 = dist[pH_ion*7*Np +2 * Np + n];
|
||||
A2 = dist[pH_ion*7*Np +1 * Np + n];
|
||||
A3 = dist[pH_ion*7*Np +4 * Np + n];
|
||||
A4 = dist[pH_ion*7*Np +3 * Np + n];
|
||||
A5 = dist[pH_ion*7*Np +6 * Np + n];
|
||||
A6 = dist[pH_ion*7*Np +5 * Np + n];
|
||||
|
||||
// charge density
|
||||
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
|
||||
//rhoe = Ca - Cb;
|
||||
// new equilibrium
|
||||
tmp = sqrt(rhoe*rhoe + 4.04e-14);
|
||||
Ca = rhoe + tmp;
|
||||
Cb = Ca - rhoe;
|
||||
if (Ca < 0.0) printf("Error in hydronium concentration, %f (charge density = %f) \n", Ca, rhoe);
|
||||
if (Cb < 0.0) printf("Error in hydroxide concentration, %f \n", Cb);
|
||||
|
||||
Den[pH_ion*Np + n] = Ca - Cb;
|
||||
|
||||
// proton production
|
||||
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
|
||||
A2 = 0.125 * Ca * (1.0 - 4.0 * (ux + uEPx));
|
||||
A3 = 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);
|
||||
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
|
||||
|
||||
A0 = Ca - (A1+A2+A3+A4+A5+A6);
|
||||
|
||||
// hydroxide ions created by water ionization (no net charge increase)
|
||||
//Cb += (f1 + f2 + f3 + f4 + f5 + f6);
|
||||
// use relative mass of hydroxide + momentum conservation
|
||||
B1 = 0.125 * Cb * (1.0 + 4.0 * (ux - uEPx));
|
||||
B2 = 0.125 * Cb * (1.0 - 4.0 * (ux - uEPx));
|
||||
B3 = 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));
|
||||
B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz));
|
||||
|
||||
B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6);
|
||||
|
||||
f0 = A0 - B0;
|
||||
f1 = A1 - B1;
|
||||
f2 = A2 - B2;
|
||||
f3 = A3 - B3;
|
||||
f4 = A4 - B4;
|
||||
f5 = A5 - B5;
|
||||
f6 = A6 - B6;
|
||||
|
||||
if (Ez > 0.0 && n == start){
|
||||
printf("Ca = %.5g, Cb = %.5g \n", Ca, Cb);
|
||||
printf(" charge density = %.5g \n", rhoe);
|
||||
printf(" Ez = %.5g, A5 = %.5g, A6 = %.5g \n", Ez, f5, f6);
|
||||
}
|
||||
|
||||
dist[pH_ion*7*Np + n] = f0;
|
||||
dist[pH_ion*7*Np +1 * Np + n] = f1;
|
||||
dist[pH_ion*7*Np +2 * Np + n] = f2;
|
||||
dist[pH_ion*7*Np +3 * Np + n] = f3;
|
||||
dist[pH_ion*7*Np +4 * Np + n] = f4;
|
||||
dist[pH_ion*7*Np +5 * Np + n] = f5;
|
||||
dist[pH_ion*7*Np +6 * Np + n] = f6;
|
||||
/*
|
||||
dist[pH_ion*7*Np +2 * Np + n] = f1;
|
||||
dist[pH_ion*7*Np +1 * Np + n] = f2;
|
||||
dist[pH_ion*7*Np +4 * Np + n] = f3;
|
||||
dist[pH_ion*7*Np +3 * Np + n] = f4;
|
||||
dist[pH_ion*7*Np +6 * Np + n] = f5;
|
||||
dist[pH_ion*7*Np +5 * Np + n] = f6;
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
/**** 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){
|
||||
|
@ -350,7 +586,6 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion_v0(
|
|||
double Ex, Ey, Ez; //electrical field
|
||||
double flux_diffusive_x, flux_diffusive_y, flux_diffusive_z;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
//double X,Y,Z, factor_x, factor_y, factor_z;
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
|
@ -503,47 +738,32 @@ extern "C" void ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist,
|
|||
|
||||
Den[n] = Ci;
|
||||
|
||||
/* use logistic function to prevent negative distributions*/
|
||||
//X = 4.0 * (ux + uEPx);
|
||||
//Y = 4.0 * (uy + uEPy);
|
||||
//Z = 4.0 * (uz + uEPz);
|
||||
//factor_x = X / sqrt(1 + X*X);
|
||||
//factor_y = Y / sqrt(1 + Y*Y);
|
||||
//factor_z = Z / sqrt(1 + Z*Z);
|
||||
|
||||
// q=0
|
||||
dist[n] = f0 * (1.0 - rlx) + rlx * 0.25 * Ci;
|
||||
|
||||
// q = 1
|
||||
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 + factor_x);
|
||||
|
||||
|
||||
// q=2
|
||||
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 - factor_x);
|
||||
|
||||
// q = 3
|
||||
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 + factor_y );
|
||||
|
||||
// q = 4
|
||||
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 - factor_y);
|
||||
|
||||
// q = 5
|
||||
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 + factor_z);
|
||||
|
||||
// q = 6
|
||||
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 - factor_z);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +779,6 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion(
|
|||
double Ex, Ey, Ez; //electrical field
|
||||
double flux_diffusive_x, flux_diffusive_y, flux_diffusive_z;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
//double X,Y,Z, factor_x, factor_y, factor_z;
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
|
@ -600,46 +819,32 @@ extern "C" void ScaLBL_D3Q7_AAeven_Ion(
|
|||
|
||||
Den[n] = Ci;
|
||||
|
||||
/* use logistic function to prevent negative distributions*/
|
||||
//X = 4.0 * (ux + uEPx);
|
||||
//Y = 4.0 * (uy + uEPy);
|
||||
//Z = 4.0 * (uz + uEPz);
|
||||
//factor_x = X / sqrt(1 + X*X);
|
||||
//factor_y = Y / sqrt(1 + Y*Y);
|
||||
//factor_z = Z / sqrt(1 + Z*Z);
|
||||
|
||||
// q=0
|
||||
dist[n] = f0 * (1.0 - rlx) + rlx * 0.25 * Ci;
|
||||
|
||||
// q = 1
|
||||
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 + factor_x);
|
||||
|
||||
// q=2
|
||||
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 - factor_x);
|
||||
|
||||
// q = 3
|
||||
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 + factor_y);
|
||||
|
||||
// q = 4
|
||||
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 - factor_y);
|
||||
|
||||
// q = 5
|
||||
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 + factor_z);
|
||||
|
||||
// q = 6
|
||||
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 - factor_z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
cpu/MRT.cpp
16
cpu/MRT.cpp
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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,
|
||||
int Ny, int Nz) {
|
||||
int n, N;
|
||||
|
|
557
cpu/Poisson.cpp
557
cpu/Poisson.cpp
|
@ -1,4 +1,5 @@
|
|||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
extern "C" void
|
||||
ScaLBL_D3Q7_AAodd_Poisson_ElectricPotential(int *neighborList, int *Map,
|
||||
|
@ -101,12 +102,18 @@ extern "C" void ScaLBL_D3Q7_AAodd_Poisson(int *neighborList, int *Map,
|
|||
int n;
|
||||
double psi; //electric potential
|
||||
double Ex, Ey, Ez; //electric field
|
||||
double rho_e; //local charge density
|
||||
double rho_e, rho_p; //local charge density
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
int nr1, nr2, nr3, nr4, nr5, nr6;
|
||||
double rlx = 1.0 / tau;
|
||||
int idx;
|
||||
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = electron_charge / (kb * T); // 1 / thermal voltage; unit [Vy]
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
//Load data
|
||||
|
@ -116,6 +123,10 @@ extern "C" void ScaLBL_D3Q7_AAodd_Poisson(int *neighborList, int *Map,
|
|||
idx = Map[n];
|
||||
psi = Psi[idx];
|
||||
|
||||
/* Compute H30+ OH- charge density from Poisson Boltzmann statistics */
|
||||
rho_p = 1.04e-7 * (exp(psi*Vt) - exp((-1.0)*psi*Vt));
|
||||
rho_e += rho_p;
|
||||
|
||||
// q=0
|
||||
f0 = dist[n];
|
||||
// q=1
|
||||
|
@ -182,11 +193,17 @@ extern "C" void ScaLBL_D3Q7_AAeven_Poisson(int *Map, double *dist,
|
|||
int n;
|
||||
double psi; //electric potential
|
||||
double Ex, Ey, Ez; //electric field
|
||||
double rho_e; //local charge density
|
||||
double rho_e, rho_p; //local charge density
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
double rlx = 1.0 / tau;
|
||||
int idx;
|
||||
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = electron_charge / (kb * T); // 1 / thermal voltage; unit [Vy]
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
//Load data
|
||||
|
@ -196,6 +213,10 @@ extern "C" void ScaLBL_D3Q7_AAeven_Poisson(int *Map, double *dist,
|
|||
idx = Map[n];
|
||||
psi = Psi[idx];
|
||||
|
||||
/* Compute H30+ OH- charge density from Poisson Boltzmann statistics */
|
||||
rho_p = 1.04e-7 * (exp(psi*Vt) - exp((-1.0)*psi*Vt));
|
||||
rho_e += rho_p;
|
||||
|
||||
f0 = dist[n];
|
||||
f1 = dist[2 * Np + n];
|
||||
f2 = dist[1 * Np + n];
|
||||
|
@ -630,13 +651,10 @@ extern "C" void ScaLBL_D3Q19_AAeven_Poisson_ElectricPotential(
|
|||
Psi[idx] = psi - 0.5*rho_e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
||||
double *dist, double *Den_charge,
|
||||
double *Psi, double *ElectricField,
|
||||
double tau, double epsilon_LB, bool UseSlippingVelBC,
|
||||
double tau, double Vt, double Cp, double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
int n;
|
||||
double psi; //electric potential
|
||||
|
@ -813,8 +831,10 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
||||
double *Den_charge, double *Psi,
|
||||
double *ElectricField, double *Error, double tau,
|
||||
double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
|
||||
int n;
|
||||
double psi; //electric potential
|
||||
double Ex, Ey, Ez; //electric field
|
||||
|
@ -833,7 +853,8 @@ extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
|||
//Load data
|
||||
//When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral
|
||||
//and thus the net space charge density is zero.
|
||||
rho_e = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n] / epsilon_LB;
|
||||
//rho_e = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n] / epsilon_LB;
|
||||
rho_e = Den_charge[n] / epsilon_LB;
|
||||
|
||||
f0 = dist[n];
|
||||
f1 = dist[2 * Np + n];
|
||||
|
@ -917,19 +938,476 @@ extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson_Potential_BC_z(int *list, double *dist, double Vin, int count, int Np) {
|
||||
/** **/
|
||||
extern "C" void ScaLBL_D3Q19_AAodd_Poisson_Grotthus(int *neighborList, int *Map,
|
||||
double *dist, double *Den_charge,
|
||||
double *Psi, double *ElectricField,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
int n;
|
||||
double psi, psit; //electric potential
|
||||
double Ex, Ey, Ez; //electric field
|
||||
double rho_i, rho_p, rho_e; //local charge density
|
||||
double f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
|
||||
f16, f17, f18;
|
||||
int nr1, nr2, nr3, nr4, nr5, nr6, nr7, nr8, nr9, nr10, nr11, nr12, nr13,
|
||||
nr14, nr15, nr16, nr17, nr18;
|
||||
double sum_q;
|
||||
double rlx = 1.0 / tau;
|
||||
int idx;
|
||||
|
||||
double W0 = 0.5;
|
||||
double W1 = 1.0/24.0;
|
||||
double W2 = 1.0/48.0;
|
||||
int nread, nr5;
|
||||
|
||||
double F,G,Fprime;
|
||||
double factor = 1.0 / epsilon_LB;
|
||||
double inVt = 1.0 / Vt;
|
||||
double expsum, expdiff, term, xv;
|
||||
|
||||
/* exponential series coefficients */
|
||||
double a3 = 0.3333333333333333;
|
||||
double a4 = 0.25; //0.08333333333333333;
|
||||
double a5 = 0.2; // 0.01666666666666667;
|
||||
double a6 = 0.1666666666666667;//0.002777777777777778;
|
||||
double a7 = 0.1428571428571428; //0.0003968253968253968;
|
||||
double a8 = 0.125; //4.96031746031746e-05;
|
||||
double a9 = 0.1111111111111111; //5.511463844797179e-06;
|
||||
double a10 = 0.1; //5.511463844797178e-07;
|
||||
double a11 = 0.09090909090909091; //5.010421677088344e-08;
|
||||
double a12 = 0.08333333333333333; //4.17535139757362e-09;
|
||||
double a13 = 0.07692307692307693;
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
//Load data
|
||||
//When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral
|
||||
//and thus the net space charge density is zero.
|
||||
rho_i = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n];
|
||||
|
||||
// q=0
|
||||
f0 = dist[n];
|
||||
// q=1
|
||||
nr1 = neighborList[n]; // neighbor 2 ( > 10Np => odd part of dist)
|
||||
f1 = dist[nr1]; // reading the f1 data into register fq
|
||||
|
||||
nr2 = neighborList[n + Np]; // neighbor 1 ( < 10Np => even part of dist)
|
||||
f2 = dist[nr2]; // reading the f2 data into register fq
|
||||
|
||||
// q=3
|
||||
nr3 = neighborList[n + 2 * Np]; // neighbor 4
|
||||
f3 = dist[nr3];
|
||||
|
||||
// q = 4
|
||||
nr4 = neighborList[n + 3 * Np]; // neighbor 3
|
||||
f4 = dist[nr4];
|
||||
|
||||
// q=5
|
||||
nr5 = neighborList[n + 4 * Np];
|
||||
f5 = dist[nr5];
|
||||
|
||||
// q = 6
|
||||
nr6 = neighborList[n + 5 * Np];
|
||||
f6 = dist[nr6];
|
||||
|
||||
// q=7
|
||||
nr7 = neighborList[n + 6 * Np];
|
||||
f7 = dist[nr7];
|
||||
|
||||
// q = 8
|
||||
nr8 = neighborList[n + 7 * Np];
|
||||
f8 = dist[nr8];
|
||||
|
||||
// q=9
|
||||
nr9 = neighborList[n + 8 * Np];
|
||||
f9 = dist[nr9];
|
||||
|
||||
// q = 10
|
||||
nr10 = neighborList[n + 9 * Np];
|
||||
f10 = dist[nr10];
|
||||
|
||||
// q=11
|
||||
nr11 = neighborList[n + 10 * Np];
|
||||
f11 = dist[nr11];
|
||||
|
||||
// q=12
|
||||
nr12 = neighborList[n + 11 * Np];
|
||||
f12 = dist[nr12];
|
||||
|
||||
// q=13
|
||||
nr13 = neighborList[n + 12 * Np];
|
||||
f13 = dist[nr13];
|
||||
|
||||
// q=14
|
||||
nr14 = neighborList[n + 13 * Np];
|
||||
f14 = dist[nr14];
|
||||
|
||||
// q=15
|
||||
nr15 = neighborList[n + 14 * Np];
|
||||
f15 = dist[nr15];
|
||||
|
||||
// q=16
|
||||
nr16 = neighborList[n + 15 * Np];
|
||||
f16 = dist[nr16];
|
||||
|
||||
// q=17
|
||||
//fq = dist[18*Np+n];
|
||||
nr17 = neighborList[n + 16 * Np];
|
||||
f17 = dist[nr17];
|
||||
|
||||
// q=18
|
||||
nr18 = neighborList[n + 17 * Np];
|
||||
f18 = dist[nr18];
|
||||
|
||||
|
||||
Ex = (f1 - f2 + 0.5*(f7 - f8 + f9 - f10 + f11 - f12 + f13 - f14))*4.0; //NOTE the unit of electric field here is V/lu
|
||||
Ey = (f3 - f4 + 0.5*(f7 - f8 - f9 + f10 + f15 - f16 + f17 - f18))*4.0;
|
||||
Ez = (f5 - f6 + 0.5*(f11 - f12 - f13 + f14 + f15 - f16 - f17 + f18))*4.0;
|
||||
ElectricField[n + 0 * Np] = Ex;
|
||||
ElectricField[n + 1 * Np] = Ey;
|
||||
ElectricField[n + 2 * Np] = Ez;
|
||||
|
||||
sum_q = f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18;
|
||||
G = 8.0* sum_q + rho_i*factor;
|
||||
|
||||
/* Use Poisson-Boltzmann for fast proton transport */
|
||||
psit = 4.0*f0;
|
||||
// rho_p = Cp * (exp(psi*inVt) - exp(-psi*inVt));
|
||||
// rho_e = rho_i + rho_p;
|
||||
|
||||
/* use semi-implicit scheme */
|
||||
//Wt = W0 + Cp*inVt*factor*(1.0 + 0.16666666666666667*(psit*inVt)*(psit*inVt) + 0.00833333333333333*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt));
|
||||
|
||||
|
||||
for (int s=0; s<10; s++){
|
||||
/* approximate the exponential with Taylor series */
|
||||
expsum = 2.0;
|
||||
xv = (psit*inVt);
|
||||
expdiff = 2.0*xv;
|
||||
term = xv*xv;
|
||||
expsum += term;
|
||||
term *= a3*xv;
|
||||
expdiff += term;
|
||||
term *= a4*xv;
|
||||
expsum += term;
|
||||
term *= a5*xv;
|
||||
expdiff += term;
|
||||
term *= a6*xv;
|
||||
expsum += term;
|
||||
term *= a7*xv;
|
||||
expdiff += term;
|
||||
term *= a8*xv;
|
||||
expsum += term;
|
||||
term *= a9*xv;
|
||||
expdiff += term;
|
||||
term *= a10*xv;
|
||||
expsum += term;
|
||||
term *= a11*xv;
|
||||
expdiff += term;
|
||||
term *= a12*xv;
|
||||
expsum += term;
|
||||
term *= a13*xv;
|
||||
expdiff += term;
|
||||
|
||||
/* Compare to analytical */
|
||||
double truesum = exp(xv) + exp(-1.0*xv);
|
||||
double truediff = exp(xv) - exp(-1.0*xv);
|
||||
|
||||
expdiff = truediff;
|
||||
expsum = truesum;
|
||||
|
||||
/* Newton iteration */
|
||||
F = Cp*factor*expdiff - 8.0*W0*psit + G;
|
||||
Fprime = Cp*factor*inVt*expsum - 8.0*W0;
|
||||
|
||||
psit -= (F / Fprime);
|
||||
/* Newton iteration is successful if F=0 */
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* 1/ 5040 = 0.0001984126984126984 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
/* 1/ 362880 = 2.755731922398589e-06 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
/* 1/ 39916800 = 2.505210838544172e-08 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
|
||||
/* compute new psi */
|
||||
psi = 2.0*f0*(1.0 - rlx) + rlx*psit; //(1.0 / Wt)*(sum_q + 0.125*rho_i);
|
||||
|
||||
idx = Map[n];
|
||||
Psi[idx] = psi;
|
||||
|
||||
// q = 0
|
||||
dist[n] = W0*psi; //f0 * (1.0 - rlx) - (1.0-0.5*rlx)*W0*rho_e;
|
||||
|
||||
// q = 1
|
||||
dist[nr2] = W1*psi; //f1 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 2
|
||||
dist[nr1] = W1*psi; //f2 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 3
|
||||
dist[nr4] = W1*psi; //f3 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 4
|
||||
dist[nr3] = W1*psi; //f4 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 5
|
||||
dist[nr6] = W1*psi; //f5 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 6
|
||||
dist[nr5] = W1*psi; //f6 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
//........................................................................
|
||||
|
||||
// q = 7
|
||||
dist[nr8] = W2*psi; //f7 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 8
|
||||
dist[nr7] = W2*psi; //f8 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 9
|
||||
dist[nr10] = W2*psi; //f9 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 10
|
||||
dist[nr9] = W2*psi; //f10 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 11
|
||||
dist[nr12] = W2*psi; //f11 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 12
|
||||
dist[nr11] = W2*psi; //f12 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 13
|
||||
dist[nr14] = W2*psi; //f13 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q= 14
|
||||
dist[nr13] = W2*psi; //f14 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 15
|
||||
dist[nr16] = W2*psi; //f15 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 16
|
||||
dist[nr15] = W2*psi; //f16 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 17
|
||||
dist[nr18] = W2*psi; //f17 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
// q = 18
|
||||
dist[nr17] = W2*psi; //f18 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson_Grotthus(int *Map, double *dist,
|
||||
double *Den_charge, double *Psi, double *ElectricField, double *Error,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
int n;
|
||||
double psi, psit; //electric potential
|
||||
double Ex, Ey, Ez; //electric field
|
||||
double rho_e, rho_i, rho_p; //local charge density
|
||||
double f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
|
||||
f16, f17, f18;
|
||||
double error,sum_q;
|
||||
double rlx = 1.0 / tau;
|
||||
int idx;
|
||||
double W0 = 0.5;
|
||||
double W1 = 1.0/24.0;
|
||||
double W2 = 1.0/48.0;
|
||||
|
||||
double F,G,Fprime;
|
||||
double factor = 1.0 / epsilon_LB;
|
||||
double inVt = 1.0 / Vt;
|
||||
double expsum, expdiff, term, xv;
|
||||
|
||||
/* exponential series coefficients */
|
||||
double a3 = 0.3333333333333333;
|
||||
double a4 = 0.25; //0.08333333333333333;
|
||||
double a5 = 0.2; // 0.01666666666666667;
|
||||
double a6 = 0.1666666666666667;//0.002777777777777778;
|
||||
double a7 = 0.1428571428571428; //0.0003968253968253968;
|
||||
double a8 = 0.125; //4.96031746031746e-05;
|
||||
double a9 = 0.1111111111111111; //5.511463844797179e-06;
|
||||
double a10 = 0.1; //5.511463844797178e-07;
|
||||
double a11 = 0.09090909090909091; //5.010421677088344e-08;
|
||||
double a12 = 0.08333333333333333; //4.17535139757362e-09;
|
||||
double a13 = 0.07692307692307693;
|
||||
|
||||
for (n = start; n < finish; n++) {
|
||||
|
||||
//Load data
|
||||
//When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral
|
||||
//and thus the net space charge density is zero.
|
||||
rho_i = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n];
|
||||
|
||||
f0 = dist[n];
|
||||
f1 = dist[2 * Np + n];
|
||||
f2 = dist[1 * Np + n];
|
||||
f3 = dist[4 * Np + n];
|
||||
f4 = dist[3 * Np + n];
|
||||
f5 = dist[6 * Np + n];
|
||||
f6 = dist[5 * Np + n];
|
||||
|
||||
f7 = dist[8 * Np + n];
|
||||
f8 = dist[7 * Np + n];
|
||||
f9 = dist[10 * Np + n];
|
||||
f10 = dist[9 * Np + n];
|
||||
f11 = dist[12 * Np + n];
|
||||
f12 = dist[11 * Np + n];
|
||||
f13 = dist[14 * Np + n];
|
||||
f14 = dist[13 * Np + n];
|
||||
f15 = dist[16 * Np + n];
|
||||
f16 = dist[15 * Np + n];
|
||||
f17 = dist[18 * Np + n];
|
||||
f18 = dist[17 * Np + n];
|
||||
|
||||
/* Ex = (f1 - f2) * rlx *
|
||||
4.0; //NOTE the unit of electric field here is V/lu
|
||||
Ey = (f3 - f4) * rlx *
|
||||
4.0; //factor 4.0 is D3Q7 lattice squared speed of sound
|
||||
Ez = (f5 - f6) * rlx * 4.0;
|
||||
*/
|
||||
Ex = (f1 - f2 + 0.5*(f7 - f8 + f9 - f10 + f11 - f12 + f13 - f14))*4.0; //NOTE the unit of electric field here is V/lu
|
||||
Ey = (f3 - f4 + 0.5*(f7 - f8 - f9 + f10 + f15 - f16 + f17 - f18))*4.0;
|
||||
Ez = (f5 - f6 + 0.5*(f11 - f12 - f13 + f14 + f15 - f16 - f17 + f18))*4.0;
|
||||
ElectricField[n + 0 * Np] = Ex;
|
||||
ElectricField[n + 1 * Np] = Ey;
|
||||
ElectricField[n + 2 * Np] = Ez;
|
||||
|
||||
sum_q = f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13+f14+f15+f16+f17+f18;
|
||||
G = 8.0* sum_q + rho_i*factor;
|
||||
|
||||
/* Use Poisson-Boltzmann for fast proton transport */
|
||||
psit = 4.0*f0;
|
||||
// rho_p = Cp * (exp(psi*inVt) - exp(-psi*inVt));
|
||||
// rho_e = rho_i + rho_p;
|
||||
|
||||
/* use semi-implicit scheme */
|
||||
//Wt = W0 + Cp*inVt*factor*(1.0 + 0.16666666666666667*(psit*inVt)*(psit*inVt) + 0.00833333333333333*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt));
|
||||
|
||||
for (int s=0; s<10; s++){
|
||||
/* approximate the exponential with Taylor series */
|
||||
expsum = 2.0;
|
||||
xv = (psit*inVt);
|
||||
expdiff = 2.0*xv;
|
||||
term = xv*xv;
|
||||
expsum += term;
|
||||
term *= a3*xv;
|
||||
expdiff += term;
|
||||
term *= a4*xv;
|
||||
expsum += term;
|
||||
term *= a5*xv;
|
||||
expdiff += term;
|
||||
term *= a6*xv;
|
||||
expsum += term;
|
||||
term *= a7*xv;
|
||||
expdiff += term;
|
||||
term *= a8*xv;
|
||||
expsum += term;
|
||||
term *= a9*xv;
|
||||
expdiff += term;
|
||||
term *= a10*xv;
|
||||
expsum += term;
|
||||
term *= a11*xv;
|
||||
expdiff += term;
|
||||
term *= a12*xv;
|
||||
expsum += term;
|
||||
term *= a13*xv;
|
||||
expdiff += term;
|
||||
|
||||
/* Compare to analytical */
|
||||
double truesum = exp(xv) + exp(-1.0*xv);
|
||||
double truediff = exp(xv) - exp(-1.0*xv);
|
||||
|
||||
expdiff = truediff;
|
||||
expsum = truesum;
|
||||
|
||||
/* iteration */
|
||||
F = Cp*factor*expdiff - 8.0*W0*psit + G;
|
||||
Fprime = Cp*factor*inVt*expsum - 8.0*W0;
|
||||
|
||||
psit -= (F / Fprime);
|
||||
/* Newton iteration is successful if F=0 */
|
||||
|
||||
}
|
||||
|
||||
|
||||
//if (fabs(expsum - truesum) > 1e-8) printf("Error in sum (psi = %0.5g, Vt =%0.5g): approx = %0.5g, true value = %0.5g \n", psit, Vt, expsum, truesum);
|
||||
//if (fabs(expdiff - truediff) > 1e-8) printf("Error in diff: approx = %0.5g, true value = %0.5g \n", expdiff, truediff);
|
||||
|
||||
/* 1/ 5040 = 0.0001984126984126984 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
/* 1/ 362880 = 2.755731922398589e-06 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
/* 1/ 39916800 = 2.505210838544172e-08 *(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt)*(psit*inVt) */
|
||||
|
||||
/* compute new psi */
|
||||
psi = 2.0*f0*(1.0 - rlx) + rlx*psit; //(1.0 / Wt)*(sum_q + 0.125*rho_i);
|
||||
//error = 8.0*(sum_q - f0) + rho_i*factor;
|
||||
error = Cp*factor*expdiff - 8.0*f0 + G;
|
||||
Error[n] = error;
|
||||
|
||||
|
||||
if (error > 1e-3){
|
||||
printf(" Newton's method error (site=%i) = %0.5g \n",n,F);
|
||||
}
|
||||
|
||||
|
||||
idx = Map[n];
|
||||
Psi[idx] = psi;
|
||||
|
||||
// q = 0
|
||||
dist[n] = W0*psi;//
|
||||
|
||||
// q = 1
|
||||
dist[1 * Np + n] = W1*psi;//f1 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 2
|
||||
dist[2 * Np + n] = W1*psi;//f2 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 3
|
||||
dist[3 * Np + n] = W1*psi;//f3 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 4
|
||||
dist[4 * Np + n] = W1*psi;//f4 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 5
|
||||
dist[5 * Np + n] = W1*psi;//f5 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
// q = 6
|
||||
dist[6 * Np + n] = W1*psi;//f6 * (1.0 - rlx) +W1* (rlx * psi) - (1.0-0.5*rlx)*0.05555555555555555*rho_e;
|
||||
|
||||
dist[7 * Np + n] = W2*psi;//f7 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[8 * Np + n] = W2*psi;//f8* (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[9 * Np + n] = W2*psi;//f9 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[10 * Np + n] = W2*psi;//f10 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[11 * Np + n] = W2*psi;//f11 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[12 * Np + n] = W2*psi;//f12 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[13 * Np + n] = W2*psi;//f13 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[14 * Np + n] = W2*psi;//f14 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[15 * Np + n] = W2*psi;//f15 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[16 * Np + n] = W2*psi;//f16 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[17 * Np + n] = W2*psi;//f17 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
dist[18 * Np + n] = W2*psi;//f18 * (1.0 - rlx) +W2* (rlx * psi) - (1.0-0.5*rlx)*0.02777777777777778*rho_e;
|
||||
|
||||
//........................................................................
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson_Potential_BC_z(int *list, double *dist, double Vin, int count, int Np) {
|
||||
//double W0 = 0.5;
|
||||
double W1 = 1.0/24.0;
|
||||
double W2 = 1.0/48.0;
|
||||
int n;//nread, nr5;
|
||||
|
||||
double psi = Vin;
|
||||
|
||||
for (int idx = 0; idx < count; idx++) {
|
||||
int n = list[idx];
|
||||
n = list[idx];
|
||||
|
||||
dist[6 * Np + n] = W1*Vin;
|
||||
dist[12 * Np + n] = W2*Vin;
|
||||
dist[13 * Np + n] = W2*Vin;
|
||||
dist[16 * Np + n] = W2*Vin;
|
||||
dist[17 * Np + n] = W2*Vin;
|
||||
dist[6 * Np + n] = W1*psi;
|
||||
dist[12 * Np + n] = W2*psi;
|
||||
dist[13 * Np + n] = W2*psi;
|
||||
dist[16 * Np + n] = W2*psi;
|
||||
dist[17 * Np + n] = W2*psi;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,18 +1415,21 @@ extern "C" void ScaLBL_D3Q19_AAeven_Poisson_Potential_BC_Z(int *list,
|
|||
double *dist,
|
||||
double Vout,
|
||||
int count, int Np) {
|
||||
|
||||
//double W0 = 0.5;
|
||||
double W1 = 1.0/24.0;
|
||||
double W2 = 1.0/48.0;
|
||||
|
||||
double psi = Vout;
|
||||
|
||||
for (int idx = 0; idx < count; idx++) {
|
||||
|
||||
int n = list[idx];
|
||||
dist[5 * Np + n] = W1*Vout;
|
||||
dist[11 * Np + n] = W2*Vout;
|
||||
dist[14 * Np + n] = W2*Vout;
|
||||
dist[15 * Np + n] = W2*Vout;
|
||||
dist[18 * Np + n] = W2*Vout;
|
||||
|
||||
dist[5 * Np + n] = W1*psi;
|
||||
dist[11 * Np + n] = W2*psi;
|
||||
dist[14 * Np + n] = W2*psi;
|
||||
dist[15 * Np + n] = W2*psi;
|
||||
dist[18 * Np + n] = W2*psi;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -959,23 +1440,24 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson_Potential_BC_z(int *d_neighborList,
|
|||
int Np) {
|
||||
double W1 = 1.0/24.0;
|
||||
double W2 = 1.0/48.0;
|
||||
|
||||
int nr5, nr11, nr14, nr15, nr18;
|
||||
|
||||
double psi = Vin;
|
||||
|
||||
for (int idx = 0; idx < count; idx++) {
|
||||
int n = list[idx];
|
||||
|
||||
// Unknown distributions
|
||||
nr5 = d_neighborList[n + 4 * Np];
|
||||
nr11 = d_neighborList[n + 10 * Np];
|
||||
nr15 = d_neighborList[n + 14 * Np];
|
||||
nr14 = d_neighborList[n + 13 * Np];
|
||||
nr15 = d_neighborList[n + 14 * Np];
|
||||
nr18 = d_neighborList[n + 17 * Np];
|
||||
|
||||
dist[nr5] = W1*Vin;
|
||||
dist[nr11] = W2*Vin;
|
||||
dist[nr15] = W2*Vin;
|
||||
dist[nr14] = W2*Vin;
|
||||
dist[nr18] = W2*Vin;
|
||||
dist[nr5] = W1*psi;
|
||||
dist[nr11] = W2*psi;
|
||||
dist[nr14] = W2*psi;
|
||||
dist[nr15] = W2*psi;
|
||||
dist[nr18] = W2*psi;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -985,21 +1467,22 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson_Potential_BC_Z(int *d_neighborList, i
|
|||
double W2 = 1.0/48.0;
|
||||
int nr6, nr12, nr13, nr16, nr17;
|
||||
|
||||
for (int idx = 0; idx < count; idx++) {
|
||||
double psi = Vout;
|
||||
|
||||
for (int idx = 0; idx < count; idx++) {
|
||||
int n = list[idx];
|
||||
// unknown distributions
|
||||
|
||||
nr6 = d_neighborList[n + 5 * Np];
|
||||
nr12 = d_neighborList[n + 11 * Np];
|
||||
nr13 = d_neighborList[n + 12 * Np];
|
||||
nr16 = d_neighborList[n + 15 * Np];
|
||||
nr17 = d_neighborList[n + 16 * Np];
|
||||
nr13 = d_neighborList[n + 12 * Np];
|
||||
|
||||
dist[nr6] = W1*Vout;
|
||||
dist[nr12] = W2*Vout;
|
||||
dist[nr16] = W2*Vout;
|
||||
dist[nr17] = W2*Vout;
|
||||
dist[nr13] = W2*Vout;
|
||||
dist[nr6] = W1*psi;
|
||||
dist[nr12] = W2*psi;
|
||||
dist[nr13] = W2*psi;
|
||||
dist[nr16] = W2*psi;
|
||||
dist[nr17] = W2*psi;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
32
cpu/dfh.cpp
32
cpu/dfh.cpp
|
@ -1,35 +1,3 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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 <stdio.h>
|
||||
|
||||
|
|
|
@ -1,32 +1,2 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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
|
||||
// copyright James McClure, 2014
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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
|
||||
#include <cuda.h>
|
||||
#include <stdio.h>
|
||||
|
|
303
cuda/Ion.cu
303
cuda/Ion.cu
|
@ -5,6 +5,218 @@
|
|||
#define NBLOCKS 1024
|
||||
#define NTHREADS 512
|
||||
|
||||
|
||||
/***** pH equilibrium ******/
|
||||
__global__ void dvc_ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
|
||||
double *Den, double *ElectricField, double *Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
int n;
|
||||
double Ex, Ey, Ez; //electrical field
|
||||
double ux, uy, uz;
|
||||
double uEPx, uEPy, uEPz; //electrochemical induced velocity
|
||||
double Ca, Cb;
|
||||
double A0, A1, A2, A3, A4, A5, A6;
|
||||
double B0, B1, B2, B3, B4, B5, B6;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
int nr1, nr2, nr3, nr4, nr5, nr6;
|
||||
double rhoe, tmp;
|
||||
|
||||
|
||||
int S = Np/NBLOCKS/NTHREADS + 1;
|
||||
for (int s=0; s<S; s++){
|
||||
//........Get 1-D index for this thread....................
|
||||
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x + start;
|
||||
if (n<finish) {
|
||||
|
||||
//Load data
|
||||
//Ci = Den[n];
|
||||
Ex = ElectricField[n + 0 * Np];
|
||||
Ey = ElectricField[n + 1 * Np];
|
||||
Ez = ElectricField[n + 2 * Np];
|
||||
|
||||
ux = Velocity[n + 0 * Np];
|
||||
uy = Velocity[n + 1 * Np];
|
||||
uz = Velocity[n + 2 * Np];
|
||||
|
||||
uEPx = Di / Vt * Ex;
|
||||
uEPy = Di / Vt * Ey;
|
||||
uEPz = Di / Vt * Ez;
|
||||
|
||||
// q=0
|
||||
// q=1
|
||||
nr1 = neighborList[n]; // neighbor 2 ( > 10Np => odd part of dist)
|
||||
// q=2
|
||||
nr2 = neighborList[n + Np]; // neighbor 1 ( < 10Np => even part of dist)
|
||||
// q=3
|
||||
nr3 = neighborList[n + 2 * Np]; // neighbor 4
|
||||
// q=4
|
||||
nr4 = neighborList[n + 3 * Np]; // neighbor 3
|
||||
// q=5
|
||||
nr5 = neighborList[n + 4 * Np];
|
||||
// q=6
|
||||
nr6 = neighborList[n + 5 * Np];
|
||||
|
||||
A0 = dist[pH_ion*7*Np + n];
|
||||
A1 = dist[pH_ion*7*Np + nr1]; // reading the A1 data into register Aq
|
||||
A2 = dist[pH_ion*7*Np + nr2]; // reading the A2 data into register Aq
|
||||
A3 = dist[pH_ion*7*Np + nr3];
|
||||
A4 = dist[pH_ion*7*Np + nr4];
|
||||
A5 = dist[pH_ion*7*Np + nr5];
|
||||
A6 = dist[pH_ion*7*Np + nr6];
|
||||
|
||||
// charge density
|
||||
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
|
||||
//rhoe = Ca - Cb;
|
||||
// new equilibrium
|
||||
tmp = sqrt(rhoe*rhoe + 4.04e-14);
|
||||
Ca = rhoe + tmp;
|
||||
Cb = Ca - rhoe;
|
||||
|
||||
Den[pH_ion*Np + n] = Ca - Cb;
|
||||
|
||||
// proton production
|
||||
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
|
||||
A2 = 0.125 * Ca * (1.0 - 4.0 * (ux + uEPx));
|
||||
A3 = 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);
|
||||
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
|
||||
|
||||
A0 = Ca - (A1+A2+A3+A4+A5+A6);
|
||||
|
||||
// hydroxide ions created by water ionization (no net charge increase)
|
||||
//Cb += (f1 + f2 + f3 + f4 + f5 + f6);
|
||||
// use relative mass of hydroxide + momentum conservation
|
||||
B1 = 0.125 * Cb * (1.0 + 4.0 * (ux - uEPx));
|
||||
B2 = 0.125 * Cb * (1.0 - 4.0 * (ux - uEPx));
|
||||
B3 = 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));
|
||||
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;
|
||||
f1 = A1 - B1;
|
||||
f2 = A2 - B2;
|
||||
f3 = A3 - B3;
|
||||
f4 = A4 - B4;
|
||||
f5 = A5 - B5;
|
||||
f6 = A6 - B6;
|
||||
|
||||
dist[pH_ion*7*Np + n] = f0;
|
||||
dist[pH_ion*7*Np + nr2] = f1;
|
||||
dist[pH_ion*7*Np + nr1] = f2;
|
||||
dist[pH_ion*7*Np + nr4] = f3;
|
||||
dist[pH_ion*7*Np + nr3] = f4;
|
||||
dist[pH_ion*7*Np + nr6] = f5;
|
||||
dist[pH_ion*7*Np + nr5] = f6;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__global__ void dvc_ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
|
||||
double *Den, double *ElectricField, double * Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
|
||||
int n;
|
||||
double Ex, Ey, Ez; //electrical field
|
||||
double ux, uy, uz;
|
||||
double uEPx, uEPy, uEPz; //electrochemical induced velocity
|
||||
double Ca, Cb;
|
||||
double A0, A1, A2, A3, A4, A5, A6;
|
||||
double B0, B1, B2, B3, B4, B5, B6;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
double rhoe, tmp;
|
||||
|
||||
int S = Np/NBLOCKS/NTHREADS + 1;
|
||||
for (int s=0; s<S; s++){
|
||||
//........Get 1-D index for this thread....................
|
||||
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x + start;
|
||||
if (n<finish) {
|
||||
|
||||
//Load data
|
||||
//Ci = Den[n];
|
||||
Ex = ElectricField[n + 0 * Np];
|
||||
Ey = ElectricField[n + 1 * Np];
|
||||
Ez = ElectricField[n + 2 * Np];
|
||||
|
||||
ux = Velocity[n + 0 * Np];
|
||||
uy = Velocity[n + 1 * Np];
|
||||
uz = Velocity[n + 2 * Np];
|
||||
|
||||
uEPx = Di / Vt * Ex;
|
||||
uEPy = Di / Vt * Ey;
|
||||
uEPz = Di / Vt * Ez;
|
||||
|
||||
A0 = dist[pH_ion*7*Np + n];
|
||||
A1 = dist[pH_ion*7*Np +2 * Np + n];
|
||||
A2 = dist[pH_ion*7*Np +1 * Np + n];
|
||||
A3 = dist[pH_ion*7*Np +4 * Np + n];
|
||||
A4 = dist[pH_ion*7*Np +3 * Np + n];
|
||||
A5 = dist[pH_ion*7*Np +6 * Np + n];
|
||||
A6 = dist[pH_ion*7*Np +5 * Np + n];
|
||||
|
||||
// charge density
|
||||
rhoe = A0 + A1 + A2 + A3 + A4 + A5 + A6;
|
||||
//rhoe = Ca - Cb;
|
||||
// new equilibrium
|
||||
tmp = sqrt(rhoe*rhoe + 4.04e-14);
|
||||
Ca = rhoe + tmp;
|
||||
Cb = Ca - rhoe;
|
||||
//if (Ca < 0.0) printf("Error in hydronium concentration, %f (charge density = %f) \n", Ca, rhoe);
|
||||
//if (Cb < 0.0) printf("Error in hydroxide concentration, %f \n", Cb);
|
||||
|
||||
Den[pH_ion*Np + n] = Ca - Cb;
|
||||
|
||||
// proton production
|
||||
A1 = 0.125 * Ca * (1.0 + 4.0 * (ux + uEPx));
|
||||
A2 = 0.125 * Ca * (1.0 - 4.0 * (ux + uEPx));
|
||||
A3 = 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);
|
||||
A6 = 0.125 * Ca * (1.0 - 4.0 * (uz) + uEPz);
|
||||
|
||||
A0 = Ca - (A1+A2+A3+A4+A5+A6);
|
||||
|
||||
// hydroxide ions created by water ionization (no net charge increase)
|
||||
//Cb += (f1 + f2 + f3 + f4 + f5 + f6);
|
||||
// use relative mass of hydroxide + momentum conservation
|
||||
B1 = 0.125 * Cb * (1.0 + 4.0 * (ux - uEPx));
|
||||
B2 = 0.125 * Cb * (1.0 - 4.0 * (ux - uEPx));
|
||||
B3 = 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));
|
||||
B6 = 0.125 * Cb * (1.0 - 4.0 * (uz - uEPz));
|
||||
|
||||
B0 = Cb - (B1 + B2 + B3 + B4 + B5 + B6);
|
||||
|
||||
f0 = A0 - B0;
|
||||
f1 = A1 - B1;
|
||||
f2 = A2 - B2;
|
||||
f3 = A3 - B3;
|
||||
f4 = A4 - B4;
|
||||
f5 = A5 - B5;
|
||||
f6 = A6 - B6;
|
||||
|
||||
dist[pH_ion*7*Np + n] = f0;
|
||||
dist[pH_ion*7*Np +1 * Np + n] = f1;
|
||||
dist[pH_ion*7*Np +2 * Np + n] = f2;
|
||||
dist[pH_ion*7*Np +3 * Np + n] = f3;
|
||||
dist[pH_ion*7*Np +4 * Np + n] = f4;
|
||||
dist[pH_ion*7*Np +5 * Np + n] = f5;
|
||||
dist[pH_ion*7*Np +6 * Np + n] = f6;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**** end of pH equlibrium model ********/
|
||||
|
||||
extern "C" void Membrane_D3Q19_Unpack(int q, int *list, int *links, int start, int linkCount,
|
||||
double *recvbuf, double *dist, int N) {
|
||||
//....................................................................................
|
||||
|
@ -306,7 +518,7 @@ __global__ void dvc_ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, doub
|
|||
double Ex, Ey, Ez; //electrical field
|
||||
double flux_diffusive_x, flux_diffusive_y, flux_diffusive_z;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
double X,Y,Z,factor_x,factor_y,factor_z;
|
||||
//double X,Y,Z,factor_x, factor_y, factor_z;
|
||||
int nr1, nr2, nr3, nr4, nr5, nr6;
|
||||
|
||||
int S = Np/NBLOCKS/NTHREADS + 1;
|
||||
|
@ -314,8 +526,10 @@ __global__ void dvc_ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, doub
|
|||
//........Get 1-D index for this thread....................
|
||||
n = S*blockIdx.x*blockDim.x + s*blockDim.x + threadIdx.x + start;
|
||||
if (n<finish) {
|
||||
//Load data
|
||||
|
||||
//Load data
|
||||
//Ci = Den[n];
|
||||
Ex = ElectricField[n + 0 * Np];
|
||||
Ey = ElectricField[n + 1 * Np];
|
||||
Ez = ElectricField[n + 2 * Np];
|
||||
|
@ -364,46 +578,32 @@ __global__ void dvc_ScaLBL_D3Q7_AAodd_Ion(int *neighborList, double *dist, doub
|
|||
|
||||
Den[n] = Ci;
|
||||
|
||||
/* use logistic function to prevent negative distributions*/
|
||||
X = 4.0 * (ux + uEPx);
|
||||
Y = 4.0 * (uy + uEPy);
|
||||
Z = 4.0 * (uz + uEPz);
|
||||
factor_x = X / sqrt(1 + X*X);
|
||||
factor_y = Y / sqrt(1 + Y*Y);
|
||||
factor_z = Z / sqrt(1 + Z*Z);
|
||||
|
||||
// q=0
|
||||
dist[n] = f0 * (1.0 - rlx) + rlx * 0.25 * Ci;
|
||||
|
||||
// q = 1
|
||||
dist[nr2] =
|
||||
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x);
|
||||
//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
|
||||
dist[nr1] =
|
||||
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x);
|
||||
//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
|
||||
dist[nr4] =
|
||||
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y );
|
||||
//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
|
||||
dist[nr3] =
|
||||
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y);
|
||||
//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
|
||||
dist[nr6] =
|
||||
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z);
|
||||
//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
|
||||
dist[nr5] =
|
||||
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z);
|
||||
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - 4.0 * (uz + uEPz));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -418,7 +618,6 @@ __global__ void dvc_ScaLBL_D3Q7_AAeven_Ion(double *dist, double *Den, double *F
|
|||
double Ex, Ey, Ez; //electrical field
|
||||
double flux_diffusive_x, flux_diffusive_y, flux_diffusive_z;
|
||||
double f0, f1, f2, f3, f4, f5, f6;
|
||||
double X,Y,Z,factor_x,factor_y,factor_z;
|
||||
|
||||
int S = Np/NBLOCKS/NTHREADS + 1;
|
||||
for (int s=0; s<S; s++){
|
||||
|
@ -463,46 +662,32 @@ __global__ void dvc_ScaLBL_D3Q7_AAeven_Ion(double *dist, double *Den, double *F
|
|||
|
||||
Den[n] = Ci;
|
||||
|
||||
/* use logistic function to prevent negative distributions*/
|
||||
X = 4.0 * (ux + uEPx);
|
||||
Y = 4.0 * (uy + uEPy);
|
||||
Z = 4.0 * (uz + uEPz);
|
||||
factor_x = X / sqrt(1 + X*X);
|
||||
factor_y = Y / sqrt(1 + Y*Y);
|
||||
factor_z = Z / sqrt(1 + Z*Z);
|
||||
|
||||
// q=0
|
||||
dist[n] = f0 * (1.0 - rlx) + rlx * 0.25 * Ci;
|
||||
|
||||
// q = 1
|
||||
dist[1 * Np + n] =
|
||||
f1 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_x);
|
||||
//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
|
||||
dist[2 * Np + n] =
|
||||
f2 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_x);
|
||||
//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
|
||||
dist[3 * Np + n] =
|
||||
f3 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_y);
|
||||
//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
|
||||
dist[4 * Np + n] =
|
||||
f4 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_y);
|
||||
//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
|
||||
dist[5 * Np + n] =
|
||||
f5 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 + factor_z);
|
||||
//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
|
||||
dist[6 * Np + n] =
|
||||
f6 * (1.0 - rlx) + rlx * 0.125 * Ci * (1.0 - factor_z);
|
||||
//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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -568,10 +753,6 @@ __global__ void dvc_ScaLBL_D3Q7_Ion_ChargeDensity(double *Den, double *ChargeDe
|
|||
CD_tmp = F*IonValence*Ci;
|
||||
ChargeDensity[n] = CD + CD_tmp;
|
||||
|
||||
// Ci = Den[n+ion_component*Np];
|
||||
// CD = ChargeDensity[n];
|
||||
// CD_tmp = F*IonValence*Ci;
|
||||
// ChargeDensity[n] = CD*(ion_component>0) + CD_tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -980,3 +1161,33 @@ extern "C" void ScaLBL_D3Q7_Membrane_IonTransport(int *membrane, double *coef,
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAodd_pH_ionization(int *neighborList, double *dist,
|
||||
double *Den, double *ElectricField, double *Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
|
||||
dvc_ScaLBL_D3Q7_AAodd_pH_ionization<<<NBLOCKS,NTHREADS >>>(neighborList,dist,Den,ElectricField,
|
||||
Velocity,Di,Vt,pH_ion,start,finish,Np);
|
||||
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if (cudaSuccess != err){
|
||||
printf("CUDA error in dvc_ScaLBL_D3Q7_AAodd_pH_ionization: %s \n",cudaGetErrorString(err));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q7_AAeven_pH_ionization( double *dist,
|
||||
double *Den, double *ElectricField, double * Velocity,
|
||||
double Di, double Vt,
|
||||
int pH_ion, int start, int finish, int Np) {
|
||||
|
||||
dvc_ScaLBL_D3Q7_AAeven_pH_ionization<<<NBLOCKS,NTHREADS >>>(dist,Den,ElectricField,
|
||||
Velocity,Di,Vt,pH_ion,start,finish,Np);
|
||||
|
||||
cudaError_t err = cudaGetLastError();
|
||||
if (cudaSuccess != err){
|
||||
printf("CUDA error in dvc_ScaLBL_D3Q7_AAeven_pH_ionization: %s \n",cudaGetErrorString(err));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -522,7 +522,8 @@ __global__ void dvc_ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
|||
//Load data
|
||||
//When Helmholtz-Smoluchowski slipping velocity BC is used, the bulk fluid is considered as electroneutral
|
||||
//and thus the net space charge density is zero.
|
||||
rho_e = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n] / epsilon_LB;
|
||||
//rho_e = (UseSlippingVelBC==1) ? 0.0 : Den_charge[n] / epsilon_LB;
|
||||
rho_e = Den_charge[n] / epsilon_LB;
|
||||
|
||||
f0 = dist[n];
|
||||
f1 = dist[2 * Np + n];
|
||||
|
@ -688,7 +689,6 @@ __global__ void dvc_ScaLBL_D3Q19_AAodd_Poisson_Potential_BC_z(int *d_neighborLi
|
|||
if (idx < count){
|
||||
int n = list[idx];
|
||||
|
||||
|
||||
// Unknown distributions
|
||||
nr5 = d_neighborList[n + 4 * Np];
|
||||
nr11 = d_neighborList[n + 10 * Np];
|
||||
|
@ -770,7 +770,8 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson_Potential_BC_Z(int *d_neighborList, i
|
|||
extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
||||
double *dist, double *Den_charge,
|
||||
double *Psi, double *ElectricField,
|
||||
double tau, double epsilon_LB, bool UseSlippingVelBC,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
//cudaProfilerStart();
|
||||
dvc_ScaLBL_D3Q19_AAodd_Poisson<<<NBLOCKS,NTHREADS >>>(neighborList, Map,
|
||||
|
@ -783,8 +784,8 @@ extern "C" void ScaLBL_D3Q19_AAodd_Poisson(int *neighborList, int *Map,
|
|||
}
|
||||
|
||||
extern "C" void ScaLBL_D3Q19_AAeven_Poisson(int *Map, double *dist,
|
||||
double *Den_charge, double *Psi,
|
||||
double *ElectricField, double *Error, double tau,
|
||||
double *Den_charge, double *Psi, double *ElectricField, double *Error,
|
||||
double tau, double Vt, double Cp,
|
||||
double epsilon_LB, bool UseSlippingVelBC,
|
||||
int start, int finish, int Np) {
|
||||
|
||||
|
|
15
hip/BGK.hip
15
hip/BGK.hip
|
@ -1,19 +1,4 @@
|
|||
/*
|
||||
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 "hip/hip_runtime.h"
|
||||
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
/*
|
||||
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 <stdio.h>
|
||||
#include "hip/hip_runtime.h"
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
/*
|
||||
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 hip functions callable from C/C++ code
|
||||
#include "hip/hip_runtime.h"
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
/*
|
||||
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 "hip/hip_runtime.h"
|
||||
#include "hip/hip_cooperative_groups.h"
|
||||
|
|
15
hip/D3Q7.hip
15
hip/D3Q7.hip
|
@ -1,19 +1,4 @@
|
|||
/*
|
||||
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
|
||||
#include "hip/hip_runtime.h"
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2020 Equinor 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 "hip/hip_runtime.h"
|
||||
|
|
16
hip/MRT.hip
16
hip/MRT.hip
|
@ -1,20 +1,6 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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
|
||||
// HIP kernels for single-phase ScaLBL_D3Q19_MRT code
|
||||
// James McClure
|
||||
//*************************************************************************
|
||||
#include "hip/hip_runtime.h"
|
||||
|
|
31
hip/dfh.hip
31
hip/dfh.hip
|
@ -1,35 +1,4 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
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 <stdio.h>
|
||||
#include "hip/hip_runtime.h"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,10 +50,14 @@ public:
|
|||
void DummyFluidVelocity();
|
||||
void DummyElectricField();
|
||||
void Checkpoint();
|
||||
|
||||
void TestGrotthus();
|
||||
|
||||
double CalIonDenConvergence(vector<double> &ci_avg_previous);
|
||||
|
||||
bool Restart;
|
||||
int timestep;
|
||||
int timestepGlobal;
|
||||
vector<int> timestepMax;
|
||||
int BoundaryConditionSolid;
|
||||
double h; //domain resolution, unit [um/lu]
|
||||
|
@ -63,6 +67,10 @@ public:
|
|||
double fluidVelx_dummy, fluidVely_dummy, fluidVelz_dummy;
|
||||
double Ex_dummy, Ey_dummy, Ez_dummy;
|
||||
|
||||
bool use_Grotthus;
|
||||
size_t pH_ion;
|
||||
double IonizationEnergy;
|
||||
|
||||
size_t number_ion_species;
|
||||
vector<int> BoundaryConditionInlet;
|
||||
vector<int> BoundaryConditionOutlet;
|
||||
|
@ -79,6 +87,8 @@ public:
|
|||
vector<double> Cout; //outlet boundary value, can be either concentration [mol/m^3] or flux [mol/m^2/sec]
|
||||
vector<double> tau;
|
||||
vector<double> time_conv;
|
||||
vector<double> BC_frequency;
|
||||
vector<double> BC_amplitude;
|
||||
|
||||
int Nx, Ny, Nz, N, Np;
|
||||
int rank, nprocx, nprocy, nprocz, nprocs;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Multi-relaxation time LBM Model
|
||||
* Gauss's Law solver
|
||||
*/
|
||||
#include "models/PoissonSolver.h"
|
||||
#include "analysis/distance.h"
|
||||
|
@ -36,6 +36,7 @@ ScaLBL_Poisson::~ScaLBL_Poisson()
|
|||
ScaLBL_FreeDeviceMemory(dvcMap);
|
||||
ScaLBL_FreeDeviceMemory(Psi);
|
||||
ScaLBL_FreeDeviceMemory(Psi_BCLabel);
|
||||
ScaLBL_FreeDeviceMemory(Permittivity);
|
||||
ScaLBL_FreeDeviceMemory(ElectricField);
|
||||
ScaLBL_FreeDeviceMemory(ResidualError);
|
||||
ScaLBL_FreeDeviceMemory(fq);
|
||||
|
@ -66,7 +67,7 @@ void ScaLBL_Poisson::ReadParams(string filename){
|
|||
TestPeriodicTime = 1.0;//unit: [sec]
|
||||
TestPeriodicTimeConv = 0.01; //unit [sec/lt]
|
||||
TestPeriodicSaveInterval = 0.1; //unit [sec]
|
||||
Restart = "false";
|
||||
Restart = false;
|
||||
|
||||
// LB-Poisson Model parameters
|
||||
if (electric_db->keyExists( "Restart" )){
|
||||
|
@ -141,7 +142,7 @@ void ScaLBL_Poisson::ReadParams(string filename){
|
|||
|
||||
/* restart string */
|
||||
sprintf(LocalRankString, "%05d", rank);
|
||||
sprintf(LocalRestartFile, "%s%s", "Psi.", LocalRankString);
|
||||
sprintf(LocalRestartFile, "%s%s", "PoissonSolver.", LocalRankString);
|
||||
|
||||
if (rank==0) printf("***********************************************************************************\n");
|
||||
if (rank==0) printf("LB-Poisson Solver: steady-state MaxTimeStep = %i; steady-state tolerance = %.3g \n", timestepMax,tolerance);
|
||||
|
@ -211,7 +212,7 @@ void ScaLBL_Poisson::ReadInput(){
|
|||
|
||||
sprintf(LocalRankString,"%05d",Dm->rank());
|
||||
sprintf(LocalRankFilename,"%s%s","ID.",LocalRankString);
|
||||
sprintf(LocalRestartFile,"%s%s","Psi.",LocalRankString);
|
||||
sprintf(LocalRestartFile,"%s%s","PoissonSolver.",LocalRankString);
|
||||
|
||||
|
||||
if (domain_db->keyExists( "Filename" )){
|
||||
|
@ -278,6 +279,44 @@ void ScaLBL_Poisson::AssignSolidBoundary(double *poisson_solid, int *poisson_sol
|
|||
ERROR("Error: LB-Poisson Solver: BC_SolidList, SolidLabels and SolidValues all must be of the same length! \n");
|
||||
}
|
||||
|
||||
if (electric_db->keyExists( "PermittivityValues" ))
|
||||
{
|
||||
/* assign the permittivity based on the material*/
|
||||
double *Permittivity_host;
|
||||
Permittivity_host = new double[Nx*Ny*Nz];
|
||||
|
||||
double PERMITTIVITY = epsilon_LB;
|
||||
auto LabelList = electric_db->getVector<int>( "SolidLabels" );
|
||||
auto PermittivityList = electric_db->getVector<double>( "PermittivityValues" );
|
||||
size_t NLABELS = LabelList.size();
|
||||
if (NLABELS != PermittivityList.size()){
|
||||
ERROR("Error: LB-Poisson Solver: SolidLabels and PermittivityList all must be of the same length! \n");
|
||||
}
|
||||
|
||||
for (int k=0;k<Nz;k++){
|
||||
for (int j=0;j<Ny;j++){
|
||||
for (int i=0;i<Nx;i++){
|
||||
int n = k*Nx*Ny+j*Nx+i;
|
||||
VALUE=Mask->id[n];
|
||||
PERMITTIVITY=epsilon_LB;
|
||||
// Assign the affinity from the paired list
|
||||
for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
if (VALUE == LabelList[idx]){
|
||||
PERMITTIVITY=PermittivityList[idx];
|
||||
//label_count[idx] += 1.0;
|
||||
idx = NLABELS;
|
||||
}
|
||||
}
|
||||
int idx=Map(i,j,k);
|
||||
if (!(idx<0)) Permittivity_host[n] = PERMITTIVITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_CopyToDevice(Permittivity, Permittivity_host, sizeof(double)*Nx*Ny*Nz);
|
||||
delete [] Permittivity_host;
|
||||
}
|
||||
|
||||
std::vector<double> label_count( NLABELS, 0.0 );
|
||||
std::vector<double> label_count_global( NLABELS, 0.0 );
|
||||
// Assign the labels
|
||||
|
@ -368,13 +407,14 @@ void ScaLBL_Poisson::Create(){
|
|||
// LBM variables
|
||||
if (rank==0) printf ("LB-Poisson Solver: Allocating distributions \n");
|
||||
//......................device distributions.................................
|
||||
int dist_mem_size = Np*sizeof(double);
|
||||
int neighborSize=18*(Np*sizeof(int));
|
||||
size_t dist_mem_size = Np*sizeof(double);
|
||||
size_t neighborSize=18*(Np*sizeof(int));
|
||||
//...........................................................................
|
||||
ScaLBL_AllocateDeviceMemory((void **) &NeighborList, neighborSize);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &dvcMap, sizeof(int)*Np);
|
||||
//ScaLBL_AllocateDeviceMemory((void **) &dvcID, sizeof(signed char)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Psi, sizeof(double)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Permittivity, sizeof(double)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &Psi_BCLabel, sizeof(int)*Nx*Ny*Nz);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &ElectricField, 3*sizeof(double)*Np);
|
||||
ScaLBL_AllocateDeviceMemory((void **) &ResidualError, sizeof(double)*Np);
|
||||
|
@ -443,8 +483,12 @@ void ScaLBL_Poisson::Potential_Init(double *psi_init){
|
|||
Vin0 = Vout0 = 1.0; //unit: [V]
|
||||
freqIn = freqOut = 50.0; //unit: [Hz]
|
||||
PhaseShift_In = PhaseShift_Out = 0.0; //unit: [radian]
|
||||
Vin = 1.0; //Boundary-z (inlet) electric potential
|
||||
Vout = 1.0; //Boundary-Z (outlet) electric potential
|
||||
Vin = 0.0; //Boundary-z (inlet) electric potential
|
||||
Vout = 0.0; //Boundary-Z (outlet) electric potential
|
||||
|
||||
/* Assign permittivity value to the solid */
|
||||
signed char VALUE=0;
|
||||
double AFFINITY=0.f;
|
||||
|
||||
if (BoundaryConditionInlet==0 && BoundaryConditionOutlet==0){
|
||||
|
||||
|
@ -453,6 +497,7 @@ void ScaLBL_Poisson::Potential_Init(double *psi_init){
|
|||
|
||||
auto LabelList = electric_db->getVector<int>( "InitialValueLabels" );
|
||||
auto AffinityList = electric_db->getVector<double>( "InitialValues" );
|
||||
auto PermittivityList = electric_db->getVector<double>( "PermittivityValues" );
|
||||
|
||||
size_t NLABELS = LabelList.size();
|
||||
if (NLABELS != AffinityList.size()){
|
||||
|
@ -549,17 +594,27 @@ void ScaLBL_Poisson::Potential_Init(double *psi_init){
|
|||
if (BoundaryConditionOutlet==2) Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,0);
|
||||
|
||||
//initialize a linear electrical potential between inlet and outlet
|
||||
double slope = (Vout-Vin)/(Nz-2);
|
||||
double psi_linearized;
|
||||
double slope = (Vout-Vin)/((Nz-2)*Dm->nprocz());
|
||||
double psi_linearized = Vin;
|
||||
for (int k=0;k<Nz;k++){
|
||||
if (Dm->kproc() == 0){
|
||||
if (k==0 || k==1){
|
||||
psi_linearized = Vin;
|
||||
}
|
||||
else if (k==Nz-1 || k==Nz-2){
|
||||
else{
|
||||
psi_linearized = slope*(Dm->kproc()*(Nz-2) + (k-1)) + Vin;
|
||||
}
|
||||
}
|
||||
if (Dm->kproc() == Dm->nprocz()-1){
|
||||
if (k==Nz-1 || k==Nz-2){
|
||||
psi_linearized = Vout;
|
||||
}
|
||||
else{
|
||||
psi_linearized = slope*(k-1)+Vin;
|
||||
psi_linearized = slope*(Dm->kproc()*(Nz-2) + (k-1)) + Vin;
|
||||
}
|
||||
}
|
||||
else{
|
||||
psi_linearized = slope*(Dm->kproc()*(Nz-2) + (k-1)) + Vin;
|
||||
}
|
||||
for (int j=0;j<Ny;j++){
|
||||
for (int i=0;i<Nx;i++){
|
||||
|
@ -643,79 +698,6 @@ void ScaLBL_Poisson::Initialize(double time_conv_from_Study){
|
|||
//}
|
||||
}
|
||||
|
||||
//void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int timestep_from_Study){
|
||||
//
|
||||
// //.......create and start timer............
|
||||
// //double starttime,stoptime,cputime;
|
||||
// //comm.barrier();
|
||||
// //auto t1 = std::chrono::system_clock::now();
|
||||
// double *host_Error;
|
||||
// host_Error = new double [Np];
|
||||
//
|
||||
// timestep=0;
|
||||
// double error = 1.0;
|
||||
// while (timestep < timestepMax && error > tolerance) {
|
||||
// //************************************************************************/
|
||||
// // *************ODD TIMESTEP*************//
|
||||
// timestep++;
|
||||
// //SolveElectricPotentialAAodd(timestep_from_Study,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
// SolvePoissonAAodd(ChargeDensity, UseSlippingVelBC);//perform collision
|
||||
// ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
//
|
||||
// // *************EVEN TIMESTEP*************//
|
||||
// timestep++;
|
||||
// //SolveElectricPotentialAAeven(timestep_from_Study,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
// SolvePoissonAAeven(ChargeDensity, UseSlippingVelBC);//perform collision
|
||||
// ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
// //************************************************************************/
|
||||
//
|
||||
//
|
||||
// // Check convergence of steady-state solution
|
||||
// if (timestep==2){
|
||||
// //save electric potential for convergence check
|
||||
// }
|
||||
// if (timestep%analysis_interval==0){
|
||||
// /* get the elecric potential */
|
||||
// ScaLBL_CopyToHost(Psi_host.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
||||
// if (rank==0) printf(" ... getting Poisson solver error \n");
|
||||
// double err = 0.0;
|
||||
// double max_error = 0.0;
|
||||
// ScaLBL_CopyToHost(host_Error,ResidualError,sizeof(double)*Np);
|
||||
// for (int idx=0; idx<Np; idx++){
|
||||
// err = host_Error[idx]*host_Error[idx];
|
||||
// if (err > max_error ){
|
||||
// max_error = err;
|
||||
// }
|
||||
// }
|
||||
// error=Dm->Comm.maxReduce(max_error);
|
||||
//
|
||||
// /* compute the eletric field */
|
||||
// //ScaLBL_D3Q19_Poisson_getElectricField(fq, ElectricField, tau, Np);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// if(WriteLog==true){
|
||||
// getConvergenceLog(timestep,error);
|
||||
// }
|
||||
//
|
||||
// //************************************************************************/
|
||||
// ////if (rank==0) printf("LB-Poission Solver: a steady-state solution is obtained\n");
|
||||
// ////if (rank==0) printf("---------------------------------------------------------------------------\n");
|
||||
// //// Compute the walltime per timestep
|
||||
// //auto t2 = std::chrono::system_clock::now();
|
||||
// //double cputime = std::chrono::duration<double>( t2 - t1 ).count() / timestep;
|
||||
// //// Performance obtained from each node
|
||||
// //double MLUPS = double(Np)/cputime/1000000;
|
||||
//
|
||||
// //if (rank==0) printf("******************* LB-Poisson Solver Statistics ********************\n");
|
||||
// //if (rank==0) printf("CPU time = %f \n", cputime);
|
||||
// //if (rank==0) printf("Lattice update rate (per core)= %f MLUPS \n", MLUPS);
|
||||
// //MLUPS *= nprocs;
|
||||
// //if (rank==0) printf("Lattice update rate (total)= %f MLUPS \n", MLUPS);
|
||||
// //if (rank==0) printf("*********************************************************************\n");
|
||||
//
|
||||
//}
|
||||
|
||||
void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int timestep_from_Study){
|
||||
|
||||
double error = 1.0;
|
||||
|
@ -791,23 +773,100 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||
double *host_Error;
|
||||
host_Error = new double [Np];
|
||||
|
||||
timestep=0;
|
||||
auto t1 = std::chrono::system_clock::now();
|
||||
while (timestep < timestepMax && error > tolerance) {
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = kb * T / electron_charge; //thermal voltage; unit [Vy]
|
||||
double Cp = 1.014e-7; // proton concentration
|
||||
|
||||
timestep=0;
|
||||
auto t1 = std::chrono::system_clock::now();
|
||||
while (timestep < timestepMax && error > tolerance) {
|
||||
//************************************************************************/
|
||||
// *************ODD TIMESTEP*************//
|
||||
// Set boundary conditions
|
||||
timestep++;
|
||||
//SolveElectricPotentialAAodd(timestep_from_Study);//,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
SolvePoissonAAodd(ChargeDensity, UseSlippingVelBC,timestep);//perform collision
|
||||
ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
|
||||
//SolvePoissonAAodd(ChargeDensity, UseSlippingVelBC, timestep);//perform collision
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
||||
// *************EVEN TIMESTEP*************//
|
||||
|
||||
timestep++;
|
||||
//SolveElectricPotentialAAeven(timestep_from_Study);//,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
SolvePoissonAAeven(ChargeDensity, UseSlippingVelBC,timestep);//perform collision
|
||||
|
||||
//SolvePoissonAAeven(ChargeDensity, UseSlippingVelBC, timestep);//perform collision
|
||||
//ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
|
||||
// Set boundary conditions
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
//************************************************************************/
|
||||
|
||||
}
|
||||
// Check convergence of steady-state solution
|
||||
if (timestep==2){
|
||||
//save electric potential for convergence check
|
||||
|
@ -826,12 +885,11 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||
}
|
||||
}
|
||||
error=Dm->Comm.maxReduce(max_error);
|
||||
|
||||
/* compute the eletric field */
|
||||
//ScaLBL_D3Q19_Poisson_getElectricField(fq, ElectricField, tau, Np);
|
||||
|
||||
if (rank==0) printf(" error = %0.5g \n",error);
|
||||
}
|
||||
}
|
||||
// SetMeanZeroVoltage();
|
||||
|
||||
if (rank == 0)
|
||||
printf("---------------------------------------------------------------"
|
||||
"----\n");
|
||||
|
@ -841,6 +899,9 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, bool UseSlippingVelBC, int times
|
|||
// Performance obtained from each node
|
||||
double MLUPS = double(Np) / cputime / 1000000;
|
||||
|
||||
if(WriteLog==true){
|
||||
getConvergenceLog(timestep,error);
|
||||
}
|
||||
if (rank == 0)
|
||||
printf("********************************************************\n");
|
||||
if (rank == 0)
|
||||
|
@ -877,20 +938,93 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, DoubleArray MembraneDistance, bo
|
|||
double *host_Error;
|
||||
host_Error = new double [Np];
|
||||
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = kb * T / electron_charge; //thermal voltage; unit [Vy]
|
||||
double Cp = 1.014e-7; // proton concentration
|
||||
|
||||
timestep=0;
|
||||
auto t1 = std::chrono::system_clock::now();
|
||||
while (timestep < timestepMax && error > tolerance) {
|
||||
//************************************************************************/
|
||||
// *************ODD TIMESTEP*************//
|
||||
timestep++;
|
||||
//SolveElectricPotentialAAodd(timestep_from_Study,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
SolvePoissonAAodd(ChargeDensity, UseSlippingVelBC,timestep);//perform collision
|
||||
ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
//SolvePoissonAAodd(ChargeDensity, UseSlippingVelBC, timestep);//perform collision
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
// Set boundary conditions
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
||||
// *************EVEN TIMESTEP*************//
|
||||
timestep++;
|
||||
//SolveElectricPotentialAAeven(timestep_from_Study,ChargeDensity, UseSlippingVelBC);//update electric potential
|
||||
SolvePoissonAAeven(ChargeDensity, UseSlippingVelBC,timestep);//perform collision
|
||||
|
||||
|
||||
//SolvePoissonAAeven(ChargeDensity, UseSlippingVelBC, timestep);//perform collision
|
||||
//ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
|
||||
// Set boundary conditions
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError,
|
||||
tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
||||
|
||||
ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
//************************************************************************/
|
||||
|
||||
|
@ -972,6 +1106,8 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, DoubleArray MembraneDistance, bo
|
|||
//ScaLBL_D3Q19_Poisson_getElectricField(fq, ElectricField, tau, Np);
|
||||
}
|
||||
}
|
||||
// SetMeanZeroVoltage();
|
||||
|
||||
if (rank == 0)
|
||||
printf("---------------------------------------------------------------"
|
||||
"----\n");
|
||||
|
@ -1000,6 +1136,43 @@ void ScaLBL_Poisson::Run(double *ChargeDensity, DoubleArray MembraneDistance, bo
|
|||
}
|
||||
}
|
||||
|
||||
void ScaLBL_Poisson::SetMeanZeroVoltage(){
|
||||
/* get the elecric potential */
|
||||
ScaLBL_CopyToHost(Psi_host.data(),Psi,sizeof(double)*Nx*Ny*Nz);
|
||||
|
||||
double local_mean_voltage = 0.0;
|
||||
double global_mean_voltage = 0.0;
|
||||
double local_count = 0.0;
|
||||
double global_count = 0.0;
|
||||
for (int k=1; k<Nz-1; k++){
|
||||
for (int j=1; j<Ny-1; j++){
|
||||
for (int i=1; i<Nx-1; i++){
|
||||
int n = k*Nx*Ny + j*Nx + i;
|
||||
local_mean_voltage += Psi_host(n);
|
||||
local_count += 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
global_mean_voltage = Dm->Comm.sumReduce(local_mean_voltage);
|
||||
global_count = Dm->Comm.sumReduce(local_count);
|
||||
global_mean_voltage /= global_count;
|
||||
// rescale the far-field electric potential
|
||||
for (int k=0; k<Nz; k++){
|
||||
for (int j=0; j<Ny; j++){
|
||||
for (int i=0; i<Nx; i++){
|
||||
int n = k*Nx*Ny + j*Nx + i;
|
||||
double value = Psi_host(n);
|
||||
value -= global_mean_voltage;
|
||||
Psi_host(n) = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
ScaLBL_CopyToDevice(Psi,Psi_host.data(),sizeof(double)*Nx*Ny*Nz);
|
||||
|
||||
if (rank == 0)
|
||||
printf("Rescale voltage (average was %.5g) \n", global_mean_voltage);
|
||||
}
|
||||
|
||||
void ScaLBL_Poisson::getConvergenceLog(int timestep,double error){
|
||||
if ( rank == 0 ) {
|
||||
fprintf(TIMELOG,"%i %.5g\n",timestep,error);
|
||||
|
@ -1120,22 +1293,22 @@ void ScaLBL_Poisson::SolveElectricPotentialAAeven(int timestep_from_Study){
|
|||
if (BoundaryConditionInlet > 0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep_from_Study);
|
||||
ScaLBL_Comm->D3Q19_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1147,6 +1320,14 @@ void ScaLBL_Poisson::SolveElectricPotentialAAeven(int timestep_from_Study){
|
|||
|
||||
void ScaLBL_Poisson::SolvePoissonAAodd(double *ChargeDensity, bool UseSlippingVelBC, int timestep){
|
||||
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = kb * T / electron_charge; //thermal voltage; unit [Vy]
|
||||
double Cp = 1.014e-7; // proton concentration
|
||||
|
||||
|
||||
if (lattice_scheme.compare("D3Q7")==0){
|
||||
ScaLBL_D3Q7_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_D3Q7_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
@ -1163,35 +1344,35 @@ void ScaLBL_Poisson::SolvePoissonAAodd(double *ChargeDensity, bool UseSlippingVe
|
|||
}
|
||||
else if (lattice_scheme.compare("D3Q19")==0){
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
//ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, Vt, Cp, epsilon_LB, UseSlippingVelBC,
|
||||
ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
|
||||
// Set boundary conditions
|
||||
if (BoundaryConditionInlet > 0){
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep);
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0){
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep);
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_D3Q19_AAodd_Poisson(NeighborList, dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, Vt, Cp, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_Comm->Barrier();
|
||||
//TODO: perhaps add another ScaLBL_Comm routine to update Psi values on solid boundary nodes.
|
||||
//something like:
|
||||
|
@ -1201,6 +1382,13 @@ void ScaLBL_Poisson::SolvePoissonAAodd(double *ChargeDensity, bool UseSlippingVe
|
|||
|
||||
void ScaLBL_Poisson::SolvePoissonAAeven(double *ChargeDensity, bool UseSlippingVelBC, int timestep){
|
||||
|
||||
// Universal constant
|
||||
double kb = 1.38e-23; //Boltzmann constant;unit [J/K]
|
||||
double electron_charge = 1.6e-19; //electron charge;unit [C]
|
||||
double T = 300.0; //temperature; unit [K]
|
||||
double Vt = kb * T / electron_charge; //thermal voltage; unit [Vy]
|
||||
double Cp = 1.014e-7; // proton concentration
|
||||
|
||||
if (lattice_scheme.compare("D3Q7")==0){
|
||||
ScaLBL_D3Q7_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_D3Q7_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
|
@ -1214,35 +1402,34 @@ void ScaLBL_Poisson::SolvePoissonAAeven(double *ChargeDensity, bool UseSlippingV
|
|||
}
|
||||
else if (lattice_scheme.compare("D3Q19")==0){
|
||||
ScaLBL_Comm->SendD3Q19AA(fq); //READ FROM NORMAL
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, Vt, Cp, epsilon_LB, UseSlippingVelBC, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
// ScaLBL_Comm->RecvD3Q19AA(fq); //WRITE INTO OPPOSITE
|
||||
|
||||
// Set boundary conditions
|
||||
if (BoundaryConditionInlet > 0){
|
||||
if (BoundaryConditionInlet > 0 && Dm->kproc()==0){
|
||||
switch (BoundaryConditionInlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vin = getBoundaryVoltagefromPeriodicBC(Vin0,freqIn,PhaseShift_In,timestep);
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_z(NeighborList, fq, Vin, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_z(NeighborList, fq, Vin, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (BoundaryConditionOutlet > 0){
|
||||
if (BoundaryConditionOutlet > 0 && Dm->kproc() == nprocz-1){
|
||||
switch (BoundaryConditionOutlet){
|
||||
case 1:
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
case 2:
|
||||
Vout = getBoundaryVoltagefromPeriodicBC(Vout0,freqOut,PhaseShift_Out,timestep);
|
||||
ScaLBL_Comm->D3Q7_Poisson_Potential_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
ScaLBL_Comm->D3Q19_Pressure_BC_Z(NeighborList, fq, Vout, timestep);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_D3Q19_AAeven_Poisson(dvcMap, fq, ChargeDensity, Psi, ElectricField, ResidualError, tau, Vt, Cp, epsilon_LB, UseSlippingVelBC, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
ScaLBL_Comm->Barrier();
|
||||
|
||||
//ScaLBL_Comm->SolidDirichletAndNeumannD3Q7(fq, Psi, Psi_BCLabel);
|
||||
|
@ -1279,7 +1466,8 @@ void ScaLBL_Poisson::DummyChargeDensity(){
|
|||
for (int i=0; i<Nx; i++){
|
||||
int idx=Map(i,j,k);
|
||||
if (!(idx < 0))
|
||||
ChargeDensity_host[idx] = chargeDen_dummy*(h*h*h*1.0e-18);
|
||||
//ChargeDensity_host[idx] = chargeDen_dummy*(h*h*h*1.0e-18);
|
||||
ChargeDensity_host[idx] = cos(2.0*M_PI*double(k-1)/double(Nz-2))*(h*h*h*1.0e-18);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1302,6 +1490,11 @@ void ScaLBL_Poisson::getElectricPotential_debug(int timestep){
|
|||
fclose(OUTFILE);
|
||||
}
|
||||
|
||||
void ScaLBL_Poisson::getSolverError(DoubleArray &ReturnValues){
|
||||
//This function wirte out the data in a normal layout (by aggregating all decomposed domains)
|
||||
ScaLBL_Comm->RegularLayout(Map,ResidualError,ReturnValues);
|
||||
}
|
||||
|
||||
void ScaLBL_Poisson::getElectricPotential(DoubleArray &ReturnValues){
|
||||
//This function wirte out the data in a normal layout (by aggregating all decomposed domains)
|
||||
//ScaLBL_Comm->RegularLayout(Map,Psi,PhaseField);
|
||||
|
@ -1373,12 +1566,15 @@ void ScaLBL_Poisson::WriteVis( int timestep) {
|
|||
auto vis_db = db->getDatabase("Visualization");
|
||||
auto format = vis_db->getWithDefault<string>( "format", "hdf5" );
|
||||
|
||||
DoubleArray ElectricalPotential(Nx, Ny, Nz);
|
||||
std::vector<IO::MeshDataStruct> visData;
|
||||
fillHalo<double> fillData(Dm->Comm, Dm->rank_info,
|
||||
{Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2}, {1, 1, 1},
|
||||
0, 1);
|
||||
|
||||
DoubleArray ElectricalPotential(Nx, Ny, Nz);
|
||||
|
||||
DoubleArray SolverError(Nx, Ny, Nz);
|
||||
|
||||
IO::initialize("",format,"false");
|
||||
// Create the MeshDataStruct
|
||||
visData.resize(1);
|
||||
|
@ -1389,8 +1585,22 @@ void ScaLBL_Poisson::WriteVis( int timestep) {
|
|||
Dm->Nz - 2, Dm->Lx, Dm->Ly, Dm->Lz);
|
||||
//electric potential
|
||||
auto ElectricPotentialVar = std::make_shared<IO::Variable>();
|
||||
auto SolverErrorVar = std::make_shared<IO::Variable>();
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
DoubleArray Analytical(Nx, Ny, Nz);
|
||||
|
||||
for (int k=0; k<Nz; k++){
|
||||
for (int j=0; j<Ny; j++){
|
||||
for (int i=0; i<Nx; i++){
|
||||
int idx=Map(i,j,k);
|
||||
if (!(idx < 0))
|
||||
//ChargeDensity_host[idx] = chargeDen_dummy*(h*h*h*1.0e-18);
|
||||
Analytical(i,j,k) = (2.0*M_PI/double(Nz-2))*(2.0*M_PI/double(Nz-2))*cos(2.0*M_PI*double(k-1)/double(Nz-2))*(h*h*h*1.0e-18)/epsilon_LB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------Create Names for Variables------------------------------------------------------
|
||||
if (vis_db->getWithDefault<bool>("save_electric_potential", true)) {
|
||||
|
@ -1400,6 +1610,14 @@ void ScaLBL_Poisson::WriteVis( int timestep) {
|
|||
ElectricPotentialVar->data.resize(Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2);
|
||||
visData[0].vars.push_back(ElectricPotentialVar);
|
||||
}
|
||||
|
||||
if (vis_db->getWithDefault<bool>("save_error", true)) {
|
||||
SolverErrorVar->name = "SolverError";
|
||||
SolverErrorVar->type = IO::VariableType::VolumeVariable;
|
||||
SolverErrorVar->dim = 1;
|
||||
SolverErrorVar->data.resize(Dm->Nx - 2, Dm->Ny - 2, Dm->Nz - 2);
|
||||
visData[0].vars.push_back(SolverErrorVar);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------Save All Variables--------------------------------------------------------------
|
||||
|
@ -1410,140 +1628,16 @@ void ScaLBL_Poisson::WriteVis( int timestep) {
|
|||
fillData.copy(ElectricalPotential, ElectricPotentialData);
|
||||
}
|
||||
|
||||
//------------------------------------Save All Variables--------------------------------------------------------------
|
||||
if (vis_db->getWithDefault<bool>("save_error", true)) {
|
||||
ASSERT(visData[0].vars[1]->name == "SolverError");
|
||||
getSolverError(SolverError);
|
||||
Array<double> &SolverErrorData = visData[0].vars[1]->data;
|
||||
fillData.copy(SolverError, SolverErrorData);
|
||||
}
|
||||
|
||||
if (vis_db->getWithDefault<bool>("write_silo", true))
|
||||
IO::writeData(timestep, visData, Dm->Comm);
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
//void ScaLBL_Poisson::SolveElectricField(){
|
||||
// ScaLBL_Comm_Regular->SendHalo(Psi);
|
||||
// ScaLBL_D3Q7_Poisson_ElectricField(NeighborList, dvcMap, dvcID, Psi, ElectricField, BoundaryConditionSolid,
|
||||
// Nx, Nx*Ny, ScaLBL_Comm->FirstInterior(), ScaLBL_Comm->LastInterior(), Np);
|
||||
// ScaLBL_Comm_Regular->RecvHalo(Psi);
|
||||
// ScaLBL_Comm->Barrier();
|
||||
// if (BoundaryCondition == 1){
|
||||
// ScaLBL_Comm->Poisson_D3Q7_BC_z(dvcMap,Psi,Vin);
|
||||
// ScaLBL_Comm->Poisson_D3Q7_BC_Z(dvcMap,Psi,Vout);
|
||||
// }
|
||||
// ScaLBL_D3Q7_Poisson_ElectricField(NeighborList, dvcMap, dvcID, Psi, ElectricField, BoundaryConditionSolid, Nx, Nx*Ny, 0, ScaLBL_Comm->LastExterior(), Np);
|
||||
//
|
||||
//}
|
||||
|
||||
//void ScaLBL_Poisson::getElectricPotential(){
|
||||
//
|
||||
// DoubleArray PhaseField(Nx,Ny,Nz);
|
||||
// ScaLBL_Comm->RegularLayout(Map,Psi,PhaseField);
|
||||
// //ScaLBL_Comm->Barrier(); comm.barrier();
|
||||
// FILE *OUTFILE;
|
||||
// sprintf(LocalRankFilename,"Electric_Potential.%05i.raw",rank);
|
||||
// OUTFILE = fopen(LocalRankFilename,"wb");
|
||||
// fwrite(PhaseField.data(),8,N,OUTFILE);
|
||||
// fclose(OUTFILE);
|
||||
//}
|
||||
|
||||
//old version where Psi is of size Np
|
||||
//void ScaLBL_Poisson::AssignSolidBoundary(double *poisson_solid)
|
||||
//{
|
||||
// size_t NLABELS=0;
|
||||
// signed char VALUE=0;
|
||||
// double AFFINITY=0.f;
|
||||
//
|
||||
// auto LabelList = electric_db->getVector<int>( "SolidLabels" );
|
||||
// auto AffinityList = electric_db->getVector<double>( "SolidValues" );
|
||||
//
|
||||
// NLABELS=LabelList.size();
|
||||
// if (NLABELS != AffinityList.size()){
|
||||
// ERROR("Error: LB-Poisson Solver: SolidLabels and SolidValues must be the same length! \n");
|
||||
// }
|
||||
//
|
||||
// double label_count[NLABELS];
|
||||
// double label_count_global[NLABELS];
|
||||
// // Assign the labels
|
||||
//
|
||||
// for (size_t idx=0; idx<NLABELS; idx++) label_count[idx]=0;
|
||||
//
|
||||
// for (int k=0;k<Nz;k++){
|
||||
// for (int j=0;j<Ny;j++){
|
||||
// for (int i=0;i<Nx;i++){
|
||||
// int n = k*Nx*Ny+j*Nx+i;
|
||||
// VALUE=Mask->id[n];
|
||||
// AFFINITY=0.f;
|
||||
// // Assign the affinity from the paired list
|
||||
// for (unsigned int idx=0; idx < NLABELS; idx++){
|
||||
// //printf("idx=%i, value=%i, %i, \n",idx, VALUE,LabelList[idx]);
|
||||
// if (VALUE == LabelList[idx]){
|
||||
// AFFINITY=AffinityList[idx];
|
||||
// //NOTE need to convert the user input phys unit to LB unit
|
||||
// if (BoundaryConditionSolid==2){
|
||||
// //for BCS=1, i.e. Dirichlet-type, no need for unit conversion
|
||||
// //TODO maybe there is a factor of gamm missing here ?
|
||||
// AFFINITY = AFFINITY*(h*h*1.0e-12)/epsilon_LB;
|
||||
// }
|
||||
// label_count[idx] += 1.0;
|
||||
// idx = NLABELS;
|
||||
// //Mask->id[n] = 0; // set mask to zero since this is an immobile component
|
||||
// }
|
||||
// }
|
||||
// poisson_solid[n] = AFFINITY;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (size_t idx=0; idx<NLABELS; idx++)
|
||||
// label_count_global[idx]=Dm->Comm.sumReduce( label_count[idx]);
|
||||
//
|
||||
// if (rank==0){
|
||||
// printf("LB-Poisson Solver: number of Poisson solid labels: %lu \n",NLABELS);
|
||||
// for (unsigned int idx=0; idx<NLABELS; idx++){
|
||||
// VALUE=LabelList[idx];
|
||||
// AFFINITY=AffinityList[idx];
|
||||
// double volume_fraction = double(label_count_global[idx])/double((Nx-2)*(Ny-2)*(Nz-2)*nprocs);
|
||||
// switch (BoundaryConditionSolid){
|
||||
// case 1:
|
||||
// printf(" label=%d, surface potential=%.3g [V], volume fraction=%.2g\n",VALUE,AFFINITY,volume_fraction);
|
||||
// break;
|
||||
// case 2:
|
||||
// printf(" label=%d, surface charge density=%.3g [C/m^2], volume fraction=%.2g\n",VALUE,AFFINITY,volume_fraction);
|
||||
// break;
|
||||
// default:
|
||||
// printf(" label=%d, surface potential=%.3g [V], volume fraction=%.2g\n",VALUE,AFFINITY,volume_fraction);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
// old version where Psi is of size Np
|
||||
//void ScaLBL_Poisson::Potential_Init(double *psi_init){
|
||||
//
|
||||
// if (BoundaryCondition==1){
|
||||
// if (electric_db->keyExists( "Vin" )){
|
||||
// Vin = electric_db->getScalar<double>( "Vin" );
|
||||
// }
|
||||
// if (electric_db->keyExists( "Vout" )){
|
||||
// Vout = electric_db->getScalar<double>( "Vout" );
|
||||
// }
|
||||
// }
|
||||
// //By default only periodic BC is applied and Vin=Vout=1.0, i.e. there is no potential gradient along Z-axis
|
||||
// double slope = (Vout-Vin)/(Nz-2);
|
||||
// double psi_linearized;
|
||||
// for (int k=0;k<Nz;k++){
|
||||
// if (k==0 || k==1){
|
||||
// psi_linearized = Vin;
|
||||
// }
|
||||
// else if (k==Nz-1 || k==Nz-2){
|
||||
// psi_linearized = Vout;
|
||||
// }
|
||||
// else{
|
||||
// psi_linearized = slope*(k-1)+Vin;
|
||||
// }
|
||||
// for (int j=0;j<Ny;j++){
|
||||
// for (int i=0;i<Nx;i++){
|
||||
// int idx = Map(i,j,k);
|
||||
// if (!(idx < 0)){
|
||||
// psi_init[idx] = psi_linearized;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
void Run(double *ChargeDensity, DoubleArray MembraneDistance,
|
||||
bool UseSlippingVelBC, int timestep_from_Study);
|
||||
void getElectricPotential(DoubleArray &ReturnValues);
|
||||
void getSolverError(DoubleArray &ReturnValues);
|
||||
void getElectricPotential_debug(int timestep);
|
||||
void getElectricField(DoubleArray &Values_x, DoubleArray &Values_y,
|
||||
DoubleArray &Values_z);
|
||||
|
@ -96,6 +97,7 @@ public:
|
|||
double *Psi;
|
||||
int *Psi_BCLabel;
|
||||
double *ElectricField;
|
||||
double *Permittivity;
|
||||
double *ChargeDensityDummy; // for debugging
|
||||
double *ResidualError;
|
||||
|
||||
|
@ -120,6 +122,7 @@ private:
|
|||
//void SolveElectricField();
|
||||
void SolvePoissonAAodd(double *ChargeDensity, bool UseSlippingVelBC, int timestep);
|
||||
void SolvePoissonAAeven(double *ChargeDensity, bool UseSlippingVelBC, int timestep);
|
||||
void SetMeanZeroVoltage();
|
||||
void getConvergenceLog(int timestep,double error);
|
||||
double getBoundaryVoltagefromPeriodicBC(double V0,double freq,double t0,int time_step);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
|
||||
int i,j,k,n;
|
||||
bool Bounceback = false;
|
||||
|
||||
int rank = comm.getRank();
|
||||
if (rank == 0){
|
||||
|
@ -300,7 +301,7 @@ int main(int argc, char **argv)
|
|||
ScaLBL_CopyToDevice(fq, fq_host, sizeof(double)*7*Np);
|
||||
|
||||
M.SendD3Q7AA(&fq[0]);
|
||||
M.RecvD3Q7AA(&gq[0]);
|
||||
M.RecvD3Q7AA(&gq[0],Bounceback);
|
||||
// this has only the communicated values
|
||||
//ScaLBL_CopyToHost(fq_host, gq, sizeof(double)*7*Np);
|
||||
if (rank==0) printf ("Sum result \n");
|
||||
|
|
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 "threadpool/atomic_helpers.h"
|
||||
#include <stdexcept>
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
// Copyright © 2004 Mark Berrill. All Rights Reserved. This work is distributed with permission,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#ifndef included_ThreadPoolAtomicHelpers
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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_AtomicModelAtomicList
|
||||
#define included_AtomicModelAtomicList
|
||||
|
||||
|
|
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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_AtomicList_hpp
|
||||
#define included_AtomicList_hpp
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
// Copyright © 2004 Mark Berrill. All Rights Reserved. This work is distributed with permission,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
// PARTICULAR PURPOSE.
|
||||
|
|
|
@ -1,33 +1,3 @@
|
|||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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/>.
|
||||
*/
|
||||
/*
|
||||
Copyright 2013--2018 James E. McClure, Virginia Polytechnic & State University
|
||||
|
||||
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 the template functions for the thread pool
|
||||
#ifndef included_ThreadPoolTmpl
|
||||
#define included_ThreadPoolTmpl
|
||||
|
|
Loading…
Reference in New Issue
Block a user