Re: [deal.II] How to apply a spatially variable non-zero initial condition in step-52?

2020-06-08 Thread Wolfgang Bangerth



Krishna,

I tried using the VectorTools::project idea from step-25. However, my code 
fails to compile, and I could not decipher the errors and do not know how to 
fix this problem (have been stuck for a while).


The attached code tries to implement Step-52 (but for 1D), with homogenous 
dirichelet BC  at the left edge and homogenous Neumann BC at the right edge, 
with an initial value of 4/5*x*(1 - x/5) (a simple quadratic function). I am 
also attaching the CMakeLists.txt (adapted from Step-52 suitably).


I'd appreciate help (from you and others here on the forum) to solve this issue.


You really need to learn how to read error messages because this is really a 
rather simple case. The error you get is this:


/home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:362:26: error: 
‘Step52::InitialValues’ is not a template

  InitialValues<1>(1, time),
  ^
/home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:362:50: error: no 
matching function for call to ‘Step52::InitialValues::InitialValues(int, 
time_t (&)(time_t*) throw ())’

  InitialValues<1>(1, time),
  ^

So you already know exactly what the line in question may be. There aren't all 
that many possibilities for what could be wrong. The issue in your case is 
that the 'time' variable doesn't exist in the function where you have the code 
in question. The obscurity of the actual error message comes from the fact 
that there is a global time() function. But in the end, this is a case where 
you could have found the solution yourself.


So just replace time->0 if you want the initial values and everything should 
work.

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/86f05575-28b3-80f3-cfa2-4dc89247f923%40colostate.edu.


Re: [deal.II] How to apply a spatially variable non-zero initial condition in step-52?

2020-06-07 Thread Krishnakumar Gopalakrishnan
Dear Dr Bangerth,

I tried using the VectorTools::project idea from step-25. However, my code
fails to compile, and I could not decipher the errors and do not know how
to fix this problem (have been stuck for a while).

The attached code tries to implement Step-52 (but for 1D), with homogenous
dirichelet BC  at the left edge and homogenous Neumann BC at the right
edge, with an initial value of 4/5*x*(1 - x/5) (a simple quadratic
function). I am also attaching the CMakeLists.txt (adapted from Step-52
suitably).

I'd appreciate help (from you and others here on the forum) to solve this
issue.

Krishna



On Tue, 14 Apr 2020 at 01:24, Wolfgang Bangerth 
wrote:

> On 4/13/20 6:00 PM, Krishnakumar Gopalakrishnan wrote:
> > I am currently working on Step-52, which solves the diffusion equation.
> >
> > I now want to disable the Method of Manufactured Solutions (MMS) i.e.
> get rid
> > of the forcing function which produces an expected analytical solution,
> in the
> > direction towards solving my real-world problem.  I also have set the
> > absorption coefficient to zero, so that the diffusion equation reduces
> to a
> > form analogous to the heat-equation.
> >
> > Currently, the initial condition is set to be the zero vector.
> >
> > As a first step, I'd like to set my initial solution to be sin(b*x) *
> sin(b*y).
> >
> > I am currently interested in using only the embedded explicit method
> driver
> > function. Within this, I suspect that the lines of interest are the
> following:
> >
> > solution = 0.;
> > constraint_matrix.distribute(solution);
> >
> >
> > But I am not quite sure how can this initial condition be imposed. Any
> help
> > will be much appreciated.
>
> You will want to take a look at step-25. That program uses
> VectorTools::project(), but you can also use VectorTools::interpolate()
> instead.
>
> 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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/l-aX46O2McY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/462c6c7a-341d-1657-559e-d7a2a3164771%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/CABvf3kby4Ju6HYu_bCVasyt3OBkvP%3DmPfx85E4C2Ozj6e%2Bd65g%40mail.gmail.com.
##
#  CMake script for the solid_diffusion program:
##

# Set the name of the project and target:
SET(PROJECT_NAME "solid_diffusion")
# SET(TARGET "solid_diffusion")
SET(TARGET ${PROJECT_NAME}.run)

SET(TARGET_SRC
${PROJECT_NAME}.cc
  )

# Define the output that should be cleaned:
SET(CLEAN_UP_FILES *.vtu *.pvd)

# Usually, you will not need to modify anything beyond this point...

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)

FIND_PACKAGE(deal.II 9.2.0 QUIET
  HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
  )
IF(NOT ${deal.II_FOUND})
  MESSAGE(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II. ***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II to 
cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this path."
)
ENDIF()

DEAL_II_INITIALIZE_CACHED_VARIABLES()
PROJECT(${TARGET})
DEAL_II_INVOKE_AUTOPILOT()


solid_diffusion.cc
Description: Binary data


Re: [deal.II] How to apply a spatially variable non-zero initial condition in step-52?

2020-04-13 Thread Wolfgang Bangerth

On 4/13/20 6:00 PM, Krishnakumar Gopalakrishnan wrote:

I am currently working on Step-52, which solves the diffusion equation.

I now want to disable the Method of Manufactured Solutions (MMS) i.e. get rid 
of the forcing function which produces an expected analytical solution, in the 
direction towards solving my real-world problem.  I also have set the 
absorption coefficient to zero, so that the diffusion equation reduces to a 
form analogous to the heat-equation.


Currently, the initial condition is set to be the zero vector.

As a first step, I'd like to set my initial solution to be sin(b*x) * sin(b*y).

I am currently interested in using only the embedded explicit method driver 
function. Within this, I suspect that the lines of interest are the following:


solution = 0.;
constraint_matrix.distribute(solution);


But I am not quite sure how can this initial condition be imposed. Any help 
will be much appreciated.


You will want to take a look at step-25. That program uses 
VectorTools::project(), but you can also use VectorTools::interpolate() instead.


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/462c6c7a-341d-1657-559e-d7a2a3164771%40colostate.edu.


[deal.II] How to apply a spatially variable non-zero initial condition in step-52?

2020-04-13 Thread Krishnakumar Gopalakrishnan
I am currently working on Step-52, which solves the diffusion equation.

I now want to disable the Method of Manufactured Solutions (MMS) i.e. get 
rid of the forcing function which produces an expected analytical solution, 
in the direction towards solving my real-world problem.  I also have set 
the absorption coefficient to zero, so that the diffusion equation reduces 
to a form analogous to the heat-equation.

Currently, the initial condition is set to be the zero vector. 

As a first step, I'd like to set my initial solution to be sin(b*x) * 
sin(b*y).

I am currently interested in using only the embedded explicit method driver 
function. Within this, I suspect that the lines of interest are the 
following:

solution = 0.;
constraint_matrix.distribute(solution);


But I am not quite sure how can this initial condition be imposed. Any help 
will be much appreciated.

-- 
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/f9b1eebb-e3d0-4847-81c9-ceb01db54a50%40googlegroups.com.