Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Nektar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Dappur
Nektar
Commits
b0aa7a11
Commit
b0aa7a11
authored
7 years ago
by
Kilian Lackhove
Browse files
Options
Downloads
Patches
Plain Diff
DummySolver: use the actual fields so we can compute L2 and Linf errors
parent
2db0c433
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
solvers/DummySolver/EquationSystems/Dummy.cpp
+43
-53
43 additions, 53 deletions
solvers/DummySolver/EquationSystems/Dummy.cpp
solvers/DummySolver/EquationSystems/Dummy.h
+1
-10
1 addition, 10 deletions
solvers/DummySolver/EquationSystems/Dummy.h
with
44 additions
and
63 deletions
solvers/DummySolver/EquationSystems/Dummy.cpp
+
43
−
53
View file @
b0aa7a11
...
...
@@ -59,25 +59,20 @@ void Dummy::v_InitObject()
{
UnsteadySystem
::
v_InitObject
();
m_nanSteps
=
0
;
auto
sV
=
m_session
->
GetVariables
();
for
(
auto
const
&
sendVar
:
m_coupling
->
GetSendFieldNames
())
{
int
i
=
distance
(
sV
.
begin
(),
find
(
sV
.
begin
(),
sV
.
end
(),
sendVar
));
m_intVariables
.
push_back
(
i
);
}
m_ode
.
DefineOdeRhs
(
&
Dummy
::
DoOdeRhs
,
this
);
m_ode
.
DefineProjection
(
&
Dummy
::
DoOdeProjection
,
this
);
ASSERTL0
(
m_session
->
DefinesCmdLineArgument
(
"cwipi"
),
"This EquationSystem requires the --cwipi command line switch"
);
m_recFields
=
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
(
m_coupling
->
GetRecvFieldNames
().
size
());
for
(
int
i
=
0
;
i
<
m_recFields
.
num_elements
();
++
i
)
{
m_recFields
[
i
]
=
Array
<
OneD
,
NekDouble
>
(
GetTotPoints
(),
0.0
);
}
m_sendFields
=
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
(
m_coupling
->
GetSendFieldNames
().
size
());
for
(
int
i
=
0
;
i
<
m_sendFields
.
num_elements
();
++
i
)
{
m_sendFields
[
i
]
=
Array
<
OneD
,
NekDouble
>
(
GetTotPoints
(),
0.0
);
}
}
/**
...
...
@@ -87,17 +82,25 @@ Dummy::~Dummy()
{
}
/**
* @brief v_P
re
Integrate
* @brief v_P
ost
Integrate
*/
bool
Dummy
::
v_P
re
Integrate
(
int
step
)
bool
Dummy
::
v_P
ost
Integrate
(
int
step
)
{
if
(
m_
sendFields
.
num_elements
()
>
0
)
if
(
m_
coupling
->
GetSendFieldNames
().
size
()
>
0
)
{
Timer
timer1
;
timer1
.
Start
();
GetFunction
(
"SendFields"
,
m_fields
[
0
])
->
Evaluate
(
m_coupling
->
GetSendFieldNames
(),
m_sendFields
,
m_time
);
auto
sV
=
m_session
->
GetVariables
();
for
(
auto
const
&
sendVar
:
m_coupling
->
GetSendFieldNames
())
{
int
i
=
distance
(
sV
.
begin
(),
find
(
sV
.
begin
(),
sV
.
end
(),
sendVar
));
cout
<<
"sendVar = "
<<
sendVar
<<
", i = "
<<
i
<<
endl
;
GetFunction
(
"SendFields"
,
m_fields
[
i
])
->
Evaluate
(
sendVar
,
m_fields
[
i
]
->
UpdatePhys
(),
m_time
);
}
timer1
.
Stop
();
if
(
m_session
->
DefinesCmdLineArgument
(
"verbose"
))
{
...
...
@@ -105,9 +108,16 @@ bool Dummy::v_PreIntegrate(int step)
}
}
return
UnsteadySystem
::
v_PreIntegrate
(
step
);
}
for
(
int
i
=
0
;
i
<
m_session
->
GetVariables
().
size
();
++
i
)
{
m_fields
[
i
]
->
FwdTrans_IterPerExp
(
m_fields
[
i
]
->
UpdatePhys
(),
m_fields
[
i
]
->
UpdateCoeffs
());
m_fields
[
i
]
->
SetPhysState
(
false
);
}
return
UnsteadySystem
::
v_PostIntegrate
(
step
);
}
/**
* @brief Compute the right-hand side.
...
...
@@ -116,7 +126,13 @@ void Dummy::DoOdeRhs(const Array<OneD, const Array<OneD, NekDouble> > &inarray,
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
&
outarray
,
const
NekDouble
time
)
{
// do nothing
int
nVariables
=
inarray
.
num_elements
();
int
nq
=
GetTotPoints
();
for
(
int
i
=
0
;
i
<
nVariables
;
++
i
)
{
Vmath
::
Zero
(
nq
,
outarray
[
i
],
1
);
}
}
/**
...
...
@@ -128,39 +144,13 @@ void Dummy::DoOdeProjection(
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
&
outarray
,
const
NekDouble
time
)
{
// do nothing
}
int
nvariables
=
inarray
.
num_elements
();
int
nq
=
m_fields
[
0
]
->
GetNpoints
();
void
Dummy
::
v_AuxFields
(
std
::
vector
<
Array
<
OneD
,
NekDouble
>
>
&
fieldcoeffs
,
std
::
vector
<
Array
<
OneD
,
NekDouble
>
>
&
fieldphys
,
std
::
vector
<
MultiRegions
::
ExpListSharedPtr
>
&
expansions
,
std
::
vector
<
std
::
string
>
&
variables
)
{
for
(
int
i
=
0
;
i
<
m_recFields
.
num_elements
();
i
++
)
// deep copy
for
(
int
i
=
0
;
i
<
nvariables
;
++
i
)
{
fieldphys
.
push_back
(
m_recFields
[
i
]);
Array
<
OneD
,
NekDouble
>
tmpC
(
GetNcoeffs
());
m_fields
[
0
]
->
FwdTrans
(
m_recFields
[
i
],
tmpC
);
fieldcoeffs
.
push_back
(
tmpC
);
variables
.
push_back
(
m_coupling
->
GetRecvFieldNames
()[
i
]);
expansions
.
push_back
(
m_fields
[
0
]);
}
for
(
int
i
=
0
;
i
<
m_sendFields
.
num_elements
();
i
++
)
{
fieldphys
.
push_back
(
m_sendFields
[
i
]);
Array
<
OneD
,
NekDouble
>
tmpC
(
GetNcoeffs
());
m_fields
[
0
]
->
FwdTrans
(
m_sendFields
[
i
],
tmpC
);
fieldcoeffs
.
push_back
(
tmpC
);
variables
.
push_back
(
m_coupling
->
GetSendFieldNames
()[
i
]);
expansions
.
push_back
(
m_fields
[
0
]);
Vmath
::
Vcopy
(
nq
,
inarray
[
i
],
1
,
outarray
[
i
],
1
);
}
}
...
...
This diff is collapsed.
Click to expand it.
solvers/DummySolver/EquationSystems/Dummy.h
+
1
−
10
View file @
b0aa7a11
...
...
@@ -81,22 +81,13 @@ protected:
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
&
outarray
,
const
NekDouble
time
);
virtual
bool
v_PreIntegrate
(
int
step
);
virtual
void
v_AuxFields
(
std
::
vector
<
Array
<
OneD
,
NekDouble
>
>
&
fieldcoeffs
,
std
::
vector
<
Array
<
OneD
,
NekDouble
>
>
&
fieldphys
,
std
::
vector
<
MultiRegions
::
ExpListSharedPtr
>
&
expansions
,
std
::
vector
<
std
::
string
>
&
variables
);
virtual
bool
v_PostIntegrate
(
int
step
);
virtual
bool
v_RequireFwdTrans
()
{
return
false
;
}
private
:
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
m_recFields
;
Array
<
OneD
,
Array
<
OneD
,
NekDouble
>
>
m_sendFields
;
};
}
...
...
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