Hi all,
I am trying to spec
Hi all,
I am trying to specify Marangoni boundary condition on the top boundary of a cavity. At first, I am trying to 'enforce' this b.c in the main code I am using (boussinesqBouyantFoam). Later, I will try to learn how to incorporate it in a new b.c library (i.e the elegant way). The b.c is: du/dy = (dSigma/dT)*(dT/dx)/mu dw/dy = (dSigma/dT)*(dT/dz)/mu where (dSigma/dT) is temperature gradient of surface tension, assumed to be constant. The implementation is as follows: ================================================= volVectorField gradT = fvc::grad(T); volScalarField dTdx = gradT.component(0); volScalarField dTdy = gradT.component(1); volScalarField dTdz = gradT.component(2); label patchI1 = mesh.boundaryMesh().findPatchID("top"); volScalarField u = U.component(0); volScalarField v = U.component(1); volScalarField w = U.component(2); fixedGradientFvPatchScalarField& bufferu = refCast<fixedgradientfvpatchscalarfield>(u.boundar yField()[patchI1]); fixedGradientFvPatchScalarField& bufferv = refCast<fixedgradientfvpatchscalarfield>(v.boundar yField()[patchI1]); fixedGradientFvPatchScalarField& bufferw = refCast<fixedgradientfvpatchscalarfield>(w.boundar yField()[patchI1]); scalarField graduyTop = bufferu.snGrad(); scalarField gradwyTop = bufferw.snGrad(); fvPatchScalarField& dTdxTop = dTdx.boundaryField()[patchI1]; fvPatchScalarField& dTdzTop = dTdz.boundaryField()[patchI1]; forAll (graduyTop, faceI1) { graduyTop[faceI1] = dsigmadT.value()*dTdxTop[faceI1]/mu.value(); } forAll (gradwyTop, faceI1) { gradwyTop[faceI1] = dsigmadT.value()*dTdzTop[faceI1]/mu.value(); } ================================================= There was no error message upon compiling. For the simulation, I used fixedGradient b.c for velocity at top surface, i.e: in 0/U: top { type fixedGradient; gradient uniform (0 0 0); } When running the simulation, I got this error message: --> FOAM FATAL ERROR : Attempt to cast type calculated to type fixedGradient From function refCast<to>(From&) in file /home/zaki/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude/typeInfo.H at line 103. FOAM aborting Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) Foam::error::abort() marangoniFoam [0x4142cb] __libc_start_main __gxx_personality_v0 Could anyone explain and help me with this problem? Thanks, zaki |
Hi Zaid,
I have not really
Hi Zaid,
I have not really lookked at your error - but I have implemented (and tested) a Marangoni boundary condition. Have a look at it, maybe it serves you. regards, Thomas http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif marangoniFvPatchVectorField.H http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif marangoniFvPatchVectorField.C |
Hi Thomas,
Thanks for the b
Hi Thomas,
Thanks for the b.c code you provided. Sorry for not replying for long time since I've been busy with other things. Now I want to concentrate back on marangoni b.c. I tried to compile the marangoni b.c but I got the following error: /home/zaki/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:132 : instantiated from 'Foam::fvPatchField<type>::adddictionaryConstructo rToTable<fvpatchfieldtype>:: adddictionaryConstructorToTable(const Foam::word&) [with fvPatchFieldType = Foam::marangoniFvPatchVectorField, Type = Foam::Vector<double>]' marangoniFvPatchVectorField.C:228: instantiated from here /home/zaki/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/fvPatchField.H:132 : error: cannot allocate an object of abstract type 'Foam::marangoniFvPatchVectorField' marangoniFvPatchVectorField.H:51: note: since type 'Foam::marangoniFvPatchVectorField' has pure virtual functions make: *** [Make/linux64GccDPOpt/marangoniFvPatchVectorField.o] Error 1 Could you explain what might happen? Thanks zaki |
Hi Zaki,
I think that versi
Hi Zaki,
I think that version I posted worked for OpenFoam-1.3. I have a version adapted to version 1.4.1, which you are apparently using, but I have to say I right now do not remember if I tested that. I have set up an installation for 1.4.1 some time ago, compiled it, but am actually still using the 1.4 version. So, here, at your own risk, the 1.4.1 version. Please note, that in 1.4.1 also the directory structure in fvPatchFields changed, if I remember correctly. Good luck... Thomas http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif marangoniFvPatchVectorField.H http://www.cfd-online.com/OpenFOAM_D...hment_icon.gif marangoniFvPatchVectorField.C |
Hi Thomas,
Thanks a lot! ht
Hi Thomas,
Thanks a lot! http://www.cfd-online.com/OpenFOAM_D...part/happy.gif The compilation was successfully done. Now I'm trying to run a test case. zaki |
Hi Thomas and Zaki,
Is it
Hi Thomas and Zaki,
Is it possible for one of you to upload an example solver and case file using this boundary file? Thanks, Mike J. |
Hello FOAMers,
I am havi
Hello FOAMers,
I am having difficulty getting the marangoni BC to operate correctly and I am hoping for a hint about what I am doing wrong. First, I am integrating this BC into a solver which uses the conjugateHeatFoam as a template and so have two mesh regions coupled by the energy equation (the fluid portion is replaced with the mhdFoam solver). Second, I have compiled the BC with the help of the instructions here. It compiles and apparently links correctly. Third, I have a case file and the <case>/0/U file includes the BC as follows: Quote:
Quote:
Quote:
I dutifully add the line: Quote:
The solver compiles without a hitch. However, when I run the solver, I get the following error message: Quote:
Can anyone help me with this error? Thank you, Mike J. |
Hi Mike,
The BC is looking
Hi Mike,
The BC is looking for gradT in database, so you should create it like you do for fields that are written and read from time dumps, i.e. something with IOobject. Regards, Kati |
Hi Kati,
This did, indeed
Hi Kati,
This did, indeed, solve my problem. Thank you. Regards, Mike J. |
Hello,
I'm new to OpenFOAM and C++ language. I have a diffucult using the "MarangoniFvPatchVectorField". Now, I am bringing this BC in solver (icoheatMaFOAM). However, I couldn't compile the solver and getting following error message. …/lnInclude/marangoniFvPatchVectorField.H:107: error: cannot allocate an object of abstract type ‘Foam::marangoniFvPatchVectorField’ …/lnInclude/marangoniFvPatchVectorField.H:58: note: because the following virtual functions are pure within ‘Foam::marangoniFvPatchVectorField’: …/lnInclude/transformFvPatchField.H:109: note: Foam::tmp<Foam::fvPatchField<Type> > Foam::transformFvPatchField<Type>::clone(const Foam::DimensionedField<Type, Foam::volMesh>&) const [with Type = Foam::Vector<double>] …/lnInclude/marangoniFvPatchVectorField.H: In member function ‘virtual Foam::tmp<Foam::fvPatchField<Foam::Vector<double> > > Foam::marangoniFvPatchVectorField::clone(const Foam::vectorField&) const’: …/lnInclude/marangoniFvPatchVectorField.H:123: error: cannot allocate an object of abstract type ‘Foam::marangoniFvPatchVectorField’ …/lnInclude/marangoniFvPatchVectorField.H:58: note: since type ‘Foam::marangoniFvPatchVectorField’ has pure virtual functions Could anyone help me with this error. Thank you. Hanna |
Hello everybody,
I have succesfully compiled the boundary condition which Thomas tehache supplied. In the solver, I have created the gradT as an IOobject: volVectorField gradT ( IOobject ( "gradT", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), fvc::grad(T) ); In the boundary conditions I wrote this: boundaryField { type marangoni; marangonicoeff 0.05; } The code compiles and runs ok. But when I execute the command foamDataToFluent (I am using Fluent as a posprocessor) I have the following warning: Time = 0 Converting field pd Converting field T marangoniFvPatchVectorField::snGrad(): object gradT not found! marangoniFvPatchVectorField::snGrad(): object gradT not found! Converting field gradT gradT is defined but the solver do not find it. And in the postprocessor I can see that gradT is not zero and is calculated oK. Other problem is that the solver is not aplying this condition, i.e. although I set the marangonicoeff = 1000000, I have no difference between marangonicoeff = 0.05 or marangonicoeff = 0 Does anybody know which is the problem. May be the boundary conditions of temperature or velocity? |
I have to leave now (urgent holidays...:)) ... but promise to post next week the version I am currently using with OpenFoam 1.6.x, where the value field is beeing written, and which needed changes to work with 1.6.x.
Thomas |
I updated the boundary condition a little (its now writing also its value, was missing before..), and its working for me now with 1.6.x.
As the testcase was too large to upload here, please find it (and the B.C.) at the links given below. Under the link named MarangoniTest I add a small testcase. Gravity is set to 0, Marangoni-Number is small in order to obtain a stationary and axisymmetric solution (although calculation is 3D), which I have compared to results from our own 2D-Code Crysmas, and with Fluent, results are (within some percent, did not check grid dependence..) the same. Therefore, I personally trust it, but dont give any guarantee :) I have run the testcase using a slightly modified buoyantBoussinesqSimpleFoam: add this to createFields to store temperature gradients: Info<< "Generating/reading field gradT\n" << endl; volVectorField gradT ( IOobject ( "gradT", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), mesh, dimensionSet(0,-1,0,1,0,0,0) ); gradT=fvc::grad(T); and add this in the solver code: turbulence->correct(); -> gradT=fvc::grad(T); runTime.write(); specify the B.C. in U as follows: outerwall { type marangoni; marangonicoeff -9.9e-06; } the marangonicoeff to specifiy is the usual marangonicoefficient (d sigma/dT) divided by DYNAMIC viscosity! http://servww6.ww.uni-erlangen.de/~jung/marangoniFvPatchVectorField-1.6.x.tar.gz http://servww6.ww.uni-erlangen.de/~jung/MarangoniTest.tar.gz Thomas |
Thank you very much, tehache. Now my problem works Ok.
|
marangoni stress
hey everyone,
i am trying to simulate selective laser sintering process with marangoni stress function wrt time as a boundary condition can u suggest me where i can apply this condition. i am using fluent as my solver and if udf is required can somebody help me with that.. thank you. |
returning gradient at the boundary
Hi everyone,
I have gone through the marangoniFvPatchVectorField.C file and I have difficulty in understanding parts of the code as I'm not very good at C++ and am new to OpenFOAM what do the following lines of the code mean? Code:
tmp<vectorField > marangoniFvPatchVectorField::snGrad() const Thanks in advance. Srivaths |
Hi sherlock (and others),
As I am getting a lot of private messages regarding the Marangoni B.C.: I posted this thing 4 years ago just as an example of how I tried to solve the problem, not as something I would consider a good programming example. It worked for me, and some others, in OpenFoam 1.6, since then, I have not touched it, and actually dont really remember what I did and why. Perhaps I should not have posted it. As far as I remember, the transform you are asking for gives the projection of the patch internal vector field onto the patch plane, I think you can figure that out looking at the implementation of the base class, transformFvPatchVectorField. God luck! |
Many thanks
Hi Thomas,
Thank you. I shall have a look at the base class to try and understand this better. |
Hello all,
I have a 2 questions. Firstly, I have a doubt in the volVectorField definition of gradT. Why is it READ_IF_PRESENT? I'm not able to view the test case attached and so i'm not able to have a look into the 0/gradT file. Second, if the internal and boundary fields are at constant temperature initially, won't gradT have the same value at all points? Kindly excuse me if the questions are too naive. I have just started with OpenFOAM. |
Quote:
I am implementing the same boundary condition. However I want to ask, do we really need to update the solver application? There must be another way of adding this IOobject externally I mean through codeStream or function object. Pl. suggest. - Tarang |
Quote:
|
Hey guys!
the links to the files that tehache posted are apparently corrupt now. Can any one please upload the files and post the link here? Thanks Quote:
|
Marangoni Condition
1 Attachment(s)
Here, use this. I am also right now seeing the feasibility if gradT can be calculated inside boundary patch only. Let's see when I am able to do it. For the time being you calculate gradT as mentioned in the post. Further you can use
Code:
IOobject::NO_READ, Code:
IOobject::READ_IF_PRESENT, PS: The file will work for Openfoam-4.1 onwards - Tarang |
Thanks Tarang!
could you please also upload your sample case? |
1 Attachment(s)
hello,
I am using the marangoni Bc for the 2D square cavity with temperature and concentration given to side wall but the results i am getting is not correct, the flow is not developing. I am using Marangoni BC with simpleFoam. please suggest something on this. thanks |
Marangoni Boundary condition
1 Attachment(s)
I have updated the marangoni condition to work with both compressible as well as incompressible solvers. The boundary condition calculates gradient of temperature internally. I have tested it in my problems and it is working well. Let me know if you face any problem.
You can also check out my github page https://github.com/gargtarang/OpenFOAM_Extensions_TG This I maintain mainly as an hobby or interest. -- Thanks gtarang |
All times are GMT -4. The time now is 02:10. |