Skip to content
Snippets Groups Projects
Commit f7e4b374 authored by Vaggelis Papoutsis's avatar Vaggelis Papoutsis Committed by Andrew Heather
Browse files

TUT: added a tutorial showcasing the transformBox option

for the definition of the morphing box in volumetric B-Splines.
parent d0b59a45
Branches
Tags
1 merge request!400Adjoint: release candidate for v2012
Showing
with 663 additions and 0 deletions
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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 );
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase
#------------------------------------------------------------------------------
#!/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
#------------------------------------------------------------------------------
/*--------------------------------*- 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;
// ************************************************************************* //
/*--------------------------------*- 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) );
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
// ************************************************************************* //
/*--------------------------------*- 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;
// ************************************************************************* //
/*--------------------------------*- 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;
// ************************************************************************* //
/*--------------------------------*- 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);
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
/*--------------------------------*- 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;
}
}
// ************************************************************************* //
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment