... | ... | @@ -33,8 +33,11 @@ p.load_msh_boundaries("mesh.msh", ["Top", "Lateral","Bottom"]) |
|
|
|
|
|
```
|
|
|
|
|
|
* Define the initial positions of the grains and add them to the particle problem. In most test cases, the positions definition is 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](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L67) of the function correspond to the dimension of the regular grid on which the grains will be placed. Once this is done, the grains are added to the particle problem with ```python add_particle()```
|
|
|
* Define the initial positions of the grains and add them to the particle problem. In most test cases, the positions definition is 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](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L67) of the function correspond to the dimension of the regular grid on which the grains will be placed. Once this is done, the grains are added to the particle problem with ```add_particle()```
|
|
|
```python
|
|
|
h = 1.5e-1 # particles area height
|
|
|
w = 4e-1 # particles area widht
|
|
|
H = 0.6 # domain height
|
|
|
def gen_rect(origin, w, h, step):
|
|
|
""" Generate coordinates on a rectangular grid
|
|
|
Keyword arguments:
|
... | ... | @@ -54,22 +57,15 @@ for xi,yi in zip(x,y): |
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
3. Set the initial conditions for the fluid phase.
|
|
|
|
|
|
3. Create the fluid structure and specify the computational domain (i.e. give the mesh to the fluid class). At this step, all the variables (velocity, pressure...) of the fluid problem and the properties of the fluid are stored in the fluid structure. The arguments for the fluid structure builder are the dimension of the problem, the gravity, the dynamic viscosity and the density of the fluid.
|
|
|
* [Build](https://git.immc.ucl.ac.be/fluidparticles/migflow/blob/master/testcases/depot-2d/depot.py#L79) the fluid structure and load the boundaries from the mesh file. The arguments to the builder include the dimension of the problem, the gravity vector, the dynamic viscosity of the fluid, its density, the solver to be used and solving options.
|
|
|
```python
|
|
|
fluid = fluid.FluidProblem(2,g,[nu*rho],[rho])
|
|
|
# Set the mesh geometry for the fluid computation
|
|
|
fluid = fluid.FluidProblem(2,g,[nu*rho],[rho],solver="petsc",solver_options="-pc_type lu", usolid=True, model_b=1)
|
|
|
fluid.load_msh("mesh.msh")
|
|
|
```
|
|
|
It is possible to solve simplified fluid equations using the temporal and advection parameters of the FluidProblem builder. If temporal is set to False, steady flows are computed. If advection is set to False, Stokes flows are computed. Default value for both temporal and advection is True to compute unsteady Navier-Stokes equations.
|
|
|
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:
|
|
|
* Set the boundary conditions. Strong or weak ones can be prescribed. Walls without normal flux are the simplest case illustrated here.
|
|
|
|
|
|
* 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/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_:
|
|
|
|
... | ... | |