erdc / proteus

A computational methods and simulation toolkit
http://proteustoolkit.org
MIT License
88 stars 56 forks source link

Updating arrays after MoveMesh step #1179

Open zhang-alvin opened 4 years ago

zhang-alvin commented 4 years ago

There are a number of data structures that are not properly updated after a MoveMesh step.

postStep() (https://github.com/erdc/proteus/blob/master/proteus/mprans/MoveMesh.py#L123) updates the mesh.nodeArray which stores the coordinates of the vertices.

There is also a separate updateAfterMeshMotion function (https://github.com/erdc/proteus/blob/master/proteus/mprans/MoveMesh.py#L801) that is called before the next MoveMesh step, which seems to update the element and boundary quadrature fields.

Neither update the nodeDiametersArray or elementDiametersArray used in the computation of the Heaviside function.

Neither update the coefficient weighting in the point gauges, which would lead to inaccurate point gauge readings when the mesh is moved. Similar issues should arise when identifying segments for the line gauges.

Updating the node diameters is simple with a call to cmeshTools.computeGeometricInfo. Updating the gauges might wind up to be quite expensive (e.g. what if a point gauge now lies on a different element because of the mesh motion).

I'm putting this issue up to get some ideas, maybe have a discussion. I think that all these updates should occur during postStep of the MoveMesh model with the ability to influence the data structures/arrays in other models if necessary. There may also be a way to smartly update the structures used to obtain the local mesh entities of interest (e.g. k-d tree).

zhang-alvin commented 4 years ago

1182 will effectively be reverted in #1211 as there were errors popping up in parallel MoveMesh runs.

There may be some additional calls needed to get things smoothed out in parallel such as:

        par_nodeDiametersArray = ParVec_petsc4py(self.subdomainMesh.nodeDiametersArray,
                                                 bs=1,
                                                 n=self.subdomainMesh.nNodes_owned,
                                                 N=self.nNodes_global,
                                                 nghosts=self.subdomainMesh.nNodes_global - self.subdomainMesh.nNodes_owned,
                                                 subdomain2global=self.nodeNumbering_subdomain2global)                                          
        par_nodeDiametersArray.scatter_forward_insert()

which is seen after partitioning