Difference between revisions of "CLSVOF"

From PHASTA Wiki
Jump to: navigation, search
Line 40: Line 40:
 
'''1.'''  N_fixed  = 0
 
'''1.'''  N_fixed  = 0
  
If at least 3 nodes are tagged as reconstructed
+
'''2.'''  For each element
  
Compute gradient of φ for the element using the three smallest values of reconstructed φ
+
'''2.a.'''  num_const = 0
  
If computed gradient is very different from advected gradient (nearest interface is not the one walked out from)
+
'''2.b.'''  loop over nodes
  
Skip the element and move on to next in the list
+
'''2.b.1.'''  If a node has been reconstructed, num_const = num_const+1
  
Else
+
'''2.c.'''  If num_const <= 3
  
Compute φ at all other nodes  
+
'''2.c.1'''  Compute gradient of φ for the element using the three smallest values of reconstructed φ
 +
  if num_const = 3, then use the reconstructed nodes
 +
  if num_const > 3, then loop over nodes to find the three smallest
 +
  re-use PHASTA's gradient calculation method?
  
If a node is tagged as reconstructed, φ = min (current value, new computed value)
+
'''2.c.2.'''  If computed gradient is very different from advected gradient (nearest interface is not the one walked out from)
 +
  if computed gradient dotted with advected gradient is less than pi/4 (or some other suitable value)
  
Else φ = computed value, node is tagged as reconstructed
+
'''2.c.2.a.'''  The current element is done for now, and left in the list; move on to the next element
  
Mark the element as complete
+
'''2.c.3.'''  Else
  
Loop over elements adjacent by shared faces
+
'''2.c.3.a.'''  Compute φ at all other nodes
 +
  gradient gives normal to the planar field
 +
  φ at a node is φ at another node plus the normal distance from the plane that other node is in to the current node
  
If the adjacent element is not marked as complete, and not in the reconstruction list, and reconstructed φ of shared nodes is < nε add it to the list (stop adding nodes when > nε from interface)
+
'''2.c.3.b.1.'''  If a node is tagged as reconstructed, φ = min (current value, new computed value)
  
Remove the element from the reconstruction list
+
'''2.c.3.b.2.'''  Else φ = computed value, node is tagged as reconstructed
  
N_fixed = N_fixed + 1
+
'''2.c.3.c.'''  Mark the element as complete
  
Else (element has only 1 or 2 reconstructed nodes)
+
'''2.c.3.d.'''  Loop over elements adjacent by shared faces
  
Skip the element and move on to next in list
+
'''2.c.3.d.1.'''  If the adjacent element is not marked as complete, and not in the reconstruction list, and reconstructed φ of shared nodes is < nε add it to the list (stop adding nodes when > nε from interface)
  
If N_fixed ≠ 0, go to start of loop
+
'''2.c.3.e.'''  Remove the element from the reconstruction list
  
Else N_fixed = 0 and list is not empty, loop again through the list (less accurate method)
+
'''2.c.3.f.'''  N_fixed = N_fixed + 1
 +
 
 +
'''2.d.'''  Else (element has only 1 or 2 reconstructed nodes), skip the element and move on to next in list
 +
 
 +
'''3.'''  At the end of a cycle through the list, if N_fixed ≠ 0, go to start of loop
 +
 
 +
'''3.a.'''  Else N_fixed = 0 and list is not empty, loop again through the list (less accurate method)
  
 
If reconstructed nodes ≤ 2
 
If reconstructed nodes ≤ 2

Revision as of 13:29, 16 August 2013

A coupled level set volume of fluid method is being implemented in the incompressible code for interface tracking.


Serial Algorithm

Loop over elements (find the elements containing interface pieces)

1. Tag each element as incomplete

 Need a tag for elemental completeness

2. Truncate volume fractions so they’re 0 ≤ F ≤ 1

 Volume fraction is the second scalar
 

3. If 0 < F < 1 (element contains interface)

3.a. Use advected φ at element nodes to find interface slope for the element

 For tetrahedra, find the points at which the interface intersects the edges
 Use those three points (defining the plane) to find the interface normal

3.b. Move interface along normal until computed F = advected F

 Depending on which side of the interface is a tetrahedron, F is either the volume of the interface tetrahedron or the volume of the element minus the interface tetrahedron.
 

For a tetrahedron with vertices a, b, c, and d, the volume is: <math>V = \frac { |(\mathbf{a}-\mathbf{d}) \cdot ((\mathbf{b}-\mathbf{d}) \times (\mathbf{c}-\mathbf{d}))| } {6}.</math>

3.c. Use established interface to compute φ at each node and tag those nodes as reconstructed

 At each node, φ is the distance to the nearest point, unless two points are equidistant.
 Need a tag for nodal completeness/reconstruction

3.d. If any node has already been reconstructed, φ is min (previous reconstruction, current reconstruction) (ensure that φ is min to interface everywhere)

3.e. Mark the element as complete

3.f. Loop over elements adjacent by shared faces - If it’s not marked as complete and not an interface element, add it to the reconstruction list

 Need reconstruction list
 Need data structure of each element's faces
 Need data structure of which two elements are adjacent to each face

While reconstruction list is not empty, loop over the reconstruction list (establish and walk out φ)

1. N_fixed = 0

2. For each element

2.a. num_const = 0

2.b. loop over nodes

2.b.1. If a node has been reconstructed, num_const = num_const+1

2.c. If num_const <= 3

2.c.1 Compute gradient of φ for the element using the three smallest values of reconstructed φ

 if num_const = 3, then use the reconstructed nodes
 if num_const > 3, then loop over nodes to find the three smallest
 re-use PHASTA's gradient calculation method?

2.c.2. If computed gradient is very different from advected gradient (nearest interface is not the one walked out from)

 if computed gradient dotted with advected gradient is less than pi/4 (or some other suitable value)

2.c.2.a. The current element is done for now, and left in the list; move on to the next element

2.c.3. Else

2.c.3.a. Compute φ at all other nodes

 gradient gives normal to the planar field
 φ at a node is φ at another node plus the normal distance from the plane that other node is in to the current node

2.c.3.b.1. If a node is tagged as reconstructed, φ = min (current value, new computed value)

2.c.3.b.2. Else φ = computed value, node is tagged as reconstructed

2.c.3.c. Mark the element as complete

2.c.3.d. Loop over elements adjacent by shared faces

2.c.3.d.1. If the adjacent element is not marked as complete, and not in the reconstruction list, and reconstructed φ of shared nodes is < nε add it to the list (stop adding nodes when > nε from interface)

2.c.3.e. Remove the element from the reconstruction list

2.c.3.f. N_fixed = N_fixed + 1

2.d. Else (element has only 1 or 2 reconstructed nodes), skip the element and move on to next in list

3. At the end of a cycle through the list, if N_fixed ≠ 0, go to start of loop

3.a. Else N_fixed = 0 and list is not empty, loop again through the list (less accurate method)

If reconstructed nodes ≤ 2

For each node not yet reconstructed, φ = min (distance to adjacent node + reconstructed φ of that node)

(Do we typically have full nodal adjacency(all nodes that share an edge or element with a node)?)

Mark the element as complete

Loop over elements adjacent by shared faces

If it’s not marked as complete, and not in the reconstruction list, and reconstructed φ of shared nodes is < nε add it to the list (stop adding nodes when > nε from interface)

Remove the element from the reconstruction list

N_fixed = N_fixed + 1

Else (at least 3 nodes are tagged as reconstructed)

Handle element as above

N_fixed = N_fixed + 1

When list is empty, for all elements not tagged as reconstructed, φ = nε for all nodes not tagged as reconstructed

Parallel Algorithm