
[Sponsors] 
April 22, 2007, 08:27 
How to transform or "smoothen" this "line"

#1 
Guest
Posts: n/a

Hi,
I need some help to transform or "smoothen" a line.... Supposed I've got a straight line, at angle of 30deg to the horizontal. Hence it's gradient is tan(30). If I want to "smoothen" this line such that at one end of the line, its gradient is fixed at tan(30). However, at the other other I want its gradient to be 0. What factor or transformation can I use to get a smooth curve based on this 2 criteria. Note that only the gradient of one end of the line is changed to 0, the location of the end points are fixed. Thank you 

April 23, 2007, 16:48 
Re: How to transform or "smoothen" this "line"

#2 
Guest
Posts: n/a

A popular way to construct such functions is to use polynomial splines. I personally like Hermite polynomials which are used in finite elements, but are very convenient for any kind of application like the one you describe. I'd have to look up the definition of the polynomials to show you the very easy way to construct a solution by superposition, but of course there is also a more tedious way that's easier to remember: Given both endpoints and both gradients you have 4 pieces of information to obtain the 4 coefficients of a thirdorder polynomial. You should remember from highschool or an undergrad math class how to do this by solving a system of 4 equations.


April 24, 2007, 22:52 
Re: How to transform or "smoothen" this "line"

#3 
Guest
Posts: n/a

Thanks Mani.
Ya guess the simplest way will be a 3rd degree polynomial. However the problem with this mtd is that the x value is unchanged since it's a 1d modification. Hence, the perpendicular grid spacing will change. There are also no more DOF to play around with Moreover, I have a problem implementing the 3rd degree polynomial when I have one of the gradient at one corner to be a vertical line ie gradient = infinity. How can I get the correct coefficient? I thought of transforming the line by 90 deg so that the new gradient is 0, get the new y values, and then transforming it back. However it seems very troublesome. I wonder if there's a better mtd. Thanks 

April 25, 2007, 10:39 
Re: How to transform or "smoothen" this "line"

#4 
Guest
Posts: n/a

If you want greater flexibility, consider parametric curves. That is, you introduce a parametric variable (call it t), and write the x and ycoordinates of a point on the curve as x=X(t), y=Y(t) (and z=Z(t)), where the functions X(t)... are cubic functions of t (0<=t<=1). You choose the polynomial coefficients in these functions to match the slopes and endpoints. There are then parameters/coefficients left over to control the curve between the ends. Special cases are x=t with y=Y(t)=Y(x), the cubic polynomial in x, and y=t with x=X(t)=X(y), the cubic polynomial in y. Infinite slopes are no problem; you just choose the coefficients in such a way that dy/dt=0 at such a point.
There are parameterizations of the coefficients to make things easier. An example is Bezier curves, but there are others. 

April 25, 2007, 10:50 
Re: How to transform or "smoothen" this "line"

#5 
Guest
Posts: n/a

Oops, I said the business of infinite slopes wrong. To get an infinite slope at a point, you set dx/dt=0 there. Then as t changes, y changes but not x, giving an infinite slope.


April 25, 2007, 11:24 
Re: How to transform or "smoothen" this "line"

#6 
Guest
Posts: n/a

I think you need to describe your application (I gather it's grid generation) in more detail. Parametric curves might be the way to go, as Jonas suggests. It may also be as simple as working with the local curvilinear coordinates instead of "x and y".


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Problem with Gmsh  nishant_hull  Open Source Meshers: Gmsh, Netgen, CGNS, ...  23  August 5, 2015 02:09 
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3  flakid  OpenFOAM Installation  16  December 28, 2010 09:48 
Regarding FoamX running Kindly help out  hariya03  OpenFOAM PreProcessing  0  April 18, 2008 04:26 
Axisymmetrical mesh  Rasmus Gjesing (Gjesing)  OpenFOAM Native Meshers: blockMesh  10  April 2, 2007 14:00 
error while compiling the USER Sub routine  CFD user  CFX  3  November 25, 2002 16:16 