Re: [deal.II] Broadcasting user types containing smart pointers

2024-03-12 Thread Paras Kumar
Thank you for the hints. It works now.

Best regards,
Paras

On Wed, Mar 6, 2024 at 12:36 AM Wolfgang Bangerth 
wrote:

> On 3/5/24 09:59, Paras Kumar wrote:
> >
> > Thank you for your response. That is exactly what I am trying to do via
> the
> > deserialize function. I build an object of the desired derived type
> (based on
> > the derived type data archived during the call to serialize()) and then
> assign
> > it to the pointer at the receiving end. But the problem is that the
> > deserialize function is never called by boost. I am not sure what hint
> it
> > needs so as to call the deserialize function. Also, interestingly boost
> does
> > not call both serialize() or deserialize() during the call to
> > dealii::Utilities::unpack() but it does call serialize() during the call
> to
> > dealii::Utilities::pack().
>
> You've got the wrong function names. You either have to provide a
> serialize()
> function, or a pair of functions called save()/load(). In the latter case,
> you
> also have to say BOOST_SERIALIZATION_SPLIT_MEMBER(). Take a look at
> classes
> such as AlignedVector, for example. The BOOST documentation also has a lot
> to
> say about this.
>
> Best
>   W.
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/1311e260-298a-431a-933e-a82240617bd8%40colostate.edu
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmRFHgRRsPmy3y6%3D0J_rXUtwD_X1_pdP-54DdKF9Les9ZA%40mail.gmail.com.


Re: [deal.II] Broadcasting user types containing smart pointers

2024-03-05 Thread Paras Kumar
Dear Wolfgang,

Thank you for your response. That is exactly what I am trying to do via the
deserialize function. I build an object of the desired derived type (based
on the derived type data archived during the call to serialize()) and then
assign it to the pointer at the receiving end. But the problem is that the
deserialize function is never called by boost. I am not sure what hint it
needs so as to call the deserialize function. Also, interestingly boost
does not call both serialize() or deserialize() during the call to
dealii::Utilities::unpack() but it does call serialize() during the call to
dealii::Utilities::pack().

Any clues on how to achieve this would be really helpful.

Best regards,
Paras

On Tue, Mar 5, 2024 at 5:40 PM Wolfgang Bangerth 
wrote:

> On 3/5/24 07:46, Paras Kumar wrote:
> >
> > Within the context of an MPI parallel code, I need to broadcast the
> > ConstitutiveParameters struct which contains std::unique pointer to the
> base
> > class StrainEnergyFuncParameters; cf. MWE file.
> >
> > Using the ideas  discussed in the post
> > https://groups.google.com/g/dealii/c/bmqTbs4ofHQ/m/aCuDpUekBAAJ, the
> code
> > works fine if the members are concrete derived classes since there the
> > serialize function is enough. However, I get segmentation fault during
> the
> > unpack() call since the deserialize() function is not called.
> >
> > Running the attached MWE would explain the issue.
> >
> > Could someone please help in understanding how I could solve this issue?
>
> Yes, this can't work :-) In essence, you are packing up a pointer (=an
> address
> into memory space) on machine A, and unpack it on machine B. But on
> machine B,
> nothing useful is likely going to be stored at the location of the memory
> address at which there was a useful object on machine A, and so when you
> access the data stored at that location, you should not expect anything
> good
> to happen.
>
> You need to find a way to serialize/deserialize the data pointed to, not
> the
> pointer itself.
>
> Best
>   W.
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/e7423abb-b213-4575-b407-12d3a2d7d0f8%40colostate.edu
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmRSrEe4BW5P%2BNzRYo5dETfgVOYXdYEFBzah-09KP6hnzw%40mail.gmail.com.


[deal.II] Broadcasting user types containing smart pointers

2024-03-05 Thread Paras Kumar
Dear deal.II Community,

Within the context of an MPI parallel code, I need to broadcast the 
ConstitutiveParameters struct which contains std::unique pointer to the 
base class StrainEnergyFuncParameters; cf. MWE file.

Using the ideas  discussed in the post 
https://groups.google.com/g/dealii/c/bmqTbs4ofHQ/m/aCuDpUekBAAJ, the code 
works fine if the members are concrete derived classes since there the 
serialize function is enough. However, I get segmentation fault during the 
unpack() call since the deserialize() function is not called.

Running the attached MWE would explain the issue.

Could someone please help in understanding how I could solve this issue?

Thanks and best regards,
Paras Kumar

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/5f719546-d28f-4670-981b-00e04283c546n%40googlegroups.com.
#include 
#include 
#include 

using UnsignedIntType = unsigned int;
using FloatType= double;
FloatType Epsilon_Tol = 1e-8;

template 
bool
Check_ifEqual(const NumberType ,
  const NumberType ,
  const NumberType   = 1e-5,
  const NumberType  = Epsilon_Tol)
{
const NumberType tol =
(0.5 * (std::fabs(a) + std::fabs(b)) * tolFac) + baseTol;
bool result = false;
if (std::fabs(a - b) < tol)
result = true;

return (result);
}

enum StrainEnergyFuncType
{
NH  = 1,
Og  = 2,
};

template 
struct StrainEnergyFuncParameters
{
  StrainEnergyFuncType strainEnergyFuncType_;

StrainEnergyFuncParameters(){};

~StrainEnergyFuncParameters() = default;

virtual void
Print_details(std::ostream ) const = 0;

template 
void
serialize(Archive , const unsigned int version)
{

ar _;
}
};

template 
struct NeoHookeParameters : public StrainEnergyFuncParameters
{
NumberType shearModulus_;
NumberType poissonRatio_;

NeoHookeParameters();
NeoHookeParameters(const StrainEnergyFuncType strainEnergyFuncType);
NeoHookeParameters(const NeoHookeParameters );
NeoHookeParameters& operator=(const NeoHookeParameters );
bool operator==(const NeoHookeParameters ) const;
virtual void Print_details(std::ostream ) const override;

template 
void
   serialize(Archive , const unsigned int version)
{
std::cout <<  "my ranK: " <<  dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)
  << "Entered NeooHookeParameters::serialize()"
  << std::endl;
 
ar ::serialization::base_object>(*this);
ar _;
ar _;
}

template 
void
deserialize(Archive , const unsigned int version)
{
std::cout <<  "my ranK: " <<  dealii::Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)
  << "Entered NeooHookeParameters::deserialize()"
  << std::endl;

ar ::serialization::base_object>(*this);
ar _;
ar _;
}
};

template 
NeoHookeParameters::NeoHookeParameters()
{}

template 
NeoHookeParameters::NeoHookeParameters(const StrainEnergyFuncType strainEnergyFuncType)
{
StrainEnergyFuncParameters::strainEnergyFuncType_ = strainEnergyFuncType;
}

template 
NeoHookeParameters::NeoHookeParameters(const NeoHookeParameters )
{
StrainEnergyFuncParameters::strainEnergyFuncType_ = other.strainEnergyFuncType_;
this->shearModulus_ = other.shearModulus_;
this->poissonRatio_ = other.poissonRatio_;
}

template 
NeoHookeParameters &
NeoHookeParameters::operator=(const NeoHookeParameters )
{
if (this != ) // confirm there is no self-assignment
{
StrainEnergyFuncParameters::strainEnergyFuncType_ = other.strainEnergyFuncType_;
this->shearModulus_ = other.shearModulus_;
this->poissonRatio_ = other.poissonRatio_;
}
return (*this);
}

template 
bool NeoHookeParameters::operator==(const NeoHookeParameters ) const
{
return (
(StrainEnergyFuncParameters::strainEnergyFuncType_ ==
 other.strainEnergyFuncType_) &&
(fabs(shearModulus_ - other.shearModulus_) < Epsilon_Tol) &&
(fabs(poissonRatio_ - other.poissonRatio_) < Epsilon_Tol));
}

template 
void NeoHookeParameters::Print_details(std::ostream ) const
{
outStream << "Strain energy function type: "
  << StrainEnergyFuncParameters::strainEnergyFuncType_
  << std::endl;
outStream << "Shear modulus: " <&l

Re: [deal.II] Re: Solving elasticity and laplace(damage) equation, one after the other.

2022-11-21 Thread Paras Kumar
Wasim,

In case, what you do is close to the phase-field fracture model (which is
essentially a gradient damage model, and in this case a  one-way coupled
one), you might find the following master thesis and the associated code
helpful: https://github.com/Jatandeep/Thesis

Best regards,
Paras

On Mon, Nov 21, 2022 at 2:28 PM Bruno Turcksin 
wrote:

> Wasim,
>
> It's hard to say without seeing any code. Are you working with one or two
> DoFHandler? If you are working with two DoFHandler, are you sure that you
> are using the correct one?
>
> Best,
>
> Bruno
>
> On Monday, November 21, 2022 at 5:54:22 AM UTC-5 ce21...@smail.iitm.ac.in
> wrote:
>
>> Hello everyone.
>>
>> I am trying to solve elasticity and *laplace (damage)* equations in the
>> same program. The rhs of laplace equation depends on the elasticity
>> solution vector. Both equations have already been solved in step3 and 8. I
>> am following the same approach. I am creating my objects (like
>> triangulation_elasticity, fe_elasticity,dof_handler_elasticity) for
>> elasticity as in step8 and solving the elasticity equation. Everything
>> works fine till this point.
>>
>>
>> Then I tried to solve the laplace equation using the elasticity solution.
>> I followed step 3 approach and created the corresponding
>> objects(triangulation_damage, fe_damage,dof_handler_damage).
>>
>> However, I am getting the following error:
>>
>> An error occurred in line <4310> of file
>> 
>> in function
>> void dealii::FEValues::reinit(const
>> dealii::TriaIterator >&) [with
>> bool level_dof_access = false; int dim = 2; int spacedim = 2]
>> The violated condition was:
>> static_cast &>(*this->fe) ==
>> static_cast &>(cell->get_fe())
>> Additional information:
>>
>>
>> * The FiniteElement you provided to FEValues and the FiniteElement that
>>   belongs to the DoFHandler that provided the cell iterator do notmatch*
>> .
>>
>> Stacktrace:
>> ---
>> #0  /home/wasim/dealii-candi/deal.II-v9.4.0/lib/libdeal_II.g.so.9.4.0:
>> void dealii::FEValues<2,
>> 2>::reinit(dealii::TriaIterator
>> > const&)
>> #1  ./step-200: float
>> step200::PhaseField::H_plus> 2, false> > >(dealii::Vector,
>> dealii::TriaActiveIterator >, unsigned
>> int)
>> #2  ./step-200: step200::PhaseField::assemble_system_damage()
>> #3  ./step-200: step200::PhaseField::damage_mesh()
>> #4  ./step-200: main
>> -
>>
>> It says that in assemble_damage, the finite element provided to fevalues
>> and that of dof_handler are different.
>> I don't know what this exactly means as I am only creating a single
>> object,* FE_Q<2>  fe_damage* for solving my damage equation.
>>
>> Thanks and regards
>> Wasim
>>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/5f30d3ae-264a-4ff0-ba85-27e6959ecc92n%40googlegroups.com
> 
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmQ8Btxu7d4LEnHHDK8CgiOs06H%2BDNEJxai3SZ71115%2BBw%40mail.gmail.com.


Re: [deal.II] Trilinos::Amesos_Superludist not scaling across multiple nodes

2022-07-15 Thread Paras Kumar
Dear Wolfgang,

Thank you for the response.


> Paras:
> I'm not sure any of us have experience with Amesos:SuperLU, so I'm not
> sure
> anyone will know right away what the problem may be.
>
> I was wondering if, while writing the wrappers and testing them out,
someone managed to figure out the requisite combination of installation
time options.


> But here are a couple of questions:
> * What happens if you run the program with just two MPI jobs on one
> machine?
> In that case, you can watch what the two programs are doing by having
> 'top'
> run in a separate window.
>
I ran a job with a direct solver from the beginning on one node with 72
processes (see job107396-flops graph) and it is evident that all except a
few cores do a similar amount of flops. I guess some of the processes are
meant to "coordinate the work" and not do much actual computation.


> * How do you distribute the matrix and right hand side? Are they both
> fully
> distributed?
>
I use BlockSpasrseMatrix and BlockVector objects available through
TrilinosWrappers.



> * Is the solution you get correct?
>
I do not have an exact solution for comparison, but the simulation results,
both visual as well as global quantities like force, energy etc., seem to
indicate that the physics is captured correctly. Thus, I claim that the
solution is correct.


> * If the answer to the last question is yes, then either Amesos or SuperLU
> is
> apparently copying the data of the linear system from all other processes
> to
> just one process that then solves the linear system. It might be useful to
> take a debugger, running with just two MPI processes, to step into the
> Amesos
> routines to see if you get to a place where that is happening, and then to
> read the code in that place to see what flags need to be set to make sure
> the
> solution really does happen in a distributed way.
>
> One would probably need to debug the code while running on at least two
nodes . I do not
have much experience with debugging an MPI code. Will try to learn more
about this.

Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmSe8LDUeRAa%3DrLuJkA_0oSeAbg5M1iZxisvmiEC%2BYgp1g%40mail.gmail.com.


[deal.II] Trilinos::Amesos_Superludist not scaling across multiple nodes

2022-07-14 Thread Paras Kumar
Dear dealii Community,

I am working on solving the a nonlinear coupled problem involving a vector 
displacement field and a scalar phase-field variable. The code is MPI 
parallelized using p:d:t and TrilinosWrappers for linear algebra. 

Usually I use CG+AMG for solving the SLEs when solving for each of the 
variables within a staggered scheme.  But for certain scenarios, the 
iterative linear solver fails and we switch to Amesos_Superludist solver. 
The code is run on 2 nodes (144 MPI processes in total) and as shown by the 
code performance monitor, the flop count of one of the nodes drops to 
(almost) zero and only one one node seems to be doing the computations once 
the solver switch from iterative to direct solver occurs. Please see 
attached flops and memory bandwidth plots. The blue and red lines here 
represent the two nodes. Similar observations were also made for  a larger 
problem involving 8 nodes.

These plots seem to  hint that Superlu-dist solver does not scale across 
multiple nodes. One possible reason I could think of is that I probably 
missed some option while installing dealii with trilinos and superlu-dist 
using spack. I also attach the spack spec which I installed on the 
cluster.  The gcc compiler and corresponding openmpi@4.1.2 are available 
form the cluster.

Any ideas on solving this issue would be of great help.

Kind regards,
Paras Kumar







-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/44fad345-7ca4-47b7-a20b-29ee006efc11n%40googlegroups.com.
Input spec

dealii@9.0.1%gcc@11.2.0
^trilinos@12.10.1~explicit_template_instantiation+superlu-dist

Concretized

dealii@9.0.1%gcc@11.2.0+adol-c~arborx+arpack+assimp~cuda~doc+examples~ginkgo+gmsh+gsl+hdf5~int64~ipo+metis+mpi+muparser~nanoflann~netcdf+oce+optflags+p4est+petsc~python+scalapack~simplex+slepc+sundials~symengine+threads+trilinos
 build_type=DebugRelease cuda_arch=none cxxstd=default 
patches=4282b32e96f2f5d376eb34f3fddcc4615fcd99b40004cca784eb874288d1b31c,61f217744b70f352965be265d2f06e8c1276685e2944ca0a88b7297dd55755da,6f876dc8eadafe2c4ec2a6673864fb451c6627ca80511b6e16f3c401946fdf33
 arch=linux-almalinux8-icelake

^adol-c@2.7.2%gcc@11.2.0~advanced_branching+atrig_erf~boost+doc+examples~openmp~sparse
 arch=linux-almalinux8-icelake
^arpack-ng@3.8.0%gcc@11.2.0+mpi+shared arch=linux-almalinux8-icelake
^cmake@3.21.4%gcc@11.2.0~doc+ncurses~openssl+ownlibs~qt 
build_type=Release arch=linux-almalinux8-icelake
^ncurses@6.2%gcc@11.2.0~symlinks+termlib abi=none 
arch=linux-almalinux8-icelake
^pkgconf@1.8.0%gcc@11.2.0 arch=linux-almalinux8-icelake

^openblas@0.3.18%gcc@11.2.0~bignuma~consistent_fpcsr~ilp64+locking+pic+shared 
threads=none arch=linux-almalinux8-icelake
^perl@5.34.0%gcc@11.2.0+cpanm+shared+threads 
arch=linux-almalinux8-icelake
^berkeley-db@18.1.40%gcc@11.2.0+cxx~docs+stl 
patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 
arch=linux-almalinux8-icelake
^bzip2@1.0.8%gcc@11.2.0~debug~pic+shared 
arch=linux-almalinux8-icelake
^diffutils@3.8%gcc@11.2.0 arch=linux-almalinux8-icelake
^libiconv@1.16%gcc@11.2.0 libs=shared,static 
arch=linux-almalinux8-icelake
^gdbm@1.19%gcc@11.2.0 arch=linux-almalinux8-icelake
^readline@8.1%gcc@11.2.0 arch=linux-almalinux8-icelake
^zlib@1.2.11%gcc@11.2.0+optimize+pic+shared 
arch=linux-almalinux8-icelake

^openmpi@4.1.2%gcc@11.2.0~atomics~cuda~cxx~cxx_exceptions+gpfs~internal-hwloc~java+legacylaunchers~lustre~memchecker+pmi~pmix~singularity~sqlite3+static~thread_multiple+vt+wrapper-rpath
 fabrics=ucx schedulers=slurm arch=linux-almalinux8-icelake
^assimp@5.0.1%gcc@11.2.0~ipo+shared build_type=RelWithDebInfo 
arch=linux-almalinux8-icelake

^boost@1.76.0%gcc@11.2.0+atomic+chrono~clanglibcpp~container~context~coroutine+date_time~debug+exception~fiber+filesystem+graph~icu+iostreams+locale+log+math~mpi+multithreaded~numpy~pic+program_options~python+random+regex+serialization+shared+signals~singlethreaded+system~taggedlayout+test+thread+timer~versionedlayout+wave
 cxxstd=98 visibility=hidden arch=linux-almalinux8-icelake

^gmsh@4.8.4%gcc@11.2.0+alglib~cairo+cgns+compression~eigen~external+fltk+gmp~hdf5~ipo+med+metis+mmg~mpi+netgen+oce~opencascade~openmp~petsc~privateapi+shared~slepc+tetgen+voropp
 build_type=RelWithDebInfo arch=linux-almalinux8-icelake

^cgns@4.2.0%

Re: [deal.II] Can I use 3D prism elements (extruded triangles) in deal.ii?

2022-06-24 Thread Paras Kumar
HI Amit,

Focusing on the question of mesh generation, it is possible to generate an
automated HEX mesh using Gmsh, but since that mesh is based on Delaunay
based approaches, quality may not be very good. See discussions in this
thread: https://groups.google.com/g/dealii/c/o_xXAur2Ao8/m/vlAjFs5ECQAJ
Alternatively, if you just want to mesh this specific geometry, you could
also get a structured (good looking) HEX mesh using the transfinite mesh
approach available in Gmsh.

In my limited knowledge, cf. [
https://www.dealii.org/current/doxygen/deal.II/group__simplex.html], it
seems that the simplex support is still experimental. As mentioned in the
link, it might be helpful to look at the tests/simplex folder. The
developers can maybe provide more precise answer here.

Best,
Paras




On Fri, Jun 24, 2022 at 2:19 PM Amit Singh  wrote:

> Hi.
> I am considering deal.ii for some nonlinear elasticity and fracture
> analysis.
> From what I read in the documentation, deal.ii supports hexahedral
> elements much better than tetrahedral elements. My geometry looks as shown
> in the attached picture. The actual geometry is a boolean difference of a
> big sphere and a small sphere. But to exploit symmetry I am considering
> only one-eighth of the sphere.
>
>  I am struggling to create a mesh that has only hexahedral elements. The
> best I was able to attain was a vast majority of the elements were
> hexahedral but there were some prism elements at the poles.
>
> Therefore, my question is can I use prism elements in deal.ii? (Or if
> there is a clever way to mesh this geometry with just hexahedral elements
> kindly let me know.)
>
> Regards,
> Amit
>
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/cd269727-64aa-4079-b261-657e9dc0248an%40googlegroups.com
> 
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmT04YkzctpkzYuJVa7d%3D31G1K8qAo1Rm6EMkZuteVGbng%40mail.gmail.com.


Re: [deal.II] simple application of anti-periodic boundary conditions

2022-04-19 Thread Paras Kumar
Dear Wolfgang,

Thank you for the hints. The second approach seems easy to start with.

One follow-up question: The mesh (which is initially periodic at the
boundaries)  is refined adaptively during the simulation and it cannot be
guaranteed if both the left and the right boundary faces would be refined
at the same time. Will make_periodicity_constraints() work in that case? If
yes, how would the periodic constraints look like for the child cell dofs?
In case it matters, I currently have a dealii::Triangulation and also wish
to update to p:d:T in future.

Going through step-45 and the docu of collect_periodic_faces(), it was not
clear to me what would happen for the case I described above.

Thanks and best regards,
Paras


On Thu, Apr 14, 2022 at 10:24 PM Wolfgang Bangerth 
wrote:

>
> Paras,
> I don't think there is a way that's already implemented, but if you look
> at
> the function that implements the periodic boundary conditions, you should
> be
> able to clone it in your project and add the negative sign where necessary.
>
> Alternatively, you can let the existing function create an AffineMatrix
> object, and then iterate over it to create a second such object that has
> the
> opposite sign.
>
> Best
>   W.
>
>
> On 4/14/22 11:28, Paras Kumar wrote:
> > *** Caution: EXTERNAL Sender ***
> >
> > Dear dealii Community,
> >
> > I am working on a solid mechanics related problem involving
> anti-periodic
> > constraints,  i.e.
> >
> > u_leftFace = - u_RightFace,
> >
> > where u is the unknown field (a component of the dim-dimensional
> displacement
> > field).
> >
> > One possible solution, I am aware of, involves marking the periodic
> faces by
> > means of boundary-ids, traversing through the dofs for each periodic
> face-pair
> > in order to determine the periodic dof pair and then manually add the
> entry in
> > the constraint matrix. This approach also worked for cases involving
> periodic
> > constraints with offsets.
> >
> > I would like to know if there exists a simpler way of achieving the
> > aforementioned goal by a simpler approach, probably by passing some
> > appropriate parameters to the make_periodicity_constraints() function,
> since
> > we just have a sign change here.
> >
> > Thanks and best regards,
> > Paras
> >
> > --
> > The deal.II project is located at http://www.dealii.org/
> > <
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dealii.org%2F=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C8f9fc858ff034f0e15ef08da1e3c3094%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637855542161551806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=D5%2B%2Fl2JSIEzLD8yAQ0g8S4npa7iZJBXOm0RNWrcMpW0%3D=0
> >
> > For mailing list/forum options, see
> > https://groups.google.com/d/forum/dealii?hl=en
> > <
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fforum%2Fdealii%3Fhl%3Den=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C8f9fc858ff034f0e15ef08da1e3c3094%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637855542161551806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=sBAFfhzgWJFRRvlWTXcZSvJrGGwXyIgarIHw04NnhB4%3D=0
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups
> > "deal.II User Group" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to dealii+unsubscr...@googlegroups.com
> > <mailto:dealii+unsubscr...@googlegroups.com>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/dealii/b2783034-32fe-43d0-80fa-5ace7204f6c0n%40googlegroups.com
> > <
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fdealii%2Fb2783034-32fe-43d0-80fa-5ace7204f6c0n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter=04%7C01%7CWolfgang.Bangerth%40colostate.edu%7C8f9fc858ff034f0e15ef08da1e3c3094%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637855542161551806%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=DyeuUwE%2BH%2FQKzLAzF9lQhGU%2By4gvef3I%2FYUg%2FklzVJg%3D=0
> >.
>
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.

[deal.II] simple application of anti-periodic boundary conditions

2022-04-14 Thread Paras Kumar
Dear dealii Community,

I am working on a solid mechanics related problem involving anti-periodic 
constraints,  i.e. 

u_leftFace = - u_RightFace, 

where u is the unknown field (a component of the dim-dimensional 
displacement field).

One possible solution, I am aware of, involves marking the periodic faces 
by means of boundary-ids, traversing through the dofs for each periodic 
face-pair in order to determine the periodic dof pair and then manually add 
the entry in the constraint matrix. This approach also worked for cases 
involving periodic constraints with offsets.  

I would like to know if there exists a simpler way of achieving the 
aforementioned goal by a simpler approach, probably by passing some 
appropriate parameters to the make_periodicity_constraints() function, 
since we just have a sign change here.

Thanks and best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/b2783034-32fe-43d0-80fa-5ace7204f6c0n%40googlegroups.com.


Re: [deal.II] Exception handling for multithreaded case

2021-08-18 Thread Paras Kumar
>
> > 2. The ExceptionBase::print_stack_trace() function does not print
> > anything if I catch an exception thrown using AssetThrow(cond,
> > dealii::ExcMessage()) or even my own MyException class derived from
> > ExceptionBase. How do I ensure that the stack trace is "populated". I
> > tried using the set_fields() function but it did not help.
>
> Can you illustrate in a small test case what you are trying to do?
>

Sorry, it was my mistake. Just to reassure myself, such a stack-trace is
only printed for Assert() and not for AssertThrow(). I realised this while
creating the attached MWE.

Stacktrace:
---
#0  ./mwe-stack-trace: Solve_timeStep()
#1  ./mwe-stack-trace: Simulate()
#2  ./mwe-stack-trace: main



>
>
> > 3. Considering the parallelization of stress averaging, how could I do a
> > reduction operation to ensure summation of the thread local stresses
> > into a "global" variable once I have distributed the computation using
> > the idea described on pg-10 pf Video Lecture-40 slides? Is Workstream
> > the only solution, or is there some less involved alternative, since I
> > just need to sum the return values of the Compute_stressSumOnCellRange()
> > function?
>
> It's difficult because you probably don't want the object you want to
> sum into to be thread-local (assuming that it is not just a single
> number). WorkStream was invented to work around exactly these sorts of
> problems. We wrote a whole paper about WorkStream precisely because it
> is not trivial to get right, and any alternative solution I could offer
> would also not be trivial.
>
>  The object could be a scalar or a dealii::Tensor<1,dim,double>. I was
looking for something on the lines of #pragma omp for using globalSum as a
shared variable and a '+' reduction operation.

TensorType globalSum;

// parallel part for each thread;  globalSum is shared , '+' as reduction
{
  TensorType localSum;

   // loop for a sub-range of cells
localSum += cellContribution;

// have a synchronised reduction operation, i.e. globalSum += localSum,
while avoiding race conditions.
}

// back to serial part

To me it seemed that there would be an openmp equivalent procedure for such
simple reduction tasks.

Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmQOaa4-1MAcnbRLTmYwATKBA6no5C2KTZK_3mOzogy%3DtQ%40mail.gmail.com.
#include 
#include 

using UnsignedIntType = unsigned int;


class MyException : public dealii::ExceptionBase
{
public:
		MyException(const std::string )
		: failureLoc_(failureLocation)
		{
		if ((failureLoc_ != "pf") && (failureLoc_ != "disp") &&
		  (failureLoc_ != "outer"))
		Assert(false, dealii::ExcMessage("Invalid failure location string!"));
		}

		virtual ~MyException() noexcept = default;

		virtual void
		print_info(std::ostream ) const
		{
			if (failureLoc_ == "pf")
			outStream << "Non convergence in the pf loop" << std::endl;
			else if (failureLoc_ == "disp")
			outStream << "Non convergence in the disp loop" << std::endl;
			else if (failureLoc_ == "outer")
			outStream << "Non convergence in the outer loop" << std::endl;
		}

std::string failureLoc_;
};

void Solve_timeStep()
{
	static UnsignedIntType timeStepCtr = 0;
	
// do some nonlinear Newton iteration
	std::cout << "local time-step counter: " << timeStepCtr << std::endl;

// the procedure fails for 4-th time-step
	if(timeStepCtr==  4)
	{
		++timeStepCtr;
		AssertThrow(false, MyException("pf")); 
	}

	if(timeStepCtr == 6)
		Assert(false, MyException("disp"));

	++timeStepCtr;
}

void Simulate()
{
	const UnsignedIntType nTimeSteps = 10;
	for(UnsignedIntType timeStepCtr=0; timeStepCtr

Re: [deal.II] Exception handling for multithreaded case

2021-08-17 Thread Paras Kumar
Dear Wolfgang,

Thank you for the quick response.

This is actually very difficult to achieve. I made that work for the 9.3
> release when you use `new_task()`, and I think one could probably make
> that
> work for `new_thread()` as well based on features C++11/14 provides. But I
> don't think this is easily possible when using WorkStream and it's not
> clear
> to me to begin with what kind of semantics this would have. Your best bet
> is
> to ensure that functions you call via WorkStream do not throw exceptions.
>
> This is exactly what I am trying to do now.

I have a few more (un)related questions:

1.  Thus this issue would not exist for simple parallel tasks involving a
reduction operation, such as computing average stresses over the domain,
using Threads::new_task?

2. The ExceptionBase::print_stack_trace() function does not print anything
if I catch an exception thrown using AssetThrow(cond, dealii::ExcMessage())
or even my own MyException class derived from ExceptionBase. How do I
ensure that the stack trace is "populated". I tried using the set_fields()
function but it did not help.

3. Considering the parallelization of stress averaging, how could I do a
reduction operation to ensure summation of the thread local stresses into a
"global" variable once I have distributed the computation using the idea
described on pg-10 pf Video Lecture-40 slides? Is Workstream the only
solution, or is there some less involved alternative, since I just need to
sum the return values of the Compute_stressSumOnCellRange() function?



> As for turning Assert into throwing exceptions instead of aborting the
> program: The way we treat the conditions used in Assert statements is that
> they are irrecoverable: There is nothing you can do to make the program do
> anything useful if you trigger an Assert, and as such aborting the program
> is
> the correct choice: You just need to fix the program. A properly debugged
> program should never run into an Assert statement.
>
> This was just for the purpose of testing the procedure.


Thanks and best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmQ3awEynNnc9PCT8cy6Vh1Xc1EC%3DjgVJEEHGyYxmXgmiQ%40mail.gmail.com.


[deal.II] Exception handling for multithreaded case

2021-08-16 Thread Paras Kumar
Dear deal.ii Community,

I am trying to work on the exception handling aspect of my code, which 
employs dealii::Workstream::run() for thread based parallelization of FE 
system assembly.  The code employs the Assert and AssertThrow macros, in 
conjunction with dealii::ExcMessage(), at several places with in the source 
code. The dealii::deal_II_exceptions::disable_abort_on_exception() command 
is used to ensure all Assert macros throw as well. 

It is desired that the exception thrown from within a function is 
propagated up to the main function, where it can be caught so that the code 
can be "elegantly" exited instead of being aborted. 
The  procedure works fine for exceptions thrown from single threaded 
functions but I get the following error for an exception thrown from the 
multi-threaded assembly function. 

-
In one of the sub-threads of this program, an exception
was thrown and not caught. Since exceptions do not
propagate to the main thread, the library has caught it.
The information carried by this exception is given below.

-

Having a look at the source code reveals that this is the intended behavior 
for exception being thrown from a sub-thread, but I am not able to 
understand why this is so. Alternatively, is there some way other out to 
ensure that the such an exception is propagated to the main ?


Thanks in advance for your help.

Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/d03ce31a-a774-42e3-82db-1318df2b10b7n%40googlegroups.com.


Re: [deal.II] Re: Extracting a component of FESystem for use elsewhere

2021-06-17 Thread Paras Kumar
Hi Corbin,

The cell-wise solution corresponding to the p field could be determined as
follows:
```
dealii::FEValuesExtractorScalar pressureExtractor(2); //assuming you have
three scalar fields and pressure is the last one
dealii::Vector solVecPerCell(nDOFsPerCell);
feValues[pressureExtractor].get_function_values(totalSolution,
solVecPerCell); // here only the values corresponding to pressure are
filled.
```
You could then use this cell-wise values of the p-field in whatever manner
you wish.

Another alternative approach, which I employ, is to use BlockVector object,
wherein one can easily get the total solution vector corresponding to any
of the fields.

Best regards,
Paras

On Thu, Jun 17, 2021 at 7:34 AM Corbin Foucart 
wrote:

> I've found one way to do this, but I imagine it's not optimal:
>
>- call DoFRenumbering::component_wise(fesys_dofh)
>- Do the finite element solve
>- then copy from one vector to another using the number of dofs in
>that component and an offset
>- This isn't great, however, because I'd rather store the fesys dofh
>cell-by-cell for memory-friendliness, as almost all other operations are
>elemental
>
> If there's a better way, I'd be glad to know :)
>
> Best,
> Corbin
>
> On Wednesday, June 16, 2021 at 11:21:56 PM UTC-4 Corbin Foucart wrote:
>
>> Hi everyone,
>>
>> This might be a simple question, but I haven't found a straightforward
>> answer in the "handling vector-valued problems" documentation.
>>
>> If I have a Vector which stores the solution to an FESystem, say
>> 3 FE_DGQ fields for u, v, p, and I want to extract a new Vector
>> which corresponds to only the pressure, what's the best way to do this?
>>
>> I'm not looking to write the data out for visualization, how to use the
>> DataComponentInterpretation classes is clear to me. What I want to do is
>> extract a separate Vector which I can then add to another DG scalar
>> field of the same type as p in the (u,v,p) system.
>>
>> I don't need p at the quadrature points, only the nodal values to add to
>> another nodal field.
>>
>> Any advice would be appreciated!
>> Corbin
>>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/2bb1442a-830e-46a2-8639-8eec8b101e15n%40googlegroups.com
> 
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmQuPz4OQG4g%2BW%2B20Ax9jEvZzi0fDPb8yKJM391po7h%2BtA%40mail.gmail.com.


Re: [deal.II] FE_Q(p) with p>1: Global coordinates of midnodes

2021-04-19 Thread Paras Kumar
Hi Simon,

This could be helpful:
https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#how-to-get-the-mapped-position-of-support-points-of-my-element

Here's a code snippet for Option-1, which I usually use.

const auto &   feSystem   = dofHandler.get_fe();
dealii::MappingQ cellMapping(feSystem.degree);
const auto &   referenceCellSupportPoints =
feSystem.get_unit_support_points();
std::vector>
realCellSupportPoints(referenceCellSupportPoints.size());
unsigned int supportPointCtr = 0;
for (const auto  : referenceCellSupportPoints)
  {
realCellSupportPoints[supportPointCtr] =
  cellMapping.transform_unit_to_real_cell(cellIter, supportPoint);
++supportPointCtr;
  }


Best regards,
Paras

On Mon, Apr 19, 2021 at 12:14 PM Simon  wrote:

> Dear All,
>
> I am implementing a local postprocessing SPR-Approach for a mechanical
> problem, in which I sloppy speaking need the global coordinates of all
> nodes.
>
> I use Elements of type FE_Q(p).
> For p=1 there is no problem: I can simply loop over all cells and vertices
> and use cell->vertex(...) in order to get the global coordinates of
> vertex(...).
> Being p=2 for instance, this approach does not work anymore. In this case
> is there an easy way to figure out the coordinates of midnodes as well?
>
> Thanks for help!
>
> Best
> Simon
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/3d87b2c4-61a4-4125-982d-f7341f44492an%40googlegroups.com
> 
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmSQ-9squp34HNynpjsc02VcdpNxqiNPAq%2Bq4LQTmgwckQ%40mail.gmail.com.


Re: [deal.II] Reading a list from parameter file

2021-04-19 Thread Paras Kumar
Dear Wolfgang,

Thank you so much for the suggestion. Just to avoid confusion for future
readers, the to_value() function needs a unique_ptr, and hence the
aforementioned line needs to be replaced by the following lines:

std::unique_ptr nItersListPattern(new
dealii::Patterns::List(dealii::Patterns::Integer(1), 2, 8, "|"));
nIters =
dealii::Patterns::Tools::Convert::to_value(nMaxItersString,
 nItersListPattern);

Best regards,
Paras

On Fri, Apr 16, 2021 at 11:53 PM Wolfgang Bangerth 
wrote:

>
> Paras,
>
> > I am trying to read a list of integers from the parameter file using the
> > dealii::Patterns::List class.
> > However, I get a runtime error which can be reproduced using the
> attached MWE.
> >
> > I also tried the approach described (for tensor) in
> > https://groups.google.com/g/dealii/c/TvtcOnxeVjw/m/9uaSAh-kAwAJ but it
> doesn't
> > seem to work for the current case.
> >
> > It would be great help if someone could help me understand where I go
> wrong?
>
> First: Excellent job coming up with a self-contained minimal example!
>
> The problem is that in this line:
>
> nIters =
>
> dealii::Patterns::Tools::Convert::to_value(nMaxItersString);
>
> The to_value() function creates its own pattern based on the type of the
> argument nMaxItersString. This pattern uses "," as the separator, but you
> want
> "|". You can fix this by providing an explicit pattern:
>
> nIters =
> dealii::Patterns::Tools::Convert::to_value(nMaxItersString,dealii::Patterns::List(dealii::Patterns::Integer(1),
>
> 2, 8, "|"));
>
> Best
>   W.
>
> --
> 
> Wolfgang Bangerth  email: bange...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/98664411-dca8-ba63-dcf3-cbdd1d0489d4%40colostate.edu
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmQ4pRED-92yambs3JV7Pc8xu0BRAvmnkjwoBOaJTL5YEQ%40mail.gmail.com.


[deal.II] Reading a list from parameter file

2021-04-15 Thread Paras Kumar
Dear All,

I am trying to read a list of integers from the parameter file using the 
dealii::Patterns::List class.
However, I get a runtime error which can be reproduced using the attached 
MWE.

I also tried the approach described (for tensor) in 
https://groups.google.com/g/dealii/c/TvtcOnxeVjw/m/9uaSAh-kAwAJ but it 
doesn't seem to work for the current case.

It would be great help if someone could help me understand where I go wrong?

Thanks in advance and best regards,
Paras



-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a478ba5e-0150-4fb5-8e90-0faf1c86b9fbn%40googlegroups.com.
#include 
#include 
#include 

using UnsignedIntType = unsigned int;

 void Declare_blockNonlinearSolverParameters(dealii::ParameterHandler )
{
parameterHandler.declare_entry(
  "Num Max Newton Iters",
  "10|10",
  dealii::Patterns::List(dealii::Patterns::Integer(1), 2, 8, "|"),
  "Allowed maximum number of newton iterations for inner loops");
}

int main()
{
// decalre the parameters to be read
dealii::ParameterHandler paramHandler;
paramHandler.enter_subsection("Block Nonlinear Solver");
Declare_blockNonlinearSolverParameters(paramHandler);
paramHandler.leave_subsection();

// generate and read the param file
const std::string paramsBNlSolverTest01 =
  "subsection Block Nonlinear Solver   \n"
  "# Allowed maximum number of newton iterations for inner loops   \n"
  "set Num Max Newton Iters = 27|30|45 \n"
  "end \n";
std::stringstream paramFileString;
paramFileString << paramsBNlSolverTest01;
paramHandler.parse_input(paramFileString);

//extract the read params

paramHandler.enter_subsection("Block Nonlinear Solver");
const std::string nMaxItersString = paramHandler.get("Num Max Newton Iters");
std::cout << "nMaxItersString: " << nMaxItersString << std::endl;
std::vector nIters;
nIters = dealii::Patterns::Tools::Convert::to_value(nMaxItersString);
paramHandler.leave_subsection();
}



[deal.II] Boost serialization linking error

2021-03-28 Thread Paras Kumar
ridge/gcc-7.3.0/boost-1.73.0-qq6dfhn4upamtqfmtvqy5pe4obuy6wkx/include/boost/archive/detail/iserializer.hpp:108:
 
error: undefined reference to 
'boost::archive::basic_binary_iprimitive >::load(std::__cxx11::basic_string, std::allocator >&)'
/home/woody/iwtm/iwtm020h/spack-install/dealii901-spackv15-gcc/spack/opt/spack/linux-centos7-ivybridge/gcc-7.3.0/boost-1.73.0-qq6dfhn4upamtqfmtvqy5pe4obuy6wkx/include/boost/archive/detail/iserializer.hpp:108:
 
error: undefined reference to 
'boost::archive::basic_binary_iprimitive >::load(std::__cxx11::basic_string, std::allocator >&)'
/home/woody/iwtm/iwtm020h/spack-install/dealii901-spackv15-gcc/spack/opt/spack/linux-centos7-ivybridge/gcc-7.3.0/boost-1.73.0-qq6dfhn4upamtqfmtvqy5pe4obuy6wkx/include/boost/archive/detail/oserializer.hpp:93:
 
error: undefined reference to 
'boost::archive::basic_binary_oprimitive >::save(std::__cxx11::basic_string, std::allocator > const&)'
/home/woody/iwtm/iwtm020h/spack-install/dealii901-spackv15-gcc/spack/opt/spack/linux-centos7-ivybridge/gcc-7.3.0/boost-1.73.0-qq6dfhn4upamtqfmtvqy5pe4obuy6wkx/include/boost/archive/detail/iserializer.hpp:108:
 
error: undefined reference to 
'boost::archive::basic_binary_iprimitive >::load(std::__cxx11::basic_string, std::allocator >&)'
collect2: error: ld returned 1 exit status
make[2]: *** [variants/cookmembranedistributed] Error 1
make[2]: Leaving directory 
`/home/woody/iwtm/iwtm020h/trial-code/MNC-Frac/_build'
make[1]: *** [variants/CMakeFiles/cookmembranedistributed.dir/all] Error 2
make[1]: Leaving directory 
`/home/woody/iwtm/iwtm020h/trial-code/MNC-Frac/_build'
make: *** [all] Error 2


I also tried to employ the patch from PR# 11024 as described in 
https://groups.google.com/g/dealii/c/dClF4Men1iY/m/o8tHBvoCAQAJ but got the 
same linking errors. Further, the infromation from 'make VERBOSE=1'  does 
not seem to hint towards system Boost (if I interpret things correctly). 
The boost version is 1.73, which is default with spack v0.15.

Some further search revealed that a possible remedy could be to switch the 
order in which the  libraries are linked as discussed here for some other 
Boost dependent project: https://github.com/esa/pagmo/issues/174 . But, I 
could not figure out how to change the linking order. I have boost as an 
explicit dependency in my CMakeLists.txt and the order in which the 
FIND_PACKAGE() commands for dealii and Boost appear in the CMakeLists.txt 
does not seem to change the outcome.

It is note worthy that the Boost library is found by my code, since other 
parts of the code using some other boost functions work fine. Also, the 
same code compiles on my local machine having Ubuntu 18.04 

Could someone please help me understand where I go wrong?

Best regards,
Paras Kumar

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/66cb0191-8a8a-48eb-bc05-219eaf708da8n%40googlegroups.com.


Re: [deal.II] Query about external meshing software

2021-03-10 Thread Paras Kumar
Hi Krishanu,

The GMSH issue has been already explained by Jane. In nutshell: to make a
square surface ABCD, you must ensure that  when creating the lines you go
A->B and not B->A.

Yes, Abaqus takes care of the ordering automatically and you usually don't
get such errors.

Best,
Paras


On Wed, Mar 10, 2021 at 3:44 AM Zelu Xu  wrote:

> Hello Krishanu:
> The error is made when you define the line/surface. You don’t have to
> check the mesh file or each mesh element but the .geo file.
> For example, here  my line loop defines the surface bounded by vertex in
> the order of [3.7,8,4], but I defined my line as the following.
> So when I define the surface, line 1 and 16 are negative.
> Line(1) = {4, 8};
> Line(16) = {3, 4};
> Line(17) = {3, 7};
> Line(18) = {7, 8};
> Line Loop(53) = {17, 18, -1, -16};
> Ruled Surface(54) = {53};
> And you just need to make sure all line/surface are defined with the same
> notation (left or right hand)
>
> On Tue, Mar 9, 2021 at 9:31 PM krishan...@gmail.com <
> krishanu.se...@gmail.com> wrote:
>
>> Hello Jane,
>>
>> Thanks for the response. I understand why there could be an issue with
>> the ordering. But I am using the GUI of Gmsh and the mesh created has about
>> 400 elements. So it is a little difficult to manually check the ordering of
>> the vertices of each element. Do you know if there is any other way to
>> enforce the ordering in the GUI?
>>
>> Thanks,
>> Krishanu
>>
>> On Tuesday, 9 March 2021 at 15:33:55 UTC-5 Jane Xu wrote:
>>
>>> Hello Krishna:
>>> I had this issue before. It just means that when you select mesh
>>> entities (vertex) to form a surface, you have to pay attention to the order
>>> of which entity goes first, second,... it would be clear if you look at the
>>> geometry txt file.
>>> Best regards
>>> Jane
>>>
>>> On Tue, Mar 9, 2021 at 3:21 PM krishan...@gmail.com <
>>> krishan...@gmail.com> wrote:
>>>
>>>> Hello Paras,
>>>>
>>>> Thanks for your response. I have been using the GUI of Gmsh to generate
>>>> the mesh. Do you have any suggestions about what to do in Gmsh to avoid the
>>>> negative volume issue?
>>>>
>>>> Do meshes generated with Abaqus, are able to avoid the above-mentioned
>>>> issue of negative volume?
>>>>
>>>> Thanks in advance.
>>>>
>>>> Krishanu
>>>>
>>>> On Tuesday, 9 March 2021 at 13:14:27 UTC-5 Paras Kumar wrote:
>>>>
>>>>> I use the .inp format of Abaqus, since my code relies on material-IDs
>>>>> which (in my limited experience) are easy to handle with .inp format. I
>>>>> generate meshes using both GMSH (here as you mentioned, one needs to be
>>>>> careful to add curves/surface parts in the correct order to avoid negative
>>>>> volumes) and Abaqus CAE (works fine for relatively simple geometries) to
>>>>> generate such meshes. Not aware of other quad/hex generating open source
>>>>> codes. The dealii::GridGenerator namespace also offers possibilities to
>>>>> generate meshes for certain primitive shapes and combinations thereof.
>>>>>
>>>>> Best,
>>>>> Paras
>>>>>
>>>>> On Tue, Mar 9, 2021 at 6:33 PM krishan...@gmail.com <
>>>>> krishan...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> I am wondering what meshing software produces output files that would
>>>>>> work best with deal.ii. I have tried Gmsh, but it seems when this mesh
>>>>>> (generated by Gmsh) is imported in deal.ii, it is facing the issue of
>>>>>> negative volume fraction of a cell (could be because of the order of 
>>>>>> nodes
>>>>>> written in Gmsh?). Any suggestion about any other meshing software that
>>>>>> could be used which would avoid this issue?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>
>>>>>> --
>>>>>> The deal.II project is located at http://www.dealii.org/
>>>>>> For mailing list/forum options, see
>>>>>> https://groups.google.com/d/forum/dealii?hl=en
>>>>>> ---
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "deal.II User Group" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,

Re: [deal.II] Query about external meshing software

2021-03-09 Thread Paras Kumar
I use the .inp format of Abaqus, since my code relies on material-IDs which
(in my limited experience) are easy to handle with .inp format. I generate
meshes using both GMSH (here as you mentioned, one needs to be careful to
add curves/surface parts in the correct order to avoid negative volumes)
and Abaqus CAE (works fine for relatively simple geometries) to generate
such meshes. Not aware of other quad/hex generating open source codes. The
dealii::GridGenerator namespace also offers possibilities to generate
meshes for certain primitive shapes and combinations thereof.

Best,
Paras

On Tue, Mar 9, 2021 at 6:33 PM krishan...@gmail.com <
krishanu.se...@gmail.com> wrote:

>
> I am wondering what meshing software produces output files that would work
> best with deal.ii. I have tried Gmsh, but it seems when this mesh
> (generated by Gmsh) is imported in deal.ii, it is facing the issue of
> negative volume fraction of a cell (could be because of the order of nodes
> written in Gmsh?). Any suggestion about any other meshing software that
> could be used which would avoid this issue?
>
> Thanks
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/33e38481-07dd-487f-ba04-91ab2d456e5dn%40googlegroups.com
> 
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAEU6zmT7fG1fWUDAX92-%3D-t8Ho76Mh0w--crXfTXZGg%2BFKoCPw%40mail.gmail.com.


Re: [deal.II] Issue with unstructured hex mesh

2020-09-25 Thread Paras Kumar
Dear Prof. Bangerth,

Thank you for the appreciation.

In the quest of alternative solutions, I came across the Mesquite library 
and was curious to know if that could be helpful to improve the quality of 
the Delaunay based Hex mesh so as to avoid the issue with stress 
irregularities.
It also seems that Mequite's integration within deal.II is under 
progress[https://github.com/dealii/dealii/pull/5971]. \
Since, I have no prior experience with this library, some guidance wrt the 
current issue would be of great help.

Best,
Paras
On Wednesday, September 23, 2020 at 12:31:22 AM UTC+2 Wolfgang Bangerth 
wrote:

> On 9/22/20 4:27 PM, Wolfgang Bangerth wrote:
> > I wished every student project were as comprehensively explored! :-)
>
> I tacitly assumed that Maurice Rohracker is your student. I didn't mean to 
> imply that the work you're doing is at the "student level" -- quite the 
> contrary: What your reports show is just really impressive!
>
> Best
> W.
>
> -- 
> 
> Wolfgang Bangerth email: bang...@colostate.edu
> www: http://www.math.colostate.edu/~bangerth/
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a802408f-2107-4499-a76b-f5cdb1b9bdedn%40googlegroups.com.


Re: [deal.II] Output multiple fields with different discretization

2020-08-09 Thread Paras Kumar
 

Hi Wolfgang,


Thank you for the quick response.


I am fine with writing the displacement and the crack phase-field in 
separate files, as long as the objective of visualizing the phase-field on 
the deformed mesh is achieved.


Listed below are two possible ways of doing this (along with the 
issues/queries regarding them).


1. Write the phase-field in a separate file using a MappingQEulerian type 
object based on the displacement with nSubdivisions equaling the polynomial 
degree for FE ansatz of phase-field. The problem with this approach is that 
the command


dataOutDisp.add_data_vector(solution.block(0),

dispNames,

dealii::DataOut::type_dof_data,

dataCompIntepretationDisp);

dataOutDisp.build_patches(qMapping, polyDegrees[0]);


results in the following error:


An error occurred in line <1069> of file 

 
in function

void dealii::DataOut_DoFData::add_data_vector_internal(const DoFHandlerType*, const 
VectorType&, const std::vector >&, 
dealii::DataOut_DoFData::DataVectorType, const 
std::vector&, 
bool) [with VectorType = dealii::Vector; DoFHandlerType = 
dealii::DoFHandler<2, 2>; int patch_dim = 2; int patch_space_dim = 2]

The violated condition was:

data_vector.size() == dof_handler->n_dofs()

Additional information:

The vector has size 132372 but the DoFHandler object says that there are 
198558 degrees of freedom and there are 65731 active cells. The size of 
your vector needs to be either equal to the number of degrees of freedom, 
or equal to the number of active cells.


A probable solution could be to create a new DOfHandler during each output 
call for both the displacement as well as the phase-field and attach the 
respective solution blocks to their DofHandlers. Not sure this would work 
since the mapping which would be used for the phase-field would be based on 
a different DoFHandler. Also, this would probably be computationally 
expensive (not sure?)


2. Another idea could be to write both of them in the same file as done in 
Step-44, but use nSubdividisions equaling either min or max of the 
polynomial degrees of the FE ansatz for the two variables. Since, I 
probably not yet fully understand the implication of the parameter 
nSubdivisions in the definition of build_patches() 
[https://www.dealii.org/9.0.0/doxygen/deal.II/classDataOut.html#a5eb51872b8736849bb7e8d2007fae086],
 
could you please explain what happens in the below example.


Let pDisp=2 and pPF=3 (it is known that pPF >= pDisp always) be the 
polynomial degrees used for the FE ansatz of displacement and phase-field 
respectively. 


a) What information would we loose for phase-field, if nSubDivisions=pDisp, 
since, there are 16 values available per cell, and we only visualize 9 in 
PARAVIEW? Are the non-vertex values used for interpolation of the 
phase-field on the 4 sub-cells or are they completely neglected?


b) If we use nSubDivisions=pPF, then we would have the best “possible” 
visualization for the phase-field, but how would the values of the 
displacement field be interpolated for the 27 sub-cells since in reality 
only values for 9 points per cell are known. Could this lead to incorrect 
visualization of displacement?


Best regards,

Paras 


On Friday, August 7, 2020 at 8:15:06 PM UTC+2, Wolfgang Bangerth wrote:
>
> On 8/7/20 11:20 AM, Paras Kumar wrote: 
> > 
> > I have a query regarding writing the solution to a VTK file for 
> visualization 
> > with PARAVIEW.  If one wanted to do this via a mapping based on the 
> > displacement field, then one could simply follow the output_results() 
> function 
> > of step-44. 
> > My question is that, Is it possible to write to the same vtk file, 
> fields 
> > based on different MappingQEulerian 
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2F9.0.0%2Fdoxygen%2Fdeal.II%2FclassMappingQEulerian.html=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Ccbd1a9a17b8540f0018708d83af62a7b%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637324176247361942=0fDQN1511kXggwdxcB8jf%2FO05Wn8ghyd3QzReWpRrqc%3D=0>
>  
>
> > objects and with different values of n_subdivsions for the 
> > data_out.build_patches 
> > <
> https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dealii.org%2F9.0.0%2Fdoxygen%2Fdeal.II%2FclassDataOut.html%23a5eb51872b8736849bb7e8d2007fae086=02%7C01%7CWolfgang.Bangerth%40colostate.edu%7Ccbd1a9a17b8540f0018708d83af62a7b%7Cafb58802ff7a4bb1ab21367ff2ecfc8b%7C0%7C0%7C637324176247371938=d1P5xlbOdyblD2C38dcCkBaFpm2sCqSI8HWRFvKNYtw%3D=0>()
>  
>
> > function? 
>
> Paras: 
> No, you can't. But there is nothing that prevents you from creating two 
> .vtu 
> files that contain different things, and visualizing the at the same time. 
> Both paraview and visit allow you to open several .vtu files at the same 
> time 
> and showing 

[deal.II] Output multiple fields with different discretization

2020-08-07 Thread Paras Kumar
Dear Deal.II Community,

I am trying to model the phase-field fracture problem, which, essentially 
is a multi field problem involving a vector valued displacement field 
coupled with a scalar crack phase-field. Both the variables are 
approximated using FE_Q type ansatz but the polynomial degree could be 
different.

I have a query regarding writing the solution to a VTK file for 
visualization with PARAVIEW.  If one wanted to do this via a mapping based 
on the displacement field, then one could simply follow the 
output_results() function of step-44.
My question is that, Is it possible to write to the same vtk file, fields 
based on different MappingQEulerian 
 
objects and with different values of n_subdivsions for the data_out.
build_patches 
()
 
function?


Best regards,
Paras 

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/e0f23177-b472-4544-81fd-ff6bbc521fceo%40googlegroups.com.


Re: [deal.II] Reading a Tensor from parameter file

2020-08-05 Thread Paras Kumar
Dear Luca,

Thank you. This really shortens the code. Is it also possible to set the 
delimiter to a user desired value, say "|" instead of ",". Also, where 
exactly is the procedure for conversion from string to deali::Tensor or 
some other type say std::vector defined? I could not find it in the 
source code.

Best regards,
Paras

On Tuesday, August 4, 2020 at 6:15:47 PM UTC+2, Paras Kumar wrote:
>
> Hi,
>
> Could you please provide an MWE to describe how the 
> Patterns::Convert::to_value() function would work in this case.
>
> Is it must to use prm.add_parameter()  to be able to do so? I usually use 
> prm.declare_entry() and prm.get(). 
>
> Best regards,
> Paras
>
> On Wednesday, April 15, 2020 at 6:01:53 PM UTC+2, Luca Heltai wrote:
>>
>> Currently, this is also the simplest way:
>>
>> Tensor tens;
>> prm.add_parameter("Tensor", tens);
>>
>> Take a look at the documentation of the add parameter method.
>>
>> Patterns::Tools::to_string(tens);
>>
>> And 
>>
>> Patterns::Tools::to_value 
>>
>> Are also available to simplify what you want to achieve. 
>>
>> Alternatively: Patterns::Tools::Convert offers ways to construct default 
>> Patterns for many types, including Tensors. 
>>
>> Best,
>> Luca
>>
>>  
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/01e0068e-205b-4984-a5e8-f9d23ab1bb72o%40googlegroups.com.


Re: [deal.II] Reading a Tensor from parameter file

2020-08-04 Thread Paras Kumar
Hi,

Could you please provide an MWE to describe how the 
Patterns::Convert::to_value() function would work in this case.

Is it must to use prm.add_parameter()  to be able to do so? I usually use 
prm.declare_entry() and prm.get(). 

Best regards,
Paras

On Wednesday, April 15, 2020 at 6:01:53 PM UTC+2, Luca Heltai wrote:
>
> Currently, this is also the simplest way:
>
> Tensor tens;
> prm.add_parameter("Tensor", tens);
>
> Take a look at the documentation of the add parameter method.
>
> Patterns::Tools::to_string(tens);
>
> And 
>
> Patterns::Tools::to_value 
>
> Are also available to simplify what you want to achieve. 
>
> Alternatively: Patterns::Tools::Convert offers ways to construct default 
> Patterns for many types, including Tensors. 
>
> Best,
> Luca
>
>  

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/2d3fae42-c1b3-4b6a-b5cb-2537176954d8o%40googlegroups.com.


[deal.II] Re: online deal.II workshop: Tuesday, May 26, 2020

2020-05-31 Thread Paras Kumar
Hi Timo,

The video links don't seem to work. Could you please have a look.

Thanks and best regards,
Paras

On Wednesday, May 20, 2020 at 2:40:31 AM UTC+2, Timo Heister wrote:
>
> Hi all,
>
> we would like to announce a one day-deal.II workshop on May 26, 2020 with 
> several talks about recent developments of the library. The talks will be 
> available live and available as a video at a later time.
>
> For more information including a schedule, please see:
> https://dealii.org/workshop-2020/
>
> Best,
> Timo and Wolfgang
>
> -- 
> Timo Heister
> http://www.math.clemson.edu/~heister/
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/94221f11-e988-420d-a39d-bb2c2ef47492%40googlegroups.com.


Re: [deal.II] Broadcast arbitrary types

2020-05-21 Thread Paras Kumar
Dear Wolfgang,

Thank you for the reply. I will try to add it soon.

Best,
Paras

On Thursday, May 21, 2020 at 5:04:19 PM UTC+2, Wolfgang Bangerth wrote:
>
> On 5/21/20 4:55 AM, Paras Kumar wrote: 
> > 
> > Could someone please confirm if deal.II offers an analogue of 
> MPI_Bcast(), 
> > i.e. a function to broadcast arbitrary types, since there are functions 
> like 
> > dealii::Utilities::MPI::gather(). 
> > An alternative solution could be to pack the type into a stream using 
> > dealii::Utilities::pack() and then call MPI_Bcast() myself on this 
> packaged 
> > stream. 
>
> There is not currently a function to do that, though if you look at how 
> gather is written, you'll immediately see how to write a corresponding 
> broadcast function. We'd be very happy to accept a patch that adds such 
> a 
> function. 
>
> Best 
>   W. 
>
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/0ffd7a2d-cee4-4c1e-bb31-dae0bcc0709f%40googlegroups.com.


[deal.II] Broadcast arbitrary types

2020-05-21 Thread Paras Kumar
Dear Deal.II community,

Could someone please confirm if deal.II offers an analogue of MPI_Bcast(), 
i.e. a function to broadcast arbitrary types, since there are functions 
like dealii::Utilities::MPI::gather(). 
An alternative solution could be to pack the type into a stream using 
dealii::Utilities::pack() and then call MPI_Bcast() myself on this 
packaged stream.

Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/03178494-bb45-4f48-b2a3-7cafff916f16%40googlegroups.com.


Re: [deal.II] Reading a Tensor from parameter file

2020-04-15 Thread Paras Kumar
Ahmad,

On Tuesday, April 14, 2020 at 5:39:06 PM UTC+2, Ahmad Shahba wrote:
>
> I don't know if it is the optimal way but I would use the following 
> approach
>
>1. Read tensor components as Patterns::List 
>2. Use  get 
>
> 
>   
>method of ParameterHandler to read all tensor  components as one string 
>into a string variable
>3. Use  split_string_list 
>
> 
>   in the Utilities namespace to split the string into individual 
>components (still all components are strings)
>4. Convert  string-type components into doubles using  string_to_double 
>
> 
>  in 
>the Utilities namespace
>5. Use  Tensor 
>
> 
> (const Tensor 
>< 
>rank_, dim, OtherNumber > ) to construct the tensor
>
> Could you please elaborate on pointa 1 and 5, or share a code snippet 
which explains the process. 

Best,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/c4cf7c8d-65b0-4c0f-a31d-242dcae09a68%40googlegroups.com.


[deal.II] Reading a Tensor from parameter file

2020-04-14 Thread Paras Kumar
Dear deal.II community,

I am trying to read a second order tensor from a .prm file using the 
ParameterHandler functionalities. The tensor (for dim=3) is set in .prm 
file as

  set macro def grad = 1.2|0.0|0.0|0.0|1.1|0.0|0.0|0.0|1.4

and is currently read as a string using 
parameterHandler.declare_entry(
  "macro def grad",
  "1.0|1.0|1.0|1.0",
  dealii::Patterns::Anything(),
  "Macroscopic deformation gradient for homogenization");

auto temp = parameterHandler.get("macro def grad");
std::vector defGradComps;
boost::algorithm::split(defGradComps,
temp,
   boost::algorithm::is_any_of("|"));
Assert(defGradComps.size() == dim * dim,
   dealii::ExcDimensionMismatch(defGradComps.size(),
dim * dim));
   for (mncfrac::utilities::UnsignedIntType i = 0; i < dim; ++i)
  for (mncfrac::utilities::UnsignedIntType j = 0; j < dim; ++j)
this->problemSpecificParameters_.macroDefGrad_[i][j] =
  std::stod(defGradComps[i * dim + j]);


I am curious to know, if there is a smarter way (avoiding this manual 
copying by looping over the tensor entries) to do so using some other type 
of dealii::Patterns object or some other way.

Thanks in advance and best regards,
Paras Kumar

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/595804dd-818f-4fd6-86ba-f4e3d7d378a6%40googlegroups.com.


[deal.II] Re: Shared Memory Parallel Linear Solver

2020-02-26 Thread Paras Kumar

Dear Bruno,

Thank you  for your response.

On Friday, February 14, 2020 at 2:34:41 PM UTC+1, Bruno Turcksin wrote:
>
> Paras,
>
> You could try to use SuperLU_MT (see 
> https://portal.nersc.gov/project/sparse/superlu/) but we don't have 
> wrapper for it. The Krylov solver in deal.II are multithreaded but the 
> preconditioners are not. What you can try is to use deal.II solvers and 
> STRUMPACK (https://github.com/pghysels/STRUMPACK) for the preconditioner 
> but again we don't have wrapper for it. 
>
> Best,
>
> Bruno
>


A bit more search let to the fact that the SuperLu-MT solver is also 
available in Trilinos-Ameso2 package (see 
https://docs.trilinos.org/latest-release/packages/amesos2/doc/html/classAmesos2_1_1Superlumt.html#a102812eafbb572475b7330b825809b09).
 


The current code uses dealii::SparseMatrix and 
dealii::Vector objects to store the system matrix and, the solution 
and rhs vectors respectively.

In order to test it out, my idea was to use a 
dealii::TrilinosWrappers::SparseMatrix (which would be reinit from the 
already assembled dealii::SparseMatrix) and then extract the underlying 
matrix (using the TrilinosWrappers::SparseMatrix::trilinos_matrix() 
function) for use with the Superlu-MT solver. This works fine.

For the vectors (solution & rhs), the idea was to copy the values from the 
dealii::Vector to dealii::LinearAlgebra::EpetraWrappers::Vector. As an 
intermediate step I first copy the dealii::Vector to 
dealii::LinearAlgebra::Vector using the constructor : 
https://www.dealii.org/current/doxygen/deal.II/classLinearAlgebra_1_1Vector.html#af441b2c23134f8e6e08c833f91a2.
 
This works fine. However, when I try to call 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(dealii::LinearAlgebra::Vector)
 
the following error occurs:

An error occurred in line <85> of file 

 
in function
virtual void 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(const 
dealii::LinearAlgebra::VectorSpaceVector&, bool)
The violated condition was: 
dynamic_cast()!=nullptr
Additional information: 
(none)

Stacktrace:
---
#0  
/opt/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.3.0/dealii-9.0.1-ssxm6qr7mlmymdmjssazlr4s32qar5cv/lib/libdeal_II.g.so.9.0.1:
 
dealii::LinearAlgebra::EpetraWrappers::Vector::reinit(dealii::LinearAlgebra::VectorSpaceVector
 
const&, bool)
#1  
/calculate/Paras_Work/PhD_Work/FRASCAL-CODE/MNC-Frac/_build/libmncfrac.so: 
std::pair mncfrac::Solve_linearEquationSystem<2u, 
double>(mncfrac::LinearAlgebraItems&, 
mncfrac::buildingblocks::inputreader::LinearSolverParameters const&, 
dealii::Vector&)
#2  ./variants/homogenization: mncfrac::homogenization::RVE<2u, 
double>::Solve_timeStep(dealii::Tensor<2, 2, double> const&, 
mncfrac::utilities::BoundaryConditionType const&, dealii::Vector&)
#3  ./variants/homogenization: mncfrac::homogenization::RVE<2u, 
double>::Homogenize(dealii::Tensor<2, 2, double> const&, 
mncfrac::utilities::BoundaryConditionType)
#4  ./variants/homogenization: main


I could not understand why does the conversion fails? Could you please help 
me understand where am I doing wrong. Any better alternatives you would 
suggest?

It is clear that copying matrices and vectors for each solver call is 
probably not very efficient, but this is just for trying out the solver.


Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/9384e043-e49c-42e6-b72b-a08328addb62%40googlegroups.com.


[deal.II] Shared Memory Parallel Linear Solver

2020-02-14 Thread Paras Kumar
Dear deal.ii Community,

I am working  on finite deformation hyperelasticity problem which is 
essentially a nonlinear-vector-valued problem with displacement as the 
unknown at each support point(dim=2,3).  *With regards to parallelism, we 
currently restrict ourselves to shared memory parallel (SMP) only.* The FE 
assembly process has been paralleized using the workstream function.

This question pertains to (possibly faster) linear solvers. Currently. For 
the current 2D problem, we use the SparseDirectUMFPACK solver. As can been 
seen in the time log below (ths example was computed on a 36 core machine 
with 64 threads), the linear solver consumes the most time. I also tried 
using the CG solver, but it was much much slower, probably due to the large 
condition number stemming out of  highly refined mesh in regions of 
interest.

Triangulation:
 Number of active cells: 2059646
 Number of Degrees of Freedom: 4119454

+-+++
| Total wallclock time elapsed since start|  7.81e+03s ||
| |||
| Section | no. calls |  wall time | % of total |
+-+---+++
| Assemble Linear System  |50 |   875s |11% |
| Linear Solver   |40 |  5.55e+03s |71% |
| Make Constraints|50 |   255s |   3.3% |
| PBC setup   | 1 |  1.02s | 0% |
| Set Boundary IDs| 1 | 0.109s | 0% |
| Stress Output Computation   |11 |   464s |   5.9% |
| Stress Output Overall   |12 | 1e+03s |13% |
| Stress Output Writing   |11 |   379s |   4.9% |
| Stress output initialize| 1 |   158s | 2% |
| System Setup| 1 |   260s |   3.3% |
+-+---+++

While going through the documentation, I came across options for DMP linear 
solvers but couldn't find any with SMP. 

Could somenone please guide me to any such possibilities within the library 
or through interface to some external library.

Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/b5508fa4-6a2c-4368-b727-52f5dd47f393%40googlegroups.com.


Re: [deal.II] Error while writing material-wise-post-processed quantities using higher order QEulerian Mapping

2020-02-03 Thread Paras Kumar
Dear Wolfgang, 

Thank you so much for your help. The function DataOut::set_cell_selection() 
seems to be quite useful.

Best regards, 
Paras

On Monday, February 3, 2020 at 12:01:39 AM UTC+1, Wolfgang Bangerth wrote:
>
>
> Finally the fix: https://github.com/dealii/dealii/pull/9466 
>
> Paras: Thanks a lot for the excellent testcase! I managed to make it 
> substantially smaller still, but it was a very good starting point to find 
> what is actually happening! I co-credited you with the fix. 
>
> Best 
>   W. 
>
> -- 
>  
> Wolfgang Bangerth  email: bang...@colostate.edu 
>  
> www: http://www.math.colostate.edu/~bangerth/ 
>
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3826418e-0759-4afd-afed-208a774f4862%40googlegroups.com.


[deal.II] Re: Using interpolate_boundary_conditions

2019-10-01 Thread Paras Kumar

Hi Amy,

 I post below one possible solution which worked for me.

On Tuesday, October 1, 2019 at 4:44:25 AM UTC+2, Amy Kaczmarowski wrote:
>
> Hi,
>
> I'm attempting to apply a displacement boundary condition on a surface in 
> my problem.  However, I would like the direction of the displacement of 
> each point on the surface to depend on its direction from some point (for 
> example the origin).  Imagine a balloon inflating where the displacement 
> direction is from the center of the balloon.  My thought was to use a 
> function similar to the example boundary conditions in step 23 but extended 
> for 3 dimensions.  I defined the following class in my code:
>
> template 
> class BoundaryValuesU : public Function{
>   public:
> virtual void vector_value(const Point & p, Vector 
> ) const override
>   {
> double xpos, ypos, zpos;
> xpos = p[0];
> ypos = p[1];
> if (dim==3){zpos=p[2];}
> else {zpos=0.0;}
> values[0] 
> = 
> xpos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
> values[1] 
> = 
> ypos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
> values[2] 
> = 
> zpos/std::pow(std::pow(xpos,2.0)+std::pow(ypos,2.0)+std::pow(zpos,2.0),0.5)*0.1;
>  
>
> return; 
> }
>   };
>
> Then I apply the boundary conditions in the following way to the surface 
> with boundary id 2:
>
> std::vector uBC (3, true);
> BoundaryValuesU boundary_values_u_function;
> VectorTools::interpolate_boundary_values (dof_handler, 2, 
> boundary_values_u_function, constraints, uBC);
>
>
 
const dealii::FEValuesExtractors::Vector & dispExtractor(0); // assuming we 
only have a vector field (having dim components) as unknown at each support 
point
 VectorTools::interpolate_boundary_values (dof_handler, 2, 
boundary_values_u_function, constraints, feSystem.component_mask(
dispExtractor));

 
Here, the function called on the feSystem object is documented at 
https://www.dealii.org/8.5.0/doxygen/deal.II/classFiniteElement.html#a530f6c3f6326e516aeb006e7533a4532.


However, when I attempt to run with this case I get the following error:
>
> An error occurred in line <2263> of file 
> 
>  
> in function
> void 
> dealii::VectorToolsdo_interpolate_boundary_values(const 
> M_or_MC &, const DoFHandlerType &, const 
> std::map *, 
> std::less, std::allocator const dealii::Function *>>> &, std::map number, std::less, std::allocator int, number>>> &, const dealii::ComponentMask &) [with dim = 3, spacedim = 
> 3, number = double, DoFHandlerType = dealii::DoFHandler, M_or_MC = 
> dealii::Mapping]
> The violated condition was:
> n_components == i->second->n_components
> Additional information:
> Dimension 3 not equal to 1.
>
> Is there a way I am supposed to be initializing n_components in the class 
> to make this work?  Or is this just the wrong way to be doing this?
>
> Thank you.
>
>
Best regards,
Paras

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/4a34accd-4bdc-4c36-a091-3b5931fe288d%40googlegroups.com.