Hi!
Thanks for the answers!
Yes, this is the exact equation I am using to govern the phi field: \partial (phi)/\partial t + div (u phi) = div (D grad phi)
There is are no source/sink terms, I am using homogenous neumann bcs, there is no scalar flux outside of the simulation domain. I agree, in theory everything should be conserved.
The "food" quantity that I plotted is obtained using hier_cc_ops.integral, like so:
int C_idx = var_db->mapVariableAndContextToIndex(concentration_var, adv_diff_integrator->getCurrentContext());
double total_food_in_simulation = hier_cc_ops.integral(C_idx,
hier_math_ops.getCellWeightPatchDescriptorIndex()) ;
I thought this was an integral over the finest patches, but in any case, I'm not calculating the total mass of the scalar field in some other strange way, I am using HierarchyCellDataOpsReal as suggested in the previous response.
What led me to believe this was a regridding issue was that everything works fine without jumps when running on one level, but when running on 4 levels, things go sideways. I don't know what is going on, perhaps it has something to do with how I set up the advection integrator?
Any ideas would be very helpful!
Thanks!
Teo