|
[Sponsors] |
[waves2Foam] Question about the integration of moving mesh cases to waves2Foam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 27, 2018, 10:23 |
Question about the integration of moving mesh cases to waves2Foam
|
#1 |
New Member
Simon J S
Join Date: May 2018
Location: Edinburgh
Posts: 11
Rep Power: 8 |
Edit: I am aware that this question has been discussed here before with a user named Fauster, however I could not find the actual solution to his issue anywhere.
Hello Niels, I have a question about the integration of moving mesh cases to waves2Foam. I followed your user manual for the ompiling of waveDyMFoam, but a few things there are a bit hard to follow for me. First of all, this is the content of my interDyMFoam folder, as found in OpenFOAM v 1712 Code:
/home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/interDyMFoam correctPhi.H createDyMControls.H interDyMFoam.C Make pEqn.H readControls.H Code:
============ BEGIN: alphaCourantNo.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/alphaCourantNo.H: No such file or directory ============= END: alphaCourantNo.H ============= ============ BEGIN: alphaEqn.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/alphaEqn.H: No such file or directory ============= END: alphaEqn.H ============= ============ BEGIN: alphaEqnSubCycle.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H: No such file or directory ============= END: alphaEqnSubCycle.H ============= ============ BEGIN: alphaSuSp.H ============ ============= END: alphaSuSp.H ============= ============ BEGIN: correctPhi.H ============ ============= END: correctPhi.H ============= ============ BEGIN: createAlphaFluxes.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/createAlphaFluxes.H: No such file or directory ============= END: createAlphaFluxes.H ============= ============ BEGIN: createFields.H ============ 81,86c81,83 < //#include "readGravitationalAcceleration.H" < //#include "readhRef.H" < //#include "gh.H" < volScalarField gh("gh", g & (mesh.C() - referencePoint)); < surfaceScalarField ghf("ghf", g & (mesh.Cf() - referencePoint)); < --- > #include "readGravitationalAcceleration.H" > #include "readhRef.H" > #include "gh.H" 143,144d139 < < relaxationZone relaxing(mesh, U, alpha1); ============= END: createFields.H ============= ============ BEGIN: pEqn.H ============ ============= END: pEqn.H ============= ============ BEGIN: rhofs.H ============ ============= END: rhofs.H ============= ============ BEGIN: setDeltaT.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/setDeltaT.H: No such file or directory ============= END: setDeltaT.H ============= ============ BEGIN: setRDeltaT.H ============ diff: /home/simon/OpenFOAM/OpenFOAM-v1712/applications/solvers/multiphase/interFoam/setRDeltaT.H: No such file or directory ============= END: setRDeltaT.H ============= ============ BEGIN: UEqn.H ============ ============= END: UEqn.H ============= ============ BEGIN: waveFoam.C ============ 56,58d55 < #include "relaxationZone.H" < #include "externalWaveForcing.H" < 62a60 > #include "postProcess.H" 67d64 < 71,75d67 < < #include "readGravitationalAcceleration.H" < #include "readWaveProperties.H" < #include "createExternalWaveForcing.H" < 80d71 < #include "postProcess.H" 84,87c75,80 < #include "readTimeControls.H" < #include "CourantNo.H" < #include "setInitialDeltaT.H" < --- > if (!LTS) > { > #include "readTimeControls.H" > #include "CourantNo.H" > #include "setInitialDeltaT.H" > } 97,99c90,99 < #include "CourantNo.H" < #include "alphaCourantNo.H" < #include "setDeltaT.H" --- > if (LTS) > { > #include "setRDeltaT.H" > } > else > { > #include "CourantNo.H" > #include "alphaCourantNo.H" > #include "setDeltaT.H" > } 105,106d104 < externalWave->step(); < 113,114d110 < relaxing.correct(); < 142,144d137 < < // Close down the external wave forcing in a nice manner < externalWave->close(); ============= END: waveFoam.C ============= /home/simon/OpenFOAM/simon-v1712/applications/utilities/waves2Foam/applications/solvers/solvers1712_PLUS/waveDyMFoam directory? These are for example setDeltaT.H and createFields.H If that is the case, the only file I would actually have to adapt would be interDyMFoam.C, which would have to be renamed into waveDyMFoam.C and then adapted, according to the last section of the comparFiles.sh-output? Thanks a lot for supplying and maintaining this toolbox, and all the support you are giving here! Cheers, Simon |
|
June 28, 2018, 04:05 |
|
#2 |
Member
P.A.
Join Date: Mar 2009
Location: Germany
Posts: 83
Rep Power: 17 |
Hi Simon,
I want to share the solution I came up together with a colleague of mine, in the hope that it will be helpful to others. This is for the integration of dynamic mesh movement into waves2Foam in OpenFOAM-v1712. 1. Create a folder parallel to the waveFoam folder. I called it "waveInterFoam". This gives a directory: waves2Foam/applications/solvers/solvers1712_PLUS/waveInterFoam 2. Copy all the contents (not the directory itself!) from directory OpenFOAM-v1712/applications/solvers/multiphase/interFoam into this new folder. As I don't want to use overInterDyMFoam and interMixingFoam for now, I deleted those two directories from this folder, just for the sake of clarity (not necessary though). 3. The directory now looks like: Code:
drwxr-xr-x 4 ofuser users 4096 26. Jun 14:16 . drwxr-xr-x 6 ofuser users 4096 26. Jun 14:16 .. -rw-r--r-- 1 ofuser users 44 26. Jun 14:16 alphaSuSp.H -rw-r--r-- 1 ofuser users 169 26. Jun 14:16 correctPhi.H -rw-r--r-- 1 ofuser users 2530 26. Jun 14:16 createFields.H -rwxr-xr-x 1 ofuser users 322 26. Jun 14:16 diff_script.sh drwxr-xr-x 3 ofuser users 4096 26. Jun 14:16 interDyMFoam drwxr-xr-x 3 ofuser users 4096 27. Jun 10:03 Make -rw-r--r-- 1 ofuser users 1567 26. Jun 14:16 pEqn.H -rw-r--r-- 1 ofuser users 76 26. Jun 14:16 rhofs.H -rw-r--r-- 1 ofuser users 654 26. Jun 14:16 UEqn.H -rw-r--r-- 1 ofuser users 4197 26. Jun 14:16 waveFoam.C Code:
//#include "readGravitationalAcceleration.H" //#include "readhRef.H" //#include "gh.H" volScalarField gh("gh", g & (mesh.C() - referencePoint)); surfaceScalarField ghf("ghf", g & (mesh.Cf() - referencePoint Code:
relaxationZone relaxing(mesh, U, alpha1); Edit like we did in the attached waveFoam.C file. This essentially is identical to the changes applied in the original waveFoam.C code, so you could actually just copy the original waveFoam.C file to our waveInterFoam folder. Edit Make/files so that it reads Code:
waveFoam.C EXE = $(FOAM_APPBIN)/waveFoam I am not entirely sure if this step is really necessary, as it seems to simply create a duplicate of waveFoam. Perhaps Niels could clarify this? 6. Edit the file Make/options: Code:
EXE_INC = \ -I$(FOAM_SOLVERS)/multiphase/VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -DOFVERSION=1712 \ -DEXTBRANCH=0 \ -DOFPLUSBRANCH=1 \ -DXVERSION=$(WAVES_XVERSION) \ -I$(WAVES_SRC)/waves2Foam/lnInclude \ -I$(WAVES_SRC)/waves2FoamSamplingNew/lnInclude \ -I$(WAVES_GSL_INCLUDE) EXE_LIBS = \ -limmiscibleIncompressibleTwoPhaseMixture \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lfiniteVolume \ -lfvOptions \ -lmeshTools \ -lsampling \ -L$(WAVES_LIBBIN) \ -lwaves2Foam \ -lwaves2FoamSampling \ -L$(WAVES_GSL_LIB) \ -lgsl \ -lgslcblas Then run wmake. This is all to be done in this directory. Now change to folder interDyMFoam. 7. Rename interDyMFoam.C to waveDyMFoam.C. Apply the changes like we did in the attached waveDyMFoam.C file. 8. Edit the file Make/files: Code:
waveDyMFoam.C EXE = $(FOAM_APPBIN)/waveDyMFoam 9. Edit the file Make/options: Code:
EXE_INC = \ -I. \ -I.. \ -I$(FOAM_SOLVERS)/multiphase/VoF \ -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/immiscibleIncompressibleTwoPhaseMixture/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -DOFVERSION=1712 \ -DEXTBRANCH=0 \ -DOFPLUSBRANCH=1 \ -DXVERSION=$(WAVES_XVERSION) \ -I$(WAVES_SRC)/waves2Foam/lnInclude \ -I$(WAVES_SRC)/waves2FoamSamplingNew/lnInclude \ -I$(WAVES_GSL_INCLUDE) EXE_LIBS = \ -limmiscibleIncompressibleTwoPhaseMixture \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lfiniteVolume \ -ldynamicMesh \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ -lmeshTools \ -lfvOptions \ -lsampling \ -L$(WAVES_LIBBIN) \ -lOceanWave3D \ -Lwaves2Foam \ -Lwaves2FoamSampling \ -lwaves2FoamProcessing \ -L$(WAVES_GSL_LIB) \ -lgsl \ -lgslcblas Again: open a new terminal window and change to this directory again. Then run wmake. Additionally you should add the following to the controlDict of your cases, if you want to use the runtime surface sampling feature: Code:
libs ( "libwaves2FoamSampling.so" ); Good luck and best regards, Pascal. -- |
|
June 28, 2018, 06:34 |
|
#3 | |
New Member
Simon J S
Join Date: May 2018
Location: Edinburgh
Posts: 11
Rep Power: 8 |
Quote:
Edit: When applying your changes I saw that you apparently deleted one line in the Make/options files when adding the new lines at the very end of the file. The line - lwaveModels is not in your code fragment. I suppose that got lost in the pasting process. Hi Pascal, thanks for this very thorough explanation. The way this looks to me however, you are basically creating a second directory (waveInterFoam) like waveFoam, without the additional files (alphaCourantNo.H etc). All the exisitng files however should be the same as the ones found in waveFoam. In that case could it be possible, that just copying interDyMFoam into waveFoam, and making the necessary changes only in this subfolder solver1712_PLUS/waveFoam/interDyMFoam? But before I try it, have you done that already and found that it doesn't work? Kind regards, Simon |
||
June 28, 2018, 10:56 |
|
#4 | |
New Member
Simon J S
Join Date: May 2018
Location: Edinburgh
Posts: 11
Rep Power: 8 |
Quote:
Hi Pascal, I tried both options. First I just copied the whole interFoam folder into solvers1712_PLUS and applied the changes. In another try I just took the adapted interDyMFolder and placed it in the existing waveFoam directory. Both times I got the same error message Code:
In file included from /home/simon/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/postProcess.H:129:0, from waveDyMFoam.C:56: ../createFields.H: In function ‘int main(int, char**)’: ../createFields.H:84:25: error: ‘g’ was not declared in this scope volScalarField gh("gh", g & (mesh.C() - referencePoint)); ^ ../createFields.H:84:41: error: ‘referencePoint’ was not declared in this scope volScalarField gh("gh", g & (mesh.C() - referencePoint)); ^ In file included from /home/simon/OpenFOAM/OpenFOAM-v1712/src/OpenFOAM/lnInclude/postProcess.H:129:0, from waveDyMFoam.C:56: ../createFields.H:144:1: error: ‘relaxationZone’ was not declared in this scope relaxationZone relaxing(mesh, U, alpha1); ^ In file included from waveDyMFoam.C:65:0: ../createFields.H:84:25: error: ‘g’ was not declared in this scope volScalarField gh("gh", g & (mesh.C() - referencePoint)); ^ ../createFields.H:84:41: error: ‘referencePoint’ was not declared in this scope volScalarField gh("gh", g & (mesh.C() - referencePoint)); ^ In file included from waveDyMFoam.C:65:0: ../createFields.H:144:1: error: ‘relaxationZone’ was not declared in this scope relaxationZone relaxing(mesh, U, alpha1); ^ waveDyMFoam.C:138:43: error: ‘ghRef’ was not declared in this scope gh = (g & mesh.C()) - ghRef; ^ /home/simon/OpenFOAM/OpenFOAM-v1712/wmake/rules/General/transform:28: recipe for target 'Make/linux64GccDPInt32Opt/waveDyMFoam.o' failed make: *** [Make/linux64GccDPInt32Opt/waveDyMFoam.o] Error 1 The changes made to the createFields.H file seem to be causing errors, since the used variables are not declared. Do I have to add som #include lines at the top or are the files maybe required in the directory I am trying to compile? Sorry but I am a bit lost here. Also it all seems to be quite far off from the description in the user manual. Niels, do you know what might be causing the trouble? Or could you maybe upload an overview of your solver1712_PLUS directory with the changes necessary for waveDyMFoam to github? That would be really great! Thanks a lot everyone for your help. Cheers, Simon |
||
June 29, 2018, 03:57 |
|
#5 |
Member
P.A.
Join Date: Mar 2009
Location: Germany
Posts: 83
Rep Power: 17 |
Hi Simon,
the linker directive -lwaveModels was not lost accidentally. As far as I understand it, this links the wave models of OpenFOAM-v1712 into the waves2Foam library, thereby superseding wave2Foam's own wave models. Therefore things like 'relaxationZone" are not known to the compiler, as the wave modeling in OpenFOAM-v1712 obviously works differently. Hope that helps! Cheers, Pascal. -- |
|
June 29, 2018, 04:48 |
|
#6 | |
Member
P.A.
Join Date: Mar 2009
Location: Germany
Posts: 83
Rep Power: 17 |
Quote:
you may be right, but I can't remember if I tried it before or not. Looking again on the differences between the interFoam directory and the waveFoam directory there are four files (alphaCourantNo.H, alphaEqn.H, alphaEqnSubCycle.H, and createAlphaFluxes.H) that are not in the interFoam directory. I did not copy these files into my waveInterFoam directory. Instead of this I added the first line in the waveInterFoam/Make/options file, which includes these files in a similar way as the original interFoam/Make/options file does: Code:
In interFoam: EXE_INC = \ -I../VoF \ In waveInterFoam: EXE_INC = \ -I$(FOAM_SOLVERS)/multiphase/VoF \ So perhaps your approach turns out to be more elegant... let me know! :-) I am by far not an expert on these things, I admit I do a lot of trial and error, trying to draw my conclusions from the outcomes. Cheers, Pascal. -- |
||
June 29, 2018, 14:01 |
|
#7 | |
New Member
Simon J S
Join Date: May 2018
Location: Edinburgh
Posts: 11
Rep Power: 8 |
Quote:
Hello Pascal, thanks a lot for all your tips. I figured everything out and set it up the way you explained it. In the end I just had two mistakes. First I had some errors in my waveDyMFoam.C script. The second one took me much longer. I actually never sourced the waves2Foam/bin/bashrc file. I always got the error message telling me that realaxationTime.H was missing. This was because I always ran the script with ./bashrc instead of . bashrc (or source bashrc) Well I guess you learn something new every day. Anyways I am quite keen to start working with the tool now! Have a nice weekend everyone. Cheers, Simon |
||
July 31, 2018, 08:04 |
SVN not available
|
#8 |
New Member
Simon J S
Join Date: May 2018
Location: Edinburgh
Posts: 11
Rep Power: 8 |
EDIT: Problem is resolved. The svn server is available again.
Hello Niels, could it be that there is a problem with the SVN server at the moment? I tried to install waves2Foam on our HPC cluster today and got an error message Code:
svn: E170013: Unable to connect to a repository at URL 'http://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder_1.6/other/waves2Foam' Is the current version of the source code available on github maybe? Or is there a way that I can copy it from my own PC, where waves2Foam is already compiled? Thanks a lot, regards Simon Last edited by oceanFoam; July 31, 2018 at 12:49. Reason: Problem solved |
|
January 4, 2021, 10:30 |
‘g’ was not declared in this scope
|
#9 |
Member
le
Join Date: Nov 2009
Location: seoul
Posts: 34
Rep Power: 17 |
Hello Simon
I compile wave2foam and interFoam in OF1812 and I got error as: /home/leqt/OpenFOAM/leqt-v1812/applications/utilities/waves2Foam/src/waves2Foam/lnInclude/readWaveProperties.H:27:38: error: ‘g’ was not declared in this scope referencePoint.value() = g.value()/Foam::mag(g.value()); Could you tell me how to sourcewaves2Foam/bin/bashrc file, please. Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Gambit problems | Althea | FLUENT | 22 | January 4, 2017 04:19 |
[mesh manipulation] Importing Multiple Meshes | thomasnwalshiii | OpenFOAM Meshing & Mesh Conversion | 18 | December 19, 2015 19:57 |
[Other] How to set up a dynamic mesh for a piston moving through a tube of variable diameter? | karkar | OpenFOAM Meshing & Mesh Conversion | 0 | July 4, 2012 07:54 |
a question about moving mesh | xck1986 | OpenFOAM | 0 | February 23, 2011 05:33 |
Icemcfd 11: Loss of mesh from surface mesh option? | Joe | CFX | 2 | March 26, 2007 19:10 |