I tried to debug it (thus the reason for "volatile"), and reduced the whole 
code down to (called in SetupSystem()):

        
VectorTools::project(dof_handler, constraint_matrix, QGauss<dim>(3), 
InitialValues<dim>(carrier_density), solution);
        //For checking of content
        const FEValuesExtractors::Vector N_density(N_component);
        const FEValuesExtractors::Vector E_temperature(TE_component);
        const FEValuesExtractors::Vector L_temperature(TL_component);
        const QGauss<dim> quadrature_formula(fe_degree+1);
        const unsigned int dofs_per_cell = finite_element.dofs_per_cell;
        const unsigned int n_q_points    = quadrature_formula.size();
        FEValues<dim> fe_values(finite_element, quadrature_formula,
                                      update_values | update_gradients | 
update_JxW_values);
        std::vector<Tensor<1, dim>> value_N(dofs_per_cell), value_TE(
dofs_per_cell), value_TL(dofs_per_cell);
        for (auto cell = dof_handler.begin_active(); cell!=dof_handler.end
(); ++cell)
        {

            fe_values.reinit (cell);

            for (unsigned int q_point=0; q_point<n_q_points; ++q_point)
            {
                for(size_t i = 0; i < dofs_per_cell; ++i)
                {
                    std::cout << "Value_N[" << i << "] = " << fe_values[
N_density].value(i, q_point) << '\n';
                    getchar();
                      value_N[i] = fe_values[N_density].value(i, q_point);
                      value_TE[i] = fe_values[E_temperature].value(i, 
q_point);
                      value_TL[i] = fe_values[L_temperature].value(i, 
q_point);
                }
            }
        }
        //Content checking end
Furthermore, I checked (via break points) how the values are set in 
InitialValues<>:
   
 template <int dim>
    double InitialValues<dim>::value(const Point<dim> &p, const unsigned int 
component) const
    {
        (void) p;
        Assert(component < this->n_components, ExcIndexRange(component, 0, 
this->n_components));
        if(component < dim)
            return equations.initial_carrier_density;
        else
            if(component < 2*dim && component >= dim)
                return equations.ambient_temperature;
            else
                return equations.ambient_temperature;
    }

    template <int dim>
    void InitialValues<dim>::vector_value(const Point<dim> &p, Vector
<double> &values) const
    {
        for(size_t i = 0; i < this->n_components; ++i)
            values(i) = InitialValues<dim>::value(p, i);
    }

and according to the debug output, every value was set correctly in that 
function. Nevertheless in the debug output code above I still get (for the 
first point, and the first values of i and j: 
 Value_N[0] = 0.324665 0 0

Value_N[1] = 0 0.324665 0

Value_N[2] = 0 0 0.324665

Value_N[3] = 0 0 0

Value_N[4] = 0 0 0

Value_N[5] = 0 0 0

Value_N[6] = 0 0 0

Value_N[7] = 0 0 0

Value_N[8] = 0 0 0

Value_N[9] = -0.0412379 0 0

Value_N[10] = 0 -0.0412379 0

Value_N[11] = 0 0 -0.0412379

Value_N[12] = 0 0 0

Value_N[13] = 0 0 0

Value_N[14] = 0 0 0

Value_N[15] = 0 0 0

Value_N[16] = 0 0 0

Value_N[17] = 0 0 0

Thus: Is there a misunderstanding in how the data is stored, or how the 
data is processed? According to my understanding the values should be 1e18 
at every point. Is that correct? Or is there a better way to debug my code?


Am Freitag, 4. August 2017 23:48:08 UTC+2 schrieb Wolfgang Bangerth:
>
> On 08/04/2017 09:49 AM, Maxi Miller wrote: 
> > 
> > Why is there only one value not equal to zero, and why is it moving? 
> Shouldn't 
> > all the values be set already? 
>
> Maxi -- this is not a question to which you can expect an answer on the 
> mailing list. We are happy to help with conceptual questions, but you do 
> need 
> to debug your code yourself. 
>
> (I will note that there is almost never a reason to mark variables as 
> 'volatile' as you do. It's not wrong -- it just doesn't have any effect in 
> this context at all.) 
>
> Best 
>   W. 
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <javascript:> 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to