Minor modification to allow motion-only cases (like the moveDynamicMesh tutorial). Tutorial has been updated to include re-meshing options.

This commit is contained in:
Sandeep Menon 2010-10-18 11:24:25 -04:00
parent 50a408df89
commit bbd3e5e396
3 changed files with 158 additions and 29 deletions

View file

@ -1197,10 +1197,12 @@ void dynamicTopoFvMesh::readOptionalParameters(bool reRead)
// Read from disk // Read from disk
dict_.readIfModified(); dict_.readIfModified();
const dictionary& meshSubDict = dict_.subDict("dynamicTopoFvMesh");
// Enable/disable run-time debug level // Enable/disable run-time debug level
if (dict_.found("debug") || mandatory_) if (meshSubDict.found("debug") || mandatory_)
{ {
debug = readLabel(dict_.lookup("debug")); debug = readLabel(meshSubDict.lookup("debug"));
} }
else else
{ {
@ -1216,8 +1218,6 @@ void dynamicTopoFvMesh::readOptionalParameters(bool reRead)
polyMesh::debug = true; polyMesh::debug = true;
} }
const dictionary& meshSubDict = dict_.subDict("dynamicTopoFvMesh");
// Re-read edge-refinement options, if necessary // Re-read edge-refinement options, if necessary
if (edgeRefinement_ && reRead) if (edgeRefinement_ && reRead)
{ {

View file

@ -58,7 +58,47 @@ void dynamicTopoFvMesh::computeMapping
const label cellSize const label cellSize
) )
{ {
// Compute cell mapping
for (label cellI = cellStart; cellI < (cellStart + cellSize); cellI++)
{
label cIndex = cellsFromCells_[cellI].index();
if (skipMapping)
{
// Set empty mapping parameters
const labelList& mo = cellParents_[cIndex];
cellsFromCells_[cellI].masterObjects() = mo;
cellWeights_[cellI].setSize(mo.size(), (1.0/(mo.size() + VSMALL)));
cellCentres_[cellI].setSize(mo.size(), vector::zero);
}
}
// Compute face mapping
for (label faceI = faceStart; faceI < (faceStart + faceSize); faceI++)
{
label fIndex = facesFromFaces_[faceI].index();
label patchIndex = whichPatch(fIndex);
// Skip mapping for internal faces.
if (patchIndex == -1)
{
// Set dummy masters, so that the conventional
// faceMapper doesn't incur a seg-fault.
facesFromFaces_[faceI].masterObjects() = labelList(1, 0);
continue;
}
if (skipMapping)
{
// Set empty mapping parameters
const labelList& mo = faceParents_[fIndex];
facesFromFaces_[faceI].masterObjects() = mo;
faceWeights_[faceI].setSize(mo.size(), (1.0/(mo.size() + VSMALL)));
faceCentres_[faceI].setSize(mo.size(), vector::zero);
}
}
} }

View file

@ -16,29 +16,27 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Select the type of dynamicFvMesh, and load custom library //- Select the type of dynamicFvMesh
dynamicFvMesh dynamicMotionSolverFvMesh; dynamicFvMesh dynamicTopoFvMesh;
// Load custom libraries
motionSolverLibs ("libmesquiteMotionSolver.so");
//- Select the type of motionSolver
solver mesquiteMotionSolver; solver mesquiteMotionSolver;
mesquiteOptions mesquiteOptions
{ {
// Optimization metric //- Optimization metric
optMetric AspectRatioGamma; optMetric AspectRatioGamma;
// Objective function //- Objective function
objFunction LPtoP; objFunction LPtoP;
// Optimization algorithm //- Optimization algorithm
optAlgorithm FeasibleNewton; optAlgorithm FeasibleNewton;
// Termination criteria sub-dictionary //- Termination criteria sub-dictionaries
// (takes default values if not specified) //- (takes default values if not specified)
// Specifying an empty sub-dictionary //- Specifying an empty sub-dictionary
// terminates with available options //- terminates with available options
tcInner tcInner
{ {
absGradL2 1e-4; absGradL2 1e-4;
@ -48,34 +46,35 @@ mesquiteOptions
// tcOuter // tcOuter
// {} // {}
// For composite functions, two objectives need to be specified //- For composite functions, two objectives need to be specified
// firstFunction LPtoP; // firstFunction LPtoP;
// secondFunction LInf; // secondFunction LInf;
// For scaled functions, scale and objective needs to be specified //- For scaled functions, scale and objective needs to be specified
// scaleFunction PMeanP; // scaleFunction PMeanP;
// scale 1.5; // scale 1.5;
// Power value for the LPtoP objective function //- Power value for the LPtoP objective function
pValue 2; pValue 2;
power 2; power 2;
// Specify a tolerance for the surface-smoothing CG solver //- Specify a tolerance for the surface-smoothing CG solver
tolerance 1e-2; tolerance 1e-2;
// Specify number of CG sweeps for surface-smoothing //- Specify number of CG sweeps for surface-smoothing
nSweeps 2; nSweeps 2;
// Specify slip patches for the motionSolver //- Specify slip patches for the motionSolver
slipPatches slipPatches
{ {
sideWall; sideWall;
topWall; topWall;
} }
//- Constrain surface mesh-motion on a specified cylinder
cylindricalConstraints cylindricalConstraints
{ {
// Specify options per slip patch //- Specify options per slip patch
sideWall sideWall
{ {
axisPoint (0.0 0.0 0.0); axisPoint (0.0 0.0 0.0);
@ -84,15 +83,15 @@ mesquiteOptions
} }
} }
// Specify fixedValue patches for the motionSolver //- Specify fixedValue patches for the motionSolver
fixedValuePatches fixedValuePatches
{ {
topWall topWall
{ {
//type angularOscillatingDisplacement; type angularOscillatingDisplacement;
//amplitude -0.0125; amplitude -0.0125;
type oscillatingDisplacement; //type oscillatingDisplacement;
amplitude (0 0 -0.01); //amplitude (0 0 -0.01);
axis (1 0 0); axis (1 0 0);
origin (0 0 3); origin (0 0 3);
angle0 0.0; angle0 0.0;
@ -101,9 +100,99 @@ mesquiteOptions
} }
} }
// Specify interval for surface smoothing //- Specify interval for surface smoothing
surfInterval 1; surfInterval 1;
} }
//- Options for dynamicTopoFvMesh
dynamicTopoFvMesh
{
//- Should all options be made mandatory?
//- Useful for first-time use.
allOptionsMandatory no;
//- Set run-time debug level [0-5]
// debug 0;
//- Specify the number of threads
threads 1;
//- Specify re-meshing interval
//- Negative value implies no re-meshing
interval 1;
//- Specify whether the length-scale field
//- should be dumped to disk
dumpLengthScale false;
//- sliverThreshold specifies the
//- quality criteria for sliver removal.
sliverThreshold 0.35;
//- Should the tool attempt to remove slivers
//- that fall below the sliverThreshold value?
removeSlivers false;
//- Skip mapping step. Useful while using
//- this tool as a pre-processor
skipMapping true;
// Toggle edgeRefinement on/off
edgeRefinement yes;
//- Options for edge-bisection/collapse.
//- The edgeRefinement flag must be set for
//- the following options to have effect
refinementOptions
{
collapseRatio 0.5;
bisectionRatio 1.5;
growthFactor 1.03;
//- By default, existing boundary edge-lengths
//- are used for length-scales.
//- Length-scale can be fixed for certain patches.
fixedLengthScalePatches
{
topWall 0.2;
bottomWall 0.2;
sideWall 0.2;
outlet 0.2;
}
//- Avoid refinement on certain patches, if necessary
noModificationPatches
{}
//- Set floating length-scale values on certain patches
freeLengthScalePatches
{}
//- Limit lengthScales to specified values, if necessary
// minLengthScale 0.1;
// maxLengthScale 0.3;
//- Field-based refinement options
// fieldRefinement gamma;
// fieldLengthScale 0.005;
// lowerRefineLevel 0.001;
// upperRefineLevel 0.999;
// maxRefineLevel 4;
// meanScale 0.015;
}
//- If the number of modifications are to be limited, set this option
// maxModifications 1000;
//- Load custom libraries for metrics
// tetMetricLibs ("libtetMetrics.so");
//- Tetrahedral mesh quality metric
tetMetric Knupp;
//- Avoid 2-2 swapping on certain patches
noSwapPatches
{}
}
// ************************************************************************* // // ************************************************************************* //