Re: [deal.II] How to implement an orthotropic material on differnet parts

2021-08-18 Thread ibrahim zawra
Thanks a lot that helped, I applied symmetric<2,dim> tensor because it is a 
heat problem. I also implemented the convection boundary condition. I have 
a problem in the results, it seems the contact between surfaces is not 
detected automatically, I want to model such contact.Please I will be 
grateful for your guidance.[image: contact problem.png]
On Monday, August 16, 2021 at 9:43:25 PM UTC+2 Wolfgang Bangerth wrote:

> On 8/16/21 10:37 AM, ibrahim zawra wrote:
> > 
> >  real problem for graphical board . I used GMSH and identified different 
> > material_ids on different parts and made sure it is correct using the 
> function 
> > print mesh info.
> > I wrote the class Material data to substitute the coefficient function. 
> but I 
> > tried several things but it didn't work.
>
> You don't say what specifically you have tried and how or why it didn't 
> work. 
> But the usual way to do this would be in the assemble_system() function, 
> where 
> you would do
>
> for (auto &cell : dof_handler.active_cell_iterators())
> {
> fe_values.reinit (cell);
>
> SymmetricTensor<4,dim> strain_stress_tensor;
> if (cell->material_id() == ...)
> strain_stress_tensor = ...whatever is appropriate for this material...;
> else
> strain_stress_tensor = ...whatever is appropriate for other materials..;
>
> for (unsigned int q=...)
> for (unsigned int i=...)
> for (unsigned int j=...)
> cell_matrix(i,j) += ...something that uses the strain stress tensor;
>
> ...
> }
>
> 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/c3c85b48-2c12-41c8-bb9f-86a2eccacd38n%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 &failureLocation)
		: 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 &outStream) 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

[deal.II] How to watch the variable of BlockVector type?

2021-08-18 Thread Michael Lee
I want to check if I have *system_rhs* assembled correctly. Is there an 
easy way to watch the contents of this BlockVector during debugging?

  BlockVector & system_rhs;
  system_rhs.reinit(dofs_per_block);

For normal vectors, I can use *((double(*)[10]) v.begin()), but it does not 
work for BlockVector. I'm using VS code.

Best,
Michael

-- 
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/9db1415e-812b-4825-8f73-eb7ed3866c17n%40googlegroups.com.


RE: [deal.II] How to watch the variable of BlockVector type?

2021-08-18 Thread Michael Li
Sorry, it seems to work using *((double(*)[20])residual.begin()).   From: Michael LeeSent: Wednesday, August 18, 2021 7:18 PMTo: deal.II User GroupSubject: [deal.II] How to watch the variable of BlockVector type? I want to check if I have system_rhs assembled correctly. Is there an easy way to watch the contents of this BlockVector during debugging?           BlockVector & system_rhs;          system_rhs.reinit(dofs_per_block); For normal vectors, I can use *((double(*)[10]) v.begin()), but it does not work for BlockVector. I'm using VS code. Best,Michael-- 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/9db1415e-812b-4825-8f73-eb7ed3866c17n%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/B3897C92-3FC3-4B18-88D2-185E7F2AD4D9%40hxcore.ol.


Re: [deal.II] How to watch the variable of BlockVector type?

2021-08-18 Thread Wolfgang Bangerth

On 8/18/21 7:18 PM, Michael Lee wrote:


           BlockVector & system_rhs;
           system_rhs.reinit(dofs_per_block);

For normal vectors, I can use *((double(*)[10]) v.begin()), but it does not 
work for BlockVector. I'm using VS code.


Try *( (double(*)[10]) v.block(0).begin())

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/46c327fa-1d8c-0eb9-d03e-40e5c3611447%40colostate.edu.


Re: [deal.II] How to implement an orthotropic material on differnet parts

2021-08-18 Thread Wolfgang Bangerth

On 8/18/21 9:20 AM, ibrahim zawra wrote:
Thanks a lot that helped, I applied symmetric<2,dim> tensor because it is a 
heat problem. I also implemented the convection boundary condition. I have a 
problem in the results, it seems the contact between surfaces is not detected 
automatically, I want to model such contact.Please I will be grateful for your 
guidance.


You will have to explain more what you are doing, what the symptoms are, what 
you have already tried, what worked and what doesn't. We can't see from just 
one picture what might possibly be wrong.


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/d8166e4d-06e6-7da4-e258-9c936fed2ce8%40colostate.edu.


RE: [deal.II] How to watch the variable of BlockVector type?

2021-08-18 Thread Michael Li
Yeah! .block(0) is essential. Without this, the data obtained is garbage! Thanks for this great hint! From: Wolfgang BangerthSent: Wednesday, August 18, 2021 8:37 PMTo: dealii@googlegroups.comSubject: Re: [deal.II] How to watch the variable of BlockVector type? On 8/18/21 7:18 PM, Michael Lee wrote:> >            BlockVector & system_rhs;>            system_rhs.reinit(dofs_per_block);> > For normal vectors, I can use *((double(*)[10]) v.begin()), but it does not > work for BlockVector. I'm using VS code. Try *( (double(*)[10]) v.block(0).begin()) 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/46c327fa-1d8c-0eb9-d03e-40e5c3611447%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/B0E16C6C-D172-4D48-BD6D-30EEC923A16A%40hxcore.ol.


Re: [deal.II] How to implement an orthotropic material on differnet parts

2021-08-18 Thread Jean-Paul Pelteret
Hi Ibrahim,

My guess is that the mesh has been exported without the connectivity between 
the parts being enforced. So even though the physical vertices of the mesh 
overlap where you have different parts, there are two or more distinct vertices 
that lie on top of one another and the “intersecting” parts of the geometry are 
therefore disconnected from one another. You can normally fix this within the 
meshing software by using an “Imprint” operation (it might be called something 
else in your specific software). 

Another approach which might work (depending on which finite elements you are 
using) is that you can use the AffineConstraints to effectively tie the two 
overlapping degrees of freedom from each region together. But you’d have to 
manage this yourself. You can look at 
https://github.com/dealii/dealii/wiki/Frequently-Asked-Questions#how-do-i-get-the-degree-of-freedom-indices-at-vertices
 

to see how you can get the indices for DoFs with support at vertices, and these 
functions might also be of use in this regard:
https://dealii.org/developer/doxygen/deal.II/namespaceDoFTools.html#a5514e4f59ea659f63953d62ca429eaff
 

https://dealii.org/developer/doxygen/deal.II/namespaceDoFTools.html#a06b3c33925c1a1f15de20deda20b4d21
 

https://dealii.org/developer/doxygen/deal.II/namespaceDoFTools.html#a8b97e816b29ecf963370a9d8b349828f
 


I hope that this helps,
Jean-Paul

> On 19. Aug 2021, at 04:39, Wolfgang Bangerth  wrote:
> 
> On 8/18/21 9:20 AM, ibrahim zawra wrote:
>> Thanks a lot that helped, I applied symmetric<2,dim> tensor because it is a 
>> heat problem. I also implemented the convection boundary condition. I have a 
>> problem in the results, it seems the contact between surfaces is not 
>> detected automatically, I want to model such contact.Please I will be 
>> grateful for your guidance.
> 
> You will have to explain more what you are doing, what the symptoms are, what 
> you have already tried, what worked and what doesn't. We can't see from just 
> one picture what might possibly be wrong.
> 
> 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/d8166e4d-06e6-7da4-e258-9c936fed2ce8%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/7C7AD21E-A410-40A8-832A-4FE2BF857D6D%40gmail.com.