Closed iuryt closed 3 years ago
Hi Iury
That sounds great. I know of MITgcm - but do not know it. How is the build system - Makefile based?
GOTM builds via CMake and can install module-files and libraries in any location you prefer and then you can use standard Make variables to point to those dirs. In this case you'll pre-compile GOTM.
If MITgcm uses CMake (and I doubt it) you can compile the GOTM library as part of the normal compilation by adding the GOTM directory via the CMake add_subdirectory command.
Karsten
Thank you very much for your response.
In fact, MITgcm do not build via CMake, so I will be following your first suggestion.
That's the MITgcm build option I am using to pass GOTM paths https://github.com/MITgcm/MITgcm/blob/master/tools/build_options/linux_amd64_gfortran
I am planning to simply add INC and LIB folders from GOTM as
INCLUDES+=" -I$GOTM_INC_DIR"
LIBS+=" -L$GOTM_LIB_DIR"
On PSOM, they pass the following paths from GOTM 4.0.0
gotm_dir_lib=-L/Users/mclaret/PSOM/gotm-4.0.0/lib/IFORT/ -lturbulence_prod -lutil_prod -lmeanflow_prod
gotm_dir_inc= -I/Users/mclaret/PSOM/gotm-4.0.0/modules/IFORT
I compiled GOTM with gfortran
and I could find the modules
directory inside build
, but I could not find the lib folder in the latest version. How should I manage that?
Try - make install
lør. 22. maj 2021 16.58 skrev iury simoes-sousa @.***>:
Thank you very much for your response.
In fact, MITgcm do not build via CMake, so I will be following your first suggestion.
That's the MITgcm build option I am using to pass GOTM paths
https://github.com/MITgcm/MITgcm/blob/master/tools/build_options/linux_amd64_gfortran
I am planning to simply add INC and LIB folders from GOTM as
INCLUDES+=" -I$GOTM_INC_DIR" LIBS+=" -L$GOTM_LIB_DIR"
On PSOM, they pass the following paths from GOTM 4.0.0
gotm_dir_lib=-L/Users/mclaret/PSOM/gotm-4.0.0/lib/IFORT/ -lturbulence_prod -lutil_prod -lmeanflow_prod gotm_dir_inc= -I/Users/mclaret/PSOM/gotm-4.0.0/modules/IFORT
I compiled GOTM with gfortran and I could find the modules directory inside build, but I could not find the lib folder in the latest version. How should I manage that?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gotm-model/code/issues/23#issuecomment-846419885, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVA42JPWKJHURNDXC7QXELTO7BAVANCNFSM45KA6UXQ .
I should have tried it before. XD It worked and I now have both directories on MITgcm build option.
For some reason it still couldn't find the modules, but now its in MITgcm's side. I will try it again and if it doesn't work I will try to contact them.
@bolding
Before actually coupling to MITgcm
, I am trying to simply create a .F
file with use turbulence
and try to compile using mpif77
passing the INC
folder from GOTM
.
Following the way they do for MITgcm
, I am first running
cat couple_gotm.F | cpp -traditional -P -DWORDLENGTH=4 -DNML_TERMINATOR -DALLOW_USE_MPI -DHAVE_SYSTEM -DHAVE_FDATE -DHAVE_ETIME_SBR -DHAVE_CLOC -DHAVE_SETRLSTK -DHAVE_SIGREG -DHAVE_STAT -DHAVE_NETCDF -DHAVE_FLUSH -I/share/pkg/netcdf-fortran/4.5.3/include -I/share/pkg/openmpi/2.1.3/include -I/home/is96d/local/gotm/include | ../../../tools/set64bitConst.sh > couple_gotm.f
Then I run
mpif77 -fconvert=big-endian -fimplicit-none -mcmodel=medium -O3 -funroll-loops -c couple_gotm.f
That is returning
couple_gotm.f:1:1:
use turbulence
1
Error: Non-numeric character in statement label at (1)
couple_gotm.f:1:1:
use turbulence
1
Error: Unclassifiable statement at (1)
Do you have any suggestion for doing that?
In modern days you would not need to do the 'cat ...' manually - .F (capital f) will be pre-processed automatically. But then all pre-processor settings must be defined in the Makefile.
The error indicates that 'couple_gotm.f:1:1:' is verbatim in the Fortran file - and that is not valid Fortran. Hence the error.
Anyway - I think we are moving away from GOTM now and more into MITgcm land.
I get the impression that the compiler interprets the file as Fortran 77 code, but “use …” is Fortran 90. The reason could be that you’ve used a .f file extension – for Fortran 90 .f90 or .F90 is the norm – and/or the use of a compiler wrapper (mpif77) that explicitly targets Fortran 77. So I would try renaming the file to couple_gotm.f90 and/or use mpif90.
Cheers,
Jorn
I think you are correct. I tested with
cat couple_gotm.F90 | cpp -traditional -P -DWORDLENGTH=4 -DNML_TERMINATOR -DALLOW_USE_MPI -DHAVE_SYSTEM -DHAVE_FDATE -DHAVE_ETIME_SBR -DHAVE_CLOC -DHAVE_SETRLSTK -DHAVE_SIGREG -DHAVE_STAT -DHAVE_NETCDF -DHAVE_FLUSH -I/share/pkg/netcdf-fortran/4.5.3/include -I/share/pkg/openmpi/2.1.3/include -I/home/is96d/local/gotm/include | ../../../tools/set64bitConst.sh > couple_gotm.f90
and
mpif90 -fconvert=big-endian -fimplicit-none -mcmodel=medium -O3 -funroll-loops -c couple_gotm.f90
which returns
f951: Error: Unexpected end of file in ‘couple_gotm.f90’
So I believe it could import turbulence
properly.
I will now check with them how to compile MITgcm
with mpif90
.
Should I keep this issue open? I'm not not very sure how this discussion should end because I made it too general. But I think that in summary, there are two options for coupling GOTM to a GCM, from @bolding comments.
GOTM builds via CMake and can install module-files and libraries in any location you prefer and then you can use standard Make variables to point to those dirs. In this case you'll pre-compile GOTM.
If the GCM use CMake you can compile the GOTM library as part of the normal compilation by adding the GOTM directory via the CMake add_subdirectory command.
I would suggest then calling do_turbulence
to update mixing coefficients for each timestep based on the way it is done in
https://github.com/PSOM/V0.63/blob/master/code/model/src/couple_gotm.f90
Thanks @jornbr and @bolding for your patience.
I think we have reach the end of the GOTM support :-) So I close.
Hi,
I am planning to couple GOTM to MITgcm following the way it's done by PSOM https://github.com/PSOM/V0.63/blob/master/code/model/src/couple_gotm.f90
I've noticed that they add an include and lib directories in their optfile https://github.com/PSOM/V0.63/blob/master/code/optfile
But I couldn't find the lib directory in the build directory I compiled the current version of GOTM. Only the modules directory.
My plan is to call do_turbulence inside MITgcm code at each timestep to update viscosity and diffusion coefficients using the setup from gotmturb.nml.
I would like to know what is the best way to do that.