Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-alugrid
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ag-ohlberger
dune-community
dune-alugrid
Commits
b7d70208
Commit
b7d70208
authored
4 years ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[feature][TransportProblem] Added test for periodic grid.
parent
8774599b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/problem-transport.hh
+49
-22
49 additions, 22 deletions
examples/problem-transport.hh
with
49 additions
and
22 deletions
examples/problem-transport.hh
+
49
−
22
View file @
b7d70208
...
...
@@ -3,6 +3,7 @@
#include
<iostream>
#include
<sstream>
#include
<memory>
#include
<dune/common/fvector.hh>
...
...
@@ -18,7 +19,20 @@ class TransportProblemData1
{
typedef
ProblemData
<
dimD
,
1
>
Base
;
std
::
string
gridFile_
;
public:
TransportProblemData1
(
const
int
problem
)
{
if
(
problem
==
3
)
{
gridFile_
=
"/dgf/periodic"
+
std
::
to_string
(
dimDomain
)
+
".dgf"
;
}
else
{
gridFile_
=
"/dgf/unitcube"
+
std
::
to_string
(
dimDomain
)
+
"d.dgf"
;
}
}
const
static
int
dimDomain
=
Base
::
dimDomain
;
const
static
int
dimRange
=
Base
::
dimRange
;
...
...
@@ -39,9 +53,7 @@ public:
std
::
string
gridFile
(
const
std
::
string
&
path
,
const
int
mpiSize
)
const
{
std
::
ostringstream
dgfFileName
;
dgfFileName
<<
path
<<
"/dgf/unitcube"
<<
dimDomain
<<
"d.dgf"
;
return
dgfFileName
.
str
();
return
path
+
gridFile_
;
}
RangeType
boundaryValue
(
const
DomainType
&
x
,
double
time
)
const
...
...
@@ -82,7 +94,20 @@ class TransportProblemData2
{
typedef
ProblemData
<
dimD
,
1
>
Base
;
std
::
string
gridFile_
;
public:
TransportProblemData2
(
const
int
problem
)
{
if
(
problem
==
4
)
{
gridFile_
=
"/dgf/periodic"
+
std
::
to_string
(
dimDomain
)
+
".dgf"
;
}
else
{
gridFile_
=
"/dgf/unitcube"
+
std
::
to_string
(
dimDomain
)
+
"d.dgf"
;
}
}
const
static
int
dimDomain
=
Base
::
dimDomain
;
const
static
int
dimRange
=
Base
::
dimRange
;
...
...
@@ -92,8 +117,9 @@ public:
//! \copydoc ProblemData::initial
RangeType
initial
(
const
DomainType
&
x
)
const
{
DomainType
r
(
0
);
return
((
x
-
r
).
two_norm
()
<
0.5
?
RangeType
(
1
)
:
RangeType
(
0
)
);
DomainType
r
(
0.5
);
return
((
x
-
r
).
two_norm
()
<
0.25
?
RangeType
(
1
)
:
RangeType
(
0
)
);
//return ((x-r).two_norm() < 0.5 ? RangeType( 1 ) : RangeType( 0 ) );
}
//! \copydoc ProblemData::endTime
...
...
@@ -105,9 +131,7 @@ public:
//! \copydoc ProblemData::gridFile
std
::
string
gridFile
(
const
std
::
string
&
path
,
const
int
mpiSize
)
const
{
std
::
ostringstream
dgfFileName
;
dgfFileName
<<
path
<<
"/dgf/unitcube"
<<
dimDomain
<<
"d.dgf"
;
return
dgfFileName
.
str
();
return
path
+
gridFile_
;
}
RangeType
boundaryValue
(
const
DomainType
&
x
,
double
time
)
const
...
...
@@ -170,25 +194,28 @@ struct TransportModel
switch
(
problem
)
{
case
1
:
problem_
=
new
TransportProblemData1
<
dimDomain
>
();
case
3
:
problem_
.
reset
(
new
TransportProblemData1
<
dimDomain
>
(
problem
)
);
break
;
case
2
:
problem_
=
new
TransportProblemData2
<
dimDomain
>
();
case
4
:
problem_
.
reset
(
new
TransportProblemData2
<
dimDomain
>
(
problem
)
);
break
;
default:
std
::
cerr
<<
"Problem "
<<
problem
<<
" does not exists."
<<
std
::
endl
;
exit
(
1
);
std
::
abort
(
);
}
// set transport velocity
velocity_
=
DomainType
(
1.25
);
}
/** \brief destructor
*/
~
TransportModel
()
{
delete
problem_
;
if
(
problem
<
3
)
{
// set transport velocity
velocity_
=
DomainType
(
1.25
);
}
else
{
velocity_
=
0.0
;
velocity_
[
0
]
=
1.25
;
}
}
/** \brief obtain problem */
...
...
@@ -291,9 +318,9 @@ struct TransportModel
}
protected
:
TransportModel
(
)
:
problem_
(
0
),
velocity_
(
1
)
{}
TransportModel
(
)
:
problem_
(),
velocity_
(
1
)
{}
private
:
Problem
*
problem_
;
std
::
unique_ptr
<
Problem
>
problem_
;
DomainType
velocity_
;
};
// end class TransportModel
...
...
This diff is collapsed.
Click to expand it.
Tobias Leibner
@l_tobi01
mentioned in commit
7d78c0c2
·
3 years ago
mentioned in commit
7d78c0c2
mentioned in commit 7d78c0c2d3cb375b11481c5b8f5fb60765eec092
Toggle commit list
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