Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary a Implementation of multiple deltaTs for the multi-region solver based on chtMultiRegionFoam Yuzhu Pearl Li Department of Mechanical and Structural Engineering and Materials Science, University of Stavanger, Stavanger, Norway 2016-12-5 Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 1 / 38
38
Embed
Implementation of multiple deltaTs for the multi-region ...hani/kurser/OS_CFD_2016/YuzhuPearlLi/slides.pdf · Outline Introduction The chtMultiRegionFoam solver Loop modi cation Test
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Implementation of multiple deltaTs for the multi-regionsolver based on chtMultiRegionFoam
Yuzhu Pearl Li
Department of Mechanical and Structural Engineering and Materials Science,University of Stavanger,
Stavanger, Norway
2016-12-5
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 1 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Outline
Outline
This work is to demonstrate the structure of chtMultiRegionFoam solverin FOAM-extend-4.0 and to implement modifications upon it.
Introduction
A walk through the solvers
Multi-region loop modifications
Verification: Try with the new solver
Pressure coupled boundary condition
Summary and future work
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 2 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Introduction
Introduction
Multi-physics(multi-region) problems
chtMultiRegionFoam
Solver modifications
*Note that the chtMultiRegionFoam in Foam-extend-4.0 has differences from
the version in OpenFOAM-4.0. This work may not be able to directly applied to
other OpenFOAM versions.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 3 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Multi-physics(multi-region) problems
Multi-physics(multi-region) problems
Conjugate Heat TransferWave-Structure-Soil
Interaction
A multi-physics problem has multiple physical domains; the interactionbetween the domains are achieved by boundary condition update.For some multi-physics problems, it is not efficient to calculate themultiple regions with the same mesh size and time step.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 4 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Multi-physics(multi-region) problems
Conjugate heat transfer and wave-structure-soil interaction
The modification of the chtMultiRegionFoam is regarded as an initialstep to develop a wave-structure-soil (WSS) interaction solver.
chtMultiRegionFoam:heat transfer (Kappa, T) between fluid and solid regions.
Wave-structure-soil Interaction:pressure transfer (p) from fluid to solid regions.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 5 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
chtMultiRegionFoam
chtMultiRegionFoam
What and why?
The chtMultiRegionFoam is a multi-regional(multi-physics) solverworking on fluid and solid regions.
The chtMultiRegionFoam contains solvers for each domain and theyare coupled by boundary condition update.
The physical feature of the conjugate heat transfer is one-waycoupling, from the high temperature regions to the low temperatureregions.
The chtMultiRegionFoam is a transient solver (whilechtMultiRegionSimpleFoam is a steady-state solver).
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 6 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Solver modifications
Solver modifications
Based on chtMultiRegionFoam,
Loop modification with multiple deltaTs (two approaches)
Solver verifications by case study
Pressure coupled boundary condition
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 7 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
A walk through the chtMultiRegionFoam solver
|----- chtMultiRegionFoam.C
|----- fluid
| |----- ...
| |----- solveFluid.H
|----- solid
|----- ...
|----- solveSolid.H
|----- derivedFvPatchFields
| |----- solidWallHeatFluxTemperature
| |----- solidWallMixedTemperatureCoupled
|----- regionProperties
|----- include
|----- readPIMPLEControls.H
|----- Make
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 8 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
A walk through the chtMultiRegionFoam solver
chtMultiRegionFoam.C, the main source file, calls the needed files andsolvers.
regionProperties/ reads fluid and solid region names setted in theconstant/regionProperties of the case files.
fluid/ contains source files that solve equations forcontinuity momentum,enthalpy, pressure for the fluid regions.
solid/ contains source files for solving heat conduction equation in solidregions.
derivedFvPatchFields/ contains files that set new boundary conditionsfor the coupling between solid and fluid domains.
include/ contains files to set/reset the multi-region time step.
Make/ contains files for compilation purpose.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 9 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
chtMultiRegionFoam.C
chtMultiRegionFoam.C
The source file of chtMultiRegionFoam.C provides a main clue of how isthe solver constructed.It can be viewed by
f40NR
cd $FOAM_SOLVERS/heatTransfer/chtMultiRegionFoam
vi chtMultiRegionFoam.C
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 10 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
PIMPLE loop
The PIMPLE loop in chtMultiRegionFoam.C
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "solveFluid.H"
}
forAll(solidRegions, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H"
}
}
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 11 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
PIMPLE loop
PIMPLE loop
The chtMultiRegionFoam solver uses PIMPLE loop algorithm. PIMPLEalgorithm is a combination of the pressure-implicit split-operator (PISO) and thesemi-implicit method for pressure-linked equations (SIMPLE) algorithms. The
PIMPLE parameters are set in the fvSolution in a case. For example,
PIMPLE
{
momentumPredictor off;
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 1;
pRefCell 0;
pRefValue 0;
}
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 12 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Fluid solver and solid solver
Fluid solver
The fluid solver solves:
density rho
pressure p, the derivative of pressure DpDt
velocity U
thermal energy h
h = cp · dT (1)
where cp is the specific heat capacity at a constant pressure.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 13 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Fluid solver and solid solver
Fluid solver includes four equations:
solveFluid.H
if (oCorr == 0)
{
#include "rhoEqn.H" //Solve the continuity for density.
}
#include "UEqn.H" //Solve the momentum equation
#include "hEqn.H" //Solve the thermal energy
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
{
#include "pEqn.H" //solve pressure
}
turb.correct();
rho = thermo.rho();
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 14 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Fluid solver and solid solver
Solid solver
The solid solver solvers temperature T .Variables that are needed for solving the temperature equation are:
thermal conductivity (Kappa)
specific heat capacity (cp)
solid density (rho)
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 15 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Fluid solver and solid solver
Solid solverThe solid solver solves the TEqn for solid regions.
tmp<fvScalarMatrix> TEqn
(
fvm::ddt(rho*cp, T)
- fvm::laplacian(Kappa, T)
);
TEqn().relax();
TEqn().solve();
}
The corresponding mathematical formula for the TEqn is:
ρ · cp∂T
∂t−∇(KT ) = 0 (2)
where K denotes Kappa.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 16 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Interface boundary coupling
Interface boundary coupling
The solidWallMixedTemperatureCoupled directory defines the mixedcoupling boundary condition that the multi-regions are coupled viaDirichlet-Neumann partitioning strategy at the coupled interface:
Dirichlet boundary condition:
Γ1 = Γ2 (3)
where the neighbour patches have the same field value.
Neumann boundary condition:
∂Γ1
∂n1=∂Γ2
∂n2(4)
where the neighbour patches agree on the gradient of the field value.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 17 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Interface boundary coupling
Temperature coupled boundary condition
The temperature coupled boundary condition is declared and defined inthe directory ofderivedFvPatchFields/ solidWallMixedTemperatureCoupled/
The source file of the boundary condition can be viewed by
cd derivedFvPatchFields/solidWallMixedTemperatureCoupled/
vi solidWallMixedTemperatureCoupledFvPatchScalarField.C
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 18 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Loop modification: Implementation of multiple deltaTs to the PIMPLEloop
Goal: The goal of the multi-region loop modification is to introduce anextra time step for the solid regions, in addition to the original time stepfor the fluid regions.
Reason: To improve the efficiency of the whole system when the time steprequirements varies between different physical regions.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 19 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Two approaches
Two approaches of implementation
The first approach. Introduce a time step for the solid regions(solidRegionDeltaT) which is an integral multiple of the fluidregion time step (deltaT), i.e.
solidRegionDeltaT = n · deltaT (5)
where n is an integer.The ’adjustTimeStep’ switch should be turned off.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 20 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
The first approach
First approach: implementation overview
1 Rename the solver as chtMultiRegionMultiDeltaTFoam.
2 Create a new variable to control the solid region delta T calledsolidRegionDeltaT. The creating of this variable should be implementedin solid/readSolidTimeControls.H.
3 A checking statement is written to check if the solidRegionDeltaT isintegral multiple of the deltaT. If not, the program will stop runninginstead of generating garbage results.
4 Based on the modification of step 3, inchtMultiRegionMultiDeltaTFoam.C, Add
#include <math.h>
for the computation of the remainder between two floating numbers.
5 Modify the PIMPLE loop.
6 Run wmake in the top-level of the new solver.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 21 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
The first approach
The modified PIMPLE loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
forAll(fluidRegions, i)
{
Info<< "\nSolving for fluid region "<< fluidRegions[i].name() << endl;
//set the solidRegionRunTime as current runTime and
//store it in the variable for the next comparison
solidRegionRunTime = runTime.value();
forAll(solidRegions, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "solveSolid.H"
}
}
}
Run wmake.Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 28 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Try with the new solver
A quick hands-on: Try with the new solver:Following the commands below to test the solver. Copy the tutorial casechtMultiRegionFoam/multiRegionHeater into run directory and rename it asmultiRegionHeaterMultiDeltaTRef.
In the system/controlDict, add the new created variable solidRegionDeltaTRef and set it to0.01. Add the following line in to the controlDict file:
solidRegionDeltaTRef 0.01;
In the Allrun file,
sed -i s/chtMultiRegionFoam/chtMultiRegionMultiDeltaTRefFoam/g Allrun
Then, type ./Allrun
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 29 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Verification and visualization
Verification
Check the log.chtMultiRegionMultiDeltaTRefFoam file. It shows that, the solid regions wererun every time the RunTime-solidRegionRunTime is larger than 0.01.For example, at the first time step, the deltaT was adjusted to 0.101s, therefore, RunTimeminus solidRegionRunTime was 0.101, larger than solidRegionDeltaTRef(0.01), so the solidregions were computed at this time step.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 30 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Verification and visualization
VisualizationTo author’s knowledge, the multiRegionHeater tutorial case solved by chtMultiRegionFoam doesnot work well with paraview visualization in Foam-extend-4.0. Therefore, current way for solvingsuch problem is to use paraview in OpenFOAM-4.0 instead.Open a new terminal, and source OpenFOAM-4.0 by:
OF4x
Then create files for each region for paraview post-processing by:
touch multiRegionHeater{bottomAir}.OpenFOAM
touch multiRegionHeater{heater}.OpenFOAM
touch multiRegionHeater{leftSolid}.OpenFOAM
touch multiRegionHeater{rightSolid}.OpenFOAM
touch multiRegionHeater{topAir}.OpenFOAM
Then
paraview
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 31 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Verification and visualization
Visualization
Meshes of the
multiRegionHeater 3D view of multiRegionHeater
Density of the topAirYuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 32 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Pressure coupled boundary condition
A pressure coupled boundary condition for multi-physics solver wasdeveloped. It has not yet been applied into the solver at this stage.
solidWallPressureCoupled boundary condition was developedbased on solidWallMixedTemperatureCoupled boundarycondition.
When pressure transfers from fluid to solid, it is only to do with theDirichlet type boundary condition. Both sides agree on the pressurevalues:
p1 = p2 (8)
However, in the development, the Neumann type andDirichlet-Neumann partitioning strategy is kept in case of futureextension.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 33 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Pressure coupled boundary condition
The code of the new boundary conditionsolidWallPressureCoupled can be found in the attachments ofthis project.
At current stage, the verification of such boundary condition cannotbe done. To verify, more modifications to the solid solver need to beimplemented.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 34 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Try with the Pressure coupled boundary conditionReplace the following condition in the field p in the tutorial case multiRegionHeater inFoam-extend-4.0,
bottomAir_to_rightSolid
{
type buoyantPressure;
value uniform 1e+05;
}
by
bottomAir_to_rightSolid
{
type solidWallPressureCoupled;
neighbourRegionName rightSolid;
neighbourPatchName rightSolid_to_bottomAir;
neighbourFieldName p;
p p;
value uniform 1e+05;
}
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 35 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Try with the Pressure coupled boundary condition
However, after running, the case will stop with an error. It complains that:
request for volScalarField p from objectRegistry rightSolid failed
available objects of type volScalarField are
5
(
cp
Kappa
rho
T
rhosCps
)
This is because a pressure field was not created for the solid regions. Avolume field p needs to be created in order to use the pressure coupledboundary condition.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 36 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Summary and future work
The chtMultiRegionFoam has been studied and modified. Thestructure of the chtMultiRegionFoam solver was discussed. Twoapproaches of loop modifications were implemented and verified. Anew boundary condition for pressure coupling was implemented.
More work needs to be done:
The test and verification of the pressure coupled boundary condition.Solid solver modification for computing displacement and stress.Fluid solver modification for solving the incompressible two-phase fluids.
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 37 / 38
Outline Introduction The chtMultiRegionFoam solver Loop modification Test the new solver Pressure coupled B.C. Summary and future work Acknowledgement
Acknowledgement
I would like to thank Professor Hakan Nilson for providing the course ofCFD with opensource software OpenFOAM and the continuous patienceand support.Thanks to Gregor Cvijetic for the technical help and very useful advices.Thanks to Turo Valikangas for the knowledge sharing of the conjugateheat transfer solvers.I am immensely grateful to my supervisor Professor Muk Chen Ong fromUniversity of Stavanger.
Many thanks to all the classmates in this course for we have shared a goodtime and knowledge with each other!
Yuzhu Pearl Li Implementation of multiple deltaTs based on chtMultiRegionFoam 2016-12-5 38 / 38