Source: k2dgrflow/galarimpgrflow.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          galarimpgrflow.h  -  description
                             -------------------
    begin                : Tue Jun 5 2001
    copyright            : (C) 2001 by benny
    email                : bm@cage.rug.ac.be
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef GALARIMPGRFLOW_H
#define GALARIMPGRFLOW_H

#include "galarsolver2d.h"
//extra includes for inlined functions
#include "domainnet2d.h"
#include "topoimp.h"

/**Implementation of the problem solved in the 
k2dgrflow problem :  
div ( exp(dz) * grad(phi) ) 
  *@author benny
  */

class GalarImpGrFlow : public GalarSolver2d  {
public:
     /** construction of the implementation by giving the domain domnet on wich to solve the equation,
         and by giving the d-parameter of the equation */
	GalarImpGrFlow( DomainNet2d * domnet , double dparam=0. ):GalarSolver2d(domnet),d(dparam){};
	~GalarImpGrFlow(){};
    /** solve the problem and return a pointer to the solution.
         beware : when the problem is deallocated, also the memory where the solution resides is freed */
    virtual VEC* solution();
    /** return the dparam
      */
    double getd(){return d;} ;
    /** set the d parameter
      */
    void setd(double dparam){ d = dparam ;};

protected :
      /** calculate the localstiffness matrix with a specific element
        */
      virtual void localStiffness(TopoElement2d* el);
      /** calculate the local force vector with a specific element
        */
      virtual void localForce(TopoElement2d* el);
      /** calculate the diffusion term for local node I,J in an element
        */
      virtual double diffusion(TopoElement2d* el, unsigned int localI, unsigned int localJ);
      /** calculate the convection term for local node I,J in an element
        */
      virtual double convection(TopoElement2d* el, unsigned int localI, unsigned int localJ){return 0.;} ;
      /** calculate the robin term for local node I,J in an element
        */
      virtual double robin(TopoElement2d* el, unsigned int localI, unsigned int localJ){return 0.;} ;
      /** calculate the head term for local node I,J in an element
        */
      virtual double headTerm(TopoElement2d* el, unsigned int localI, unsigned int localJ){return 0.;} ;
      /** calculate the source term for local node J in an element, part of the force
        */
      virtual double sourceTerm(TopoElement2d* el, unsigned int localJ);
      /** calculate the neumann term for local node J in an element, part of the force
        */
      virtual double neumannTerm(TopoElement2d* el, unsigned int localJ){return 0.;} ;
      /** return the gdir function in a node
        */
      virtual double gDir(TopoNodeDir2d* nod);
      /** return the gNeu function in a node
        */
      virtual double gNeu(TopoNodeNeu2d* nod){return 0.;} ;
      /** return the gRob function in a node
        */
      virtual double gRob(TopoNodeRobin2d* nod){return 0.;} ;

private :
    /** the d parameter of the equation
      */
    double d;
};

//inline short functions for speed optimazation
/** calculate the source term for local node J in an element, part of the force */
inline double GalarImpGrFlow::sourceTerm(TopoElement2d* tria, unsigned int localJ)
{ //if dirichletnode, then gdir, otherwise 0 !
  if (tria->node(localJ)->dirNode())
     { //the force of a dirichletnode in the local matrix, is the value of the dirichlet function
       return gDir((TopoNodeDir2d *) tria->node(localJ)) ;
     } else {
       // there is no real source term in our equation
       return 0. ;
     }

}
/** return the gdir function in a node */
inline double GalarImpGrFlow::gDir(TopoNodeDir2d* nod)
{  //a dir node contains the bordernumber of the border in the net.
   //in this application, all dirichletvalues are contained in the K2dBorderBase Class
   return net->geoBoundary[nod->onBorder()]->gDirichlet(nod->co1() , nod->co2() ) ;
}


#endif

Generated by: benny@okidoki on Thu Jun 21 10:41:51 2001, using kdoc 2.0a53.