Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
swe_solvers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
swe_solvers
Commits
632163d5
Commit
632163d5
authored
Feb 25, 2013
by
Sebastian Rettenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vectorization with Intel compilers 13.x
parent
47999975
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
45 deletions
+45
-45
FWaveVec.hpp
src/solver/FWaveVec.hpp
+45
-45
No files found.
src/solver/FWaveVec.hpp
View file @
632163d5
...
@@ -109,7 +109,7 @@ public:
...
@@ -109,7 +109,7 @@ public:
T
uRight
=
i_huRight
/
i_hRight
;
T
uRight
=
i_huRight
/
i_hRight
;
//! wave speeds of the f-waves
//! wave speeds of the f-waves
T
waveSpeeds
[
2
]
;
T
waveSpeeds
0
=
0.
,
waveSpeeds1
=
0.
;
//compute the wave speeds
//compute the wave speeds
fWaveComputeWaveSpeeds
(
i_hLeft
,
i_hRight
,
fWaveComputeWaveSpeeds
(
i_hLeft
,
i_hRight
,
...
@@ -117,10 +117,10 @@ public:
...
@@ -117,10 +117,10 @@ public:
uLeft
,
uRight
,
uLeft
,
uRight
,
i_bLeft
,
i_bRight
,
i_bLeft
,
i_bRight
,
waveSpeeds
[
0
],
waveSpeeds
[
1
]
);
waveSpeeds
0
,
waveSpeeds1
);
//! where to store the two f-waves
//! where to store the two f-waves
T
fWaves
[
2
]
;
T
fWaves
0
=
0.
,
fWaves1
=
0.
;
//compute the decomposition into f-waves
//compute the decomposition into f-waves
fWaveComputeWaveDecomposition
(
i_hLeft
,
i_hRight
,
fWaveComputeWaveDecomposition
(
i_hLeft
,
i_hRight
,
...
@@ -128,8 +128,8 @@ public:
...
@@ -128,8 +128,8 @@ public:
uLeft
,
uRight
,
uLeft
,
uRight
,
i_bLeft
,
i_bRight
,
i_bLeft
,
i_bRight
,
waveSpeeds
[
0
],
waveSpeeds
[
1
]
,
waveSpeeds
0
,
waveSpeeds1
,
fWaves
[
0
],
fWaves
[
1
]
);
fWaves
0
,
fWaves1
);
//compute the net-updates
//compute the net-updates
T
hUpdateLeft
=
0.
;
T
hUpdateLeft
=
0.
;
...
@@ -138,35 +138,35 @@ public:
...
@@ -138,35 +138,35 @@ public:
T
huUpdateRight
=
0.
;
T
huUpdateRight
=
0.
;
//1st wave family
//1st wave family
if
(
waveSpeeds
[
0
]
<
-
zeroTol
)
{
//left going
if
(
waveSpeeds
0
<
-
zeroTol
)
{
//left going
hUpdateLeft
+=
fWaves
[
0
]
;
hUpdateLeft
+=
fWaves
0
;
huUpdateLeft
+=
fWaves
[
0
]
*
waveSpeeds
[
0
]
;
huUpdateLeft
+=
fWaves
0
*
waveSpeeds0
;
}
}
else
if
(
waveSpeeds
[
0
]
>
zeroTol
)
{
//right going
else
if
(
waveSpeeds
0
>
zeroTol
)
{
//right going
hUpdateRight
+=
fWaves
[
0
]
;
hUpdateRight
+=
fWaves
0
;
huUpdateRight
+=
fWaves
[
0
]
*
waveSpeeds
[
0
]
;
huUpdateRight
+=
fWaves
0
*
waveSpeeds0
;
}
}
else
{
//split waves
else
{
//split waves
hUpdateLeft
+=
(
T
)
.5
*
fWaves
[
0
]
;
hUpdateLeft
+=
(
T
)
.5
*
fWaves
0
;
huUpdateLeft
+=
(
T
)
.5
*
fWaves
[
0
]
*
waveSpeeds
[
0
]
;
huUpdateLeft
+=
(
T
)
.5
*
fWaves
0
*
waveSpeeds0
;
hUpdateRight
+=
(
T
)
.5
*
fWaves
[
0
]
;
hUpdateRight
+=
(
T
)
.5
*
fWaves
0
;
huUpdateRight
+=
(
T
)
.5
*
fWaves
[
0
]
*
waveSpeeds
[
0
]
;
huUpdateRight
+=
(
T
)
.5
*
fWaves
0
*
waveSpeeds0
;
}
}
//2nd wave family
//2nd wave family
if
(
waveSpeeds
[
1
]
>
zeroTol
)
{
//right going
if
(
waveSpeeds
1
>
zeroTol
)
{
//right going
hUpdateRight
+=
fWaves
[
1
]
;
hUpdateRight
+=
fWaves
1
;
huUpdateRight
+=
fWaves
[
1
]
*
waveSpeeds
[
1
]
;
huUpdateRight
+=
fWaves
1
*
waveSpeeds1
;
}
}
else
if
(
waveSpeeds
[
1
]
<
-
zeroTol
)
{
//left going
else
if
(
waveSpeeds
1
<
-
zeroTol
)
{
//left going
hUpdateLeft
+=
fWaves
[
1
]
;
hUpdateLeft
+=
fWaves
1
;
huUpdateLeft
+=
fWaves
[
1
]
*
waveSpeeds
[
1
]
;
huUpdateLeft
+=
fWaves
1
*
waveSpeeds1
;
}
}
else
{
//split waves
else
{
//split waves
hUpdateLeft
+=
(
T
)
.5
*
fWaves
[
1
]
;
hUpdateLeft
+=
(
T
)
.5
*
fWaves
1
;
huUpdateLeft
+=
(
T
)
.5
*
fWaves
[
1
]
*
waveSpeeds
[
1
]
;
huUpdateLeft
+=
(
T
)
.5
*
fWaves
1
*
waveSpeeds1
;
hUpdateRight
+=
(
T
)
.5
*
fWaves
[
1
]
;
hUpdateRight
+=
(
T
)
.5
*
fWaves
1
;
huUpdateRight
+=
(
T
)
.5
*
fWaves
[
1
]
*
waveSpeeds
[
1
]
;
huUpdateRight
+=
(
T
)
.5
*
fWaves
1
*
waveSpeeds1
;
}
}
// Set output variables
// Set output variables
...
@@ -176,7 +176,7 @@ public:
...
@@ -176,7 +176,7 @@ public:
o_huUpdateRight
=
huUpdateRight
;
o_huUpdateRight
=
huUpdateRight
;
//compute maximum wave speed (-> CFL-condition)
//compute maximum wave speed (-> CFL-condition)
o_maxWaveSpeed
=
std
::
max
(
std
::
abs
(
waveSpeeds
[
0
])
,
std
::
abs
(
waveSpeeds
[
1
]
)
);
o_maxWaveSpeed
=
std
::
max
(
std
::
abs
(
waveSpeeds
0
)
,
std
::
abs
(
waveSpeeds1
)
);
}
}
inline
inline
...
@@ -189,22 +189,22 @@ public:
...
@@ -189,22 +189,22 @@ public:
T
&
o_waveSpeed0
,
T
&
o_waveSpeed1
)
const
T
&
o_waveSpeed0
,
T
&
o_waveSpeed1
)
const
{
{
//compute eigenvalues of the jacobian matrices in states Q_{i-1} and Q_{i}
//compute eigenvalues of the jacobian matrices in states Q_{i-1} and Q_{i}
T
characteristicSpeed
[
2
]
;
T
characteristicSpeed
0
=
0.
,
characteristicSpeed1
=
0.
;
characteristicSpeed
[
0
]
=
i_uLeft
-
std
::
sqrt
(
gravity
*
i_hLeft
);
characteristicSpeed
0
=
i_uLeft
-
std
::
sqrt
(
gravity
*
i_hLeft
);
characteristicSpeed
[
1
]
=
i_uRight
+
std
::
sqrt
(
gravity
*
i_hRight
);
characteristicSpeed
1
=
i_uRight
+
std
::
sqrt
(
gravity
*
i_hRight
);
//compute "Roe speeds"
//compute "Roe speeds"
T
hRoe
=
(
T
)
.5
*
(
i_hRight
+
i_hLeft
);
T
hRoe
=
(
T
)
.5
*
(
i_hRight
+
i_hLeft
);
T
uRoe
=
i_uLeft
*
std
::
sqrt
(
i_hLeft
)
+
i_uRight
*
std
::
sqrt
(
i_hRight
);
T
uRoe
=
i_uLeft
*
std
::
sqrt
(
i_hLeft
)
+
i_uRight
*
std
::
sqrt
(
i_hRight
);
uRoe
/=
std
::
sqrt
(
i_hLeft
)
+
std
::
sqrt
(
i_hRight
);
uRoe
/=
std
::
sqrt
(
i_hLeft
)
+
std
::
sqrt
(
i_hRight
);
T
roeSpeed
[
2
]
;
T
roeSpeed
0
=
0.
,
roeSpeed1
=
0.
;
roeSpeed
[
0
]
=
uRoe
-
std
::
sqrt
(
gravity
*
hRoe
);
roeSpeed
0
=
uRoe
-
std
::
sqrt
(
gravity
*
hRoe
);
roeSpeed
[
1
]
=
uRoe
+
std
::
sqrt
(
gravity
*
hRoe
);
roeSpeed
1
=
uRoe
+
std
::
sqrt
(
gravity
*
hRoe
);
//computer eindfeldt speeds
//computer eindfeldt speeds
o_waveSpeed0
=
std
::
min
(
characteristicSpeed
[
0
],
roeSpeed
[
0
]
);
o_waveSpeed0
=
std
::
min
(
characteristicSpeed
0
,
roeSpeed0
);
o_waveSpeed1
=
std
::
max
(
characteristicSpeed
[
1
],
roeSpeed
[
1
]
);
o_waveSpeed1
=
std
::
max
(
characteristicSpeed
1
,
roeSpeed1
);
}
}
inline
inline
...
@@ -220,31 +220,31 @@ public:
...
@@ -220,31 +220,31 @@ public:
T
lambdaDif
=
i_waveSpeed1
-
i_waveSpeed0
;
T
lambdaDif
=
i_waveSpeed1
-
i_waveSpeed0
;
//compute the inverse matrix R^{-1}
//compute the inverse matrix R^{-1}
T
Rinv
[
2
][
2
]
;
T
Rinv
00
=
0.
,
Rinv01
=
0.
,
Rinv10
=
0.
,
Rinv11
=
0.
;
T
oneDivLambdaDif
=
(
T
)
1.
/
lambdaDif
;
T
oneDivLambdaDif
=
(
T
)
1.
/
lambdaDif
;
Rinv
[
0
][
0
]
=
oneDivLambdaDif
*
i_waveSpeed1
;
Rinv
00
=
oneDivLambdaDif
*
i_waveSpeed1
;
Rinv
[
0
][
1
]
=
-
oneDivLambdaDif
;
Rinv
01
=
-
oneDivLambdaDif
;
Rinv
[
1
][
0
]
=
oneDivLambdaDif
*
-
i_waveSpeed0
;
Rinv
10
=
oneDivLambdaDif
*
-
i_waveSpeed0
;
Rinv
[
1
][
1
]
=
oneDivLambdaDif
;
Rinv
11
=
oneDivLambdaDif
;
//right hand side
//right hand side
T
fDif
[
2
]
;
T
fDif
0
=
0.
,
fDif1
=
0.
;
//calculate modified (bathymetry!) flux difference
//calculate modified (bathymetry!) flux difference
// f(Q_i) - f(Q_{i-1})
// f(Q_i) - f(Q_{i-1})
fDif
[
0
]
=
i_huRight
-
i_huLeft
;
fDif
0
=
i_huRight
-
i_huLeft
;
fDif
[
1
]
=
i_huRight
*
i_uRight
+
(
T
)
.5
*
gravity
*
i_hRight
*
i_hRight
fDif
1
=
i_huRight
*
i_uRight
+
(
T
)
.5
*
gravity
*
i_hRight
*
i_hRight
-
(
i_huLeft
*
i_uLeft
+
(
T
)
.5
*
gravity
*
i_hLeft
*
i_hLeft
);
-
(
i_huLeft
*
i_uLeft
+
(
T
)
.5
*
gravity
*
i_hLeft
*
i_hLeft
);
// \delta x \Psi[2]
// \delta x \Psi[2]
T
psi
=
-
gravity
*
(
T
)
.5
*
(
i_hRight
+
i_hLeft
)
*
(
i_bRight
-
i_bLeft
);
T
psi
=
-
gravity
*
(
T
)
.5
*
(
i_hRight
+
i_hLeft
)
*
(
i_bRight
-
i_bLeft
);
fDif
[
1
]
-=
psi
;
fDif
1
-=
psi
;
//solve linear equations
//solve linear equations
o_fWave0
=
Rinv
[
0
][
0
]
*
fDif
[
0
]
+
Rinv
[
0
][
1
]
*
fDif
[
1
]
;
o_fWave0
=
Rinv
00
*
fDif0
+
Rinv01
*
fDif1
;
o_fWave1
=
Rinv
[
1
][
0
]
*
fDif
[
0
]
+
Rinv
[
1
][
1
]
*
fDif
[
1
]
;
o_fWave1
=
Rinv
10
*
fDif0
+
Rinv11
*
fDif1
;
}
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment