I need to solve a 1d axisymmet
I need to solve a 1d axisymmetric problem in a channel (1d steady state solution of pipe flow under constant pressure gradient). So, I would use an axisymmetric geometry and set number of cells in "x" direction equal to one and left and right boundaries as 'empty' and say number of grids in "r" direction 100 grids (lower boundary is axis, upper one is wall, and front and back boundaries as wedge). Now about solver, this is the equation:
1/r*d/dr(r*dU/dr)+Px=0 where Px is pressure gradient in "x" direction, I start with laplacianFOAM, rename it to channel1dFoam. Then, in the main 'channel1dFoam', I need to define a vector in "Px". I define it like below: Info<< "\nCalculating velocity distribution\n" << endl; dimensionedVector Px ( "Px", dimensionSet(1, 2, 2, 0, 0, 0, 0), vector(0.1,0,0), ); for (runTime++; !runTime.end(); runTime++) { Info<< "\n Time = " << runTime.timeName() << nl << endl; # include "readSIMPLEControls.H" for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { solve ( Px + fvm::laplacian(1, U) ); } When I compile it, I get this error. Any clue what to do: ali@ns microFluid1dFoam]$ wmake SOURCE_DIR=. SOURCE=channel1dFoam.C ; g++ m32 Dlinux DlinuxOpt DscalarMachine DoptSolvers Wall W Wnounusedparameter O3 ffastmath DNoRepository ftemplatedepth30 I/home/ali/foam/foam2.3.2/src/foam/lnInclude IlnInclude I. DWM_PROJECT_VERSION='"'2.3.2'"' I/home/ali/foam/foam2.3.2/src/cfdTools/incompressible I/home/ali/foam/foam2.3.2/src/cfdTools/lnInclude fPIC pthread c $SOURCE o Make/linuxOpt/channel1dFoam.o channel1dFoam.C: In function `int main(int, char**)': channel1dFoam.C:54: error: expected primaryexpression before ')' token make: *** [Make/linuxOpt/channel1dFoam.o] Error 1 Sorry if this seems stupid question. 
boundaryFoam does what you ne
boundaryFoam does what you need

If I have this equation:
1/
If I have this equation:
1/r*d/dr(r*dU/dr) = k*tanh(U) where 'k' is a constant. volScalarField tanhU = tanh(U); tmp UrEqn ( fvm::laplacian(mm, U) == fvm::Sp(k, tanhU) ); solve(UrEqn); where mm=1 is just a constant. when I compile it, it gives no error, but when I want to run it, it gives this error: Time = 1 > FOAM FATAL ERROR : incompatible fields for operation [tanhU] == [tanh(U)] Function: checkMethod(const fvMatrix&, const fvMatrix&) in file: /home/ali/foam/foam2.3.2/src/foam/lnInclude/fvMatrix.C at line: 936. FOAM aborting I don't know what's wrong, as if I change tanh(U) to U itself, there is no problem and it works. What I'm missing here? Another thing is that if I have the main variable (here 'U') in the RHS of equation, I should use 'Sp()' function for source term (as I've used in the above equation), otherwise, if the RHS doesn't contain main variable U and would be something like mu*1/r*d/dr(r*dU/dr)=Px where Px is just an independent scalar that's given, we do not necessary need to use can use 'Sp()' and the following also works: solve ( fvm::laplacian(mu, UExact) + gradP ); where 'mu' is kinematic viscosity. Is my perception right or I can implement every equation without using 'Sp()' or it's better I always use 'Sp()'? Please guide me. Thanks. 
Also,
how to use spatial i
Also,
how to use spatial integration in openFOAM's FVM formulation. i.e. if I find a scalar say 'T' from solving one of the above equations and want to calculate this integral: from 0 to R (bounds): Integral{(dT/dr)*(dT/dr)*r*dr} or another intergral: from 0 to R (bounds): Integral{T*r*dr} How can I do this? Thanks. 
You cannot solve the equation
You cannot solve the equation treating tan(U) implicitly.
fvm::laplacian(mm, U) == k*tanhU is what you want fvm::Sp(k, tanhU) constructs a matrix treating the variable tanhU implicit, not U (which is what I think you want) 
Now, it's becoming interestin
Now, it's becoming interesting:
If the RHS is tanh(T) it works, but if it's sinh(T), it diverges quickly and gives very high numbers that are unaccetbale. It's odd because in MATLAB it's solvable, but here it can't be solved. Even if I start from a good intial condition for T, again it doesn't work. fvm::laplacian(mm, T) == k*sinh(T) where mm=1. The linearized version (if we assume sinh(T)=T for small enough T) is easily solvable if I replace sinh(T) by T itself. Any clue where the problem would be? PS: I even changed the nNonOrthogonaslCorrectors and used a couple of different laplacian schemes, but no success. 
All times are GMT 4. The time now is 13:38. 