|
[Sponsors] |
March 20, 2008, 08:37 |
Hi all,
first a rather long e
|
#1 |
Member
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17 |
Hi all,
first a rather long explanation of what I'm trying to achieve: I want to apply location-based displacement to boundary points of my mesh. I do the following so far inside my dynamicFvMesh derivative: (1) grab all points from a boundaryPatch and move them according to a mathematical function. in pseudo code: for all points() if(point is in boundaryPatch.localPoints()) move point Works fine so far (2) movePoints(newPoints) (3) get motionU for this patch tetPointVectorField& motionU = mSolver.motionU(); fixedValueTetPolyPatchVectorField& motionUBodyPatch = refCast<fixedvaluetetpolypatchvectorfield> ( motionU.boundaryField()[movingBottomID] ); (4) assign the motionU (i.e. displacement/timeStep) to motionUBodyPatch There is the problem: If I try motionUBodyPatch==boundaryMesh[patchID].localPoints() I only get the points of the un-tetragonized mesh. So I would need boundaryMesh.faceCentres additionally My first Idea was to merge these two pointLists, but I think I'll run into trouble with the ordering. Second Idea would be to decompose the boundaryMesh and get a tetPolyBoundaryMeshFaceDecomp, but so far I didn't manage to do so. Trying to construct these classes from polyMesh leads to compiler problems, since the constructors are private due to several layers of explicit functions and derivation. Does anyone know how to do this decomposition in code? regards, Bjoern |
|
March 20, 2008, 08:48 |
You could try to use a dynamic
|
#2 |
Senior Member
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18 |
You could try to use a dynamicFvMesh library based on the displacement fvMotionSolvers.......You will get something like:
pointVectorField& motionU = mSolver.pointDisplacement(); if ( motionU.boundaryField()[bodyPatchID_].type() == fixedValuePointPatchVectorField::typeName ) { fixedValuePointPatchVectorField& motionUBodyPatch = refCast<fixedvaluepointpatchvectorfield> ( motionU.boundaryField()[bodyPatchID_] ); motionUBodyPatch == ( dispRot + dispTrans ); }
__________________
Frank Bos |
|
March 20, 2008, 08:58 |
Hi Frank,
your suggestion wor
|
#3 |
Member
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17 |
Hi Frank,
your suggestion works fine for rigid boundary, but in my case dispRot and dispTrans are different for _each_ point on my boundary. So motionU isn't fixedValue on the patch but non-uniform. And additionally I intend to use the laplaceTetDecomposition motionsolver because the standard laplacian motionsolver does not lead to the desired result (doing a couple of periodic movements makes the mesh look like "worn out" after a period, i.e. moving the boundary fro and back should be complentary operations, but aren't) |
|
March 20, 2008, 09:10 |
Hi Bjorn,
You mesh is "worn
|
#4 |
Senior Member
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18 |
Hi Bjorn,
You mesh is "worn out" because you are using velocity based motion solvers.....Try using displacement laplacian to recover the original mesh after each period. See: http://www.opencfd.co.uk/openfoam/do...aseNotes-1.4.1 Regards, Frank
__________________
Frank Bos |
|
March 26, 2008, 12:26 |
Hmmm,
I tried the following:
|
#5 |
Member
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17 |
Hmmm,
I tried the following: volScalarField& displacementY = mSolver.cellDisplacement(); displacementY.boundaryField()[bodyPatchID_] == calculatedDisplacement_; fvMesh::movePoints(motionPtr_->newPoints()); But somehow it only updates cellDisplacementy file but not pointDisplacementy. How can I make it propagate my displacement? Unfortunately I can't access pointDisplacementy directly (I think there's a reason, though I can't see it). Do I have to call some kind of cell-to-point-interpolation? puzzled, Bjorn |
|
March 26, 2008, 13:28 |
Well, I kinda got a solution:
|
#6 |
Member
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17 |
Well, I kinda got a solution:
1) to access pointDisplacementy I used the following (C++-is-my-favourite-language): pointScalarField& ptDispY = const_cast<pointscalarfield&>(objectRegistry::look upObject<pointscalarfield>("po intDisplacementy")); 2) the displacement stored in cellDisplacementy and pointDisplacementy is relative to the original geometry, while I thought it would be relative to my last timestep. So the displacements I used were simply too small to be seen Anyway, now it looks like it's working and it's time to go home. Thanks anyway Bjorn |
|
May 19, 2008, 12:24 |
Hi there,
I'd like to have ac
|
#7 |
New Member
Christoph Heinrich
Join Date: Mar 2009
Posts: 12
Rep Power: 17 |
Hi there,
I'd like to have access to pointDisplacement within the icoDyMFoam solver. So I tried: pointVectorField& disp = const_cast<pointvectorfield&>(mesh.objectRegistry: :lookupObject<pointvectorfield >("pointDisplacement")); When compiling, I get the following error message: myIcoDyMFoam.C: In function 'int main(int, char**)': myIcoDyMFoam.C:152: error: expected type-specifier before 'pointvectorfield' myIcoDyMFoam.C:152: error: expected `>' before 'pointvectorfield' myIcoDyMFoam.C:152: error: expected `(' before 'pointvectorfield' myIcoDyMFoam.C:152: error: 'pointvectorfield' was not declared in this scope myIcoDyMFoam.C:152: error: expected primary-expression before '>' token myIcoDyMFoam.C:152: error: 'pointvectorfield' cannot appear in a constant-expression myIcoDyMFoam.C:152: error: no matching function for call to 'Foam::dynamicFvMesh::lookupObject(const char [18])' myIcoDyMFoam.C:152: error: expected `)' before ';' token Can anyone help me? What went wrong? Do I have to include a special Header-file? Regards, Christoph |
|
May 19, 2008, 17:44 |
Case sensitive: pointvectorfie
|
#8 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Case sensitive: pointvectorfield
Should be pointVectorField, maybe? |
|
May 20, 2008, 02:55 |
Yes, you're right.
I was conf
|
#9 |
New Member
Christoph Heinrich
Join Date: Mar 2009
Posts: 12
Rep Power: 17 |
Yes, you're right.
I was confused, because I found it everywhere written small here. So now the correct line: pointVectorField& disp = const_cast<pointvectorfield&>(mesh.objectRegistry: :lookupObject<pointvectorfield >("pointDisplacement")); And first I had to #include "pointFields.H" Thanks a lot, Christoph |
|
August 21, 2008, 16:31 |
Hi all!
When i implement di
|
#10 |
Member
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23 |
Hi all!
When i implement displacement solver, should i move all boundary points or do i need only to specify facecenter change and using slip? The point is that if you move along normal then only facecenter value is needed. Further, how to implement pointdisplacement, as above with patch, since i get the message that i cannot cast pointdisplacement to slip/fixedvalue type. I would truly appriciate some help here since my automesh just produce crap fields. Best Regards Johan |
|
August 21, 2008, 18:42 |
Greetings all!
Disregard th
|
#11 |
Member
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23 |
Greetings all!
Disregard the previous notion about slip/moving along face normals. Just me late in the nite trying to ask for help in how to implement a motion solver for a precribed motion of the boundary. This thread is interesting and i tried to implement it but i got error while reading the pointdisplacement file, telling me that the type is not matching. Best Regards Johan |
|
August 21, 2008, 19:06 |
Hello again,
I have scavang
|
#12 |
Member
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23 |
Hello again,
I have scavanged the whole forum for information, but from what i have understood is the following, using cellDisplacement requires only the move of faceCentres() (= number of cells to be moved), using pointDisplacement, then whole boundaryfield shall be moved. Please correct me if am wrong. But the problem i have still is that i dont know what type i shall enter for the pointdisplacement file, fixedValue/slip all return unknown "type". Do i need to recast the pointVectorField? Best Regards Johan |
|
March 17, 2009, 10:01 |
Finding mesh points
|
#13 |
Senior Member
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17 |
Hi. I'm sorting out a simulation of a peristaltic pump, which involves a hump in one wall moving along the wall. I'm doing this by moving the points making up the wall in and out dynamically, by changing the values in the pointDisplacement field on the appropriate boundary individually. This works fine, and I'm getting a nice ripple running along the mesh.
However to set up the simulation in full I need to find the original location of the vertices. For most field quantities I would just ask for a boundaryField or something similar, but I can't work out what I need to ask to get the correct information. I've tried mesh.boundaryMesh()[0].points() but this seems to give me all the points in the mesh, not just the ones on the 0th patch (which is what I want). Any suggestions as to how I can get the required information? I could of course hardcode this but thats inelegant. Gavin |
|
March 19, 2009, 05:37 |
|
#14 |
Member
Etienne Lorriaux
Join Date: Mar 2009
Location: Compiegne, France
Posts: 45
Rep Power: 17 |
Hello Gavin,
i'm not sure to understand what you are trying to do. To get the points of the boundary mesh, i would try something like : mesh.boundaryMesh()[patchID].localPoints(); Sincerely, Etienne. |
|
March 19, 2009, 05:54 |
Thanks
|
#15 |
Senior Member
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17 |
Thanks - that works! I could have sworn I had tried just that earlier, and something had gone wrong, but never mind. Thanks again.
Gavin |
|
February 11, 2010, 09:47 |
|
#16 |
New Member
Andreas Ho
Join Date: Jan 2010
Posts: 4
Rep Power: 16 |
Hi all,
I’m using OpenFOAM 1.6 with dynamic mesh. I would like to have access to the boundary patch motion field. Therefore, I included in pimpleDyMFoam.C: fixedValuePointPatchVectorField& motPat = refCast<fixedValuePointPatchVectorField>(motionU.boundaryField()[PatchID]); ................. before mesh.update(); However, I receive the error message ‘motionU’ was not declared in this scope Do I have to include some more files? Have any declarations changed in OpenFOAM 1.6? I would be very happy, if anybody could answer this question. Best regards, andreas |
|
February 11, 2010, 10:19 |
|
#17 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37 |
Hi Andreas
First, you need to access the motionU object, which I do in the following way: tetPointVectorField & motionU ( const_cast<tetPointVectorField&> ( mesh.objectRegistry::lookupObject<tetPointVectorFi eld> ( "motionU" ) ) ); Further, you will need to include some header files. The following list might be excessive, though I have not tested which are actually needed: #include "tetFemMatrices.H" #include "tetPointFields.H" #include "faceTetPolyPatch.H" #include "tetPolyPatchInterpolation.H" #include "fixedValueTetPolyPatchFields.H" This off cource means that you will need to change the option file under Make, which in my case includes the following: EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ $(WM_DECOMP_INC) \ -I$(LIB_SRC)/tetDecompositionFiniteElement/lnInclude \ -I$(LIB_SRC)/tetDecompositionMotionSolver/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -ldynamicFvMesh \ -ldynamicMesh \ These option files I believe I have stripped from somewhere on the Forum. Good luck, Niels |
|
October 18, 2011, 10:32 |
|
#18 |
Senior Member
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17 |
Hi all,
I'm digging up this older thread... Using the method above, one is able to access the motionU object during runtime. If I want to change the point velocity on a boundary patch now, I have the problem that my points are calculated for the "normal" mesh, whereas points in motionU are "tet-decomposed" ones. Otherwise I have incompatible fields, because some additional points of the tet mesh are missing. So am I right that an interpolation from "original" mesh points on the boundary to the points of the FE mesh is needed? If so, how can this be done? Arne |
|
October 18, 2011, 10:44 |
|
#19 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37 |
Hi Arne
Yes, you would need to perform an interpolation. I suggest that you look into e.g. freeSurface.C in 1.6-ext and look how it is being done. Especially, you will gain insight into a method that will allow you to use different mesh motion methods instead of restricting yourself to one particular method (even though your choice is generally sane). It should be said, however, that the applied interpolation method is not taking boundary conditions into consideration, thus it could lead to a small mass conservation problem for your bed level change, however, I suspect it to be of negligible importance in your case. - Niels |
|
October 18, 2011, 10:45 |
|
#20 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Simple. Use this snippet;
Code:
#include "tetPolyPatchInterpolation.H" // Boundary motion specified for the tetDecompositionMotionSolver tetPointVectorField& motionU = const_cast<tetPointVectorField&> ( mesh.lookupObject<tetPointVectorField>("motionU") ); // Assign boundary conditions to the motion solver // The face-decomposition solver includes points at face-centres, // thus point motion has to be interpolated to these points tetPolyPatchInterpolation interpolator ( refCast<const faceTetPolyPatch> ( motionU.boundaryField()[index].patch() ) ); motionU.boundaryField()[index] == ( interpolator.pointToPointInterpolate ( dispField/mesh.time().deltaT().value() ) ); |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fortran derived type assignment | Paolo Lampitella | Main CFD Forum | 1 | September 12, 2008 04:53 |
Farfield BC assignment | BM | Main CFD Forum | 0 | February 4, 2008 13:56 |
correct assignment of permeability? | jemteo | CFX | 0 | March 17, 2006 05:34 |
UDF memory assignment | Kate | FLUENT | 0 | February 2, 2006 08:15 |
private tuition for a cfd assignment - payment | ahmed | Main CFD Forum | 4 | August 10, 2005 09:15 |