Skip to content

Commit

Permalink
Update readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaraujo committed Dec 22, 2024
1 parent dc3ac3c commit 75df8f4
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ print('Temperature at point (0.5, 0.5) (calculated) = ' + str(u.value(index)))

<details><summary>Code (FVM)</summary>
<p>

```python
import math
from ENigMA import ENigMA
Expand Down Expand Up @@ -859,13 +859,30 @@ Lid-driven cavity (Re = 1000).

![liddriven](https://github.com/bjaraujo/ENigMA/blob/master/images/fvm_01.png)

Note for extracting components (v0, v1) in gmsh:
```
Components:
MathEval (plugin)
Expression 0: v0
Expression 1: v1
```
or
```
Magnitude:
MathEval (plugin)
Expression 0: Sqrt(v0^2+v1^2)
```

<details><summary>Code</summary>
<p>

```python
import math
from ENigMA import ENigMA

def modulus(v):
return math.sqrt(sum(x**2 for x in v))

vertex1 = ENigMA.CGeoCoordinate(+0.00, +0.00, +0.1)
vertex2 = ENigMA.CGeoCoordinate(+1.00, +0.00, +0.1)
vertex3 = ENigMA.CGeoCoordinate(+1.00, +1.00, +0.1)
Expand All @@ -887,7 +904,7 @@ hexahedron.addVertex(vertex7)
hexahedron.addVertex(vertex8)

mesher = ENigMA.CMshBasicMesher()
mesher.generate(hexahedron, 40, 40, 1, False)
mesher.generate(hexahedron, 80, 80, 1, False)
mesher.mesh().generateFaces(1E-3)
mesher.mesh().calculateFaceCentroid()
mesher.mesh().calculateElementCentroid()
Expand Down Expand Up @@ -939,13 +956,16 @@ pisoSolver.setBoundaryVelocity(faceIds, ENigMA.BT_WALL_NO_SLIP, U, 0.0, 0.0)
# Courant < 1
dt = U / 40

iter = 100
iter = 2000

# Flow in a rectangle
for ii in range(0, iter):
print('Iter = ' + str(ii + 1) + ' of ' + str(iter))
pisoSolver.iterate(dt)

r = modulus(pisoSolver.residual())
print('Iter = {} of {} residual = {}'.format(ii + 1, iter, r))
if (r < 1E-6):
break

u = ENigMA.CPdeField()
u.setMesh(volumeMesh)
u.setSimulationType(ENigMA.ST_FLOW)
Expand Down

0 comments on commit 75df8f4

Please sign in to comment.