|
[Sponsors] |
Problem with linearized Navier-Stokes equations |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 4, 2014, 12:57 |
Problem with linearized Navier-Stokes equations
|
#1 |
New Member
Andrea
Join Date: Sep 2014
Posts: 17
Rep Power: 12 |
Hi everybody,
i'm new to OpenFOAM and i'm trying to solve the incompressible linearized Navier-Stokes equations. Called U_zero the equilibrium solution, i tried to modify the icoFoam.C code as follow: fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi_zero, U) + fvm::div(phi,U_zero) - fvm::laplacian(nu, U) ); solve(UEqn == -fvc::grad(p)); where phi_zero is defined as surfaceScalarField phi_zero ( IOobject ( "phi_zero", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), linearInterpolate(U_zero) & mesh.Sf() ); I also defined U_zero in createFields.H as: Info<< "Reading field U_zero\n" << endl; volVectorField U_zero ( IOobject ( "U_zero", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, Foam::vector(1,0,0) ); I compiled the code without errors but when i try to run a case (cavity for example) the following error message appears: --> FOAM FATAL ERROR: valueInternalCoeffs cannot be called for a calculatedFvPatchField on patch movingWall of field U_zero in file "/home/andrea/Desktop/tesi/openfoam/tutorials/incompressible/icoFoam/cavityLinearized/0/U_zero" You are probably trying to solve for a field with a default boundary condition. From function calculatedFvPatchField<Type>::valueInternalCoeffs( const tmp<scalarField>&) const in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 144. FOAM exiting I know that i should first calculate U_zero as a stationary solution and then solve the linearized NS equation in a neighbourhood of it . In my case U_zero is just a constant vector, but i'm just trying to run the code without errors to see what happens. Thanks for your help. Regards, Andrea |
|
October 4, 2014, 16:32 |
|
#2 |
Senior Member
|
Hi,
if I got your problem right, you need to set boundary conditions for U_zero. Now you create the field with: Code:
volVectorField U_zero ( IOobject ( "U_zero", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, Foam::vector(1,0,0) ); Code:
volVectorField U_zero ( IOobject ( "U_zero", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh, Foam::vector(1,0,0), U.boundaryField().types() ); |
|
October 5, 2014, 04:58 |
|
#3 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
Good morning,
You must use fvc:: on the U_zero term, as it should not be a part of your matrix, but rather the source term. Kind regards, Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request. |
|
October 5, 2014, 06:19 |
|
#4 |
New Member
Andrea
Join Date: Sep 2014
Posts: 17
Rep Power: 12 |
Hi Alexey,
thanks for your reply, i added the new line for BC as you said but a new error appears: --> FOAM FATAL ERROR: incompatible dimensions for operation [U[0 1 -2 0 0 0 0] ] + [U[0 0 -1 0 0 0 0] ] From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&) in file /opt/openfoam211/src/finiteVolume/lnInclude/fvMatrix.C at line 1316. FOAM aborting #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 at ??:? #3 at ??:? #4 at ??:? #5 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #6 at ??:? Aborted (core dumped) It seems that U dimensions are not correct but U file in /0 directory has dimensions: dimensions [0 1 -1 0 0 0 0]; |
|
October 5, 2014, 06:23 |
|
#5 |
New Member
Andrea
Join Date: Sep 2014
Posts: 17
Rep Power: 12 |
Hi Niels,
sorry, maybe my question is stupid but why did you say that U_zero should be a source term? In linearized Navier-Stokes equations U_zero is always coupled with U so how can i write it as a source term? Best Regards, Andrea. |
|
October 5, 2014, 10:18 |
|
#6 | |
Senior Member
|
Hi,
Quote:
Maybe dimensions of U_zero that you've put in 0 folder are overwritten by Foam::vector(1,0,0), try using dimensionedVector("U_zero", dimVelocity, vector(1, 0, 0)). About comment by Niels, in your div(phi, U_zero) there's no U, so you have to use div method from fvc namespace. And it will be treated as a source term. |
||
October 6, 2014, 06:49 |
|
#7 |
New Member
Andrea
Join Date: Sep 2014
Posts: 17
Rep Power: 12 |
Hi Alexey,
thanks a lot for your advices, i solved the problem. Sorry if i ask you one more question; i would like to read U_zero from a file following these steps: 1) run cavity case with icoFoam; 2) extract U field at each time step typing "foamCalc components U"; 3) Set U_zero = U (so i need to read U_zero from a file); 4)Solve linearized Navier-Stokes equations around U_zero; I have done step 1 and 2 but i don't know how to do step 3. I would appreciate your help. Best regards, Andrea |
|
October 6, 2014, 09:52 |
|
#8 |
Senior Member
|
Hi,
right now the only solution that I can think of is to use another variant of IObject constructor to create U_zero vector field: http://foam.sourceforge.net/docs/cpp...52f901319147b6 Code:
IOobject ( const fileName& path, const objectRegistry& registry, readOption r = NO_READ, writeOption w = NO_WRITE, bool registerObject = true ) |
|
October 7, 2014, 11:11 |
|
#9 |
New Member
Andrea
Join Date: Sep 2014
Posts: 17
Rep Power: 12 |
Thanks Alexey,
problem solved. Best Regards, Andrea |
|
December 6, 2015, 07:51 |
|
#10 |
Senior Member
Join Date: Jan 2013
Posts: 135
Rep Power: 13 |
Thanks to this thread, my icoLinearFoam is also compiled.
Now I am trying to construct the operation matrix M, for , and analysis the eigenvalues of M to see if the base flow is stable or not. Last edited by kkpal; December 6, 2015 at 09:26. |
|
December 6, 2015, 09:32 |
|
#11 |
Member
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14 |
Hello
I think you either have a missing file or a miss-spell in the name of the file or inside U_zero |
|
December 6, 2015, 09:42 |
|
#12 |
Senior Member
Join Date: Jan 2013
Posts: 135
Rep Power: 13 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Non-dimensionalizing Navier Stokes | VincentD | Main CFD Forum | 16 | July 10, 2017 05:55 |
Navier stokes Equations in Unstructured Grid | Mh.R | Main CFD Forum | 4 | October 19, 2011 16:37 |
Navier stokes compresible viscid flow fea, somebody can help? | Jose Choy | Main CFD Forum | 3 | October 24, 2003 03:28 |
Presure range of the Navier Stokes Equations | Dr. Tsimento | Main CFD Forum | 7 | May 23, 2001 11:12 |
need help on solution to Stokes equations | Yuksel Onsoy | Main CFD Forum | 3 | November 2, 2000 06:54 |