CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

MotionUBoundaryPatch assignment HowTo

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2008, 09:37
Default Hi all, first a rather long e
  #1
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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
bfa is offline   Reply With Quote

Old   March 20, 2008, 09:48
Default You could try to use a dynamic
  #2
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
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
lr103476 is offline   Reply With Quote

Old   March 20, 2008, 09:58
Default Hi Frank, your suggestion wor
  #3
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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)
bfa is offline   Reply With Quote

Old   March 20, 2008, 10:10
Default Hi Bjorn, You mesh is "worn
  #4
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
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
lr103476 is offline   Reply With Quote

Old   March 26, 2008, 13:26
Default Hmmm, I tried the following:
  #5
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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
bfa is offline   Reply With Quote

Old   March 26, 2008, 14:28
Default Well, I kinda got a solution:
  #6
bfa
Member
 
Björn Fabritius
Join Date: Mar 2009
Location: Freiberg, Germany
Posts: 31
Rep Power: 17
bfa is on a distinguished road
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
bfa is offline   Reply With Quote

Old   May 19, 2008, 13:24
Default Hi there, I'd like to have ac
  #7
New Member
 
Christoph Heinrich
Join Date: Mar 2009
Posts: 12
Rep Power: 17
christoph_heinrich is on a distinguished road
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
christoph_heinrich is offline   Reply With Quote

Old   May 19, 2008, 18:44
Default Case sensitive: pointvectorfie
  #8
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25
deepsterblue will become famous soon enough
Case sensitive: pointvectorfield

Should be pointVectorField, maybe?
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Old   May 20, 2008, 03:55
Default Yes, you're right. I was conf
  #9
New Member
 
Christoph Heinrich
Join Date: Mar 2009
Posts: 12
Rep Power: 17
christoph_heinrich is on a distinguished road
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
christoph_heinrich is offline   Reply With Quote

Old   August 21, 2008, 17:31
Default Hi all! When i implement di
  #10
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
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
pi06jl6 is offline   Reply With Quote

Old   August 21, 2008, 19:42
Default Greetings all! Disregard th
  #11
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
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
pi06jl6 is offline   Reply With Quote

Old   August 21, 2008, 20:06
Default Hello again, I have scavang
  #12
Member
 
Johan Lorentzon
Join Date: Mar 2009
Location: Lunds University, Sweden
Posts: 78
Rep Power: 23
pi06jl6 will become famous soon enough
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
pi06jl6 is offline   Reply With Quote

Old   March 17, 2009, 11:01
Default Finding mesh points
  #13
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17
grtabor is on a distinguished road
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
grtabor is offline   Reply With Quote

Old   March 19, 2009, 06:37
Default
  #14
Member
 
Etienne Lorriaux
Join Date: Mar 2009
Location: Compiegne, France
Posts: 45
Rep Power: 17
elorriaux is on a distinguished road
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.
elorriaux is offline   Reply With Quote

Old   March 19, 2009, 06:54
Default Thanks
  #15
Senior Member
 
Gavin Tabor
Join Date: Mar 2009
Posts: 181
Rep Power: 17
grtabor is on a distinguished road
Thanks - that works! I could have sworn I had tried just that earlier, and something had gone wrong, but never mind. Thanks again.

Gavin
grtabor is offline   Reply With Quote

Old   February 11, 2010, 10:47
Default
  #16
New Member
 
Andreas Ho
Join Date: Jan 2010
Posts: 4
Rep Power: 16
andreho is on a distinguished road
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
andreho is offline   Reply With Quote

Old   February 11, 2010, 11:19
Default
  #17
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   October 18, 2011, 11:32
Default
  #18
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
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
Arnoldinho is offline   Reply With Quote

Old   October 18, 2011, 11:44
Default
  #19
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   October 18, 2011, 11:45
Default
  #20
Senior Member
 
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25
deepsterblue will become famous soon enough
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()
            )
        );
This is typically applicable to faceDecomposition. With cellDecomposition, the step can be avoided and assigned directly.
__________________
Sandeep Menon
University of Massachusetts Amherst
https://github.com/smenon
deepsterblue is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fortran derived type assignment Paolo Lampitella Main CFD Forum 1 September 12, 2008 05:53
Farfield BC assignment BM Main CFD Forum 0 February 4, 2008 14:56
correct assignment of permeability? jemteo CFX 0 March 17, 2006 06:34
UDF memory assignment Kate FLUENT 0 February 2, 2006 09:15
private tuition for a cfd assignment - payment ahmed Main CFD Forum 4 August 10, 2005 10:15


All times are GMT -4. The time now is 16:45.