On 4/12/11 11:06 AM, Roy Stogner wrote:
> On Tue, 12 Apr 2011, Boyce Griffith wrote:
>> I have an application in which I would like to use a coarse mesh for one
>> system and a (statically or adaptively) refined mesh for another system.
>> The systems will be loosely coupled --- I will need to evaluate coarse
>> variables onto the refined grid and vice versa. The elements of the
>> fine mesh will remain nested within the coarse mesh, and I currently
>> expect only to do h-refinement with Lagrangian elements.
>> It seems like the easiest way to couple these two systems would be to
>> use MeshFunction; however, I expect that there are more efficient ways
>> to go about this. Can the system projection functionality be used for
>> this kind of thing?
> Unfortunately no - the inefficiency of MeshFunction is due to the
> element lookup, the system projection code avoids this inefficiency by
> using the tree structure of the mesh to locate which element to
> project from.
> Modifying the tree structure to reflect multiple nested meshes at once
> would be possible (active elements in one could be subactive in
> another, with some changes to the RefinementFlags and Mesh::*iterator
> code) but that would be a fairly extensive modification.
> My suggestion would be to start with the MeshFunction code, and then
> if that needs speeding up cache an unordered_map<Elem*,Elem*> between
> the meshes.
OK; I will start out with MeshFunction, but I am fairly confident that
it will need speeding up.
Suppose that things are setup as follows:
// setup original mesh ...
ExplicitSystem& coarse_system =
coarse_system.add_variable("X", FIRST, LAGRANGE);
Mesh* fine_mesh = coarse_mesh.clone().release;
ExplicitSystem& fine_system =
fine_system.add_variable("X", FIRST, LAGRANGE);
// adaptively refine fine_mesh, e.g., within timestep loop ...
And I need to be able to convert the coarse representation of X into the
fine one (and vice versa).
Is there a simple mapping between the original coarse DOF indices and
the corresponding coarse DOF indices of the fine system? If so, it
seems like it might not be too hard to start with the existing
ProjectVector code and modify it to project data from the system
associated with the coarse mesh onto the fine system. Similarly, it
seems like it would be relatively straightforward to start with the
existing restrict_vector() code and modify it to restrict data from the
fine system onto the coarse one.
Alternatively, if there is not a simple mapping between DOF indices,
should it be easy to construct a mapping between the coarse elements of
the original mesh and the corresponding coarse elements of the refined
mesh, which in turn could be used to construct the mapping between the
coarse DOFs of the coarse system and the corresponding coarse DOFs of
the fine system.