... | ... | @@ -2,14 +2,14 @@ Many test cases are given to help users to understand how to use the different f |
|
|
|
|
|
### Test Cases Structure
|
|
|
|
|
|
Let us illustrate the structure of the executable python files with a two dimensional deposit of grains in a fluid. This test case is provided in the [testcases/depo-2d/dep.py](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/dep.py) file.
|
|
|
Let us illustrate the structure of the executable python files with a two dimensional deposit of grains in a fluid. This test case is provided in the [testcases/depot-2d/depot.py](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py) file.
|
|
|
|
|
|
Some steps have to be followed in order to properly define the application you want to solve with the MigFlow Software.
|
|
|
|
|
|
1. Set the problem parametres.
|
|
|
|
|
|
In an application, many variables are required to define :
|
|
|
* [fluid and grains properties](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L69)
|
|
|
* [fluid and grains properties](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L69)
|
|
|
```python
|
|
|
g = -9.81 # gravity
|
|
|
r = 1e-3 # grains radius
|
... | ... | @@ -17,13 +17,13 @@ rhop = 1500 # grains density |
|
|
rho = 1000 # fluid density
|
|
|
nu = 1e-6 # kinematic viscosity
|
|
|
```
|
|
|
* [numerical parametres](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L76)
|
|
|
* [numerical parametres](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L76)
|
|
|
```python
|
|
|
outf = 5 # number of iterations between output files
|
|
|
dt = 1e-2 # time step
|
|
|
tEnd = 100 # final time
|
|
|
```
|
|
|
* [domain geometry](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L81)
|
|
|
* [domain geometry](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L81)
|
|
|
```python
|
|
|
#geometrical parameters
|
|
|
ly = 5e-2 # grains area height
|
... | ... | @@ -33,7 +33,7 @@ H = 1.2 # domain height |
|
|
|
|
|
2. Define the matrix of the grains positions and actually create the grains at these positions
|
|
|
|
|
|
* Setting the initial situation requires to define the initial positions of the grains. In test cases, this is often achieved by defining a [function](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L37) in which the positions of the centres are defined. The arguments of the function are related to the grains properties and the grains area geometry defined previously. The physical surfaces defined in your mesh.geo file are used to specify the solid boundaries for the grains. Grain objects are created locally and all the information about the initial conditions of the grains are written in an output file. The argument of the particles structure builder is the dimension of the problem.
|
|
|
* Setting the initial situation requires to define the initial positions of the grains. In test cases, this is often achieved by defining a [function](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L37) in which the positions of the centres are defined. The arguments of the function are related to the grains properties and the grains area geometry defined previously. The physical surfaces defined in your mesh.geo file are used to specify the solid boundaries for the grains. Grain objects are created locally and all the information about the initial conditions of the grains are written in an output file. The argument of the particles structure builder is the dimension of the problem.
|
|
|
```python
|
|
|
def genInitialPosition(filename, r, H, ly, lx, rhop) :
|
|
|
"""Set all the particles centre positions and create the particles objects to add in the computing structure
|
... | ... | @@ -64,7 +64,7 @@ def genInitialPosition(filename, r, H, ly, lx, rhop) : |
|
|
|
|
|
```
|
|
|
|
|
|
* Use the previous function to set the initial condition and write it in the outputdir directory. Then, build the particle structure and [fill](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L86) the global particle structure with the information written in the initial file
|
|
|
* Use the previous function to set the initial condition and write it in the outputdir directory. Then, build the particle structure and [fill](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L86) the global particle structure with the information written in the initial file
|
|
|
```python
|
|
|
genInitialPosition(outputdir, r, H, ly, lx, rhop)
|
|
|
p = scontact.ParticleProblem(2)
|
... | ... | @@ -80,25 +80,48 @@ fluid.load_msh("mesh.msh") |
|
|
```
|
|
|
4. Once the fluid variables and properties are created, it is mandatory to set the boundary conditions of the fluid problem. Boundary conditions are of two types:
|
|
|
|
|
|
* [Strong boundaries](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L107) constrain a field variable to a specified value. This is done by suppressing an equation of the linear system to replace it by this constraint :
|
|
|
* Strong boundaries (Optional) constrain a field variable to a specified value. This is done by suppressing an equation of the linear system to replace it by this constraint :
|
|
|
|
|
|
```pyhton
|
|
|
fluid.set_strong_boundary(Physical boundary tag, field variable item, field value)
|
|
|
```
|
|
|
|
|
|
* [Weak boundaries](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L111) specify the flux at each boundary. The flux terms added by these conditions come from the integration by part arising from the finite element methods and can be suppressed for some weak boundary type. For example, if you consider a wall, it is quite obvious that the velocity flux across the boundary is zero.
|
|
|
* [Weak boundaries](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L107) specify the flux at each boundary. The flux terms added by these conditions come from the integration by part arising from the finite element methods and can be suppressed for some weak boundary type. For example, if you consider a wall, it is quite obvious that the velocity flux across the boundary is zero but the pressure could be specified. There are two types of weak boundaries _wall_ and _open_:
|
|
|
|
|
|
```python
|
|
|
fluid.set_weak_boundary(Physical boundary tag, Weak boundary type)
|
|
|
fluid.set_wall_boundary(tag, pressure=None)
|
|
|
"""Set the weak boundaries (=normal fluxes) for the fluid problem.
|
|
|
|
|
|
Keyword arguments:
|
|
|
tag -- physical tag (or list of tags), set in the mesh.geo file, of the wall boundaries
|
|
|
pressure -- the pressure value if imposed (callback or number)
|
|
|
"""
|
|
|
|
|
|
fluid.set_open_boundary(tag, velocity=None, pressure=None, porosity=1, concentration=1)
|
|
|
"""Set the weak boundaries (=normal fluxes) for the fluid problem.
|
|
|
|
|
|
Keyword arguments:
|
|
|
tag -- physical tag (or list of tags), set in the mesh.geo file, of the wall boundaries
|
|
|
velocity -- the velocity vector if imposed (callback or number))
|
|
|
pressure -- the pressure value if imposed (callback or number)
|
|
|
porosity -- the volume fraction of fluid at aperture (work in progress - should be one)
|
|
|
concentration -- the volume fraction of the first continuous phase
|
|
|
|
|
|
Raises:
|
|
|
ValueError -- if the number of values set in the list callback_or_value do not match what is expected for this boundary type.
|
|
|
|
|
|
"""
|
|
|
```
|
|
|
|
|
|
For now, the open boundary condition only allow to specify velocity and concentration if two continuous phases are considered (inflow) or pressure and concentration if two continuous phases are considered (outflow).
|
|
|
|
|
|
5. Coupling between fluid and solid is mainly based on the detection of the mesh cells in which grains are. Computing fluid fraction in a cell or evaluating the fluid velocity at the grain position both imply to know where the grains are in the fluid. The tree structure based on mesh cells is used to locate them.
|
|
|
|
|
|
```python
|
|
|
fluid.set_particles(p.mass(), p.volume(), p.position(), p.velocity())
|
|
|
```
|
|
|
|
|
|
6. At this step, the initial state is completely defined and all the variables and parametres have been created. Then the computation can start. The [computational loop](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/oneFluid/testcases/depot-2d/depot.py#L121) is composed of three main steps:
|
|
|
6. At this step, the initial state is completely defined and all the variables and parametres have been created. Then the computation can start. The [computational loop](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L117) is composed of three main steps:
|
|
|
|
|
|
* Fluid equations solving
|
|
|
```python
|
... | ... | |