|
|
## How to set initial conditions for the fluid?
|
|
|
|
|
|
Some functions are provided to set field variables of the fluid from the User Python Interface.
|
|
|
```python
|
|
|
from migflow import fluid
|
|
|
|
|
|
fluid = fluid.FluidProblem(2,g,nu*rho,rho)
|
|
|
fluid.load_msh(mesh.msh)
|
|
|
s = fluid.solution()
|
|
|
x = fluid.coordinates()
|
|
|
s[x[:,1]<0,0] = 1
|
|
|
```
|
|
|
The array named s is an array of size [number of nodes $\times$ number of fields] while the array named x is an array of size [number of nodes $\times$ 3]. The last command above states that the first fluid field variable for nodes that have a height smaller than zero are set to one.
|
|
|
|
|
|
The fields are ordered as follows
|
|
|
+ 2D : (x-velocity, y-velocity, pressure)
|
|
|
+ 3D : (x-velocity, y-velocity, z-velocity, pressure)
|
|
|
When two continuous phases are considered, a field corresponding to the concentration of the first phase is added at the end of the list. Please pay attention that the y-velocity is the vertical velocity.
|
|
|
|
|
|
## Is it possible to separate fluid and grains modules?
|
|
|
|
|
|
Sometimes it is convenient to run some simulation only with grains or fluid, that's why each module can be run individually. For example, running the avalanch1fluid.py test case requires to first run the depot.py contained in a parent folder to obtain a set of grains at rest at the beginning of the simulation.
|
|
|
|
|
|
## Is it possible to reload simulations?
|
|
|
|
|
|
Functions are dedicated to the reading of existing output files. Here is an example to reload the 25th output files.
|
|
|
|
|
|
```python
|
|
|
from migflow import scontact
|
|
|
from migflow import fluid
|
|
|
|
|
|
p = scontact.ParticleProblem(2)
|
|
|
p.read_vtk("output",25)
|
|
|
fluid = fluid.FluidProblem(2,g,nu*rho,rho)
|
|
|
fluid.load_msh(mesh.msh)
|
|
|
fluid.import_vtk("output/fluid_%05d.vtu"%25)
|
|
|
```
|
|
|
|
|
|
In this example the boundary conditions for the grains are those you specified in the script you want to reload while the boundary conditions for the fluid are reset. If you want to change the boundary conditions for the grains you have to create another container structure for the grains and initialize the grains positions with the reloaded ones (see avalanch1fluid.py).
|
|
|
|