mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
TUT: added a tutorial showcasing the transformBox option
for the definition of the morphing box in volumetric B-Splines.
This commit is contained in:
committed by
Andrew Heather
parent
d0b59a4529
commit
f7e4b374d9
@ -0,0 +1,55 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object U;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 1 -1 0 0 0 0 ];
|
||||
|
||||
internalField uniform ( 0.039473 0 0 );
|
||||
|
||||
boundaryField
|
||||
{
|
||||
frontBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
sideWall
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
lower
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
upper
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
Inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform ( 0.039473 0 0 );
|
||||
}
|
||||
Outlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,56 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volVectorField;
|
||||
location "0";
|
||||
object Ua;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 1 -1 0 0 0 0 ];
|
||||
|
||||
internalField uniform ( 0 0 0 );
|
||||
|
||||
boundaryField
|
||||
{
|
||||
frontBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
sideWall
|
||||
{
|
||||
type adjointWallVelocity;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
upper
|
||||
{
|
||||
type adjointWallVelocity;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
Inlet
|
||||
{
|
||||
type adjointInletVelocity;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
Outlet
|
||||
{
|
||||
type adjointOutletVelocity;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
lower
|
||||
{
|
||||
type adjointWallVelocity;
|
||||
value uniform ( 0 0 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object p;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
frontBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
lower
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
upper
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
sideWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
Inlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
Outlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object pa;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
frontBack
|
||||
{
|
||||
type empty;
|
||||
}
|
||||
sideWall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
upper
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
Inlet
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
Outlet
|
||||
{
|
||||
type adjointOutletPressure;
|
||||
value uniform 0;
|
||||
}
|
||||
lower
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
resourcesDir=$FOAM_TUTORIALS/incompressible/adjointOptimisationFoam/resources
|
||||
|
||||
\cp -r $resourcesDir/meshes/sbend/polyMesh constant
|
||||
runApplication decomposePar
|
||||
runParallel $(getApplication)
|
||||
runParallel cumulativeDisplacement
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object RASProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
adjointRASModel adjointLaminar;
|
||||
|
||||
adjointTurbulence on;
|
||||
|
||||
printCoeffs off;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,50 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object dynamicMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solver volumetricBSplinesMotionSolver;
|
||||
|
||||
volumetricBSplinesMotionSolverCoeffs
|
||||
{
|
||||
duct
|
||||
{
|
||||
type cartesian;
|
||||
nCPsU 9;
|
||||
nCPsV 5;
|
||||
nCPsW 3;
|
||||
degreeU 3;
|
||||
degreeV 3;
|
||||
degreeW 2;
|
||||
|
||||
controlPointsDefinition transformBox;
|
||||
lowerCpBounds (-1.1 -0.21 -0.05);
|
||||
upperCpBounds ( 1.1 0.39 0.15);
|
||||
translation ( 0 0 0 );
|
||||
rotation ( 0 0 0 );
|
||||
scale ( 1.2 1.1 1 );
|
||||
|
||||
confineUMovement false;
|
||||
confineVMovement false;
|
||||
confineWMovement true;
|
||||
confineBoundaryControlPoints false;
|
||||
|
||||
confineUMinCPs ( (true true true) (true true true) );
|
||||
confineUMaxCPs ( (true true true) (true true true) );
|
||||
confineWMinCPs ( (true true true) );
|
||||
confineWMaxCPs ( (true true true) );
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
transportModel Newtonian;
|
||||
|
||||
nu nu [0 2 -1 0 0 0 0] 1.5e-05;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,19 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object turbulenceProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
simulationType laminar;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,47 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application adjointOptimisationFoam;
|
||||
|
||||
startFrom latestTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 5;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 1;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 16;
|
||||
|
||||
writeCompression true;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,26 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 4;
|
||||
|
||||
method hierarchical;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (4 1 1);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,55 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
|
||||
div(phi,U) bounded Gauss linearUpwind gradUConv;
|
||||
div(-phi,Ua) bounded Gauss linearUpwind gradUaConv;
|
||||
|
||||
div((nuEff*dev(grad(U).T()))) Gauss linear;
|
||||
div((nuEff*dev(grad(Ua).T()))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear corrected;
|
||||
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,61 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
solvers
|
||||
{
|
||||
"p|pa"
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-9;
|
||||
relTol 0.01;
|
||||
};
|
||||
"m|ma"
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-9;
|
||||
relTol 0.01;
|
||||
};
|
||||
"U|Ua"
|
||||
{
|
||||
solver PBiCGStab;
|
||||
preconditioner DILU;
|
||||
tolerance 1e-9;
|
||||
relTol 0.1;
|
||||
};
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
fields
|
||||
{
|
||||
p 0.5;
|
||||
pa 0.5;
|
||||
}
|
||||
equations
|
||||
{
|
||||
U 0.7;
|
||||
Ua 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,124 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2006 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object optimisationDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
optimisationManager steadyOptimisation;
|
||||
|
||||
primalSolvers
|
||||
{
|
||||
p1
|
||||
{
|
||||
active true;
|
||||
type incompressible;
|
||||
solver simple;
|
||||
solutionControls
|
||||
{
|
||||
nIters 3000;
|
||||
residualControl
|
||||
{
|
||||
"p.*" 1.e-7;
|
||||
"U.*" 1.e-7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
adjointManagers
|
||||
{
|
||||
am1
|
||||
{
|
||||
primalSolver p1;
|
||||
adjointSolvers
|
||||
{
|
||||
as1
|
||||
{
|
||||
// choose adjoint solver
|
||||
//----------------------
|
||||
active true;
|
||||
type incompressible;
|
||||
solver adjointSimple;
|
||||
|
||||
// manage objectives
|
||||
//------------------
|
||||
objectives
|
||||
{
|
||||
type incompressible;
|
||||
objectiveNames
|
||||
{
|
||||
losses
|
||||
{
|
||||
weight 1;
|
||||
type PtLosses;
|
||||
patches (Inlet Outlet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ATC treatment
|
||||
//--------------
|
||||
ATCModel
|
||||
{
|
||||
ATCModel standard;
|
||||
}
|
||||
|
||||
// solution control
|
||||
//------------------
|
||||
solutionControls
|
||||
{
|
||||
nIters 3000;
|
||||
residualControl
|
||||
{
|
||||
"pa.*" 1.e-7;
|
||||
"Ua.*" 1.e-7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
optimisation
|
||||
{
|
||||
optimisationType
|
||||
{
|
||||
type shapeOptimisation;
|
||||
writeEachMesh true;
|
||||
}
|
||||
|
||||
sensitivities
|
||||
{
|
||||
type volumetricBSplinesFI;
|
||||
patches (lower upper);
|
||||
}
|
||||
|
||||
updateMethod
|
||||
{
|
||||
method BFGS;
|
||||
BFGS
|
||||
{
|
||||
etaHessian 0.8;
|
||||
nSteepestDescent 1;
|
||||
scaleFirstHessian true;
|
||||
}
|
||||
}
|
||||
|
||||
meshMovement
|
||||
{
|
||||
type volumetricBSplines;
|
||||
maxAllowedDisplacement 2.e-3;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user