Skip to content
Snippets Groups Projects
Commit 07f77f75 authored by Franck Pérignon's avatar Franck Pérignon
Browse files

Fix tests

Fix penalisation/subsets (partially)
Update doc (sphinx)
Almost all tests ok except:
	 22 - mpi_test_advec_scales (Failed)
	 77 - test_advection_nullVelocity (Failed)
	 79 - test_advection_randomVelocity (Failed)
parent 7bd2f9cf
No related branches found
No related tags found
No related merge requests found
Showing
with 89 additions and 51 deletions
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
File moved
../CMake
\ No newline at end of file
...@@ -10,10 +10,16 @@ Box-shaped domain ...@@ -10,10 +10,16 @@ Box-shaped domain
:class:`~box.Box` :class:`~box.Box`
Data distribution
-----------------
.. toctree::
:maxdepth: 2
topologies
How to define a subset How to define a subset
---------------------- ----------------------
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
......
...@@ -3,12 +3,14 @@ ...@@ -3,12 +3,14 @@
Penalisation Penalisation
============ ============
.. currentmodule:: hysop.operator.penalization
:math:`u(X,t)` is the current velocity field, :math:`\omega(X,t)` is the current vorticity field, :math:`u_D` the velocity of the obstacle, dt the time step. :math:`u(X,t)` is the current velocity field, :math:`\omega(X,t)` is the current vorticity field, :math:`u_D` the velocity of the obstacle, dt the time step.
Velocity penalisation Velocity penalisation
--------------------- ---------------------
:class:`hysop.operator.penalization.Penalization` :class:`Penalization`
Solves: Solves:
...@@ -41,7 +43,7 @@ After that, vorticity is computing as: ...@@ -41,7 +43,7 @@ After that, vorticity is computing as:
Vorticity penalisation Vorticity penalisation
---------------------- ----------------------
:class:`hysop.operator.penalize_vorticity.PenalizeVorticity` :class:`PenalizeVorticity`
Solves: Solves:
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
Subsets and obstacles Subsets and obstacles
--------------------- ---------------------
.. currentmodule:: hysop.domain.subsets .. currentmodule:: hysop.domain
The class :class:`~subset.Subset` and its heirs allow user to define some subsets The class :class:`subsets.Subset` and its heirs allow user to define some subsets
of a predefined domain. This may be useful for: of a predefined domain. This may be useful for:
* define specific area(s) where an operator applies (penalisation for example) * define specific area(s) where an operator applies (penalisation for example)
* reduce the size of i/o by writing hdf output only for a specific area. * reduce the size of i/o by writing hdf output only for a specific area.
...@@ -15,12 +15,12 @@ of a predefined domain. This may be useful for: ...@@ -15,12 +15,12 @@ of a predefined domain. This may be useful for:
Porous obstacles Porous obstacles
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
:class:`~porous.BiPole` :class:`porous.BiPole`
.. image:: /figures/PolesExample.png .. image:: /figures/PolesExample.png
:width: 400pt :width: 400pt
:class:`~porous.QuadriPole` :class:`porous.QuadriPole`
.. image:: /figures/QuadriPoleExample.png .. image:: /figures/QuadriPoleExample.png
:width: 400pt :width: 400pt
.. _topologies:
MPI topologies and space discretisation
=======================================
.. currentmodule:: hysop.mpi
:class:`topology.Cartesian` objects are used to described both the mpi grid layout
and the space discretisations (global and local to each mpi process).
TODO :
* describe the different ways to build topologies
* describe the way we define local and global grids.
../CMake/
\ No newline at end of file
...@@ -85,14 +85,14 @@ include(FindPythonModule) ...@@ -85,14 +85,14 @@ include(FindPythonModule)
# - python packages - # - python packages -
find_python_module(numpy REQUIRED) find_python_module(numpy REQUIRED)
find_python_module(scipy REQUIRED) find_python_module(scipy)
find_python_module(matplotlib) find_python_module(matplotlib)
if(NOT matplotlib_FOUND) if(NOT matplotlib_FOUND)
find_python_module(Gnuplot REQUIRED) find_python_module(Gnuplot REQUIRED)
endif() endif()
find_python_module(scitools) find_python_module(scitools)
find_python_module(h5py REQUIRED) find_python_module(h5py REQUIRED)
find_python_module(sympy REQUIRED) find_python_module(sympy)
# --- OpenCL --- # --- OpenCL ---
find_python_module(pyopencl REQUIRED) find_python_module(pyopencl REQUIRED)
# --- MPI --- # --- MPI ---
......
## @package hysop.domain
# Physical domains descriptions and related tools.
# At the time :
# - Box for box-shaped domains
# - obstacle
""" """Box-shaped domains definition.
@file box.py
Box-shaped domains definition.
""" """
from hysop.domain.domain import Domain from hysop.domain.domain import Domain
from hysop.constants import PERIODIC, debug from hysop.constants import PERIODIC, debug
...@@ -9,10 +6,9 @@ import hysop.tools.numpywrappers as npw ...@@ -9,10 +6,9 @@ import hysop.tools.numpywrappers as npw
class Box(Domain): class Box(Domain):
""" """ Box-shaped domain description.
Box-shaped domain description.
@note FP : BC as parameter may be better? todo implement different boundary conditions typesKHave different BC
@todo Have different BC
""" """
@debug @debug
...@@ -20,8 +16,12 @@ class Box(Domain): ...@@ -20,8 +16,12 @@ class Box(Domain):
""" """
Create a Periodic Box from a dimension, length and origin. Create a Periodic Box from a dimension, length and origin.
@param length : Box length. Default [1.0, ...] Parameters
@param origin : Box minimum position. Default [0., ...] -----------
length : list or numpy array of double
box sides lengthes. Default = [1.0, ...]
origin : list or numpy array of double
position of the lowest point of the box. Default [0., ...]
Example: Example:
...@@ -59,10 +59,6 @@ class Box(Domain): ...@@ -59,10 +59,6 @@ class Box(Domain):
assert list(self.boundaries).count(PERIODIC) == self.dimension, msg assert list(self.boundaries).count(PERIODIC) == self.dimension, msg
def __str__(self): def __str__(self):
"""
Informations display.
@return Informations
"""
s = str(self.dimension) + \ s = str(self.dimension) + \
"D box (parallelepipedic or rectangular) domain : \n" "D box (parallelepipedic or rectangular) domain : \n"
...@@ -74,5 +70,5 @@ class Box(Domain): ...@@ -74,5 +70,5 @@ class Box(Domain):
c1 = (self.length == other.length).all() c1 = (self.length == other.length).all()
c2 = (self.origin == other.origin).all() c2 = (self.origin == other.origin).all()
c3 = (self.boundaries == other.boundaries).all() c3 = (self.boundaries == other.boundaries).all()
c4 = self.currentTask() == other.currentTask() c4 = self.current_task() == other.current_task()
return c1 and c2 and c3 and c4 return c1 and c2 and c3 and c4
...@@ -12,6 +12,9 @@ class ControlBox(SubBox): ...@@ -12,6 +12,9 @@ class ControlBox(SubBox):
Useful to define control volume to perform integration. Useful to define control volume to perform integration.
""" """
def __init__(self, **kwds): def __init__(self, **kwds):
"""
Same parameters as for :class:`hysop.domain.subsets.SubBox`.
"""
super(ControlBox, self).__init__(**kwds) super(ControlBox, self).__init__(**kwds)
# We must have a real box, not a plane ... # We must have a real box, not a plane ...
...@@ -20,6 +23,9 @@ class ControlBox(SubBox): ...@@ -20,6 +23,9 @@ class ControlBox(SubBox):
self.surf = [None] * len(self.length) * 2 self.surf = [None] * len(self.length) * 2
def discretize(self, topo): def discretize(self, topo):
"""Create a sub meshes for topo inside the control box and
on its faces.
"""
# Create the mesh for the whole box # Create the mesh for the whole box
super(ControlBox, self).discretize(topo) super(ControlBox, self).discretize(topo)
# Create a mesh for each side # Create a mesh for each side
...@@ -54,17 +60,26 @@ class ControlBox(SubBox): ...@@ -54,17 +60,26 @@ class ControlBox(SubBox):
def integrate_on_faces(self, field, topo, list_dir, def integrate_on_faces(self, field, topo, list_dir,
component=0, root=None): component=0, root=None):
""" """Integration of a field on one or more faces of the box
@param[in] field : a hysop continuous field
@param[in] topo : a hysop.mpi.topology.Cartesian topology Parameters
@param[in] root : root process used for mpi reduction. If None ----------
reduction is done on all processes from topo. field : :class:`~hysop.fields.continuous.Field`
@param[in] list_dir : list of surfaces on which we must integrate. a field to be integrated on the box
0 : normal to xdir, lower surf, topo : :class:`~hysop.mpi.topology.Cartesian`
1 : normal to xdir, upper surf (in x dir) set mesh/topology used for integration
2 : normal to ydir, lower surf, and so on. list_dir : list of int
the field must be integrated. indices of faces on which integration is required
@return a numpy array, with res = sum 0 : normal to xdir, lower surf,
1 : normal to xdir, upper surf (in x dir)
2 : normal to ydir, lower surf, and so on.
component : int, optional
number of the field component to be integrated
root : int, optional
rank of the leading mpi process (to collect data)
If None reduction is done on all processes from topo.
Returns a numpy array, with res = sum
of the integrals of a component of field on all surf in list_dir of the integrals of a component of field on all surf in list_dir
""" """
res = 0. res = 0.
...@@ -79,17 +94,24 @@ class ControlBox(SubBox): ...@@ -79,17 +94,24 @@ class ControlBox(SubBox):
return topo.comm.reduce(res, root=root) return topo.comm.reduce(res, root=root)
def integrate_on_faces_allc(self, field, topo, list_dir, root=None): def integrate_on_faces_allc(self, field, topo, list_dir, root=None):
""" """Integration of a field on one or more faces of the box
@param[in] field : a hysop continuous field
@param[in] topo : a hysop.mpi.topology.Cartesian topology Parameters
@param[in] root : root process used for mpi reduction. If None ----------
reduction is done on all processes from topo. field : :class:`~hysop.fields.continuous.Field`
@param[in] list_dir : list of surfaces on which we must integrate. a field to be integrated on the box
0 : normal to xdir, lower surf, topo : :class:`~hysop.mpi.topology.Cartesian`
1 : normal to xdir, upper surf (in x dir) set mesh/topology used for integration
2 : normal to ydir, lower surf, and so on. list_dir : list of int
the field must be integrated. indices of faces on which integration is required
@return a numpy array, with res[i] = sum 0 : normal to xdir, lower surf,
1 : normal to xdir, upper surf (in x dir)
2 : normal to ydir, lower surf, and so on.
root : int, optional
rank of the leading mpi process (to collect data)
If None reduction is done on all processes from topo.
Returns a numpy array, with res[i] = sum
of the integrals of component i of field on all surf in list_dir of the integrals of component i of field on all surf in list_dir
""" """
nbc = field.nb_components nbc = field.nb_components
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment