If you want to be happy, you should probably avoid Manchester by the Sea. It’s a well-made film: expertly acted, competently sketched, and the kind of adult-driven drama we need more of these days. It’s also an unrepentant gut punch that, instead of drawing back its fist, simply leaves it there in your midsection and expects your body to permanently adjust to its force. It’s tempting to award it extra credit for its refusal to avoid the harsh realities of life, but it offers so little hope that it’s just downright punishing.

Lee Chandler (Casey Affleck) is a familiar type in arthouse cinema: a guy who has taken on a menial, physical job in order to avoid or atone for past trauma. Think Jack Nicholson in Five Easy Pieces or, hey, Matt Damon in Good Will Hunting. He works all day and drinks all night. With his ice-blue eyes and face frozen as if steeled against an incoming threat, Affleck hints too acutely at the pain behind his unassuming attitude. The unfortunate combination of his underwritten character and Affleck’s evocative performance foreshadows the events that lay in his future and his past.

He’s forced to confront them both when his older brother Joe (Kyle Chandler) dies suddenly, leaving behind a teenage son. Lee drops everything and returns to his hometown, a small, working-class fishing village north of Boston, to help make arrangements. He moves into Joe’s house and becomes temporary guardian to Patrick (a preternaturally confident Lucas Hedges), where the two fall into an easy, unexamined rapport, treating Joe’s death as simply another practical matter to be addressed, along with meeting lawyers and funeral directors.

The film proceeds slowly, methodically, and almost mathematically. Writer/director Kenneth Lonergan (You Can Count on Me, Margaret) skillfully inserts flashbacks of his old life, from before Joe died, and when he and Patrick were silly pals, and before a bellowing trauma that nearly stops the film in its tracks when it is replayed halfway through. The film is peppered with these outbursts of emotions: a moment of sheer grief for Patrick that he mistakes for a nervous breakdown, because he is so unaccustomed to emotion; a tearful reunion between Lee and his ex-wife (a scene-stealing Michelle Williams); and a police interrogation scene that subverts everything we have come to expect from its setting.

But in between, Manchester can feel a little too orchestrated. Lonergan could best be described as a dramatist (he has written more plays than movies), and the story often feels as if it has been logically pieced together, instead of springing forth organically from the characters. There’s nothing wrong with a film feeling literary, but too often here you feel the fingers of the writer, typing the story into existence, crafting it to its desired ends.

And its hopeful ending is, well, not hopeful enough to justify the hell it puts you through. Much of the film alternates between buttoned-up grief and full-fledged expressions of pain. It hints eventually at a brighter future for Lee and Patrick, but the light only flickers on the path ahead. Manchester by the Sea does a fine job ripping us apart but doesn’t really have the tools to put us back together.

Manchester by the Sea opens Friday at E Street and Bethesda Row.