
[Sponsors] 
June 10, 2009, 14:45 
Modifying the laplacian operator

#1 
New Member
Michael Lawson
Join Date: Apr 2009
Location: NREL  Boulder, CO
Posts: 11
Rep Power: 9 
Hi everyone,
I would like to modify the laplacian so the derivative is only calculated in one direction  that is I would like to compute only d^2T/dx^2 and not d^2T/dx^2 + d^2T/dy^2 + d^2T/dz^2 Then I want to solve a system of equations using this modified laplacian. I tried to do this by dotting the result of the laplacian operator with a unit normal vector in the xdirection. A simple example would be: solve ( fvm::ddt(T)  fvm::laplacian(DT, T) & xDir // where xDir is a dimentionedVector with the units [0 1 1 0 0 0 0] (1 0 0) ); Unfortunately, I get the following error when trying to compile my solver.  1dScalarTransportFoam.C: In function ‘int main(int, char**)’: 1dScalarTransportFoam.C:67: error: no match for ‘operator&’ in ‘Foam:perator(const Foam::tmp<Foam::fvMatrix<Type> >&, const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = double](((const Foam::tmp<Foam::fvMatrix<double> >&)((const Foam::tmp<Foam::fvMatrix<double> >*)(& Foam::fvm::laplacian(const Foam::dimensioned<Type2>&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double, GType = double](((Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&)(& T))))))) & xDir’  I assume I get this error because the & operator is not defined for a fvScalarMatrix. Does anyone know a method modifying the laplacian operator so that the derivative is only calculated in one direction? Mike 

August 3, 2011, 16:27 

#2 
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 136
Rep Power: 9 
Hi,
I am trying to do the same thing. Did you manage to do this ? Method you described is wrong, because laplacian(DT,T) is not a vector , but scalar: Txx + Tyy + Tzz, so you cant make dot product operation for scalar and vector... I did it in explicit way, but this not the best way... If you have some updates how to solve this problem, pleas let me know. best ZM 

August 3, 2011, 16:54 

#3 
New Member
Michael Lawson
Join Date: Apr 2009
Location: NREL  Boulder, CO
Posts: 11
Rep Power: 9 
You are correct the result of the laplacian operator is a scalar in this case. What should have asked is, is there a way to dot the laplacian operator itself with a unit vector before it is applied to the variable T (i.e (d/dx^2 + d/dy^2 + d/dz^2) dot (1 0 0) * T).
Either way, I never did solve this problem in a robust way. I ended up tricking the solver into only computing diffusion in one direction by making my two dimensional domain very long in one of the nonempty directions, the ydir in my case, so the d/dy^2 term was negligible with respect to the d/dx^2 term. I know this is not a good way to solve the problem, but it ended up working for the specific case I was working on. Good luck and please let me know if you find a solution to the problem. Mike 

August 3, 2011, 17:23 

#4 
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 136
Rep Power: 9 
in explicit way u can do this like that:
volVectorField gradT=fvc::grad(T); volScalarField gradTx = gradT & vector(1,0,0); volScalarField Tx = gradT.component(0); // T_x volVectorField gradT2 = fvc::grad(Tx); // (T_xx, T_xy) volScalarField Txx = gradT2.component(0); // T_xx 

August 4, 2011, 03:32 

#5 
Senior Member
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 1,133
Rep Power: 20 
Michael, it sounds like you want anisotropic diffusion  why not just pass a diffusion coefficient tensor to laplacian instead of a scalar? I don't think you need any modifications to the code to do that (but I haven't tried it myself).


August 4, 2011, 10:32 

#6 
New Member
Michael Lawson
Join Date: Apr 2009
Location: NREL  Boulder, CO
Posts: 11
Rep Power: 9 
Hi Anton,
Mathematically that makes sense, but I'm unsure how to convert the scalar field T into a tensor in OpenFOAM. Do you have an idean about how this would be done? Mike 

August 4, 2011, 10:49 

#7 
Senior Member
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 1,133
Rep Power: 20 
T stays a scalar field, you only have to change the diffusion coefficient into a tensor (you wouldn't do anything else on pen and paper). Redefine DT from dimensionedScalar to dimensionedTensor (see e.g. http://www.foamcfd.org/Nabla/guides/...sGuidese5.html) and recompile.


August 4, 2011, 12:13 

#8 
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 136
Rep Power: 9 
Hi Akidess,
Thanks for your suggestion. It works just as it should. Human being is learning all its life... To Mlawson: x  direction diffusion: DTe DTe [ 0 2 1 0 0 0 0 ] (3e02 0 0 0 0 0 0 0 0 ); x,y and  directions diffusion: DTe DTe [ 0 2 1 0 0 0 0 ] (3e02 0 0 0 3e02 0 0 0 3e02 ); Thanks again! 

September 7, 2011, 11:51 

#9 
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 446
Rep Power: 12 
hey there.
could anybody please give me a hint on where to find some sort of documentation for a part of the FSIsolver (icoFSIFoam??) like mentioned above. i am espacially interessted in how the pde´s have been derived for the solid/stress part. e.g. fvm::laplacian (2*mu, + lambda, Usolid, "laplacian (DU,U)") what is that third part good for? I wasn´t able to get any doc. for a third part in laplacian(..). Is this some sort of comment?? Thanks in advance, neewbie 

September 7, 2011, 12:05 

#10 
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 136
Rep Power: 9 
Third part "laplacian(DU,U)" is just needed for fvScheme file, where laplacian(DU,U) is defined. Here it just says that variable DU = 2*mu + lambda.
ZMM 

September 7, 2011, 12:06 

#11 
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 446
Rep Power: 12 
okay.
found it. i guess. it´s a label for that part of the eq. to hook it up with the schemes in fvSchemes. 

September 7, 2011, 12:30 

#12 
Senior Member
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 136
Rep Power: 9 
I think that all needed information you can find in the solver description:l
inearelastic, smallstrain deformation of a solid body, with optional thermal diffusion and thermal stresses. For example in solver solidDisplacementFoamfact there are only two PDE solved (I dont know where FSIsolver is): fvm::ddt(T) == fvm::laplacian(DT, T) and fvm::d2dt2(D) == fvm::laplacian(2*mu + lambda, D, "laplacian(DD,D)") + divSigmaExp first equation is just standart heat equation, second equation is just linearelastic equation with optional thermat stress (+ divSigmaExp) influence (calculated by solving first equation). This are standart equations so they derivation can be easly found in basic PDE books, or online: http://en.wikipedia.org/wiki/Linear_elasticity ZMM if (thermalStress) 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Elementwise multiplication operator  johndeas  OpenFOAM Running, Solving & CFD  2  May 14, 2012 09:45 
Question about the fvmatrix and Laplacian operator  liuhuafei  OpenFOAM Running, Solving & CFD  6  October 3, 2009 06:58 
Operator declaration in Thermophysical library  lena  OpenFOAM Running, Solving & CFD  0  March 12, 2009 10:47 
Material interfaces and the laplacian operator  cliffoi  OpenFOAM Running, Solving & CFD  8  November 8, 2006 09:57 
Material interfaces using the laplacian operator  cliffoi  OpenFOAM  0  November 6, 2006 11:42 