Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
106e5903
Commit
106e5903
authored
Jun 22, 2022
by
Markus Wiedemann
Browse files
vtk output in app
parent
364b0fc3
Pipeline
#40969
failed with stages
in 10 minutes and 53 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/3d_convection/ConvectionSimulation.cpp
View file @
106e5903
...
...
@@ -116,17 +116,10 @@ ConvectionSimulation::ConvectionSimulation( const walberla::Config::BlockHandle&
m_fDensity
=
[
&
](
const
Point3D
&
x
)
{
real_t
retVal
;
if
(
m_variableParam
.
haveDensityProfile
)
{
auto
radius
=
std
::
sqrt
(
x
[
0
]
*
x
[
0
]
+
x
[
1
]
*
x
[
1
]
+
x
[
2
]
*
x
[
2
]
);
retVal
=
linear_interpolate_between
(
m_inputParam
.
densityProfile
,
radius
);
}
else
{
retVal
=
m_inputParam
.
density
;
}
retVal
=
m_inputParam
.
density
;
return
retVal
;
};
m_fConductivity
=
[
&
](
const
Point3D
&
x
)
{
return
m_inputParam
.
thermal_conductivity
;
};
};
...
...
@@ -159,6 +152,12 @@ void ConvectionSimulation::parseConfig( const walberla::Config::BlockHandle& mai
if
(
readDataFile
(
fileDensityProfile
,
m_inputParam
.
densityProfile
,
2
)
)
{
m_variableParam
.
haveDensityProfile
=
true
;
m_fDensity
=
[
&
](
const
Point3D
&
x
)
{
real_t
retVal
;
auto
radius
=
std
::
sqrt
(
x
[
0
]
*
x
[
0
]
+
x
[
1
]
*
x
[
1
]
+
x
[
2
]
*
x
[
2
]
);
retVal
=
linear_interpolate_between
(
m_inputParam
.
densityProfile
,
radius
);
return
retVal
;
};
}
}
else
if
(
mainConf
.
isDefined
(
"density"
)
)
...
...
@@ -172,6 +171,12 @@ void ConvectionSimulation::parseConfig( const walberla::Config::BlockHandle& mai
if
(
readDataFile
(
fileTemperatureProfile
,
m_inputParam
.
temperatureProfile
,
2
)
)
{
m_variableParam
.
haveTemperatureProfile
=
true
;
m_fInitalTemperature
=
[
&
](
const
Point3D
&
x
)
{
real_t
retVal
;
auto
radius
=
std
::
sqrt
(
x
[
0
]
*
x
[
0
]
+
x
[
1
]
*
x
[
1
]
+
x
[
2
]
*
x
[
2
]
);
retVal
=
linear_interpolate_between
(
m_inputParam
.
temperatureProfile
,
radius
);
return
retVal
;
};
}
}
else
if
(
mainConf
.
isDefined
(
"cmb_temp"
)
&&
mainConf
.
isDefined
(
"surface_temp"
)
&&
...
...
@@ -186,8 +191,7 @@ void ConvectionSimulation::parseConfig( const walberla::Config::BlockHandle& mai
<<
"Specify profile for temperature! Continuing with cmb_temp of 4200, surface_tmp of 300 and initialTemperatureSteepness of 10"
<<
std
::
endl
;
if
(
mainConf
.
isDefined
(
"fileViscosityProfile"
)
)
if
(
mainConf
.
isDefined
(
"fileViscosityProfile"
)
)
{
std
::
string
fileViscosityProfile
=
mainConf
.
getParameter
<
std
::
string
>
(
"fileViscosityProfile"
);
if
(
readDataFile
(
fileViscosityProfile
,
m_inputParam
.
viscosityProfile
,
2
)
)
...
...
@@ -231,9 +235,6 @@ void ConvectionSimulation::parseConfig( const walberla::Config::BlockHandle& mai
m_outputParam
.
vtkOutputVertexDoFs
=
mainConf
.
getParameter
<
bool
>
(
"vtkOutputVertexDoFs"
);
m_verbose
=
mainConf
.
getParameter
<
bool
>
(
"verbose"
);
m_outputParam
.
outputDirectory
=
mainConf
.
getParameter
<
std
::
string
>
(
"outputDirectory"
);
m_outputParam
.
outputBaseName
=
mainConf
.
getParameter
<
std
::
string
>
(
"outputBaseName"
);
}
void
ConvectionSimulation
::
createSetupStorage
()
...
...
@@ -347,13 +348,6 @@ void ConvectionSimulation::initialiseFunctions()
void
ConvectionSimulation
::
setupSolversAndOperators
()
{
// 7
// m_pStokesSolver = solvertemplates::stokesMinResSolver< StokesOperator >( m_pStorage,
// m_domainInfo.minLevel,
// m_solverInfo.stokesAbsoluteResidualUTolerance,
// m_solverInfo.stokesMaxNumIterations,
// m_verbose );
auto
prolongationOperator
=
std
::
make_shared
<
P2P1StokesToP2P1StokesProlongation
>
();
auto
restrictionOperator
=
std
::
make_shared
<
P2P1StokesToP2P1StokesRestriction
>
(
true
);
...
...
@@ -437,47 +431,53 @@ void ConvectionSimulation::setupSolversAndOperators()
m_pParticleTracker
=
std
::
make_shared
<
particleTracker
::
ParticleTracker
<
ScalarFunction
>
>
(
m_pStorage
,
m_domainParam
.
minLevel
,
m_domainParam
.
maxLevel
,
particleTracker
::
TimeSteppingScheme
::
RK4
,
100000
);
}
void
ConvectionSimulation
::
setupOutput
()
{
auto
vtkOutputParticles
=
std
::
make_shared
<
walberla
::
convection_particles
::
vtk
::
ParticleVtkOutput
>
(
m_pParticleTracker
->
getStorage
()
);
auto
vtkWriter
=
walberla
::
vtk
::
createVTKOutput_PointData
(
m_pVtkOutputParticles
=
walberla
::
vtk
::
createVTKOutput_PointData
(
vtkOutputParticles
,
"cnt"
,
1
,
m_outputParam
.
outputDirectory
,
"simulation_step"
,
true
,
true
,
true
,
true
);
// hyteg::VTKOutput vtkOutput(
outputDirectory, outputBaseName,
s
torage,
vtk
Interval );
// v
tkOutput
.
setVTKDataFormat( hyteg::vtk::DataFormat::BINARY );
//
if ( vtkOutputVertexDoFs )
//
{
//
v
tkOutput
.
add(
t
emperature
.
getVertexDoFFunction() );
//
}
//
else
//
{
//
v
tkOutput
.
add(
t
emperature );
//
}
//
if ( vtkOutputVelocity )
//
{
//
if ( vtkOutputVertexDoFs )
//
{
//
v
tkOutput
.
add(
u.
uvw()[0].getVertexDoFFunction() );
//
v
tkOutput
.
add(
u.
uvw()[1].getVertexDoFFunction() );
//
v
tkOutput
.
add(
u.
uvw()[2].getVertexDoFFunction() );
//
}
//
else
//
{
//
v
tkOutput
.
add(
u
);
//
}
//
}
//
else
//
{
//
if ( vtkOutputVertexDoFs )
//
{
//
v
tkOutput
.
add(
u
MagnitudeSquared
.
getVertexDoFFunction() );
//
}
//
else
//
{
//
v
tkOutput
.
add(
u
MagnitudeSquared );
//
}
//
}
m_pVtkOutput
=
std
::
make_shared
<
hyteg
::
VTKOutput
>
(
m_outputParam
.
outputDirectory
,
m_outputParam
.
outputBaseName
,
m_pS
torage
,
m_outputParam
.
vtkOutput
Interval
);
m_pV
tkOutput
->
setVTKDataFormat
(
hyteg
::
vtk
::
DataFormat
::
BINARY
);
if
(
m_outputParam
.
vtkOutputVertexDoFs
)
{
m_pV
tkOutput
->
add
(
m_pT
emperature
->
getVertexDoFFunction
()
);
}
else
{
m_pV
tkOutput
->
add
(
*
m_pT
emperature
);
}
if
(
m_outputParam
.
vtkOutputVelocity
)
{
if
(
m_outputParam
.
vtkOutputVertexDoFs
)
{
m_pV
tkOutput
->
add
(
m_pU
->
uvw
()[
0
].
getVertexDoFFunction
()
);
m_pV
tkOutput
->
add
(
m_pU
->
uvw
()[
1
].
getVertexDoFFunction
()
);
m_pV
tkOutput
->
add
(
m_pU
->
uvw
()[
2
].
getVertexDoFFunction
()
);
}
else
{
m_pV
tkOutput
->
add
(
*
m_pU
);
}
}
else
{
if
(
m_outputParam
.
vtkOutputVertexDoFs
)
{
m_pV
tkOutput
->
add
(
m_pU
MagnitudeSquared
->
getVertexDoFFunction
()
);
}
else
{
m_pV
tkOutput
->
add
(
*
m_pU
MagnitudeSquared
);
}
}
}
void
ConvectionSimulation
::
step
()
...
...
@@ -556,6 +556,18 @@ void ConvectionSimulation::step()
this
->
prepareRHSMassAndMomentum
();
m_pStokesSolver
->
solve
(
*
m_pStokesOperator
,
*
m_pU
,
*
m_pF
,
m_domainParam
.
maxLevel
);
// ##################
// Write Output
if
(
m_outputParam
.
vtk
)
{
m_pVtkOutput
->
write
(
m_domainParam
.
maxLevel
,
m_timestep
);
m_pVtkOutputParticles
->
write
(
m_domainParam
.
maxLevel
,
m_timestep
);
}
++
m_timestep
;
}
...
...
@@ -697,7 +709,11 @@ void ConvectionSimulation::updateViscosity()
{
m_pViscosity
->
interpolate
(
update
,
{
*
m_pTemperature
},
All
);
}
}
}
else
{
return
;
}
}
}
// namespace hyteg
apps/3d_convection/ConvectionSimulation.h
View file @
106e5903
...
...
@@ -175,14 +175,13 @@ struct InputParameters
real_t
diffusivity
=
3
;
real_t
thermal_expansivity
=
2.238
*
1e-5
;
real_t
thermal_conductivity
=
3.0
;
real_t
specific_heat_capacity
=
1
079
;
real_t
specific_heat_capacity
=
1
.1
*
1e3
;
real_t
internal_heating_rate
=
3.0
;
real_t
density
=
1.0
;
real_t
viscosity
=
1.0
;
real_t
rayleighNumber
=
1e6
;
real_t
alpha
=
1.
f
;
real_t
alpha
=
2.238
*
1e-5
f
;
real_t
activation_energy
=
0.1
f
;
};
...
...
@@ -233,6 +232,12 @@ class ConvectionSimulation
*/
void
setupSolversAndOperators
();
/**
* @brief Set up output
*
*/
void
setupOutput
();
/**
* @brief Parse the given config into member variables
*
...
...
@@ -353,6 +358,11 @@ class ConvectionSimulation
std
::
shared_ptr
<
MMOCTransport
<
ScalarFunction
>
>
m_pTransport
;
std
::
shared_ptr
<
particleTracker
::
ParticleTracker
<
ScalarFunction
>
>
m_pParticleTracker
;
std
::
shared_ptr
<
hyteg
::
VTKOutput
>
m_pVtkOutput
;
std
::
shared_ptr
<
walberla
::
vtk
::
VTKOutput
>
m_pVtkOutputParticles
;
// std::functions for various functionalities
std
::
function
<
real_t
(
const
Point3D
&
)
>
m_fViscosity
;
std
::
function
<
real_t
(
const
Point3D
&
)
>
m_fInitalTemperature
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment