|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Zaki Saldi
Join Date: Mar 2009
Posts: 18
Rep Power: 17 ![]() |
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: ![]() Foam::error::abort() marangoniFoam [0x4142cb] __libc_start_main __gxx_personality_v0 Could anyone explain and help me with this problem? Thanks, zaki |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
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 ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Zaki Saldi
Join Date: Mar 2009
Posts: 18
Rep Power: 17 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
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 ![]() ![]() |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Zaki Saldi
Join Date: Mar 2009
Posts: 18
Rep Power: 17 ![]() |
Hi Thomas,
Thanks a lot! ![]() zaki |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#7 | |||||
Senior Member
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17 ![]() |
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. |
||||||
![]() |
![]() |
![]() |
![]() |
#8 |
Member
Kati Laakkonen
Join Date: Mar 2009
Location: Espoo, Finland
Posts: 35
Rep Power: 17 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17 ![]() |
Hi Kati,
This did, indeed, solve my problem. Thank you. Regards, Mike J. |
|
![]() |
![]() |
![]() |
![]() |
#10 |
New Member
Atsuko Ishida
Join Date: Apr 2009
Posts: 1
Rep Power: 0 ![]() |
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: ![]() …/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 |
|
![]() |
![]() |
![]() |
![]() |
#11 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 ![]() |
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? |
|
![]() |
![]() |
![]() |
![]() |
#12 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
I have to leave now (urgent holidays...
![]() Thomas |
|
![]() |
![]() |
![]() |
![]() |
#13 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#14 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 ![]() |
Thank you very much, tehache. Now my problem works Ok.
|
|
![]() |
![]() |
![]() |
![]() |
#15 |
New Member
U.Magarajan
Join Date: Nov 2011
Location: Vellore
Posts: 7
Rep Power: 14 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#16 |
Senior Member
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13 ![]() |
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 { //Info << "entering marangoniFvPatchVectorField::snGrad()" << endl; vectorField nHat = this->patch().nf(); vectorField pif = this->patchInternalField(); vectorField result; if(!db().foundObject<vectorField>("gradT")) { Info << " marangoniFvPatchVectorField::snGrad(): object gradT not found!" << endl; Foam::error theError(" marangoniFvPatchVectorField::evaluate(): object gradT not found!"); return transform(I - sqr(nHat),pif); } else { fvPatchField<vector> gradT =this->patch().lookupPatchField<volVectorField, vector>("gradT"); vectorField gradT_internal = gradT.patchInternalField(); vectorField gradTplane= transform(I - sqr(nHat),gradT_internal); vectorField pifplane= transform(I - sqr(nHat),pif); result=pifplane+marangonicoeff_*gradTplane/this->patch().deltaCoeffs(); return (result-pif)*this->patch().deltaCoeffs(); } //Info << "leaving marangoniFvPatchVectorField::snGrad()" << endl; return result; } Thanks in advance. Srivaths |
|
![]() |
![]() |
![]() |
![]() |
#17 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 ![]() |
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! |
|
![]() |
![]() |
![]() |
![]() |
#18 |
Senior Member
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13 ![]() |
Hi Thomas,
Thank you. I shall have a look at the base class to try and understand this better.
__________________
Regards, Srivaths |
|
![]() |
![]() |
![]() |
![]() |
#19 |
Senior Member
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13 ![]() |
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.
__________________
Regards, Srivaths |
|
![]() |
![]() |
![]() |
![]() |
#20 | |
Member
Tarang
Join Date: Feb 2011
Location: Delhi, India
Posts: 47
Rep Power: 15 ![]() |
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 |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Marangoni stress, help!! | dong | FLUENT | 2 | February 23, 2024 12:30 |
Marangoni flow | Tao | CFX | 0 | September 4, 2007 17:14 |
Marangoni Convection | Rucy | FLUENT | 0 | July 6, 2005 05:17 |
Marangoni Stress At the Wall | Peter Nagy | FLUENT | 4 | January 26, 2004 15:06 |
Marangoni VS Rayleigh-Bernard | Peter Nagy | FLUENT | 2 | January 12, 2004 09:53 |