Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
b00fe1d2
Commit
b00fe1d2
authored
Oct 23, 2013
by
Praetorius, Simon
Browse files
navierStokes demo added
parent
2c1e3427
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
extensions/demo/other/init/navierStokes.dat.2d
0 → 100644
View file @
b00fe1d2
dimension of world: 2
% ====================== VARIABLES ========================
output_folder: output
output_postfix: _drivenCavity
mesh_name: mesh
% ====================== MESH =============================
${mesh_name}->macro file name: macro/macro.drivenCavity.2d
${mesh_name}->global refinements: 12
${mesh_name}->check: 0
% ============= PROBLEM-SPACES ==================================
ns->space->components: (${dimension of world})+1
ns->space->polynomial degree[0]: 2
ns->space->polynomial degree[1]: 2
ns->space->polynomial degree[2]: 1
ns->space->dim: 2
ns->space->mesh: ${mesh_name}
% ================== SOLVER ======================================
ns->space->solver: direct
ns->space->solver->tolerance: 1.e-8
ns->space->solver->info: 1
% ====================== USER-PARAMETER ==============
ns->viscosity: 0.1
ns->density: 1.0
%ns->force: [0.0, 9.81] % gravitational force [m/s^2]
ns->laplace operator: 0 % 0... div(nu*grad(u)), 1... div(0.5*nu*(grad(u)+grad(u)^T)) [sehr langsam]
ns->non-linear term: 3 % 0... u^old*grad(u_i^old), 1... u'*grad(u_i^old), 2... u^old*grad(u'_i)
% ====================== TIMESTEPS ========================
adapt->timestep: 1.e-2
adapt->max timestep: 1e+10
adapt->min timestep: 1e-6
adapt->start time: 0.0
adapt->end time: 20
% =========== OUTPUT ==============================================
ns->velocity->output->filename: ${output_folder}/velocity${output_postfix}_
ns->space->output[2]->filename: ${output_folder}/pressure${output_postfix}_
ns->velocity->output->ParaView animation: 1
ns->velocity->output->ParaView vector format: 1
ns->velocity->output->write vector as 3d vector: 1
ns->velocity->output->write every i-th timestep: 1
%ns->velocity->output->compression: gzip
ns->velocity->output->append index: 1
ns->velocity->output->index length: 9
ns->velocity->output->index decimals: 7
ns->space->output[2]->ParaView animation: 1
ns->space->output[2]->ParaView format: 1
ns->space->output[2]->write every i-th timestep: 1
%ns->space->output[2]->compression: gzip
ns->space->output[2]->append index: 1
ns->space->output[2]->index length: 9
ns->space->output[2]->index decimals: 7
% ====================== ESTIMATORS =======================
adapt->strategy: 0 % 0=explicit, 1=implicit
WAIT: 1
extensions/demo/other/init/navierStokes_TaylorHood.inc.3d
0 → 100644
View file @
b00fe1d2
ns->space->mesh: ${mesh_name}
% ============ USER_PARAMETERS - NS =================================
ns->viscosity: 1
ns->beta: 1
ns->sigma: 0.072
ns->beta: 1
ns->exponent: 2
ns->theta: 0.5
%ns->force: [0.0, -9.81] % gravitational force
ns->viscosity1: 1
ns->viscosity2: ${ns->viscosity1}/1000
ns->force dirichlet bc: 0
ns->poisson problem pertubation: 0 % 1..applySingularPertubation, 2..applySingularDBC, 0..nothing
ns->simple algorithm: 1
ns->calculate pressure: 0
ns->initial velocity: 3
ns->initial velocity value: 0.1
ns->laplace operator: 0 % 0... div(nu*grad(u)), 1... div(0.5*nu*(grad(u)+grad(u)^T)) [sehr langsam]
ns->non-linear term: 2 % 0... u^old*grad(u_i^old), 1... u'*grad(u_i^old), 2... u^old*grad(u'_i)
% =========== OUTPUT ==============================================
ns->velocity->output->filename: ${output_folder}/velocity${output_postfix}_
ns->space->output[3]->filename: ${output_folder}/pressure${output_postfix}_
% ============= PROBLEM-SPACES ==================================
ns->space->components: 4
ns->space->polynomial degree[0]: ${polynomial-degree}+1
ns->space->polynomial degree[1]: ${polynomial-degree}+1
ns->space->polynomial degree[2]: ${polynomial-degree}+1
ns->space->polynomial degree[3]: ${polynomial-degree}
ns->space->dim: 3
% ================== SOLVER ======================================
ns->space->solver: petsc-navierstokes2 %direct
ns->space->solver->backend: ${backend}
ns->space->solver->max iteration: 500
ns->space->solver->tolerance: 1.e-6
ns->space->solver->info: 10
ns->space->solver->navierstokes->laplace solver: 0
ns->space->solver->navierstokes->mass solver: 0
ns->space->solver->navierstokes->velocity solver: 0
ns->space->solver->navierstokes->use old initial guess: 1
%ns->space->solver->navierstokes->neumann boundary indices: 2
parallel->solver->petsc->ksp: -ns_ksp_gmres_modifiedgramschmidt -ns_ksp_initial_guess_nonzero 1
parallel->debug->print options info: 1
ns->space->solver->navierstokes->pressure component: 3
ns->space->solver->navierstokes->pressure null space: 1
ns->space->solver->navierstokes->use old initial guess: 1
% =================== OUTPUT =========================================
ns->velocity->output->ParaView animation: 1
ns->velocity->output->ParaView vector format: 1
ns->velocity->output->write vector as 3d vector: 1
ns->velocity->output->write every i-th timestep: 1
%ns->velocity->output->compression: gzip
ns->velocity->output->append index: 1
ns->velocity->output->index length: 9
ns->velocity->output->index decimals: 7
ns->space->output[3]->ParaView animation: 0
ns->space->output[3]->ParaView format: 0
ns->space->output[3]->write every i-th timestep: 1
%ns->space->output[3]->compression: gzip
ns->space->output[3]->append index: 1
ns->space->output[3]->index length: 9
ns->space->output[3]->index decimals: 7
extensions/demo/other/macro/kanal_25_4_4.3d
0 → 100644
View file @
b00fe1d2
This diff is collapsed.
Click to expand it.
extensions/demo/other/src/navierStokes.cc
0 → 100644
View file @
b00fe1d2
/******************************************************************************
*
* Extension of AMDiS - Adaptive multidimensional simulations
*
* Copyright (C) 2013 Dresden University of Technology. All Rights Reserved.
* Web: https://fusionforge.zih.tu-dresden.de/projects/amdis
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*
* See also license.opensource.txt in the distribution.
*
******************************************************************************/
#include
"AMDiS.h"
#include
"NavierStokes_TaylorHood.h"
using
namespace
AMDiS
;
struct
DrivenCavityBC
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
{
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
double
vel
=
std
::
max
(
0.0
,
1.0
-
4.0
*
sqr
(
x
[
0
]
-
0.5
));
return
(
*
time
<
0.1
?
sin
((
*
time
)
*
m_pi
/
0.2
)
*
vel
:
vel
);
}
void
setTimePtr
(
double
*
time_
)
{
time
=
time_
;
}
private:
double
*
time
;
};
class
DrivenCavity
:
public
NavierStokes_TaylorHood
{
public:
// typedefs
typedef
NavierStokes_TaylorHood
super
;
public:
// methods
/// Constructor
DrivenCavity
(
std
::
string
name
)
:
super
(
name
),
drivenCavityBC
(
NULL
)
{
}
/// Destructor
~
DrivenCavity
()
{
if
(
drivenCavityBC
)
{
delete
drivenCavityBC
;
drivenCavityBC
=
NULL
;
}
}
virtual
void
initData
()
{
super
::
initData
();
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
Parallel
::
PetscSolverNavierStokes
*
solver
=
dynamic_cast
<
Parallel
::
PetscSolverNavierStokes
*>
(
prob
->
getSolver
());
if
(
solver
)
solver
->
setStokesData
(
&
viscosity
,
getInvTau
(),
prob
->
getSolution
());
// solver->setStokesData(getInvTau(), prob->getSolution(), &viscosity1, &viscosity2, &density1, &density2);
#endif
}
/// Set initial condition: constant zero velocity
virtual
void
solveInitialProblem
(
AdaptInfo
*
adaptInfo
)
{
super
::
solveInitialProblem
(
adaptInfo
);
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
prob
->
getSolution
()
->
getDOFVector
(
i
)
->
set
(
0.0
);
drivenCavityBC
->
setTimePtr
(
adaptInfo
->
getTimePtr
());
}
/// add boundary conditions corresponding to the lid driven cavity example
virtual
void
fillBoundaryConditions
()
{
AMDiS
::
Const
<
double
,
WorldVector
<
double
>
>
*
zero
=
new
AMDiS
::
Const
<
double
,
WorldVector
<
double
>
>
(
0.0
);
/// at rigid wall: no-slip boundary condition
for
(
size_t
i
=
0
;
i
<
dow
;
i
++
)
prob
->
addDirichletBC
(
1
,
i
,
i
,
zero
);
/// at upper wall: prescribed velocity
drivenCavityBC
=
new
DrivenCavityBC
;
prob
->
addDirichletBC
(
2
,
0
,
0
,
drivenCavityBC
);
prob
->
addDirichletBC
(
2
,
1
,
1
,
zero
);
}
protected:
// variables
DrivenCavityBC
*
drivenCavityBC
;
};
int
main
(
int
argc
,
char
**
argv
)
{
FUNCNAME
(
"main"
);
AMDiS
::
init
(
argc
,
argv
);
Timer
t
;
DrivenCavity
nsProb
(
"ns"
);
nsProb
.
initialize
(
INIT_ALL
);
nsProb
.
initTimeInterface
();
// Adapt-Infos
AdaptInfo
adaptInfo
(
"adapt"
,
nsProb
.
getNumComponents
());
AdaptInstationary
adaptInstat
(
"adapt"
,
nsProb
,
adaptInfo
,
nsProb
,
adaptInfo
);
int
error_code
=
adaptInstat
.
adapt
();
MSG
(
"elapsed time= %d sec
\n
"
,
t
.
elapsed
());
AMDiS
::
finalize
();
return
error_code
;
}
Write
Preview
Supports
Markdown
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