|
[Sponsors] |
October 9, 2018, 08:03 |
moveDynamicMesh BCs
|
#1 |
Member
Massachusetts
Join Date: Jun 2015
Posts: 46
Rep Power: 11 |
Hello everybody,
I need to move the surface points of my mesh according to a surface sensitivity. I found this code http://www.tfd.chalmers.se/~hani/kur..._corrected.pdf but the problem is that my boundary has a complex geometry and I cannot define simply one fixed normal vector in the boundary conditions. So I would like to know what type of boundary I should set to get all the normal vector (and not a single one) in the pointDisplacement file. Best regards |
|
October 9, 2018, 12:15 |
|
#2 |
Member
Massachusetts
Join Date: Jun 2015
Posts: 46
Rep Power: 11 |
Some more details.
This is part of the code. The goal is to move surface "wall" according to a displacement proportional to the "sensitivity". Code:
word patchName = "wall"; label patchID = mesh.boundaryMesh().findPatchID(patchName); pointVectorField& PointDisplacement = const_cast<pointVectorField&> ( mesh.objectRegistry::lookupObject<pointVectorField> ( "pointDisplacement" ) ); // GETTING THE PATCH VECTOR FIELD vectorField &pDisp = refCast<vectorField>(PointDisplacement.boundaryFieldRef()[patchID]); // FIND THE RELEVANT SIZE OF THE VECTOR AND DECLARE A VECTORFIELD int Psize = pDisp.size(); vectorField dispVals(Psize); // SETTING-UP INTERPOLATOR primitivePatchInterpolation patchInterpolator(mesh.boundaryMesh()[patchID]); // DISPLACEMENT BASED ON SURFACE SENSITIVITY scalarField sensitivityPatch = sensitivity.boundaryFieldRef()[patchID]; // INTERPOLATION scalarField faceValues = patchInterpolator.faceToPointInterpolate(sensitivityPatch); vectorField &PointPointer = refCast<vectorField>(PointDisplacement.boundaryFieldRef()[patchID]); vectorField PointNormalVector = mesh.boundaryMesh()[patchID].pointNormals(); // LOOP OVER ALL POINTS forAll(dispVals,index) { dispVals[index].x() = PointPointer[index].x() -alpha.value() * faceValues[index] * PointNormalVector[index].x(); dispVals[index].y() = PointPointer[index].y() - alpha.value() * faceValues[index] * PointNormalVector[index].y(); dispVals[index].z() = PointPointer[index].z() - alpha.value() * faceValues[index] * PointNormalVector[index].z(); } // ONCE THE VALUES HAVE BEEN ASSIGNED TO DISPVALS ASSIGN THEM TO cellDisplacement boundaryField PointDisplacement.boundaryFieldRef()[patchID] == dispVals; while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << endl; mesh.movePoints(motionPtr->newPoints()); runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Code:
dimensions [0 1 0 0 0 0 0]; internalField uniform (0 0 0); boundaryField { wall { type fixedValue; value nonuniform List<vector> 11566(); \\ Here a list of the normal vectors at the surface wall for every point } inlet { type fixedValue; value uniform (0 0 0); } outlet { type fixedValue; value uniform (0 0 0); } } Unfortunately I got the following error telling me Code:
--> FOAM FATAL IO ERROR: size 11566 is not equal to the given value of 23132 To calculate the normal I used this code Code:
normal.boundaryFieldRef()[patchID] == mesh.Sf().boundaryField()[patchID]/mesh.magSf().boundaryField()[patchID] |
|
October 9, 2018, 13:17 |
|
#3 |
Member
Tony Ladd
Join Date: Aug 2013
Posts: 48
Rep Power: 13 |
Kayla
What you are trying to do should be supported by Vitaliy Starchenko's normalMotionSlip boundary condition https://github.com/vitst/libsFoamAux. It implements a variable normal displacement on the boundary and solves a Laplace equation to relax the rest of the mesh. If you simply move the points (without relaxation) the mesh will get tangled in a few steps. The easiest thing to do might be to install OF-v1706 and then the dissolFoam-v1706 package from https://github.com/vitst/dissolFoam/releases. This contains a (slightly outdated) version of the codes and cases, linked to OF-v1706. There are some cases implementing a moving boundary in response to a normal gradient of a scalar field. You might try some of them to get the feel for what the code can do. Then if you want to take it further there are updates at https://github.com/vitst to libsFoamAux, dissolFoam, dissolCases and dissolUtilities. These introduce coded boundary conditions where you can add your own stuff with a small include file. But this is a bit more complex than just installing the release version; you will need to clone and compile the various libraries and source codes. Eventually you might find the dissolFrac_codedMotionBC interesting. It does more or less what you are trying to do in its Mesh step. Note that the version in the master branch is missing a couple of files. Until we get that updated you will need to use the development version. |
|
December 10, 2018, 12:26 |
OpenFOAM - Local scour around a cylinder
|
#4 |
New Member
Viet-Dung NGUYEN
Join Date: Aug 2018
Posts: 4
Rep Power: 8 |
Hi,
I would like to model the scour around a cylinder like this study : http://water.engr.psu.edu/liu/openFOAM-local-scour.html I downloaded your code and compiled it but two files miss : fluidSolutionControl.H; fftw3.h Thank you for help, best regards, Viet-Dung |
|
December 10, 2018, 18:02 |
|
#5 |
Member
Tony Ladd
Join Date: Aug 2013
Posts: 48
Rep Power: 13 |
The file fluidSolutionControl.H is part of the OF development release:
OpenFOAM-dev/src/finiteVolume/cfdTools/general/solutionControl/solutionControl/fluidSolutionControl/fluidSolutionControl.H. Are you using OpenFOAM-v1706? Other versions may have the things in different places. I don't think this file is in v1706 which is likely why it is not being found. OF is changing so rapidly that codes usually have to be compiled against specific versions, since the developers don't maintain back compatibility. So try v1706 or v1712. The fftw3.h is the FFT library. It might be in 3rd party. If not it can be downloaded and built in the usual way. Good luck Tony |
|
September 30, 2021, 13:01 |
|
#6 | |
New Member
haungxili
Join Date: Sep 2021
Posts: 3
Rep Power: 5 |
Quote:
|
||
September 30, 2021, 16:50 |
|
#7 | |
Member
Tony Ladd
Join Date: Aug 2013
Posts: 48
Rep Power: 13 |
Quote:
|
||
October 4, 2021, 23:14 |
|
#8 |
New Member
haungxili
Join Date: Sep 2021
Posts: 3
Rep Power: 5 |
Thank you for your reply. I am very sorry to reply you so late. The main problem I encountered is how to discretize the convection term in the exner equation. After the boundary mesh is deformed, I have no idea on how to handle the Non-orthogonality and the skewness of the mesh, I am also very confused about how to interpolate the value of the face centers to the points, can you give me some advices on how to realise in openfoam,I look forward to your reply
|
|
October 4, 2021, 23:25 |
|
#9 |
Member
Tony Ladd
Join Date: Aug 2013
Posts: 48
Rep Power: 13 |
You choose a convection scheme in system/fvSchemes. The OF documentation describes how. For steady problems we found Gauss linear upwind was effective, but you may need to experiment yourself.
Unless you are digging deep into the OF source code, you should not need to worry about interpolation. OF will handle that automatically, using teh methods specified in fvSchemes. In dissolFoam we need to interpolate the velocities at the face centers (on the boundary patches) to vertexes. But that is handled automatically by dissolFoam in the standard OF way. I suggest you try to run one of the test cases and see what happens. TOny |
|
October 4, 2021, 23:37 |
|
#10 |
New Member
haungxili
Join Date: Sep 2021
Posts: 3
Rep Power: 5 |
I got what you mean,I will explore how dissolFoam handles these problems,thanks for your reply sincerely!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to set BCs programmatically | incompressible | OpenFOAM Programming & Development | 6 | November 20, 2017 03:47 |
chtMultiRegionSimpleFoam: inconsistency between BCs and results | Diro7 | OpenFOAM Running, Solving & CFD | 1 | March 2, 2017 05:36 |
Difference between HF and Temperature BCs | Catthan | FLUENT | 0 | August 7, 2013 06:59 |
Dealing with BC's in OF 1.6 | vkrastev | OpenFOAM Running, Solving & CFD | 5 | September 4, 2012 12:58 |
Understanding Code behind BCs | Linse | OpenFOAM Programming & Development | 8 | January 9, 2012 09:58 |