Errors when using slightly modified solver libraries

Discussion about coding and new developments
Post Reply
ka1
Posts: 3
Joined: 07 Aug 2010, 23:22

Errors when using slightly modified solver libraries

Post by ka1 »

Hi everyone,

I'd like to write a slightly modified StatElecSolver. I downloaded the Elmer binaries (Windows XP workstation) and the source code of Elmer Solver (5.4.0). I made some changes (just adding some CALL Info(...)) to StatElecSolve.src so I could see whether it works. After compiling the source code and replacing the installed library with the compiled one I ran the solver but it crashed. The error seems to occur when the library tries to access the 'Variable' field in the 'Solver' structure for the first time (Potential => ...). Using the compiled version of Elmer Solver instead of the binary included in the installation package didn't prevent a crash either. Apparently the GetSolverParams() function is not used, which disagrees with the Solver Manual (section ‘Basic Programming’ – 'Writing a Solver').

What is wrong with the source code (or me)? Does anyone know how to fix this? I'd be happy about any advice.

Thanks a lot in advance.
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Errors when using slightly modified solver libraries

Post by raback »

Hi

Modifiying just a solver (all those in Models Manual) is not that complicated. The following instructions for Windows will enable you to work with the up to date stuff, rather than some old tar ball. The Windows version includes a consistant gfortran solver so you do not need to install it.
  • Download latest Windows binary from https://sourceforge.net/projects/elmerfem/ and install it
  • Get the solver of interest from http://elmerfem.svn.sourceforge.net/vie ... k/fem/src/
  • Copy the .src file with suffix .f90 to your case directory
  • In ElmerGUI in "Run -> Compiler" open the .f90 and compile it OR in the command line say "elmerf90 MySolver.f90 -o MySolver.so"
  • Change the solver path in the .sif file to include the root directory i.e. Procedure ="MySolver" ... -> Procedure ="./MySolver" ...
You case should now work with a local version of the solver which you can freely manipulate.

-Peter
ka1
Posts: 3
Joined: 07 Aug 2010, 23:22

Re: Errors when using slightly modified solver libraries

Post by ka1 »

Thank you, everything works very well now.
Post Reply