Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
particle_methods
hysop
Commits
20cbd81f
Commit
20cbd81f
authored
6 years ago
by
Christophe Picard
Browse files
Options
Downloads
Patches
Plain Diff
Destroy old BC
parent
c91291dd
No related branches found
No related tags found
1 merge request
!3
Resolve "Sine and cosine transforms to solve homogeneous Neumann and Dirichlet problems"
Pipeline
#16726
failed
6 years ago
Stage: env
Stage: configure
Stage: build
Stage: install
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hysop/old/operator.old/absorption_bc.py
+0
-126
0 additions, 126 deletions
hysop/old/operator.old/absorption_bc.py
with
0 additions
and
126 deletions
hysop/old/operator.old/absorption_bc.py
deleted
100755 → 0
+
0
−
126
View file @
c91291dd
"""
Operator to kill the vorticity at the outlet boundary
(i.e. removal of the periodic BC in the flow direction
by vorticity absorption in order to set the far field
velocity to u_inf at the inlet)
See :ref:`absorption_bc`.
"""
from
hysop.constants
import
debug
from
hysop.operator.discrete.absorption_bc
import
AbsorptionBC
as
Dab
from
hysop.operator.computational
import
Computational
from
hysop.operator.continuous
import
opsetup
from
hysop.domain.subsets
import
SubBox
import
numpy
as
np
class
AbsorptionBC
(
Computational
):
"""
The periodic boundary condition is modified at the outlet
in the flow direction in order to discard
in the dowstream region the eddies coming
periodically from the outlet.
The far field velocity is set to u_inf at the inlet.
"""
@debug
def
__init__
(
self
,
velocity
,
vorticity
,
req_flowrate
,
x_range
,
filter_func
=
None
,
**
kwds
):
"""
Parameters
----------
velocity, vorticity : :class:`~hysop.fields.continuous_field.Field`
req_flowrate : double
required value for the flow rate
(used to set the u_inf velocity value at the inlet)
x_range : list or numpy array
x-coordinates delimitating the absorption domain
like [x_beginning, x_end]
filter_func: list of python functions, optional
functions used to compute the filter and its differential.
**kwds : extra parameters for base class
Notes
-----
* if set, filter_func[0] and filter_func[1] must be python function
returning a numpy array. For example to apply a sine inside
the absorption area use :
.. code::
def func(x):
return np.sin(x)
"""
assert
'
variables
'
not
in
kwds
,
'
variables parameter is useless.
'
super
(
AbsorptionBC
,
self
).
__init__
(
variables
=
[
velocity
,
vorticity
],
**
kwds
)
# velocity variable
self
.
velocity
=
velocity
# vorticity variable
self
.
vorticity
=
vorticity
self
.
input
=
[
self
.
velocity
,
self
.
vorticity
]
self
.
output
=
[
self
.
vorticity
]
# Expected value for the flow rate through input surface
self
.
req_flowrate
=
req_flowrate
# x-coordinates delimitating the absorption band at the outlet
self
.
_filter_func
=
filter_func
self
.
absorption_box
=
self
.
build_absorption_box
(
x_range
)
# on_proc[topo] = True if this operator has to work on the
# current process, i.e. if absorption_box has points
# on the current process.
self
.
on_proc
=
{}
def
discretize
(
self
):
super
(
AbsorptionBC
,
self
).
_standard_discretize
()
assert
self
.
_single_topo
,
'
Multi-resolution case is not allowed.
'
topo
=
self
.
discrete_fields
[
self
.
vorticity
].
topology
self
.
absorption_box
.
discretize
(
topo
)
self
.
on_proc
[
topo
]
=
self
.
absorption_box
.
on_proc
[
topo
]
def
build_absorption_box
(
self
,
x_range
):
"""
Build a box to define the area where the absorption
filter will be applied
Parameters
----------
x_range : list or numpy array
x right and left positions of the box.
"""
# setup for the absorption filter definition
dom
=
self
.
vorticity
.
domain
borig
=
dom
.
origin
.
copy
()
borig
[
0
]
=
x_range
[
0
]
blength
=
dom
.
length
.
copy
()
blength
[
0
]
=
x_range
[
1
]
-
x_range
[
0
]
return
SubBox
(
parent
=
dom
,
origin
=
borig
,
length
=
blength
)
def
get_work_properties
(
self
):
super
(
AbsorptionBC
,
self
).
get_work_properties
()
wd
=
self
.
discrete_fields
[
self
.
vorticity
]
subshape
=
self
.
absorption_box
.
mesh
[
wd
.
topology
].
resolution
subsize
=
np
.
prod
(
subshape
)
return
{
'
rwork
'
:
(
subsize
,
),
'
iwork
'
:
None
}
@debug
@opsetup
def
setup
(
self
,
rwork
=
None
,
iwork
=
None
):
if
not
self
.
_is_uptodate
:
# if self.on_proc[self.discrete_fields[self.vorticity].topology]:
self
.
discrete_op
=
\
Dab
(
velocity
=
self
.
discrete_fields
[
self
.
velocity
],
vorticity
=
self
.
discrete_fields
[
self
.
vorticity
],
req_flowrate
=
self
.
req_flowrate
,
absorption_box
=
self
.
absorption_box
,
rwork
=
rwork
,
iwork
=
iwork
,
filter_func
=
self
.
_filter_func
)
# Output setup
self
.
_set_io
(
'
absorption_BC
'
,
(
1
,
2
+
self
.
domain
.
dim
))
self
.
discrete_op
.
set_writer
(
self
.
_writer
)
self
.
_is_uptodate
=
True
def
wait
(
self
):
print
"
TEMP WAIT FOR TEST
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment