CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   help! where to begin study OF?! (https://www.cfd-online.com/Forums/openfoam/106805-help-where-begin-study.html)

houkensjtu September 9, 2012 10:47

help! where to begin study OF?!
 
Hi openFoamer!
I am a student and my research is about flow boiling in microchannel.
I have been doing some programming using Fortran (based on SOLA-VOF and RIPPLE) to simulate bubble flow in microchannel.
After I finished my thesis by that, I am now looking forward to use openFoam to continue my work--bubble flow with phase-change inside microchannel.
I have read the official user-guide and have a glance at programmer guide. Both of them are too brief and I can not do anything other than run the tutorial case written in the user-guide. Also I totally can't understand how openFoam work.
Is there any proper study material can help beginner to learn OF?
THX!

akidess September 10, 2012 03:57

The single best source of information is still the official guide, even considering it's deficiencies. After working through it you should be able to set up and run cases without too much trouble. Apart from that there's the OpenFOAM wiki and this forum.

I recommend you to work (not just read!) through the tutorials described in the guide if you haven't yet, then set up a microchannel simulation without phase change. Once you have that you'll have to do some programming into interFoam to add phase change - I think you can find clues on the forum on how to do that (i.e. people have already done it). Having a good C++ book on your desk will help you surely. Finally, be aware that you're on a long road - it takes years to become proficient at writing your own code.

- Anton

houkensjtu September 11, 2012 21:59

Quote:

Originally Posted by akidess (Post 380990)
The single best source of information is still the official guide, even considering it's deficiencies. After working through it you should be able to set up and run cases without too much trouble. Apart from that there's the OpenFOAM wiki and this forum.

I recommend you to work (not just read!) through the tutorials described in the guide if you haven't yet, then set up a microchannel simulation without phase change. Once you have that you'll have to do some programming into interFoam to add phase change - I think you can find clues on the forum on how to do that (i.e. people have already done it). Having a good C++ book on your desk will help you surely. Finally, be aware that you're on a long road - it takes years to become proficient at writing your own code.

- Anton

Thx for reply!
Yeah I found the foam wiki really helpful, and I am now working through the tutorials step by step.
In fact I am totally patient to study even it's long way to go, problem is, my professor can't even wait a week to see results...That's really annoying u know...

elvis September 12, 2012 12:23

Hi,

there is http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/
or search those peer-reviewed, student-contributed tutorials
http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/ (or that tutorials 2007 until 2011)

great stuff
http://www.personal.psu.edu/dab143/OFW6/training.htm
http://www.personal.psu.edu/dab143/OFW6/Program.htm search for a technical presentation that suits to your topic in the program might be of interest

mmkr825 September 12, 2012 13:46

About zero flux boundary condition...
 
Hi everyone,
I am fresher for openFoam. I have written my own application. I am doing my project on suspension (solid particles in fluid) flow through straight channels. I prepared my solver for the coupling of continuity, momentum and particle conservation equation.
Now i am facing problem with boundary condition for the particle volume fraction at the upper and lower walls. When applied this condition in particle conservation equation i got an expression for the gradient of particle volume fraction.
my governing equation for the particle volume fraction is:-

solve
(
fvm::div(phi, T)
+ fvm::laplacian(0.62*1.82*pow(a,2)*g*pow(T,2)*pow(0 .68-T,-1), T)
+ fvm::laplacian(0.41*pow(a,2)*g*T, T)
==
- fvc::laplacian(0.41*pow(a,2)*T*T, g)
);


where T=particle volume fraction (no units)
where g=local strain rate scalar=1.41421*sqrt(magSqr(symm(fvc::grad(U))))

After applying zero boundary condition i got an expression for gradient as:-
grad(T)= - 0.41*pow(T, 2)*(fvc::grad(g))/(T*g*(0.41+T*1.1284*pow(0.68-T, -1)))

For this purpose i need to develop derived boundary condition. I checked the boundary conditions and found that solidDisplacementFoam/tractionDisplacement matches for my needs. I developed code based upon that solver but i am getting some error message. That's why i reproduced the same tractionDisplacement changing name to mytractionDisplacement.

when i compiled with wmake the following error is coming (which is same as those i obtained for the above gradient expression)
Error message:-
malli_reddy@ubuntu:~/Desktop/mysolidDisplacementFoam/mytractionDisplacement$ wmake

Making dependency list for source file mytractionDisplacementFvPatchVectorField.C
SOURCE=mytractionDisplacementFvPatchVectorField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/mytractionDisplacementFvPatchVectorField.o
g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linuxGccDPOpt/mytractionDisplacementFvPatchVectorField.o -L/opt/openfoam211/platforms/linuxGccDPOpt/lib \
-lfiniteVolume -lOpenFOAM -ldl -lm -o /home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/platforms/linuxGccDPOpt
/bin/mytractionDisplacementFvPatchVectorField
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [/home/malli_reddy/OpenFOAM/
malli_reddy-2.1.1/platforms/linuxGccDPOpt/bin/mytractionDisplacementFvPatchVectorField] Error 1

Please guide me to rectify this error. Now i am using OF 2.1.1 version. And give any valuable information about swak4Foam utility.

Thanks
Regards
Mallikarjuna

adhiraj September 12, 2012 20:29

Are you building the library when you get this error?
wmake is used to build the solvers, and they have the main() function.
For the library use "wmake libso".

mmkr825 September 13, 2012 01:57

Hi Adhiraj,
Thanks for your quick reply. Now i got the solution for mytractionDisplacement. But when i extend to my needs the following error message is coming.
Error Message:-
malli_reddy@ubuntu:~/OpenFOAM/malli_reddy-2.1.1/myDiffusiveFoam/myFlux$ wmake libso

wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file myFluxFvPatchScalarField.C
SOURCE=myFluxFvPatchScalarField.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -I/opt/openfoam211/src/turbulenceModels -I/opt/openfoam211/src/turbulenceModels/incompressible/RAS/RASModel -I/opt/openfoam211/src/transportModels -I/opt/openfoam211/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam211/src/turbulenceModels/incompressible/RAS/lnInclude -I/opt/openfoam211/src/finiteVolume/lnInclude -I/opt/openfoam211/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/myFluxFvPatchScalarField.o
In file included from /opt/openfoam211/src/OpenFOAM/lnInclude/Field.C:735:0,
from /opt/openfoam211/src/OpenFOAM/lnInclude/Field.H:360,
from /opt/openfoam211/src/OpenFOAM/lnInclude/labelField.H:39,
from /opt/openfoam211/src/OpenFOAM/lnInclude/primitiveFields.H:37,
from /opt/openfoam211/src/OpenFOAM/lnInclude/pointField.H:36,
from /opt/openfoam211/src/OpenFOAM/lnInclude/edge.H:40,
from /opt/openfoam211/src/OpenFOAM/lnInclude/edgeList.H:32,
from /opt/openfoam211/src/OpenFOAM/lnInclude/PrimitivePatch.H:56,
from /opt/openfoam211/src/OpenFOAM/lnInclude/primitivePatch.H:35,
from /opt/openfoam211/src/OpenFOAM/lnInclude/polyPatch.H:43,
from /opt/openfoam211/src/finiteVolume/lnInclude/fvPatch.H:39,
from /opt/openfoam211/src/finiteVolume/lnInclude/fvPatchField.H:47,
from /opt/openfoam211/src/finiteVolume/lnInclude/fvPatchFields.H:29,
from myFluxFvPatchScalarField.H:39,
from myFluxFvPatchScalarField.C:26:
/opt/openfoam211/src/OpenFOAM/lnInclude/FieldFunctions.C: In function ‘void Foam::subtract(Foam::Field<typename Foam::typeOfSum<Type1, Type2>::type>&, const Foam::UList<T>&, const Foam::UList<Key>&) [with Type1 = double, Type2 = Foam::Vector<double>, typename Foam::typeOfSum<Type1, Type2>::type = double]’:
/opt/openfoam211/src/OpenFOAM/lnInclude/FieldFunctions.C:700:1: instantiated from ‘Foam::tmp<Foam::Field<typename Foam::typeOfSum<Type1, Type2>::type> > Foamoperator-(const Foam::tmp<Foam::Field<Type> >&, const Foam::tmp<Foam::Field<Type2> >&) [with Type1 = double, Type2 = Foam::Vector<double>, typename Foam::typeOfSum<Type1, Type2>::type = double]’
myFluxFvPatchScalarField.C:185:65: instantiated from here
/opt/openfoam211/src/OpenFOAM/lnInclude/FieldFunctions.C:700:1: error: no match for ‘operator-’ in ‘*(f2P ++) - *(f3P ++)’
/opt/openfoam211/src/OpenFOAM/lnInclude/scalarField.H:78:1: note: candidates are: Foam::tmp<Foam::Field<double> > Foamoperator-(const Foam::scalar&, const Foam::UList<double>&)
/opt/openfoam211/src/OpenFOAM/lnInclude/scalarField.H:78:1: note: Foam::tmp<Foam::Field<double> > Foamoperator-(const Foam::scalar&, const Foam::tmp<Foam::Field<double> >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/scalarField.H:78:1: note: Foam::tmp<Foam::Field<double> > Foamoperator-(const Foam::UList<double>&, const Foam::scalar&)
/opt/openfoam211/src/OpenFOAM/lnInclude/scalarField.H:78:1: note: Foam::tmp<Foam::Field<double> > Foamoperator-(const Foam::tmp<Foam::Field<double> >&, const Foam::scalar&)
/opt/openfoam211/src/OpenFOAM/lnInclude/labelField.H:54:1: note: Foam::tmp<Foam::Field<int> > Foamoperator-(const Foam::label&, const Foam::UList<int>&)
/opt/openfoam211/src/OpenFOAM/lnInclude/labelField.H:54:1: note: Foam::tmp<Foam::Field<int> > Foamoperator-(const Foam::label&, const Foam::tmp<Foam::Field<int> >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/labelField.H:54:1: note: Foam::tmp<Foam::Field<int> > Foamoperator-(const Foam::UList<int>&, const Foam::label&)
/opt/openfoam211/src/OpenFOAM/lnInclude/labelField.H:54:1: note: Foam::tmp<Foam::Field<int> > Foamoperator-(const Foam::tmp<Foam::Field<int> >&, const Foam::label&)
/opt/openfoam211/src/OpenFOAM/lnInclude/dimensionSet.H:255:29: note: Foam::dimensionSet Foamoperator-(const Foam::dimensionSet&)
/opt/openfoam211/src/OpenFOAM/lnInclude/dimensionSet.H:263:29: note: Foam::dimensionSet Foamoperator-(const Foam::dimensionSet&, const Foam::dimensionSet&)
/opt/openfoam211/src/OpenFOAM/lnInclude/dimensionedScalar.H:52:19: note: Foam::dimensionedScalar Foamoperator-(const Foam::dimensionedScalar&, Foam::scalar)
/opt/openfoam211/src/OpenFOAM/lnInclude/dimensionedScalar.H:53:19: note: Foam::dimensionedScalar Foamoperator-(Foam::scalar, const Foam::dimensionedScalar&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:61:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::UList<Foam::DiagTensor<double> >&, const Foam::UList<Foam::Tensor<double> >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:61:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::UList<Foam::DiagTensor<double> >&, const Foam::tmp<Foam::Field<Foam::Tensor<double> > >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:61:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::tmp<Foam::Field<Foam::DiagTensor<double> > >&, const Foam::UList<Foam::Tensor<double> >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:61:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::tmp<Foam::Field<Foam::DiagTensor<double> > >&, const Foam::tmp<Foam::Field<Foam::Tensor<double> > >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:64:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::diagTensor&, const Foam::UList<Foam::Tensor<double> >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:64:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::diagTensor&, const Foam::tmp<Foam::Field<Foam::Tensor<double> > >&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:64:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::UList<Foam::DiagTensor<double> >&, const Foam::tensor&)
/opt/openfoam211/src/OpenFOAM/lnInclude/diagTensorField.H:64:1: note: Foam::tmp<Foam::Field<Foam::Tensor<double> > > Foamoperator-(const Foam::tmp<Foam::Field<Foam::DiagTensor<double> > >&, const Foam::tensor&)
/opt/openfoam211/src/OpenFOAM/lnInclude/vectorTensorTransformI.H:283:36: note: Foam::vectorTensorTransform Foamoperator-(const Foam::vectorTensorTransform&, const Foam::vector&)
/opt/openfoam211/src/OpenFOAM/lnInclude/quaternionI.H:273:25: note: Foam::quaternion Foamoperator-(const Foam::quaternion&)
/opt/openfoam211/src/OpenFOAM/lnInclude/quaternionI.H:279:25: note: Foam::quaternion Foamoperator-(const Foam::quaternion&, const Foam::quaternion&)
/opt/openfoam211/src/OpenFOAM/lnInclude/septernionI.H:190:25: note: Foam::septernion Foamoperator-(const Foam::septernion&, const Foam::vector&)
make: *** [Make/linuxGccDPOpt/myFluxFvPatchScalarField.o] Error 1



please suggest me what will be the error.

Thanks
Regards
Mallikarjuna

elmo555 May 31, 2016 09:20

Quote:

Originally Posted by mmkr825 (Post 381515)
/opt/openfoam211/src/OpenFOAM/lnInclude/FieldFunctions.C:700:1: error: no match for ‘operator-’ in ‘*(f2P ++) - *(f3P ++)’

I'm getting the same error, can anybody explain?

The line of code is
Code:

surfaceVectorField Uf_gamma(Uf-mDotVoluf*nHatf*mesh.delta()*(scalar(1)/rho2-scalar(1)/rho1));
with Uf and nHatf as surfaceVectorField, mDotVoluf as surfaceScalarField and rho1 and rho2 as dimensionedScalar.

EDIT:
I found the problem, my mistake was to assume mesh.delta() to be a scalar, although it's a vector. Using mag(mesh.delta()) did the trick.


All times are GMT -4. The time now is 11:04.