project-asgard / DG-SparseGrid

Matlab implementation of ASGarD
1 stars 2 forks source link

apply_FMWT_blocks error #57

Closed dlg0 closed 4 years ago

dlg0 commented 4 years ago

on reference ...

asgard(@fokkerplanck1_pitch_E,'timestep_method','BE','dt',0.005,'num_steps',500,'lev',4,'deg',3,'save_output',true,'quiet',false,'output_grid','quadrature','case',1,'adapt',true,'adapt_threshold',1e-2)

gives ...

Index exceeds the number of array elements (16).

Error in apply_FMWT_blocks (line 65)
first_block = blocks{(max_level - level) * 2 + 1};

Error in matrix_plot_D (line 139)
Meval = apply_FMWT_blocks(lev, pde.transform_blocks, Meval, trans_side);

Error in adapt (line 436)
        [Meval{d},nodes{d}] = matrix_plot_D(pde,opts,pde.dimensions{d});

Error in asgard_run_pde (line 234)
            =
            adapt(pde,opts,fval,hash_table,Meval,nodes,nodes_nodups,nodes_count,fval_realspace,1,0);

Error in asgard (line 23)
[err,fval,fval_realspace,nodes,err_realspace,outputs] = asgard_run_pde(opts,pde);
dlg0 commented 4 years ago

this is interesting because even the adaptivity based tests in runtests pass

bmcdanie commented 4 years ago

Yes - I did check that. Hm, I will track down the problem.

bmcdanie commented 4 years ago

@dlg0 these args cause the routine to be called with a level == 0. I was not planning for level < 1, and probably should have asserted on it. I will investigate why this occurs.

bmcdanie commented 4 years ago

@dlg0 I began fixing the indexing in the routine for lev == 0, but it's not clear to me what the apply_FMWT operation should look like in that case, because the FMWT generation routine in the MATLAB (which the block application scheme is based on) does not work in this case. i.e., I can't see an example level 0 transformation matrix.

further, there is no block that "makes sense" dimensions-wise (in the matrix dimensions sense) to apply as a transformation to a level 0-sized input. so, I may need some help with this.

dlg0 commented 4 years ago

so yeah, the details for lev=0 don't follow the same rules. For now I'd just enforce lev>=1 and talk to @MollyRaver about the lev==0 rules

bmcdanie commented 4 years ago

@dlg0 I sent her a Slack message. I can modify the adaptivity to floor at 1 for now and add a check to the function.

bmcdanie commented 4 years ago

For the record, transform at level 0 is the identity function.