Dear experts,

I'm trying to define a analytic solution as BC using the DirichletBoundary
class, for that I'm using FEMSystem ex1, my problem is 2D and I want to
prescribe u and v. From my understanding the DenseVector<Number> & output
was the same size as variables input when constructing the bc object, but
I'm passing a vector with 2 variables and output has only one value, so the
program crashes with the assert:

Assertion `i < _val.size()' failed.

i = 1

_val.size() = 1

Should I resize output or define once for each variable ?
Bellow the code and debug values:

all_bdys <4 items> std::set<short, std::less<short>, std::allocator<short> >
uvw <2 items> std::vector<unsigned int, std::allocator<unsigned int> >
output @0x7fffffffb1f0 libMesh::DenseVector<double> &
[libMesh::DenseVectorBase<double>] @0x7fffffffb1f0
libMesh::DenseVectorBase<double>
_val <1 items> std::vector<double, std::allocator<double> >

class KimMoinBC : public FunctionBase<Number>

{

public:

    KimMoinBC(unsigned int u_var,

              unsigned int v_var)

        : _u_var(u_var), _v_var(v_var)

    {

        this->_initialized = true;

    }


    virtual Number operator() (const Point &, const Real = 0)

    {

        libmesh_not_implemented();

    }


    virtual void operator() (const Point & p,

                             const Real t,

                             DenseVector<Number> & output)

    {

        output.zero();

        const Real a = 2.0;

        const Real V = 0.01;

        const Real x = p(0), y = p(1);

        output(_u_var) = -cos(a * pi * x) * sin(a * pi * y) *
exp(-(a*a * pi*pi * t * V));

        output(_v_var) = sin(a * pi * x) * cos(a * pi * y) * exp(-2 *
(a*a * pi*pi * t * V));

    }


    virtual UniquePtr<FunctionBase<Number> > clone() const

    {

        return UniquePtr<FunctionBase<Number> >(new KimMoinBC(_u_var, _v_var));

    }


private:

    const unsigned int _u_var, _v_var;

};



            KimMoinBC kmbc(u_var, v_var);

            this->get_dof_map().add_dirichlet_boundary

            (DirichletBoundary(all_bdys, uvw, &kmbc));


Regards, Fabio
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to