CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   dynamicRefineFvMesh with mesh deformation (

boeleman May 31, 2012 17:15

dynamicRefineFvMesh with mesh deformation

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

// fvMesh::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.



All times are GMT -4. The time now is 05:03.