Compiling User defined solver

Discussion about coding and new developments
Post Reply
Posts: 3
Joined: 25 Sep 2020, 11:24
Antispam: Yes

Compiling User defined solver

Post by hisham.noaman »

Hi All

i am using Elmer and i want to defined a user defined solver, so i just wrote the code in fortran and compile it with the compiler wrapper provided by Elmer, using elmerf90 mysolver.f90 -o mysolver, but the problem is that i want to link another library to the user defined solver. In other program written using Fortran, i just link it when i build the code using cmake, the cmake file as follows

find_package(precice REQUIRED CONFIG)

add_executable(solverdummy solverdummy.f90)

So my preinstalled library precice is linked to the fortran executable, so i want to link the User defined solver with this precice library but i do not have access to the wrapper script to modify it. So how to do that. Thanks in advance.

Posts: 667
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Compiling User defined solver

Post by kevinarden »

In fortran if you want to compile several programs into one exectuable you list them all

elmerf90 proga.f90 progb.f90 progc.f90 -o myprog

if the other programs(libraries) are compiled objects then provide the compiled object files

elmerf90 proga.f90 -o myprog progb.o progc.o

if they are compiled libraries then

elmerf90 -o output mainprogram.f90 libABC.a
Post Reply