Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
blaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Aerospace and Mechanical Engineering
blaster
Commits
7e2b47ce
Verified
Commit
7e2b47ce
authored
3 months ago
by
Paul Dechamps
Browse files
Options
Downloads
Patches
Plain Diff
(format) Renamed arguments of RBF interpolator
parent
4ed49c3f
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
BLASTER v1.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
blast/interfaces/interpolators/DRbfInterpolator.py
+14
-14
14 additions, 14 deletions
blast/interfaces/interpolators/DRbfInterpolator.py
with
14 additions
and
14 deletions
blast/interfaces/interpolators/DRbfInterpolator.py
+
14
−
14
View file @
7e2b47ce
...
...
@@ -3,9 +3,11 @@
import
numpy
as
np
from
scipy.interpolate
import
RBFInterpolator
class
RbfInterpolator
:
def
__init__
(
self
,
_cfg
,
_nDim
):
self
.
cfg
=
_cfg
self
.
nDim
=
_nDim
def
__init__
(
self
,
cfg
,
ndim
):
self
.
_cfg
=
cfg
if
ndim
!=
2
and
ndim
!=
3
:
raise
ValueError
(
'
Number of dimensions must be 2 or 3 but {} was given
'
.
format
(
ndim
))
self
.
_ndim
=
ndim
def
inviscidToViscous
(
self
,
iDict
,
vDict
):
## Airfoil
...
...
@@ -16,35 +18,33 @@ class RbfInterpolator:
M
=
np
.
zeros
(
reg
.
nodesCoord
.
shape
[
0
])
rho
=
np
.
zeros
(
reg
.
nodesCoord
.
shape
[
0
])
for
iDim
in
range
(
3
):
v
[:,
iDim
]
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
V
[:,
iDim
],
reg
.
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
M
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
M
,
reg
.
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
rho
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
Rho
,
reg
.
nodesCoord
[:,:(
self
.
cfg
[
'
nDim
'
]
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
v
[:,
iDim
]
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
_ndim
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
V
[:,
iDim
],
reg
.
nodesCoord
[:,:(
self
.
_ndim
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
M
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
_ndim
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
M
,
reg
.
nodesCoord
[:,:(
self
.
_ndim
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
rho
=
self
.
__rbfToSection
(
iDict
[
iReg
].
nodesCoord
[:,:(
self
.
_ndim
if
iDict
[
iReg
].
name
==
'
iWing
'
else
1
)],
iDict
[
iReg
].
Rho
,
reg
.
nodesCoord
[:,:(
self
.
_ndim
if
'
vAirfoil
'
in
reg
.
name
else
1
)])
vDict
[
iSec
][
iReg
].
updateVars
(
v
,
M
,
rho
)
def
viscousToInviscid
(
self
,
iDict
,
vDict
):
if
self
.
nD
im
==
2
:
if
self
.
_nd
im
==
2
:
for
iReg
,
reg
in
enumerate
(
iDict
):
iDict
[
iReg
].
blowingVel
=
self
.
__rbfToSection
(
vDict
[
0
][
iReg
].
elemsCoordTr
[:,:(
self
.
cfg
[
'
nDim
'
]
-
1
if
'
vAirfoil
'
in
reg
.
name
else
1
)],
vDict
[
0
][
iReg
].
blowingVel
,
reg
.
elemsCoordTr
[:,:(
self
.
cfg
[
'
nDim
'
]
-
1
if
reg
.
name
==
'
iWing
'
else
1
)])
elif
self
.
nD
im
==
3
:
iDict
[
iReg
].
blowingVel
=
self
.
__rbfToSection
(
vDict
[
0
][
iReg
].
elemsCoordTr
[:,:(
self
.
_ndim
-
1
if
'
vAirfoil
'
in
reg
.
name
else
1
)],
vDict
[
0
][
iReg
].
blowingVel
,
reg
.
elemsCoordTr
[:,:(
self
.
_ndim
-
1
if
reg
.
name
==
'
iWing
'
else
1
)])
elif
self
.
_nd
im
==
3
:
for
iReg
,
reg
in
enumerate
(
iDict
):
viscElemsCoord
=
np
.
zeros
((
0
,
3
))
viscBlowing
=
np
.
zeros
(
0
)
for
iSec
,
sec
in
enumerate
(
vDict
):
viscElemsCoord
=
np
.
row_stack
((
viscElemsCoord
,
sec
[
iReg
].
elemsCoord
[:,:
3
]))
viscBlowing
=
np
.
concatenate
((
viscBlowing
,
sec
[
iReg
].
blowingVel
))
if
'
Sym
'
in
self
.
cfg
:
for
s
in
self
.
cfg
[
'
Sym
'
]:
if
'
Sym
'
in
self
.
_
cfg
:
for
s
in
self
.
_
cfg
[
'
Sym
'
]:
dummy
=
viscElemsCoord
.
copy
()
dummy
[:,
1
]
=
(
dummy
[:,
1
]
-
s
)
*
(
-
1
)
+
s
viscElemsCoord
=
np
.
row_stack
((
viscElemsCoord
,
dummy
))
viscBlowing
=
np
.
concatenate
((
viscBlowing
,
viscBlowing
))
reg
.
blowingVel
=
self
.
__rbfToSection
(
viscElemsCoord
,
viscBlowing
,
reg
.
elemsCoord
[:,:
3
])
else
:
raise
RuntimeError
(
'
Incorrect number of dimensions
'
,
self
.
cfg
[
'
nDim
'
])
def
__rbfToSection
(
self
,
x
,
var
,
xs
):
if
np
.
all
(
var
==
var
[
0
]):
varOut
=
RBFInterpolator
(
x
,
var
,
neighbors
=
1
,
kernel
=
'
linear
'
,
smoothing
=
0.0
,
degree
=
0
)(
xs
)
else
:
varOut
=
RBFInterpolator
(
x
,
var
,
neighbors
=
self
.
cfg
[
'
neighbors
'
],
kernel
=
self
.
cfg
[
'
rbftype
'
],
smoothing
=
self
.
cfg
[
'
smoothing
'
],
degree
=
self
.
cfg
[
'
degree
'
])(
xs
)
varOut
=
RBFInterpolator
(
x
,
var
,
neighbors
=
self
.
_
cfg
[
'
neighbors
'
],
kernel
=
self
.
_
cfg
[
'
rbftype
'
],
smoothing
=
self
.
_
cfg
[
'
smoothing
'
],
degree
=
self
.
_
cfg
[
'
degree
'
])(
xs
)
return
varOut
\ No newline at end of file
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