|
[Sponsors] |
March 21, 2012, 09:48 |
programming a new solver
|
#1 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear all,
I am trying to embed the Field Source functionality (see here) in the buoyantSimpleFoam solver. My new solver is attached. When I compile it, I get the following error: Code:
lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/buoyantSimpleFoam_Epta$ wmake Making dependency list for source file buoyantSimpleFoam_Epta.C could not open file singlePhaseTransportModel.H for source file buoyantSimpleFoam_Epta.C could not open file cellSet.H for source file buoyantSimpleFoam_Epta.C SOURCE=buoyantSimpleFoam_Epta.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/turbulenceModels -I/opt/openfoam210/src/turbulenceModels/compressible/RAS/lnInclude -I/opt/openfoam210/src/finiteVolume/cfdTools -I/opt/openfoam210/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/buoyantSimpleFoam_Epta.o buoyantSimpleFoam_Epta.C:36:39: error: singlePhaseTransportModel.H: No such file or directory In file included from /opt/openfoam210/src/finiteVolume/lnInclude/basicSourceList.H:41, from /opt/openfoam210/src/finiteVolume/lnInclude/IObasicSourceList.H:38, from buoyantSimpleFoam_Epta.C:38: /opt/openfoam210/src/finiteVolume/lnInclude/basicSource.H:49:21: error: cellSet.H: No such file or directory make: *** [Make/linux64GccDPOpt/buoyantSimpleFoam_Epta.o] Error 1 Thanks a lot, Samuele |
|
March 21, 2012, 10:18 |
|
#2 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Take a look at the .dep file in the original solver and see where it is looking for these files. Perhaps it is using a relative path and you have moved the new solver somewhere else so it can't find the files. You will need to update your Make/options file accordingly so it knows where to look.
|
|
March 21, 2012, 10:55 |
|
#3 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Kent,
thanks a lot for answering. Well, I understand what you say, but I would like to let you know that I have doubled the simpleFoam solver (calling it my_simpleFoam) and I saved it in the same directory with buoyantSimpleFoam_Epta. When I compile the my_simpleFoam, everything works properly. reading the 2 .dep files, in the my_simpleFoam.dep the cellSets.H appears Code:
. . . my_simpleFoam.dep: $(WM_PROJECT_DIR)/src/finiteVolume/lnInclude/basicSource.H my_simpleFoam.dep: $(WM_PROJECT_DIR)/src/meshTools/lnInclude/cellSet.H my_simpleFoam.dep: $(WM_PROJECT_DIR)/src/meshTools/lnInclude/topoSet.H my_simpleFoam.dep: $(WM_PROJECT_DIR)/src/finiteVolume/lnInclude/basicSourceI.H my_simpleFoam.dep: $(WM_PROJECT_DIR)/src/finiteVolume/lnInclude/basicSourceListTemplates.C . . . Any idea?? |
|
March 22, 2012, 07:04 |
The compilation is now ok
|
#4 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear all,
the compilation of the solver I am trying to set is ok. The point is that I can use it. When I try it on a case that usually works I get this error message: Code:
--> FOAM FATAL ERROR: incompatible dimensions for operation [U[1 -2 -2 0 0 0 0] ] == [U[0 1 -2 0 0 0 0] ] From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&) in file /opt/openfoam210/src/finiteVolume/lnInclude/fvMatrix.C at line 1313. Can anyone help? |
|
March 22, 2012, 07:08 |
|
#5 |
Senior Member
ata kamyabi
Join Date: Aug 2009
Location: Kerman
Posts: 323
Rep Power: 18 |
Hi
May be I do not understand you correctly but I think any solver need its .dep file independent of where the solver is copied. So, the .dep file of two solvers are different. Good luck |
|
March 22, 2012, 07:16 |
|
#6 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Ata,
thanks for your answer. Actually, I have compiled my new solver (I forgot the attachement, here it is).. Now I do have a problem when I try to use it. And the problem is the one posted above. Could you help? Thanks, Samuele |
|
March 22, 2012, 10:41 |
|
#7 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
It is complaining that the units for the equation UEqn don't match on the LHS and RHS somewhere. Looks like you've got kg/m2s2 on the left and m/s2 on the right somewhere U is being called. So what's missing? Looks like density on RHS (multiply by kg/m3 and ...).
Perhaps the problem is in the momentumPredictor section, do you have momentumPredictor on? Something may need to be changed in that if statement in UEqn.H to make it work with sources, but I am not sure offhand. Try turning off momentumPredictor in fvSolution to check if that indeed is the problem. |
|
March 22, 2012, 10:53 |
|
#8 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear Kent,
thanks again for answering. Well, I solved this point and now - in my buoyantSimplFoam_Epta I can fix the velocity in a certain region. What I can not still do is to fix the temperature. I think I have to edit (adding the source) the hEqn.H file. Is that a good way to proceed, to you? I am attaching the working solver (where you can impose the U) and the tmp version, where I am trying (without success, so far!) to be able to impose the temperature. Any idea? |
|
March 22, 2012, 10:58 |
|
#9 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Yes, you need to add sources(h) in to HEqn as you did for UEqn. Of course, in this case you already have some other source term there on the RHS. Add it in along with that one as +sources(h) and see if it works.
|
|
March 22, 2012, 11:02 |
|
#10 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
I've edited my hEqn.H file like this
Code:
{ fvScalarMatrix hEqn ( fvm::div(phi, h) - fvm::Sp(fvc::div(phi), h) - fvm::laplacian(turbulence->alphaEff(), h) == - fvc::div(phi, 0.5*magSqr(U), "div(phi,K)") + sources(h) ); hEqn.relax(); sources.constrain(hEqn()); hEqn.solve(); thermo.correct(); } Code:
lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/buoyantSimpleFoam_Epta_tmp$ wclean lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/buoyantSimpleFoam_Epta_tmp$ wmake Making dependency list for source file buoyantSimpleFoam_Epta_tmp.C SOURCE=buoyantSimpleFoam_Epta_tmp.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/turbulenceModels -I/opt/openfoam210/src/turbulenceModels/compressible/RAS/lnInclude -I/opt/openfoam210/src/finiteVolume/cfdTools -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/buoyantSimpleFoam_Epta_tmp.o In file included from buoyantSimpleFoam_Epta_tmp.C:63: hEqn.H: In function int main(int, char**): hEqn.H:13: error: no match for call to (Foam::fvScalarMatrix) () make: *** [Make/linux64GccDPOpt/buoyantSimpleFoam_Epta_tmp.o] Error 1 Thanks a lot! |
|
March 22, 2012, 11:14 |
|
#11 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
should be
sources.constrain(hEqn); I think. Does that work? |
|
March 22, 2012, 11:17 |
|
#12 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
It doesnt. If I add such a line, like:
Code:
{ fvScalarMatrix hEqn ( fvm::div(phi, h) - fvm::Sp(fvc::div(phi), h) - fvm::laplacian(turbulence->alphaEff(), h) == - fvc::div(phi, 0.5*magSqr(U), "div(phi,K)") //+ sources(h) ); hEqn.relax(); sources.constrain(hEqn()); hEqn.solve(); thermo.correct(); } Code:
lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/buoyantSimpleFoam_Epta_tmp$ wclean lab@lab-laptop:~/OpenFOAM/lab-2.1.0/applications/solvers/buoyantSimpleFoam_Epta_tmp$ wmake Making dependency list for source file buoyantSimpleFoam_Epta_tmp.C SOURCE=buoyantSimpleFoam_Epta_tmp.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam210/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam210/src/turbulenceModels -I/opt/openfoam210/src/turbulenceModels/compressible/RAS/lnInclude -I/opt/openfoam210/src/finiteVolume/cfdTools -I/opt/openfoam210/src/finiteVolume/lnInclude -I/opt/openfoam210/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam210/src/OpenFOAM/lnInclude -I/opt/openfoam210/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/buoyantSimpleFoam_Epta_tmp.o In file included from buoyantSimpleFoam_Epta_tmp.C:63: hEqn.H: In function int main(int, char**): hEqn.H:13: error: no match for call to (Foam::fvScalarMatrix) () make: *** [Make/linux64GccDPOpt/buoyantSimpleFoam_Epta_tmp.o] Error 1 |
|
March 22, 2012, 12:07 |
|
#13 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
WoW: it works, now. Just a small bug that I would like to solve, i.e. I'd like to impose the temperature and not the enthalpy..
But to get my goal this is not very important: it's just to have a `more practical' solver.. If you have any suggestion, please let me know. Also, do you know if I can share the developed sover? If so, to whom should I send it? |
|
March 22, 2012, 12:16 |
|
#14 |
Senior Member
Kent Wardle
Join Date: Mar 2009
Location: Illinois, USA
Posts: 219
Rep Power: 21 |
Glad to hear it. Well, you can always just post it here for people to grab. How to 'share' things with the main distribution is one of those things that is a little nebulous...
You may also be able to get the folks who run the openfoamwiki to include it as a contrib. Not sure how to go about that myself. |
|
March 22, 2012, 12:20 |
|
#15 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Thanks!
Attached the solver. It is possible to fix either the entahlpy or the velocity. It needs being compiled. Have fun, Samuele |
|
June 1, 2012, 10:30 |
|
#16 |
Member
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17 |
Hi,
I have a very similar problem. I would like to fix the velocity in some cells and the solver in use is buoyantBoussinesqPimpleFoam. I made the modifications to incorporate the field source addition to the existing solver: creatField.H Code:
+ IObasicSourceList sources(mesh); Code:
U = rAU*(UEqn() == sources(U))().H(); ... if (pimple.finalNonOrthogonalIter()) { // Calculate the conservative fluxes phi -= p_rghEqn.flux(); // Explicitly relax pressure for momentum corrector p_rgh.relax(); // Correct the momentum source with the pressure gradient flux // calculated from the relaxed pressure U -= rAU*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); sources.correct(U); } Code:
// Solve the momentum equation tmp<fvVectorMatrix> UEqn ( fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) ); UEqn().relax(); sources.constrain(UEqn()); if (pimple.momentumPredictor()) { solve ( UEqn() == fvc::reconstruct ( ( - ghf*fvc::snGrad(rhok) - fvc::snGrad(p_rgh) )*mesh.magSf() ) + sources(U) ); } Any help would be appreciated! |
|
June 1, 2012, 10:48 |
|
#17 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
I'll study your case, since it's that same thing that I'd like to do ..
|
|
June 5, 2012, 08:56 |
|
#18 |
Member
Norbert Weber
Join Date: May 2012
Location: Dresden, Germany
Posts: 37
Rep Power: 14 |
I am working on the same problem ...
@samiam1000: Do you have an example case to try your modified solver? Thank you!! |
|
June 5, 2012, 09:07 |
|
#19 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
For sure..
But not here. Please, give me your email and I'll share it with you asap. Have fun, Samuele |
|
June 5, 2012, 09:12 |
|
#20 | ||
Member
Norbert Weber
Join Date: May 2012
Location: Dresden, Germany
Posts: 37
Rep Power: 14 |
@Toorop: There may be an error in the line
Quote:
Quote:
|
|||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] A New Solver for Supersonic Combustion | nakul | OpenFOAM Community Contributions | 20 | February 22, 2019 10:08 |
Quarter Burner mesh with periosic condition | SamCanuck | FLUENT | 2 | August 31, 2011 12:34 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |
why the solver reject it? Anyone with experience? | bearcat | CFX | 6 | April 28, 2008 15:08 |
Programming a coupled solver | didomenico | OpenFOAM Running, Solving & CFD | 1 | March 5, 2006 04:04 |