#include "Galeri_Utils.h"
#include "Galeri_FiniteElements.h"
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
using namespace Galeri;
using namespace Galeri::FiniteElements;
double Diffusion(const double& x, const double& y, const double& z)
{
return (1.0);
}
double conv = 5000;
double ConvX(const double& x, const double& y, const double& z)
{
return (conv);
}
double ConvY(const double& x, const double& y, const double& z)
{
return (-conv);
}
double ConvZ(const double& x, const double& y, const double& z)
{
return (0.0);
}
double Source(const double& x, const double& y, const double& z)
{
return (0.0);
}
double Force(const double& x, const double& y, const double& z)
{
return (0.0);
}
double BoundaryValue(const double& x, const double& y,
const double& z, const int& Patch)
{
if ((x == 0.0 && y >= 0.0) || (y == 1.0 && x <= 0.2))
return(1.0);
else
return (0.0);
}
int BoundaryType(const int& Patch)
{
return(GALERI_DIRICHLET);
}
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
Epetra_MpiComm Comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm Comm;
#endif
try {
Epetra_CrsMatrix A(Copy, Grid.RowMap(), 0);
Epetra_Vector LHS(Grid.RowMap());
Epetra_Vector RHS(Grid.RowMap());
int NumQuadratureNodes = 3;
AdvDiff(NumQuadratureNodes, Diffusion, ConvX, ConvY, ConvZ,
Source, Force, BoundaryValue, BoundaryType);
FiniteElementProblem.Compute();
Solve(&A, &LHS, &RHS);
MEDIT.Write(Grid, "AdvDiff2D", LHS);
}
catch (int e) {
cerr << "Caught exception, value = " << e << endl;
}
catch (...) {
cerr << "Caught generic exception" << endl;
}
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return(0);
}