Thanks for the help, but I still have the other doubt about the extraction of water.
Iam the two phase model with a fluidsustem ( h2oairfluid system), where water as wetting phase and air as non-wetting phase. In the function of SourceAtpos when i put the value ( negative for extraction) I think is extracting air , how i can only extract water?? Thanks Here is the code if you need it // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- // vi: set et ts=4 sw=4 sts=4: /***************************************************************************** * See the file COPYING for full copying permissions. * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! * \file * * \brief Tutorial problem for a fully coupled twophase box model. */ #ifndef DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian1}@*/ #define DUMUX_TUTORIAL_PROBLEM_COUPLED_HH // guardian macro /*@\label{tutorial-coupled:guardian2}@*/ // The numerical model #include <dumux/implicit/2p/2pmodel.hh> // The base porous media box problem #include <dumux/implicit/common/implicitporousmediaproblem.hh> // The DUNE grid used #if HAVE_ALUGRID #include <dune/grid/alugrid.hh> #else #include <dune/grid/yaspgrid.hh> #endif // HAVE_ALUGRID // Spatially dependent parameters #include "tutorialspatialparams_coupled.hh" // The components that are used #include <dumux/material/components/h2o.hh> #include <dumux/material/components/lnapl.hh> #include <dumux/material/components/brine.hh> #include <dumux/material/components/dnapl.hh> #include <dumux/material/components/air.hh> #include <dumux/io/cubegridcreator.hh> #include <dumux/io/simplexgridcreator.hh> #include <dumux/material/fluidsystems/h2oairfluidsystem.hh> namespace Dumux{ // Forward declaration of the problem class template <class TypeTag> class TutorialProblemCoupled; namespace Properties { // Create a new type tag for the problem NEW_TYPE_TAG(TutorialProblemCoupled, INHERITS_FROM(BoxTwoP, TutorialSpatialParamsCoupled)); /*@\label{tutorial-coupled:create-type-tag}@ */ // Set the "Problem" property SET_PROP(TutorialProblemCoupled, Problem) /*@\label{tutorial-coupled:set-problem}@*/ { typedef Dumux::TutorialProblemCoupled<TypeTag> type;}; // Set grid and the grid creator to be used #if HAVE_ALUGRID /*@\label{tutorial-coupled:set-grid}@*/ //Grilla cuadrada SET_TYPE_PROP(TutorialProblemCoupled, Grid, Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>); /*@\label{tutorial-coupled:set-grid-ALU}@ */ // SET_TYPE_PROP(TutorialProblemCoupled, Grid, Dune::ALUGrid</*dim=*/2, 2, Dune::simplex, Dune::nonconforming>); /*@\label{tutorial-coupled:set-grid}@ */ #else SET_TYPE_PROP(TutorialProblemCoupled, Grid, Dune::YaspGrid<2>); #warning If you want to use adaptivity, install and use ALUGrid. #endif // HAVE_ALUGRID //grilla cuadrada SET_TYPE_PROP(TutorialProblemCoupled, GridCreator, Dumux::CubeGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-gridcreator}@*/ // SET_TYPE_PROP(TutorialProblemCoupled, GridCreator, Dumux::SimplexGridCreator<TypeTag>); /*@\label{tutorial-coupled:set-gridcreator}@*/ // Set the wetting phase SET_PROP(TutorialProblemCoupled, WettingPhase) /*@\label{tutorial-coupled:2p-system-start}@*/ { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; // Agua public: typedef Dumux::LiquidPhase<Scalar, Dumux::H2O<Scalar> > type; /*@\label{tutorial-coupled:wettingPhase}@*/ // Brine // public: typedef Dumux::LiquidPhase<Scalar, Dumux::Brine<Scalar, Dumux::H20<Scalar> > > type; /*@\label{tutorial-coupled:wettingPhase}@*/ }; // Set the non-wetting phase SET_PROP(TutorialProblemCoupled, NonwettingPhase) { private: typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; // LNAPL public: typedef Dumux::GasPhase<Scalar, Dumux::Air<Scalar> > type; /*@\label{tutorial-coupled:nonwettingPhase}@*/ }; /*@\label{tutorial-coupled:2p-system-end}@*/ SET_TYPE_PROP(TutorialProblemCoupled, FluidSystem, Dumux::TwoPImmiscibleFluidSystem<TypeTag>);/*@\label{tutorial-coupled:set-fluidsystem}@ */ // Disable gravity SET_BOOL_PROP(TutorialProblemCoupled, ProblemEnableGravity, true); /*@\label{tutorial-coupled:gravity}@*/ } /*! * \ingroup TwoPBoxModel * * \brief Tutorial problem for a fully coupled twophase box model. */ template <class TypeTag> class TutorialProblemCoupled : public ImplicitPorousMediaProblem<TypeTag> /*@\label{tutorial-coupled:def-problem}@*/ { typedef ImplicitPorousMediaProblem<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; // Grid dimension enum { dim = GridView::dimension }; // Types from DUNE-Grid typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::template Codim<dim>::Entity Vertex; typedef typename GridView::Intersection Intersection; typedef Dune::FieldVector<Scalar, dim> GlobalPosition; // Dumux specific types typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices; typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes; typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; public: TutorialProblemCoupled(TimeManager &timeManager, const GridView &gridView) : ParentType(timeManager, gridView) , eps_(3e-6) { } //! Specifies the problem name. This is used as a prefix for files //! generated by the simulation. const char *name() const { return "tutorial_coupled"; } //! Returns true if a restart file should be written. bool shouldWriteRestartFile() const /*@\label{tutorial-coupled:restart}@ */ { return false; } //! Returns true if the current solution should be written to disk //! as a VTK file bool shouldWriteOutput() const /*@\label{tutorial-coupled:output}@*/ { return this->timeManager().timeStepIndex() > 0 && (this->timeManager().timeStepIndex() % 1 == 0); } //! Returns the temperature within a finite volume. We use constant //! 10 degrees Celsius. Scalar temperature() const { return 283.15; }; //! Specifies which kind of boundary condition should be used for //! which equation for a finite volume on the boundary. void boundaryTypes(BoundaryTypes &bcTypes, const Vertex &vertex) const { const GlobalPosition &globalPos = vertex.geometry().center(); if (globalPos[1] > 42.04-eps_) // Dirichlet conditions on left boundary // if (globalPos[1] < eps_) // Dirichlet conditions on bottom boundary bcTypes.setAllDirichlet(); else // neuman for the remaining boundaries bcTypes.setAllNeumann(); } //! Evaluates the Dirichlet boundary conditions for a finite volume //! on the grid boundary. Here, the 'values' parameter stores //! primary variables. void dirichlet(PrimaryVariables &values, const Vertex &vertex) const { values[Indices::pwIdx] = 101.3e3; // 200 kPa = 2 bar // values[Indices::snIdx] = 0.85; // 0 % } //! Evaluates the boundary conditions for a Neumann boundary //! segment. Here, the 'values' parameter stores the mass flux in //! [kg/(m^2 * s)] in normal direction of each phase. Negative //! values mean influx. void neumann(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, const Intersection &intersection, int scvIdx, int boundaryFaceIdx) const { values[Indices::contiWEqIdx] = 0; values[Indices::contiNEqIdx] = 0; } //! Evaluates the initial value for a control volume. For this //! method, the 'values' parameter stores primary variables. void initial(PrimaryVariables &values, const Element &element, const FVElementGeometry &fvGeometry, int scvIdx) const { GlobalPosition globalPos = element.geometry().corner(scvIdx); values[Indices::pwIdx] = (42.04-globalPos[1])*9800+101.3e3; values[Indices::snIdx] = 0.0; } //! Evaluates the source term for all phases within a given //! sub-control-volume. In this case, the 'values' parameter //! stores the rate mass generated or annihilated per volume unit //! in [kg / (m^3 * s)]. Positive values mean that mass is created. // void source(PrimaryVariables &values, // const Element &element, // const FVElementGeometry &fvGeometry, // int scvIdx) const // { // GlobalPosition globalPos = element.geometry().corner(scvIdx); // if (globalPos[1] < 20 && globalPos[1] > 10 && globalPos[0] > 5 && globalPos[0] < 10) // values[Indices::contiWEqIdx] = -10.0; // values[Indices::contiNEqIdx]= 0.0; // else // values[Indices::contiWEqIdx] = 0.0; // values[Indices::contiNEqIdx]= 0.0; // } void sourceAtPos(PrimaryVariables &values, const GlobalPosition &globalPos) const { const Scalar time = this->timeManager().time() + this->timeManager().timeStepSize(); if(time>5000) { if (globalPos[1] < 21 && globalPos[1] > 20 && globalPos[0] > 9 && globalPos[0] < 10) values = -1; else values= 0.0;} else {values= 0.0;} } private: // small epsilon value Scalar eps_; }; } #endif 2014-02-14 12:04 GMT+01:00 Alexander Kissinger < [email protected]>: > Dear Gerado, > > > I dont know very well how to use de return values of this function. > > Depending on whether useMoles is set on true or false, the flux has to be > given either in * kg/(m^3*s) or mole/(m^3*s) in the input file. So you have > to divide your extraction rate by the volume of the element(s) you are > injecting into. > If you are not sure whether you have the right position for injection, > just put an output into your if statement: > > > if (globalPos[1] < 21 && globalPos[1] > 20 && globalPos[0] > 9 && > globalPos[0] < 10) > std::cout<<"Im in the injection spot"<<std::endl; > > values= -1; > else > values= 0;} > > best regards, > Alex > > > On 02/13/2014 04:01 PM, Gerardo Zegers R wrote: > > Hi. > > I want to put a extraction well of water in a model. To do this i use > function sourceAtPos ( below is the function), the model is running but > it´s not extracting only water. How can I put that extraction of water > qw=-1 and extraction of air qa=0 . I dont know very well how to use de > return values of this function. > > Thanks > > Gerardo > > void sourceAtPos(PrimaryVariables &values, > const GlobalPosition &globalPos) const > { > > const Scalar time = this->timeManager().time() + > this->timeManager().timeStepSize(); > > if(time>5000) > { > if (globalPos[1] < 21 && globalPos[1] > 20 && globalPos[0] > 9 && > globalPos[0] < 10) > values= -1; > else > values= 0;} > else > {values= 0;} > } > > > 2014-02-12 12:24 GMT+01:00 Holger Class <[email protected] > >: > >> Dear Gerardo, >> >> problems with convergence can have thousands of reasons, most common is >> some problem with non-physical boundary and initial values or other model >> parameters. >> Try to get a simple problem running, increase step by step the complexity >> of your physics, e.g. taking a very small value of the source term first, >> and so on. >> >> Without knowing this, we cannot help in this situation. At least I cannot. >> >> Best regards, >> Holger >> >> On Wed, Feb 12, 2014 at 12:15:07PM +0100, Gerardo Zegers R wrote: >> > Hi thanks for the help and sorry for not give more details. >> > >> > When i used the function SourceAtPos , the problem can compile without >> > problem but when I run the file It cant converge. >> > >> > The describing area is inside the grid and they are nodes inside because >> > dx=0.4 m and dy=0.4 m and iam using now a subarea of 1x1m to put the >> source >> > term. >> > >> > What can i do to get convergence? i have tried with differents >> timesteps. >> > >> > Thanks >> > >> > Gerardo >> > >> > >> > >> > 2014-02-12 9:19 GMT+01:00 Christoph Grüninger < >> > [email protected]>: >> > >> > > Hi Gerardo, >> > > "does not work" is kind of an useless problem description. What do you >> > > expect? What happens actually? >> > > >> > > Having a look into my crystal ball unveils the following hint: >> > > >> > > - Adding a std::cout to your function to proof that it is actually >> > > evaluated. >> > > - Your grid must match the conditions. It must be fine enough that >> some >> > > nodes are inside the described area and that this area is inside the >> > > grid. Please double check. Maybe a std::cout inside the first case >> would >> > > be helpful, too. >> > > - Have a look at the resulting linear system, especially the right >> hand >> > > side. Does your source term have an effect? >> > > >> > > Bye >> > > Christoph >> > > >> > > -- >> > > ... as Sir Cyril Hinshelwood has observed ...fluid dynamicists >> > > were divided into hydraulic engineers who observed things that >> > > could not be explained and mathematicians who explained things >> > > that could not be observed. -- James Lighthill >> > > ********************************************* >> > > CMWR 2014: 10th - 13th June 2014 in Stuttgart >> > > Please visit www.cmwr14.de >> > > ********************************************* >> > > _______________________________________________ >> > > Dumux mailing list >> > > [email protected] >> > > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux >> > > >> > >> > >> > >> > -- >> > Gerardo Zegers R >> > 89850305 >> >> > _______________________________________________ >> > Dumux mailing list >> > [email protected] >> > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux >> >> >> -- >> Holger Class >> >> >> ############################################################################### >> Lehrstuhl fuer Hydromechanik und Hydrosystemmodellierung (LH2) >> Institut für Wasser- und Umweltsystemmodellierung (IWS), Universitaet >> Stuttgart >> www.iws.uni-stuttgart.de/hydrosys >> email: [email protected] >> Pfaffenwaldring 61 ** 70550 Stuttgart >> Tel.: ++49 711 / 685-64678 <%2B%2B49%20%20711%20%2F%20685-64678> >> Fax.: ++49 711 / >> 685-60430<%2B%2B49%20%20711%20%2F%20685-60430> >> >> ##################################Ecc#4,4###################################### >> _______________________________________________ >> Dumux mailing list >> [email protected] >> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux >> > > > > -- > Gerardo Zegers R > 89850305 > > > _______________________________________________ > Dumux mailing > [email protected]https://listserv.uni-stuttgart.de/mailman/listinfo/dumux > > > > -- > ******************************************************* > !!!! CMWR 2014: 10th - 13th June 2014 in Stuttgart !!!! > Please visit www.cmwr14.de > ******************************************************* > Alexander Kissinger > Institut für Wasser- und Umweltsystemmodellierung > Lehrstuhl für Hydromechanik und Hydrosystemmodellierung > Pfaffenwaldring 61 > D-70569 Stuttgart > > Telefon: +49 (0) 711 685-64729 > E-Mail: [email protected] > > > _______________________________________________ > Dumux mailing list > [email protected] > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux > > -- Gerardo Zegers R 89850305
_______________________________________________ Dumux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
