# Coded boundary condition for dynamic mesh

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

 March 15, 2018, 08:33 Coded boundary condition for dynamic mesh #1 New Member   Delchini Marc-Olivier Join Date: Dec 2016 Posts: 7 Rep Power: 9 Hello, I am trying to model a synthetic jet that is produced by a membrane vibrating in a cavity. The membrane is treated as a boundary condition that is a function of space and time as follows: sin(freq*time)*sin(pi*x) where freq is the frequency, time is time, and x is the spatial coordinates. I started from the example located in '/opt/openfoam4/tutorials/incompressible/pimpleDyMFoam/movingCone' One option I tried is to use the coded boundary condition class. I successfully implemented a parabolic inlet velocity boundary condition for velocity and temperature fields as a training exercise. I then tried the same approach for pointMotionUx but this variable is defined at vertices and not cell centers. I was able to figure out functions to access time and vertices (I think) using Doxygen. The current version of the boundary implementation is the following: Code: ``` const polyMesh& mesh = this->internalField().mesh()(); const Time& tt = mesh.time(); const pointPatch& p = this->patch(); operator==( sin(constant::mathematical::pi*10*t)*sin(10*p.localPoints() );``` when openfoam compiles before running, I get the below error message: /home/openfoam/run/piston/0/pointMotionUx.boundaryField.inlet: In member function 'virtual void Foam::testFixedValuePointPatchScalarField::updateC oeffs()': /home/openfoam/run/piston/0/pointMotionUx.boundaryField.inlet:71:85: error: no matching function for call to 'sin(Foam::tmp > >)' Any help would be appreciated. Thanks, Marco

 March 17, 2018, 02:41 #2 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,930 Rep Power: 38 Hi, The error is quite clear: there is no sin function with vector argument, since p.localPoints() is a list of points, which are vectors. Use component method of Field class (https://cpp.openfoam.org/v5/classFoa...5fd130cb44a20e) to extract X (or whatever) component of point coordinate. Also, since you have tmp>, you need to use () operator to get to underlying Field object.