Commit 3f64696e authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

some demos added

parent 754e14dd
......@@ -10,14 +10,40 @@ if(AMDIS_FOUND)
SET(BASIS_LIBS ${AMDIS_LIBRARIES})
endif(AMDIS_FOUND)
file(GLOB sources src/*.cc)
foreach(s ${sources})
get_filename_component(swe ${s} NAME_WE)
add_executable(${swe} ${s})
target_link_libraries(${swe} ${BASIS_LIBS})
install(TARGETS ${swe}
RUNTIME DESTINATION bin )
endforeach(s)
# file(GLOB sources src/*.cc)
# foreach(s ${sources})
# get_filename_component(swe ${s} NAME_WE)
# add_executable(${swe} ${s})
# target_link_libraries(${swe} ${BASIS_LIBS})
# install(TARGETS ${swe}
# RUNTIME DESTINATION bin )
# endforeach(s)
set(TOOLS_DIR /opt/amdis_trunk/tools)
include_directories(${TOOLS_DIR}/diffuseDomain)
include_directories(${TOOLS_DIR}/baseProblems)
set(ch_source src/cahn_hilliard.cc
${TOOLS_DIR}/baseProblems/CahnHilliard.cc)
set(elliptImplicit src/elliptImplicit.cc)
set(elliptBase src/elliptBaseProblem.cc)
set(roberto src/newmodel_s.cc)
add_executable("cahn_hilliard" ${ch_source})
target_link_libraries("cahn_hilliard" ${BASIS_LIBS})
# Problem von Robert
add_executable("roberto" ${roberto})
target_link_libraries("roberto" ${BASIS_LIBS})
add_executable("elliptImplicit" ${elliptImplicit})
target_link_libraries("elliptImplicit" ${BASIS_LIBS})
add_executable("elliptBase" ${elliptBase})
target_link_libraries("elliptBase" ${BASIS_LIBS})
#create the output dir
file(MAKE_DIRECTORY output)
# file(MAKE_DIRECTORY output)
\ No newline at end of file
dimension of world: 2
elliptMesh->macro file name: ./macro/macro.stand.2d
elliptMesh->global refinements: 0
elliptMesh->global refinements: 5
ellipt->mesh: elliptMesh
ellipt->dim: 2
......@@ -24,7 +24,7 @@ ellipt->estimator[0]->C1: 0.1 % constant of jump residual
ellipt->marker[0]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS
ellipt->marker[0]->MSGamma: 0.5
ellipt->adapt[0]->tolerance: 1e-4
ellipt->adapt[0]->tolerance: 1e-6
ellipt->adapt[0]->refine bisections: 2
ellipt->adapt->max iteration: 10
......
dimension of world: 2
elliptMesh->macro file name: ./macro/stand.macro.2d
elliptMesh->global refinements: 5
ellipt->space->mesh: elliptMesh
ellipt->space->dim: 2
ellipt->space->components: 1
ellipt->space->polynomial degree[0]: 1
ellipt->space->solver: cg
ellipt->space->solver->ell: 1
ellipt->space->solver->max iteration: 1000
ellipt->space->solver->tolerance: 1.e-8
ellipt->space->solver->info: 10
ellipt->space->solver->left precon: ilu
ellipt->space->solver->right precon: no
ellipt->space->estimator[0]: residual
ellipt->space->estimator[0]->error norm: H1_NORM % 1: H1_NORM, 2: L2_NORM
ellipt->space->estimator[0]->C0: 0.1 % constant of element residual
ellipt->space->estimator[0]->C1: 0.1 % constant of jump residual
ellipt->space->marker[0]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS
ellipt->space->marker[0]->MSGamma: 0.5
ellipt->adapt[0]->tolerance: 1e-6
ellipt->adapt[0]->refine bisections: 2
ellipt->adapt->max iteration: 10
ellipt->space->output->filename: output/elliptBase.2d
ellipt->space->output->ParaView format: 1
ellipt->space->output->ARH format: 1
ellipt->space->output->AMDiS format: 1
dimension of world: 2
elliptMesh->macro file name: ./macro/macro.big.2d
elliptMesh->global refinements: 0
mesh->refinement->initial level: 10
mesh->refinement->level on interface: 17
mesh->refinement->level in inner domain: 10
mesh->refinement->level in outer domain: 0
mesh->refinement->interface width: 0.01
ellipt->mesh: elliptMesh
ellipt->dim: 2
ellipt->components: 1
ellipt->polynomial degree[0]: 1
ellipt->solver: cg
ellipt->solver->ell: 1
ellipt->solver->max iteration: 1000
ellipt->solver->tolerance: 1.e-8
ellipt->solver->info: 10
ellipt->solver->left precon: ilu
ellipt->solver->right precon: no
ellipt->estimator[0]: residual
ellipt->estimator[0]->error norm: H1_NORM % 1: H1_NORM, 2: L2_NORM
ellipt->estimator[0]->C0: 0.1 % constant of element residual
ellipt->estimator[0]->C1: 0.1 % constant of jump residual
ellipt->marker[0]->strategy: 2 % 0: no adaption 1: GR 2: MS 3: ES 4:GERS
ellipt->marker[0]->MSGamma: 0.5
ellipt->adapt[0]->tolerance: 1e-6
ellipt->adapt[0]->refine bisections: 2
ellipt->adapt->max iteration: 5
ellipt->output->filename: output/elliptImplicit.2d
ellipt->output->ParaView format: 1
ellipt->output->ARH format: 1
ellipt->output->AMDiS format: 1
#include "AMDiS.h"
#include "boost/date_time/posix_time/posix_time.hpp"
using namespace AMDiS;
using namespace std;
using namespace boost::posix_time;
// ===========================================================================
// ===== function definitions ================================================
......@@ -57,7 +59,6 @@ int main(int argc, char* argv[])
// === create adapt ===
AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
// ===== create matrix operator =====
Operator matrixOperator(ellipt.getFeSpace());
......@@ -70,14 +71,17 @@ int main(int argc, char* argv[])
Operator rhsOperator(ellipt.getFeSpace());
rhsOperator.addZeroOrderTerm(new CoordsAtQP_ZOT(new F(degree)));
ellipt.addVectorOperator(rhsOperator, 0);
// ===== add boundary conditions =====
ellipt.addDirichletBC(1, 0, 0, new G);
// ===== start adaption loop =====
ptime start_time= microsec_clock::local_time();
adapt.adapt();
time_duration td= microsec_clock::local_time()-start_time;
MSG("elapsed time= %f msec\n", td.total_milliseconds()/1000.0);
ellipt.writeFiles(adaptInfo, true);
......
#include "AMDiS.h"
#include "BaseProblem.h"
#include "boost/date_time/posix_time/posix_time.hpp"
using namespace AMDiS;
using namespace boost::posix_time;
// ===========================================================================
// ===== function definitions ================================================
// ===========================================================================
/// Dirichlet boundary function
class G : public AbstractFunction<double, WorldVector<double> >
{
public:
/// Implementation of AbstractFunction::operator().
double operator()(const WorldVector<double>& x) const
{
return exp(-10.0 * (x * x));
}
};
/// RHS function
class F : public AbstractFunction<double, WorldVector<double> >
{
public:
F(int degree) : AbstractFunction<double, WorldVector<double> >(degree) {}
/// Implementation of AbstractFunction::operator().
double operator()(const WorldVector<double>& x) const
{
int dow = Global::getGeo(WORLD);
double r2 = (x * x);
double ux = exp(-10.0 * r2);
return -(400.0 * r2 - 20.0 * dow) * ux;
}
};
class ElliptBase : public StandardBaseProblem
{
public:
typedef StandardBaseProblem super;
public:
ElliptBase(std::string name_) : super(name_) {}
protected:
void fillOperators()
{
// ===== create matrix operator =====
Operator *matrixOperator = new Operator(getFeSpace());
matrixOperator->addSecondOrderTerm(new Simple_SOT);
prob->addMatrixOperator(matrixOperator, 0, 0);
// ===== create rhs operator =====
int degree = getFeSpace()->getBasisFcts()->getDegree();
Operator *rhsOperator = new Operator(getFeSpace());
rhsOperator->addZeroOrderTerm(new CoordsAtQP_ZOT(new F(degree)));
prob->addVectorOperator(rhsOperator, 0);
}
void fillBoundaryCondition()
{
// ===== add boundary conditions =====
prob->addDirichletBC(1, 0, 0, new G);
}
};
// ===========================================================================
// ===== main program ========================================================
// ===========================================================================
int main(int argc, char* argv[])
{
FUNCNAME("main");
AMDiS::init(argc, argv);
// ===== create and init the scalar problem =====
ElliptBase ellipt("ellipt");
ellipt.initialize(INIT_ALL);
// === create adapt info ===
AdaptInfo adaptInfo("ellipt->adapt", ellipt.getNumComponents());
// === create adapt ===
AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
// ===== start adaption loop =====
ptime start_time= microsec_clock::local_time();
ellipt.initTimeInterface(); // fillOperators() and fillBoundaryCondition()
adapt.adapt();
time_duration td= microsec_clock::local_time()-start_time;
MSG("elapsed time= %f msec\n", td.total_milliseconds()/1000.0);
ellipt.writeFiles(&adaptInfo, true);
AMDiS::finalize();
}
#include "AMDiS.h"
#include "SignedDistFunctors.h"
#include "ExtendedProblemStat.h"
#include "Refinement.h"
#include "MeshFunction_Level.h"
#include "boost/date_time/posix_time/posix_time.hpp"
using namespace AMDiS;
using namespace boost::posix_time;
/**
* solve poisson-equation in domain defined by signed-dist function, using
* dirichlet boundary condition on the implicit boundary (zero level set of
* signed-dist function) and an algebraic equation in the outer domain (sign
* of the signed-dist function poisitive).
**/
// ===========================================================================
// ===== function definitions ================================================
// ===========================================================================
/// Dirichlet boundary function
class G : public AbstractFunction<double, WorldVector<double> >
{
public:
/// Implementation of AbstractFunction::operator().
double operator()(const WorldVector<double>& x) const
{
return 0.0;
}
};
// ===========================================================================
// ===== main program ========================================================
// ===========================================================================
int main(int argc, char* argv[])
{
FUNCNAME("main");
AMDiS::init(argc, argv);
// ===== create and init the scalar problem =====
ExtendedProblemStat ellipt("ellipt");
ellipt.initialize(INIT_ALL);
// === create adapt info ===
AdaptInfo adaptInfo("ellipt->adapt", ellipt.getNumComponents());
// === create adapt ===
AdaptStationary adapt("ellipt->adapt", ellipt, adaptInfo);
// ===== signedDist function that describes the geometry =====
AbstractFunction<double, WorldVector<double> > *signedDistFct = new InverseCircle(1.0);
// ===== refine mesh at interface =====
SignedDistRefinement refFunction(ellipt.getMesh());
RefinementLevelCoords2 refinement(
ellipt.getFeSpace(),
&refFunction,
signedDistFct);
refinement.refine(9);
// ===== create matrix operator =====
Operator matrixOperator(ellipt.getFeSpace());
matrixOperator.addSecondOrderTerm(new Simple_SOT);
ellipt.addMatrixOperator(matrixOperator, 0, 0);
// ===== create rhs operator =====
Operator rhsOperator(ellipt.getFeSpace());
rhsOperator.addZeroOrderTerm(new Simple_ZOT(1.0));
ellipt.addVectorOperator(rhsOperator, 0);
// ===== add boundary conditions =====
DOFVector<double> G_dof(ellipt.getFeSpace(), "G");
G_dof.interpol(new G);
DOFVector<double> signedDist_dof(ellipt.getFeSpace(), "signedDist");
signedDist_dof.interpol(signedDistFct);
ellipt.addImplicitDirichletBC(signedDist_dof, 0, 0, G_dof);
// ===== start adaption loop =====
ptime start_time= microsec_clock::local_time();
adapt.adapt();
time_duration td= microsec_clock::local_time()-start_time;
MSG("elapsed time= %f msec\n", td.total_milliseconds()/1000.0);
ellipt.writeFiles(adaptInfo, true);
AMDiS::finalize();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment