int main(int argc, char *argv[])
{
bool plot = false;
cmd.addSwitch("plot", "Plot the result in ParaView.", plot);
try { cmd.getValues(argc,argv); } catch (int rv) { return rv; }
gsInfo<<
"Source function is: "<< f <<
"\n";
patches.computeTopology();
int numRefine = 2;
int numElevate = 0;
if ( numElevate > -1 )
{
int tmp = refine_bases.maxDegree(0);
for (
short_t j = 1; j < patches.parDim(); ++j )
if ( tmp < refine_bases.maxDegree(j) )
tmp = refine_bases.maxDegree(j);
tmp += numElevate;
refine_bases.setDegree(tmp);
}
for (int i = 0; i < numRefine; ++i)
refine_bases.uniformRefine();
real_t theta = 0.5;
stationary.options().setInt("DirichletStrategy", dirichlet::elimination);
stationary.options().setInt("InterfaceStrategy", iFace::glue);
assembler.setTheta(theta);
gsInfo<<assembler.options()<<
"\n";
gsSparseSolver<>::CGDiagonal solver;
gsInfo<<
"Assembling mass and stiffness...\n";
assembler.assemble();
int ndof = assembler.numDofs();
real_t endTime = 0.1;
int numSteps = 40;
Sol.setZero(ndof, 1);
real_t Dt = endTime / numSteps ;
const std::string baseName("heat_eq_solution");
collection.options().setInt("numPoints", 1000);
collection.options().setInt("precision", 5);
if ( plot )
{
gsField<> sol = stationary.constructSolution(Sol);
collection.newTimeStep(&patches);
collection.addField(sol, "Temperature");
collection.saveTimeStep();
}
for ( int i = 1; i<=numSteps; ++i)
{
assembler.nextTimeStep(Sol, Dt);
gsInfo<<
"Solving timestep "<< i*Dt<<
".\n";
Sol = solver.compute( assembler.matrix() ).solve( assembler.rhs() );
gsField<> sol = stationary.constructSolution(Sol);
if ( plot )
{
collection.newTimeStep(&patches);
collection.addField(sol, "Temperature");
collection.saveTimeStep();
}
}
if ( plot )
{
collection.save();
}
else
gsInfo <<
"Done. No output created, re-run with --plot to get a ParaView "
"file containing the solution.\n";
return EXIT_SUCCESS;
}
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
Class for command-line argument parsing.
Definition gsCmdLine.h:57
Class defining a globally constant function.
Definition gsConstantFunction.h:34
A scalar of vector field defined on a m_parametric geometry.
Definition gsField.h:55
static void open(const std::string &fn)
Opens the file fn using the preferred application of the OS.
Definition gsFileManager.cpp:688
Constructs the assembler for the discretized isogeometric heat equation.
Definition gsHeatEquation.h:34
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
This class is used to create a Paraview .pvd (collection) file.
Definition gsParaviewCollection.h:77
Implementation of an (multiple right-hand side) Poisson assembler.
Definition gsPoissonAssembler.h:37
A Poisson PDE.
Definition gsPoissonPde.h:35
Main header to be included by clients using the G+Smo library.
#define short_t
Definition gsConfig.h:35
#define gsInfo
Definition gsDebug.h:43
The G+Smo namespace, containing all definitions for the library.
@ dirichlet
Dirichlet type.
Definition gsBoundaryConditions.h:31
@ neumann
Neumann type.
Definition gsBoundaryConditions.h:33
Class gsNurbsCreator provides some simple examples of Nurbs Geometries.
Definition gsNurbsCreator.h:37