CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   dynamicRefineFvMesh with mesh deformation (https://www.cfd-online.com/Forums/openfoam-programming-development/102703-dynamicrefinefvmesh-mesh-deformation.html)

boeleman May 31, 2012 17:15

dynamicRefineFvMesh with mesh deformation
 
Hello,

I am trying to set up a simulation where I combine mesh deformation with mesh refinement, but I cannot get it to work, and I'm wondering whether anyone could help.

I made a local copy of the dynamicRefineFvMesh and added the following code at the beginning of the update routine, which should give the result that my simulation box is stretched periodically in the z direction:

// Grid stretching and compression
scalar oldTime = time().value() - time().deltaT().value();
scalar Time = time().value();

// Height of the cube at the old time
scalar oldZ = startZ_ + amplitude_*(
::sin(constant::mathematical::twoPi*frequency_*old Time)
);

// Height of the cube at the new time
scalar Z = startZ_ + amplitude_*(
::sin(constant::mathematical::twoPi*frequency_* Time)
);

Info<< "Mesh scaling. Time = " << time().value() << " Box height = "
<< Z << endl;

pointField newPoints = points();

// Calculate where a grid point was relative to oldZ and multiply with Z to have
// the same new relative position
newPoints.replace
(
vector::Z,
points().component(vector::Z)*Z/oldZ
);

// fvMesh::movePoints(newPoints);
movePoints(newPoints);

However, I get an error message:

Cannot find surfaceScalarField meshPhi in user-provided flux mapping table

and the code crashes with a floating point exception after a couple of iterations.

Thanks,

Arnout


All times are GMT -4. The time now is 09:24.