CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[waves2Foam] New wave theory coded in FORTRAN, how to add to waves2Foam?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 28, 2017, 05:06
Default New wave theory coded in FORTRAN, how to add to waves2Foam?
  #1
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 8
Kun_zheng is on a distinguished road
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
Kun_zheng is offline   Reply With Quote

Old   August 28, 2017, 10:32
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   August 29, 2017, 04:19
Default
  #3
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 8
Kun_zheng is on a distinguished road
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
Kun_zheng is offline   Reply With Quote

Old   August 29, 2017, 06:01
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   August 29, 2017, 14:11
Default
  #5
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 8
Kun_zheng is on a distinguished road
Quote:
Originally Posted by ngj View Post
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
Hi Niels,

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
Kun_zheng is offline   Reply With Quote

Old   August 29, 2017, 15:41
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   August 30, 2017, 04:58
Default
  #7
New Member
 
Kun Zheng
Join Date: May 2017
Location: Harbin, China
Posts: 20
Rep Power: 8
Kun_zheng is on a distinguished road
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
Kun_zheng is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[PyFoam] and paraview eelcovv OpenFOAM Community Contributions 28 May 30, 2016 09:23
Waves2Foam help needed, inserting multiple wave probes chia87 OpenFOAM Running, Solving & CFD 1 February 10, 2016 04:15
Add a FORTRAN object to wmake compilation directives vitors OpenFOAM Programming & Development 1 April 9, 2014 14:25
How to call FORTRAN files as UDF? Ehsan-F Fluent UDF and Scheme Programming 6 September 11, 2012 11:03
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56


All times are GMT -4. The time now is 06:26.