Skip to content

Commit

Permalink
geochemical package update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyprien SOULAINE committed Feb 20, 2020
1 parent 498a810 commit 1e9df1a
Show file tree
Hide file tree
Showing 14 changed files with 439 additions and 24 deletions.
1 change: 0 additions & 1 deletion Allwclean
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ then
rm -f $FOAM_USER_LIBBIN/libporousModels.so
rm -f $FOAM_USER_LIBBIN/libtoolsGIS.so
rm -f $FOAM_USER_LIBBIN/liboherModelsGIS.so
rm -f $FOAM_USER_LIBBIN/libgeochemicalModels.so
fi
2 changes: 2 additions & 0 deletions libraries/porousModels/Make/files
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ unsaturatedPorousModels/unsaturatedPorousModel.C

geochemicalModels/basicGeochemicalModel/basicGeochemicalModel.C
geochemicalModels/basicGeochemicalModel/basicGeochemicalModelNew.C
geochemicalModels/flowOnly/flowOnly.C


geochemicalModels/geochemicalModel.C

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,85 @@ Foam::basicGeochemicalModel::basicGeochemicalModel
const dictionary& dict
)
:
// basicGeochemicalModel(mesh, dict.subDict("geochemicalProperties")),
mesh_(mesh),
mineralList_(dict.lookup("mineral"))
mineralList_(dict.lookup("mineral")),
Ys_(mineralList_.size() ),
inertMineral_
(
IOobject
(
"inertMineral",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("inertMineral",dimless,0.0),
"zeroGradient"
),
eps_
(
IOobject
(
"eps",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("eps",dimless,1.0),
"zeroGradient"
),
porousMedia_(mineralList_.size()),
absolutePermeabilityModelPtr_
(
absolutePermeabilityModel::New(mesh, dict)
)
/// rhol_(dict.lookup("rhol"))
{

forAll(mineralList_,s)
{
word currentMineral = mineralList_[s];
Info << " Doing stuff for mineral: " << currentMineral << endl;

Ys_.set
(
s,
new volScalarField
(
IOobject
(
"Ys."+mineralList_[s],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ, //READ_IF_PRESENT, //MUST_READ ??
IOobject::AUTO_WRITE
),
mesh_ //,
// dimensionedScalar(currentMineral,dimless,0.0),
// "zeroGradient"
)
);
Ys_[s].write();

porousMedia_.set
(
s,
new porousModel
(
mesh,
mineralList_[s],
Ys_[s],
dict
)
);
}
updatePorosity();


}

// -------------------------------------------------------------------------//
Expand Down Expand Up @@ -77,4 +151,17 @@ Foam::volScalarField Foam::basicGeochemicalModel::rhol() const
return rhol_;
}
*/

void Foam::basicGeochemicalModel::updatePorosity()
{
eps_ = 0.0*eps_;
forAll(mineralList_,s)
{
eps_+=Ys_[s];
}
eps_ = 1.-eps_-inertMineral_;
}



// ************************************************************************* //
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,19 @@ class basicGeochemicalModel
const fvMesh &mesh_;

speciesTable mineralList_;
/*

PtrList<volScalarField> Ys_;

volScalarField inertMineral_;

volScalarField eps_;
*/


// autoPtr<surfaceAreaModel> surfaceAreaModelPtr_;
PtrList<porousModel> porousMedia_;

// tmp<volScalarField> Ae_;
// volScalarField Ae_;

// autoPtr<permeabilityModel> permeabilityModelPtr_;
autoPtr<absolutePermeabilityModel> absolutePermeabilityModelPtr_;
/*
tmp<volScalarField> invK_;
*/
Expand Down Expand Up @@ -145,7 +143,8 @@ class basicGeochemicalModel
virtual void updatePermeability();
*/
/*
/* rm -f $FOAM_USER_LIBBIN/libgeochemicalModels.so
tmp<volScalarField> surfaceArea() const
// volScalarField surfaceArea() const
{
Expand Down Expand Up @@ -187,9 +186,24 @@ class basicGeochemicalModel
*/

virtual void updatePorosity() = 0;
void updatePorosity();

// virtual volScalarField dMs() const = 0;

virtual volScalarField dMs() const = 0;
tmp<volScalarField> porosity() const
{
return eps_;
}

tmp<volScalarField> absolutePermeability() const
{
return absolutePermeabilityModelPtr_->absolutePermeability();
}

tmp<volScalarField> inversePermeability() const
{
return absolutePermeabilityModelPtr_->inversePermeability();
}

void coucou()
{
Expand Down
90 changes: 90 additions & 0 deletions libraries/porousModels/geochemicalModels/flowOnly/flowOnly.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/

#include "flowOnly.H"
#include "addToRunTimeSelectionTable.H"


// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace geochemicalModels
{
defineTypeNameAndDebug(flowOnly, 0);

addToRunTimeSelectionTable
(
basicGeochemicalModel,
flowOnly,
dictionary
);
}
}

// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

Foam::geochemicalModels::flowOnly::flowOnly
(
const fvMesh& mesh,
const dictionary& dict
)
:
basicGeochemicalModel(mesh, dict)
/// rhol_(dict.lookup("rhol"))
{
Info << " flowOnly, no geochemistry " << nl << endl;
}

// -------------------------------------------------------------------------//

/*
Foam::volScalarField Foam::flowOnly::dMl() const
{
volScalarField dMl_(0.0*fvc::ddt(Y_[0])/this->rhol());
forAll(Y_,s)
{
dMl_ = dMl_ + fvc::ddt(Y_[s])/this->rhol();
}
return dMl_;
}
*/

/*
Foam::volScalarField Foam::flowOnly::rhol() const
{
volScalarField rhol_(0.0*Y_[0]);
forAll(Y_,s)
{
rhol_ = rhol_ + Y_[s];
}
return rhol_;
}
*/
// ************************************************************************* //
Loading

0 comments on commit 1e9df1a

Please sign in to comment.