Hello,

I wrote a class for set up initial values and called it by 
              system.attach_init_function (init_sys);

Here is the part of init_sys

void init_sys(EquationSystems& es,const std::string& system_name)
{
    System & system =
        es.get_system<System>(system_name);
    vector< string > formulas;
    boost::split(formulas, system_name, boost::is_any_of("_"), 
token_compress_on );

    if(boost::iequals(formulas[0], string("ns")))
    {
//        TransientNonlinearImplicitSystem & system =
//            es.get_system<TransientNonlinearImplicitSystem>(system_name);
        system.project_solution(init_value, NULL, es.parameters); // run-time 
error by petsc, segfault
        cout<<"init_sys OK, "<<system_name<<endl; // this line never run due to 
the following error
    }
    else
    {
      cout<<"unknown type from system_name yet"<<endl;
      exit(-1);
    }
}

Number init_value (const Point& p,
                   const Parameters& parameters,
                   const std::string& sysname,
                   const std::string& varname)
{
    auto _func=_init_conditioner->get_func(sysname,varname);

    if(!_func)
    {
        std::cerr<<"!!! init_value(...): _func is nullptr"<<endl;
        exit(-1);
    }

    Real _time =parameters.get<Real> ("time");
    Number result=(*_func)(p, _time);
    ipoint++;
#if 1 
    cout<< sysname<<"."<<varname<<":";
    cout<<"("<<p(0)<<","<<p(1)<<","<<p(2)<<"), "
        <<"t= "<<_time
        <<", value= "<<result
        <<", ipoint="<<ipoint<<endl;
#endif
    return result;
}

The whole code is cuessfully built and linked.
Now the question is when it runs, in the main() function 
errors aborted the run when it reached
    equation_systems.init ();
Then I located the error more precisely, say, 
the above system.project_solution() in init_sys was partly executed.

I am sorry the original codes is long enough, but if any of you think it 
necessary,
I can upload it afterwards,

Here are some screenshot of the errors:

ns_0.v:(5.98457,4.68673,0), t= 0, value= 0.069756, ipoint=783857
ns_0.v:(5.87916,4.9296,0), t= 0, value= 0.069756, ipoint=783858
ns_0.v:(5.93191,4.9295,0), t= 0, value= 0.069756, ipoint=783859
ns_0.v:(5.98465,4.92939,0), t= 0, value= 0.069756, ipoint=783860
ns_0.p:(5.86218,4.37566,0), t= 0, value= 0, ipoint=783861
ns_0.p:(6,4.37319,0), t= 0, value= 0, ipoint=783862
ns_0.p:(6,5,0), t= 0, value= 0, ipoint=783863
ns_0.p:(5.86402,5,0), t= 0, value= 0, ipoint=783864
[0]PETSC ERROR: 
------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably 
memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see 
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC ERROR: or 
try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory 
corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run 
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: --------------------- Error Message 
------------------------------------
[0]PETSC ERROR: Signal received!
[0]PETSC ERROR: 
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.4.2, Jul, 02, 2013 
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR: 
------------------------------------------------------------------------
[0]PETSC ERROR: ./icaruslm on a linux-gnu-c-opt named hp820g1 by zhenyu Mon Apr 
20 20:54:27 2015
[0]PETSC ERROR: Libraries linked from 
/build/buildd/petsc-3.4.2.dfsg1/linux-gnu-c-opt/lib
[0]PETSC ERROR: Configure run at Tue Apr 29 01:14:41 2014
[0]PETSC ERROR: Configure options --with-shared-libraries --with-debugging=0 
--useThreads 0 --with-clanguage=C++ --with-c-support 
--with-fortran-interfaces=1 --with-mpi-dir=/usr/lib/openmpi --with-mpi-shared=1 
--with-blas-lib=-lblas --with-lapack-lib=-llapack --with-blacs=1 
--with-blacs-include=/usr/include 
--with-blacs-lib="[/usr/lib/libblacsCinit-openmpi.so,/usr/lib/libblacs-openmpi.so]"
 --with-scalapack=1 --with-scalapack-include=/usr/include 
--with-scalapack-lib=/usr/lib/libscalapack-openmpi.so --with-mumps=1 
--with-mumps-include=/usr/include 
--with-mumps-lib="[/usr/lib/libdmumps.so,/usr/lib/libzmumps.so,/usr/lib/libsmumps.so,/usr/lib/libcmumps.so,/usr/lib/libmumps_common.so,/usr/lib/libpord.so]"
 --with-umfpack=1 --with-umfpack-include=/usr/include/suitesparse 
--with-umfpack-lib="[/usr/lib/libumfpack.so,/usr/lib/libamd.so]" 
--with-cholmod=1 --with-cholmod-include=/usr/include/suitesparse 
--with-cholmod-lib=/usr/lib/libcholmod.so --with-spooles=1 
--with-spooles-include=/usr/includ
 e/spooles --with-spooles-lib=/usr/lib/libspooles.so --with-hypre=1 
--with-hypre-dir=/usr --with-ptscotch=1 
--with-ptscotch-include=/usr/include/scotch 
--with-ptscotch-lib="[/usr/lib/libptesmumps.so,/usr/lib/libptscotch.so,/usr/lib/libptscotcherr.so]"
 --with-fftw=1 --with-fftw-include=/usr/include 
--with-fftw-lib="[/usr/lib/x86_64-linux-gnu/libfftw3.so,/usr/lib/x86_64-linux-gnu/libfftw3_mpi.so]"
 --CXX_LINKER_FLAGS=-Wl,--no-as-needed
[0]PETSC ERROR: 
------------------------------------------------------------------------
[0]PETSC ERROR: User provided function() line 0 in unknown directory unknown 
file
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD 
with errorcode 59.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
...

--------------------------------------------------------------------------
mpirun has exited due to process rank 0 with PID 7386 on
node hp820g1 exiting improperly. There are two reasons this could occur:

1. this process did not call "init" before exiting, but others in
the job did. This can cause a job to hang indefinitely while it waits
for all processes to call "init". By rule, if one process calls "init",
then ALL processes must call "init" prior to termination.

2. this process called "init", but exited without calling "finalize".
By rule, all processes that call "init" MUST call "finalize" prior to
exiting or it will be considered an "abnormal termination"

This may have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------

Zhenyu
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to