using namespace std;
int main(int argc, char *argv[])
{
bool plot = false;
gsCmdLine cmd(
"Example for solving a convection-diffusion problem.");
cmd.addSwitch("plot", "Create a ParaView visualization file with the solution", plot);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }
gsInfo<<
"Source function " << rhs <<
"\n";
gsInfo<<
"Dirichlet boundary conditions " << g <<
"\n\n";
string fileSrc( "planar/lshape2d_3patches_thb.xml" );
gsInfo <<
"The domain is a "<< patches <<
"\n";
for ( gsMultiPatch<>::const_biterator
bit = patches.
bBegin(); bit != patches.
bEnd(); ++bit)
{
}
int numInitUniformRefine = 2;
for (int i = 0; i < numInitUniformRefine; ++i)
bases.uniformRefine();
int numRefinementLoops = 3;
MarkingStrategy adaptRefCrit = PUCA;
const real_t adaptRefParam = 0.7;
cdrAss.options().setInt("DirichletValues",dirichlet::l2Projection);
for( int refLoop = 0; refLoop <= numRefinementLoops; refLoop++)
{
gsInfo <<
"====== Loop " << refLoop <<
" of "
<<numRefinementLoops<< " ======" << "\n";
cdrAss.assemble();
gsSparseSolver<>::BiCGSTABILUT( cdrAss.matrix() ).solve( cdrAss.rhs() );
solField = cdrAss.constructSolution(solVector);
gsExprEvaluator<>::geometryMap Gm = ev.
getMap(patches);
const std::vector<real_t> & eltErrs = ev.
elementwise();
std::vector<bool> elMarked( eltErrs.size() );
gsInfo <<
"Marked "<< std::count(elMarked.begin(), elMarked.end(),
true) <<
" elements.\n";
cdrAss.multiBasis().repairInterfaces( patches.
interfaces() );
cdrAss.refresh();
if( plot && refLoop == numRefinementLoops )
{
gsWriteParaview<>( solField, "adaptRef", 1000, true);
}
}
if( plot )
{
}
else
{
gsInfo<<
"Done. No output created, re-run with --plot to get a ParaView "
"file containing Plotting image data.\n";
}
return EXIT_SUCCESS;
}
Definition gsExpressions.h:928
Class containing a set of boundary conditions.
Definition gsBoundaryConditions.h:342
void addCondition(int p, boxSide s, condition_type::type t, gsFunctionSet< T > *f, short_t unknown=0, bool parametric=false, int comp=-1)
Adds another boundary condition.
Definition gsBoundaryConditions.h:650
const ifContainer & interfaces() const
Return the vector of interfaces.
Definition gsBoxTopology.h:252
const_biterator bBegin() const
Definition gsBoxTopology.h:139
const_biterator bEnd() const
Definition gsBoxTopology.h:144
Implementation of an (multiple righ-hand side) Poisson solver.
Definition gsCDRAssembler.h:50
Class for command-line argument parsing.
Definition gsCmdLine.h:57
A convection-diffusion-reaction PDE, including source term on the right-hand side.
Definition gsConvDiffRePde.h:36
Generic evaluator of isogeometric expressions.
Definition gsExprEvaluator.h:39
void setIntegrationElements(const gsMultiBasis< T > &mesh)
Sets the domain of integration.
Definition gsExprEvaluator.h:110
const std::vector< T > & elementwise() const
Returns an std::vector containing the last computed values per element.
Definition gsExprEvaluator.h:99
T integralElWise(const expr::_expr< E > &expr)
Calculates the integral of the expression expr on each element.
Definition gsExprEvaluator.h:159
variable getVariable(const gsFunctionSet< T > &func, index_t dim=1)
Registers func as a variable and returns a handle to it.
Definition gsExprEvaluator.h:124
geometryMap getMap(const gsMultiPatch< T > &mp)
Registers mp as an isogeometric geometry map and return a handle to it.
Definition gsExprEvaluator.h:116
A scalar of vector field defined on a m_parametric geometry.
Definition gsField.h:55
const gsFunctionSet< T > & fields() const
Returns the fields (defined per patch)
Definition gsField.h:218
static void open(const std::string &fn)
Opens the file fn using the preferred application of the OS.
Definition gsFileManager.cpp:688
Class defining a multivariate (real or vector) function given by a string mathematical expression.
Definition gsFunctionExpr.h:52
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Holds a set of patch-wise bases and their topology information.
Definition gsMultiBasis.h:37
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
bool computeTopology(T tol=1e-4, bool cornersOnly=false, bool tjunctions=false)
Attempt to compute interfaces and boundaries automatically.
Definition gsMultiPatch.hpp:377
Reads an object from a data file, if such the requested object exists in the file.
Definition gsReadFile.h:43
Main header to be included by clients using the G+Smo library.
void gsMarkElementsForRef(const std::vector< T > &elError, int refCriterion, T refParameter, std::vector< bool > &elMarked)
Marks elements/cells for refinement.
Definition gsAdaptiveRefUtils.h:196
void gsRefineMarkedElements(gsMultiBasis< T > &basis, const std::vector< bool > &elMarked, index_t refExtension=0)
Refine a gsMultiBasis, based on a vector of element-markings.
Definition gsAdaptiveRefUtils.h:294
Provides class for adaptive refinement.
#define gsInfo
Definition gsDebug.h:43
The G+Smo namespace, containing all definitions for the library.
@ dirichlet
Dirichlet type.
Definition gsBoundaryConditions.h:31
@ SUPG
Use SUPG.
Definition gsCDRAssembler.h:30