Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node/element diameters need to be updated with MoveMesh #1182

Merged
merged 2 commits into from
May 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions proteus/mprans/MoveMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from proteus.Transport import OneLevelTransport, TC_base, NonlinearEquation
from proteus import Quadrature, FemTools, Comm, Archiver, cfemIntegrals
from proteus.Profiling import logEvent, memory
from proteus import cmeshTools
from . import cArgumentsDict

class Coefficients(proteus.TransportCoefficients.TC_base):
Expand All @@ -34,6 +35,7 @@ def __init__(self,
self.gravityStep = True
self.meIndex = meIndex
self.dt_last = None
self.dt_last_last = None
self.solidsList = []
self.nullSpace = nullSpace
if initialize:
Expand Down Expand Up @@ -137,7 +139,21 @@ def postStep(self, t, firstStep=False):
else:
dt = self.dt_last
self.mesh.nodeVelocityArray /= dt
#this is needed for proper restarting
if(self.dt_last is not None):
self.dt_last_last = self.dt_last

self.dt_last = self.model.timeIntegration.dt

#update nodal/element diameters:
#TODO: unclear if this needs to apply to all mesh types
if self.nd == 2:
cmeshTools.computeGeometricInfo_triangle(self.mesh.subdomainMesh.cmesh)
self.mesh.buildFromC(self.mesh.cmesh)
if self.nd == 3:
cmeshTools.computeGeometricInfo_tetrahedron(self.mesh.subdomainMesh.cmesh)
self.mesh.buildFromC(self.mesh.cmesh)

copyInstructions = {'clear_uList': True}
return copyInstructions

Expand Down