|
[Sponsors] |
[waves2Foam] New wave theory coded in FORTRAN, how to add to waves2Foam? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9 ![]() |
Hi all,
I want to add a new wave theory to waves2Foam. Did anyone know how to do it? The wave theory is not analytic, I have a fortran code to calculated it every time step. What I want is to add the subroutines of fortran code to the waves2Foam. I think it is possible to compile the fortran code into an object file. Then link the Cpp file and object file. But I failed. If anyone know how to do it, could you please give me some guidances. Thank you for your time! Kun |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 ![]() ![]() |
Hi Kun,
You most likely need to create an interface between fortran and C++; at least this was the approach taken for OceanWave3D. Consequently, I can only recommend that you look into both the source code of OceanWave3D and the external wave theory oceanWave3D to get a feel for the coupling. In the present implementation, OceanWave3D exists as a library, which is executed through OpenFoam. May I ask what the external method does? 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. |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9 ![]() |
Hi Niels,
I find it. I think that is what I need. Thank you ! The external model I used is named Green Naghdi equations. It is a strong nonlinear wave model. Best regards, Kun |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 ![]() ![]() |
Hi Kun,
That is very interesting. If you get it to work, it would be great to include in waves2Foam. Please consider. 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. |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
New Member
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9 ![]() |
Quote:
After a minor modification, I get trouble in running the case " couplingOceanWave3D ". Could you see what I did and help me fix the trouble ? Under your suggestion, I find the source code of OceanWave3D in " **/waves2Foam/ThirdParty/OceanWave3D-Fortran90/src/main ". So I add a fortran code of " hello world " to test what would happen if a new subroutine is added in " oceanWave3D.C ". And then the test-subroutine is called in "oceanWave3D.C" like other previous subroutines. After that I re-compile the " **/waves2Foam/ThirdParty " and the " **/waves2Foam/src ". No errors came out till now. Then I run the case "couplingOceanWave3D", the log of setWaveField says: " symbol lookup error: **/platforms/linux64GccDPInt32Opt/lib/libwaves2Foam.so: undefined symbol: test " But there was no errors when I compile the lib. I do not understand what was wrong. Could you help me ? Thank you very much for your time ! Best regards, Kun |
||
![]() |
![]() |
![]() |
![]() |
#6 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 ![]() ![]() |
Hi Kun,
The compilation gets a new pull from the git for OceanWave3D every time, so that might overwrite your modifications. I did not make the fortran side of the coupling, so I can only hypothesise on how things work. Right now, I do not have a good suggestion besides making a simpler test outside of OceanWave3D source. 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. |
|
![]() |
![]() |
![]() |
![]() |
#7 |
New Member
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 9 ![]() |
Hi Niels,
Yes, I have checked the modification. It is still there. Thank you so much, you really help a lot ! I think I have to do more tests to find out where is the problem. Hope to make a progress soon. Best regards, Kun |
|
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[PyFoam] and paraview | eelcovv | OpenFOAM Community Contributions | 28 | May 30, 2016 10:23 |
Waves2Foam help needed, inserting multiple wave probes | chia87 | OpenFOAM Running, Solving & CFD | 1 | February 10, 2016 05:15 |
Add a FORTRAN object to wmake compilation directives | vitors | OpenFOAM Programming & Development | 1 | April 9, 2014 15:25 |
How to call FORTRAN files as UDF? | Ehsan-F | Fluent UDF and Scheme Programming | 6 | September 11, 2012 12:03 |
CFX11 + Fortran compiler ? | Mohan | CFX | 20 | March 30, 2011 19:56 |